Skip to content

Commit 3d4e79f

Browse files
Tyler Zhaozibaiwan
authored andcommitted
Output fuzz test run classification
1 parent 1b6d4aa commit 3d4e79f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

fuzz_testing/script/fuzz_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def fuzz_test_main(test_file_name, group, test, var, original_value, all_outputs
121121
if time_taken >= TIMEOUT:
122122
timeout = True
123123
all_outputs.append(TIMEOUT_MESSAGE)
124+
run_result = ""
124125

125126
# Update results
126127
# Total run
@@ -132,38 +133,49 @@ def fuzz_test_main(test_file_name, group, test, var, original_value, all_outputs
132133
# Test error + 1
133134
results_dictionary[test_file_name][TEST_ERRORS] = results_dictionary[test_file_name][TEST_ERRORS] + 1
134135
test_error = True
136+
run_result = TEST_ERRORS
135137
# If failed test message not found
136138
else:
137139
# Successful test + 1
138140
results_dictionary[test_file_name][SUCCESSFUL_RUNS] = results_dictionary[test_file_name][SUCCESSFUL_RUNS] + 1
141+
run_result = SUCCESSFUL_RUNS
139142
# If successful test message not found
140143
else:
141144
# If failed test message found
142145
if re.search(encode_if_condition(FAILED_TEST_PATTERN, encoded), output):
143146
# Failed test + 1
144147
results_dictionary[test_file_name][FAILED_RUNS] = results_dictionary[test_file_name][FAILED_RUNS] + 1
148+
run_result = FAILED_RUNS
145149
# If failed test message not found
146150
else:
147151
# If timeout
148152
if timeout:
149153
# Hang + 1
150154
results_dictionary[test_file_name][HANGS] = results_dictionary[test_file_name][HANGS] + 1
155+
run_result = HANGS
151156
# If not timeout
152157
else:
153158
# If assertion message found
154159
if re.search(encode_if_condition(ASSERTION_FAILURE_PATTERN, encoded), output):
155160
# Assertion failures + 1
156161
results_dictionary[test_file_name][ASSERTION_FAILURES] = results_dictionary[test_file_name][ASSERTION_FAILURES] + 1
162+
run_result = ASSERTION_FAILURES
157163
# If assertion message not found
158164
else:
159165
# Aborted run + 1
160166
results_dictionary[test_file_name][ABORTED_RUNS] = results_dictionary[test_file_name][ABORTED_RUNS] + 1
167+
run_result = ABORTED_RUNS
168+
# Print run result to output
169+
all_outputs.append(run_result + " + 1")
161170
# ASAN errors
162171
if re.search(encode_if_condition(ASAN_ERROR_PATTERN, encoded), output):
163172
results_dictionary[test_file_name][ASAN_ERRORS] = results_dictionary[test_file_name][ASAN_ERRORS] + 1
173+
all_outputs.append(ASAN_ERRORS + " + 1")
164174
# Test errors
165175
if re.search(encode_if_condition(FUZZ_TEST_ERROR_PATTERN, encoded), output) and not test_error:
166176
results_dictionary[test_file_name][TEST_ERRORS] = results_dictionary[test_file_name][TEST_ERRORS] + 1
177+
all_outputs.append(TEST_ERRORS + " + 1")
178+
all_outputs.append("\n")
167179

168180
def load_yaml(test_file_name):
169181
# Fetch data from original_inputs

0 commit comments

Comments
 (0)