diff --git a/tools/clusterfuzz/testdata/failure_output.txt b/tools/clusterfuzz/testdata/failure_output.txt index e053a860ea..fe94bb9ecc 100644 --- a/tools/clusterfuzz/testdata/failure_output.txt +++ b/tools/clusterfuzz/testdata/failure_output.txt @@ -11,7 +11,7 @@ # Flags of x64,ignition: --correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --turbo-filter=~ --noopt --liftoff --no-wasm-tier-up --flag1 --flag2=0 # Flags of x64,ignition_turbo: ---correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --flag3 --stress-scavenge=100 +--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --flag3 # # Difference: - unknown diff --git a/tools/clusterfuzz/testdata/sanity_check_output.txt b/tools/clusterfuzz/testdata/sanity_check_output.txt index fa3d672f00..636f4c9d9e 100644 --- a/tools/clusterfuzz/testdata/sanity_check_output.txt +++ b/tools/clusterfuzz/testdata/sanity_check_output.txt @@ -11,7 +11,7 @@ # Flags of x64,ignition: --correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --turbo-filter=~ --noopt --liftoff --no-wasm-tier-up # Flags of x64,ignition_turbo: ---correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 --stress-scavenge=100 +--correctness-fuzzer-suppressions --expose-gc --allow-natives-syntax --invoke-weak-callbacks --omit-quit --es-staging --no-wasm-async-compilation --suppress-asm-messages --random-seed 12345 # # Difference: - unknown diff --git a/tools/clusterfuzz/v8_foozzie.py b/tools/clusterfuzz/v8_foozzie.py index bf22642152..55f76e8bc6 100755 --- a/tools/clusterfuzz/v8_foozzie.py +++ b/tools/clusterfuzz/v8_foozzie.py @@ -88,22 +88,6 @@ CONFIGS = dict( ], ) -# Additional flag experiments. List of tuples like -# (, ). -ADDITIONAL_FLAGS = [ - (0.1, '--stress-marking=100'), - (0.1, '--stress-scavenge=100'), - (0.1, '--stress-compaction-random'), - (0.1, '--random-gc-interval=2000'), - (0.2, '--noanalyze-environment-liveness'), - (0.1, '--stress-delay-tasks'), - (0.01, '--thread-pool-size=1'), - (0.01, '--thread-pool-size=2'), - (0.01, '--thread-pool-size=4'), - (0.01, '--thread-pool-size=8'), - (0.1, '--interrupt-budget=1000'), -] - # Timeout in seconds for one d8 run. TIMEOUT = 3 @@ -316,7 +300,6 @@ def print_difference( def main(): options = parse_args() - rng = random.Random(options.random_seed) # Suppressions are architecture and configuration specific. suppress = v8_suppressions.get_suppression( @@ -339,13 +322,6 @@ def main(): second_config_flags = (common_flags + CONFIGS[options.second_config] + options.second_config_extra_flags) - # TODO(machenbach): Deprecate calculating flag experiements in this script - # and instead pass flags as extra flags on command line. - # Add additional flags to second config based on experiment percentages. - for p, flag in ADDITIONAL_FLAGS: - if rng.random() < p: - second_config_flags.append(flag) - def run_d8(d8, config_flags, config_label=None, testcase=options.testcase): preamble = PREAMBLE[:] if options.first_arch != options.second_arch: diff --git a/tools/clusterfuzz/v8_foozzie_test.py b/tools/clusterfuzz/v8_foozzie_test.py index 1535914f7b..43b65e850b 100755 --- a/tools/clusterfuzz/v8_foozzie_test.py +++ b/tools/clusterfuzz/v8_foozzie_test.py @@ -41,8 +41,9 @@ class ConfigTest(unittest.TestCase): '--first-config=ignition', '--second-config=ignition_turbo', '--second-d8=d8', + '--second-config-extra-flags=--stress-scavenge=100', ], - v8_fuzz_config.Config('foo', Rng()).choose_foozzie_flags(), + v8_fuzz_config.Config('foo', Rng(), 42).choose_foozzie_flags(), ) diff --git a/tools/clusterfuzz/v8_fuzz_config.py b/tools/clusterfuzz/v8_fuzz_config.py index b557a64ce8..0dcacf216b 100644 --- a/tools/clusterfuzz/v8_fuzz_config.py +++ b/tools/clusterfuzz/v8_fuzz_config.py @@ -23,6 +23,22 @@ FOOZZIE_EXPERIMENTS = [ [5, 'ignition', 'ignition', 'clang_x86_v8_arm/d8'], ] +# Additional flag experiments. List of tuples like +# (, ). +ADDITIONAL_FLAGS = [ + (0.1, '--stress-marking=100'), + (0.1, '--stress-scavenge=100'), + (0.1, '--stress-compaction-random'), + (0.1, '--random-gc-interval=2000'), + (0.2, '--noanalyze-environment-liveness'), + (0.1, '--stress-delay-tasks'), + (0.01, '--thread-pool-size=1'), + (0.01, '--thread-pool-size=2'), + (0.01, '--thread-pool-size=4'), + (0.01, '--thread-pool-size=8'), + (0.1, '--interrupt-budget=1000'), +] + class Config(object): def __init__(self, name, rng=None, random_seed=None): """ @@ -36,12 +52,27 @@ class Config(object): """ self.name = name self.rng = rng or random.Random() + self.random_seed = random_seed def choose_foozzie_flags(self): """Randomly chooses a configuration from FOOZZIE_EXPERIMENTS. Returns: List of flags to pass to v8_foozzie.py fuzz harness. """ + # TODO(machenbach): Temporarily use same RNG state for all test cases in one + # fuzz session. See also TODO above. + if self.random_seed is not None: + flags_rng = random.Random(self.random_seed) + else: + flags_rng = random.Random() + + # Add additional flags to second config based on experiment percentages. + extra_flags = [] + for p, flag in ADDITIONAL_FLAGS: + if flags_rng.random() < p: + extra_flags.append('--second-config-extra-flags=%s' % flag) + + # Calculate flags determining the experiment. acc = 0 threshold = self.rng.random() * 100 for prob, first_config, second_config, second_d8 in FOOZZIE_EXPERIMENTS: @@ -51,5 +82,5 @@ class Config(object): '--first-config=' + first_config, '--second-config=' + second_config, '--second-d8=' + second_d8, - ] + ] + extra_flags assert False