Skip to content

Commit

Permalink
[fuzz_task][rearch] Handle bad builds in postprocess (#4201)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmetzman authored Aug 23, 2024
1 parent 970c2ce commit aba10fc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
30 changes: 19 additions & 11 deletions src/clusterfuzz/_internal/bot/tasks/utasks/fuzz_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -1772,11 +1772,10 @@ def run(self):

build_data = testcase_manager.check_for_bad_build(self.job_type,
crash_revision)
# TODO(https://github.com/google/clusterfuzz/issues/3008): Move this to
# postprocess.
testcase_manager.update_build_metadata(self.job_type, build_data)
self.fuzz_task_output.build_data = build_data
_track_build_run_result(self.job_type, crash_revision,
build_data.is_bad_build)

if build_data.is_bad_build:
return uworker_msg_pb2.Output( # pylint: disable=no-member
error_type=uworker_msg_pb2.ErrorType.UNHANDLED) # pylint: disable=no-member
Expand Down Expand Up @@ -1896,6 +1895,8 @@ def postprocess(self, uworker_output):

_upload_testcase_run_jsons(
uworker_output.fuzz_task_output.testcase_run_jsons)
testcase_manager.update_build_metadata(
uworker_input.job_type, uworker_output.fuzz_task_output.build_data)


def _upload_testcase_run_jsons(testcase_run_jsons):
Expand Down Expand Up @@ -1929,14 +1930,6 @@ def utask_main(uworker_input):
return session.run()


def _make_session(uworker_input):
test_timeout = environment.get_value('TEST_TIMEOUT')
return FuzzingSession(
uworker_input,
test_timeout,
)


def handle_fuzz_no_fuzz_target_selected(output):
save_fuzz_targets(output)
# Try again now that there are some fuzz targets.
Expand All @@ -1945,6 +1938,19 @@ def handle_fuzz_no_fuzz_target_selected(output):
output.uworker_input.uworker_env)


def handle_fuzz_bad_build(output):
testcase_manager.update_build_metadata(output.uworker_input.job_type,
output.fuzz_task_output.build_data)


def _make_session(uworker_input):
test_timeout = environment.get_value('TEST_TIMEOUT')
return FuzzingSession(
uworker_input,
test_timeout,
)


_ERROR_HANDLER = uworker_handle_errors.CompositeErrorHandler({
uworker_msg_pb2.ErrorType.FUZZ_BUILD_SETUP_FAILURE: # pylint: disable=no-member
handle_fuzz_build_setup_failure,
Expand All @@ -1954,6 +1960,8 @@ def handle_fuzz_no_fuzz_target_selected(output):
handle_fuzz_no_fuzzer,
uworker_msg_pb2.ErrorType.FUZZ_NO_FUZZ_TARGET_SELECTED: # pylint: disable=no-member
handle_fuzz_no_fuzz_target_selected,
uworker_msg_pb2.ErrorType.FUZZ_BAD_BUILD: # pylint: disable=no-member
handle_fuzz_bad_build,
}).compose_with(uworker_handle_errors.UNHANDLED_ERROR_HANDLER)


Expand Down
1 change: 1 addition & 0 deletions src/clusterfuzz/_internal/protos/uworker_msg.proto
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ enum ErrorType {
FUZZ_DATA_BUNDLE_SETUP_FAILURE = 10;
FUZZ_NO_FUZZER = 11;
FUZZ_NO_FUZZ_TARGET_SELECTED = 13;
FUZZ_BAD_BUILD = 37;
PROGRESSION_REVISION_LIST_ERROR = 14;
PROGRESSION_BUILD_NOT_FOUND = 15;
PROGRESSION_NO_CRASH = 16;
Expand Down
Loading

0 comments on commit aba10fc

Please sign in to comment.