diff options
author | Dongge Liu <alan32.liu@gmail.com> | 2024-05-20 11:38:03 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-20 11:38:03 +1000 |
commit | da925a6332ca45feaf29cd4d88b541a8de2d5e29 (patch) | |
tree | 8b5373c6aefc2266e689e312ae6fe26d5fca0c61 | |
parent | f8983caa6240006971a5e9c9efd58c2a10040853 (diff) | |
download | oss-fuzz-da925a6332ca45feaf29cd4d88b541a8de2d5e29.tar.gz |
Add timeout for `target_experiment.py` (#11972)
Add a 3-hour timeout to `target_experiment.py`, which should be more
than enough given fuzzing timeout is 30 minutes and most successful
cloud builds finish in 2.5 hours empirically.
-rw-r--r-- | infra/build/functions/target_experiment.py | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/infra/build/functions/target_experiment.py b/infra/build/functions/target_experiment.py index bfdcc35d6..a61be75f8 100644 --- a/infra/build/functions/target_experiment.py +++ b/infra/build/functions/target_experiment.py @@ -220,11 +220,20 @@ def run_experiment(project_name, target_name, args, output_path, errlog_path, f'COVERAGE_EXTRA_ARGS={project.coverage_extra_args.strip()}', ]) steps.append({ - 'name': build_lib.get_runner_image_name(''), - 'env': env, + 'name': + build_lib.get_runner_image_name(''), + 'env': + env, + 'entrypoint': + '/bin/bash', 'args': [ - 'coverage', - target_name, + '-c', + ( + f'timeout 30m coverage {target_name}; ret=$?; ' + '[ $ret -eq 124 ] ' # Exit code 124 indicates a time out. + f'&& echo "coverage {target_name} timed out after 30 minutes" ' + f'|| echo "coverage {target_name} completed with exit code $ret"' + ), ], }) @@ -268,6 +277,8 @@ def run_experiment(project_name, target_name, args, output_path, errlog_path, }) credentials, _ = google.auth.default() + # Empirically, 3 hours is more than enough for 30-minute fuzzing cloud builds. + build_lib.BUILD_TIMEOUT = 3 * 60 * 60 build_id = build_project.run_build(project_name, steps, credentials, |