Skip to content

Commit

Permalink
Restore intended behavior of run_experiment.py (google#1107)
Browse files Browse the repository at this point in the history
* Restore intended behavior of run_experiment.py when omitting
benchmarks.
Use code cov benchmarks by default.
  • Loading branch information
jonathanmetzman authored Mar 8, 2021
1 parent ce2abbf commit 1e4f5a9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 9 additions & 3 deletions common/benchmark_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,14 @@ def get_all_benchmarks():
return sorted(all_benchmarks)


def get_coverage_benchmarks():
"""Returns the list of all coverage benchmarks."""
return (get_oss_fuzz_coverage_benchmarks() +
get_standard_coverage_benchmarks())


def get_oss_fuzz_coverage_benchmarks():
"""Return the list of OSS-Fuzz coverage benchmarks."""
"""Returns the list of OSS-Fuzz coverage benchmarks."""
return [
benchmark for benchmark in get_all_benchmarks()
if is_oss_fuzz_benchmark(benchmark) and
Expand All @@ -142,7 +148,7 @@ def get_oss_fuzz_coverage_benchmarks():


def get_standard_coverage_benchmarks():
"""Return the list of standard coverage benchmarks."""
"""Returns the list of standard coverage benchmarks."""
return [
benchmark for benchmark in get_all_benchmarks()
if not is_oss_fuzz_benchmark(benchmark) and
Expand All @@ -151,7 +157,7 @@ def get_standard_coverage_benchmarks():


def get_bug_benchmarks():
"""Return the list of standard coverage benchmarks."""
"""Returns the list of standard bug benchmarks."""
return [
benchmark for benchmark in get_all_benchmarks()
if get_type(benchmark) == BenchmarkType.BUG.value
Expand Down
11 changes: 7 additions & 4 deletions experiment/run_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,15 @@ def main():
'more benchmarks.')

all_benchmarks = benchmark_utils.get_all_benchmarks()
all_fuzzers = fuzzer_utils.get_fuzzer_names()

coverage_benchmarks = benchmark_utils.get_coverage_benchmarks()
parser.add_argument('-b',
'--benchmarks',
help='Benchmark names. All of them by default.',
help=('Benchmark names. '
'All code coverage benchmarks of them by '
'default.'),
nargs='+',
required=False,
default=all_benchmarks,
default=coverage_benchmarks,
choices=all_benchmarks)
parser.add_argument('-c',
'--experiment-config',
Expand All @@ -494,6 +495,8 @@ def main():
'--description',
help='Description of the experiment.',
required=False)

all_fuzzers = fuzzer_utils.get_fuzzer_names()
parser.add_argument('-f',
'--fuzzers',
help='Fuzzers to use.',
Expand Down

0 comments on commit 1e4f5a9

Please sign in to comment.