Skip to content

Commit aba10fc

Browse files
[fuzz_task][rearch] Handle bad builds in postprocess (#4201)
1 parent 970c2ce commit aba10fc

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py

+19-11
Original file line numberDiff line numberDiff line change
@@ -1772,11 +1772,10 @@ def run(self):
17721772

17731773
build_data = testcase_manager.check_for_bad_build(self.job_type,
17741774
crash_revision)
1775-
# TODO(https://github.com/google/clusterfuzz/issues/3008): Move this to
1776-
# postprocess.
1777-
testcase_manager.update_build_metadata(self.job_type, build_data)
1775+
self.fuzz_task_output.build_data = build_data
17781776
_track_build_run_result(self.job_type, crash_revision,
17791777
build_data.is_bad_build)
1778+
17801779
if build_data.is_bad_build:
17811780
return uworker_msg_pb2.Output( # pylint: disable=no-member
17821781
error_type=uworker_msg_pb2.ErrorType.UNHANDLED) # pylint: disable=no-member
@@ -1896,6 +1895,8 @@ def postprocess(self, uworker_output):
18961895

18971896
_upload_testcase_run_jsons(
18981897
uworker_output.fuzz_task_output.testcase_run_jsons)
1898+
testcase_manager.update_build_metadata(
1899+
uworker_input.job_type, uworker_output.fuzz_task_output.build_data)
18991900

19001901

19011902
def _upload_testcase_run_jsons(testcase_run_jsons):
@@ -1929,14 +1930,6 @@ def utask_main(uworker_input):
19291930
return session.run()
19301931

19311932

1932-
def _make_session(uworker_input):
1933-
test_timeout = environment.get_value('TEST_TIMEOUT')
1934-
return FuzzingSession(
1935-
uworker_input,
1936-
test_timeout,
1937-
)
1938-
1939-
19401933
def handle_fuzz_no_fuzz_target_selected(output):
19411934
save_fuzz_targets(output)
19421935
# Try again now that there are some fuzz targets.
@@ -1945,6 +1938,19 @@ def handle_fuzz_no_fuzz_target_selected(output):
19451938
output.uworker_input.uworker_env)
19461939

19471940

1941+
def handle_fuzz_bad_build(output):
1942+
testcase_manager.update_build_metadata(output.uworker_input.job_type,
1943+
output.fuzz_task_output.build_data)
1944+
1945+
1946+
def _make_session(uworker_input):
1947+
test_timeout = environment.get_value('TEST_TIMEOUT')
1948+
return FuzzingSession(
1949+
uworker_input,
1950+
test_timeout,
1951+
)
1952+
1953+
19481954
_ERROR_HANDLER = uworker_handle_errors.CompositeErrorHandler({
19491955
uworker_msg_pb2.ErrorType.FUZZ_BUILD_SETUP_FAILURE: # pylint: disable=no-member
19501956
handle_fuzz_build_setup_failure,
@@ -1954,6 +1960,8 @@ def handle_fuzz_no_fuzz_target_selected(output):
19541960
handle_fuzz_no_fuzzer,
19551961
uworker_msg_pb2.ErrorType.FUZZ_NO_FUZZ_TARGET_SELECTED: # pylint: disable=no-member
19561962
handle_fuzz_no_fuzz_target_selected,
1963+
uworker_msg_pb2.ErrorType.FUZZ_BAD_BUILD: # pylint: disable=no-member
1964+
handle_fuzz_bad_build,
19571965
}).compose_with(uworker_handle_errors.UNHANDLED_ERROR_HANDLER)
19581966

19591967

src/clusterfuzz/_internal/protos/uworker_msg.proto

+1
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ enum ErrorType {
351351
FUZZ_DATA_BUNDLE_SETUP_FAILURE = 10;
352352
FUZZ_NO_FUZZER = 11;
353353
FUZZ_NO_FUZZ_TARGET_SELECTED = 13;
354+
FUZZ_BAD_BUILD = 37;
354355
PROGRESSION_REVISION_LIST_ERROR = 14;
355356
PROGRESSION_BUILD_NOT_FOUND = 15;
356357
PROGRESSION_NO_CRASH = 16;

0 commit comments

Comments
 (0)