diff options
author | Leo Neat <leosneat@gmail.com> | 2020-02-28 09:41:44 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-28 09:41:44 -0800 |
commit | 8d905b08c2898702fbf13f7286e166acdd7efe18 (patch) | |
tree | 2c20ba0d7ca3a6890d8e1322284ec3eefc9d07f5 /infra/cifuzz/actions | |
parent | 98020984ba4862ce93f8015dc2470d7fe7c20e50 (diff) |
[CIFuzz] Adding dry_run mode to check_build (#3444)
Prevents crash from surfacing when dry run mode is enabled and check fuzzers fails.
Diffstat (limited to 'infra/cifuzz/actions')
-rw-r--r-- | infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py | 12 | ||||
-rw-r--r-- | infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py | 8 |
2 files changed, 10 insertions, 10 deletions
diff --git a/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py b/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py index dee41fb0..3c84e64a 100644 --- a/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py +++ b/infra/cifuzz/actions/build_fuzzers/build_fuzzers_entrypoint.py @@ -58,30 +58,30 @@ def main(): dry_run = (os.environ.get('DRY_RUN').lower() == 'true') # The default return code when an error occurs. - error_code = 1 + returncode = 1 if dry_run: # Sets the default return code on error to success. - error_code = 0 + returncode = 0 if not workspace: logging.error('This script needs to be run in the Github action context.') - return error_code + return returncode if event == 'push' and not cifuzz.build_fuzzers( oss_fuzz_project_name, github_repo_name, workspace, commit_sha=commit_sha): logging.error('Error building fuzzers for project %s with commit %s.', oss_fuzz_project_name, commit_sha) - return error_code + return returncode if event == 'pull_request' and not cifuzz.build_fuzzers( oss_fuzz_project_name, github_repo_name, workspace, pr_ref=pr_ref): logging.error('Error building fuzzers for project %s with pull request %s.', oss_fuzz_project_name, pr_ref) - return error_code + return returncode out_dir = os.path.join(workspace, 'out') if cifuzz.check_fuzzer_build(out_dir): return 0 - return 1 + return returncode if __name__ == '__main__': diff --git a/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py b/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py index 5aa83e5a..4d80e5e7 100644 --- a/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py +++ b/infra/cifuzz/actions/run_fuzzers/run_fuzzers_entrypoint.py @@ -58,7 +58,7 @@ def main(): dry_run = (os.environ.get('DRY_RUN').lower() == 'true') # The default return code when an error occurs. - error_code = 1 + returncode = 1 if dry_run: # A testcase file is required in order for CIFuzz to surface bugs. # If the file does not exist, the action will crash attempting to upload it. @@ -68,17 +68,17 @@ def main(): os.makedirs(out_dir, exist_ok=True) # Sets the default return code on error to success. - error_code = 0 + returncode = 0 if not workspace: logging.error('This script needs to be run in the Github action context.') - return error_code + return returncode # Run the specified project's fuzzers from the build. run_status, bug_found = cifuzz.run_fuzzers(fuzz_seconds, workspace, oss_fuzz_project_name) if not run_status: logging.error('Error occured while running in workspace %s.', workspace) - return error_code + return returncode if bug_found: logging.info('Bug found.') if not dry_run: |