From acf42378821e778070cac1452ae742485b7fe38e Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 Apr 2025 14:45:28 -0700 Subject: [PATCH 1/3] add --- scripts/clusterfuzz/run.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/clusterfuzz/run.py b/scripts/clusterfuzz/run.py index 4e7bf6659f0..95b46289d7b 100755 --- a/scripts/clusterfuzz/run.py +++ b/scripts/clusterfuzz/run.py @@ -33,7 +33,12 @@ # The V8 flags we put in the "fuzzer flags" files, which tell ClusterFuzz how to # run V8. By default we apply all staging flags. -FUZZER_FLAGS_FILE_CONTENTS = '--wasm-staging' +FUZZER_FLAGS = '--wasm-staging' + +# Optional V8 flags to add to FUZZER_FLAGS, some of the time. +OPTIONAL_FUZZER_FLAGS = [ + '--experimental-wasm-revectorize', +] # Maximum size of the random data that we feed into wasm-opt -ttf. This is # smaller than fuzz_opt.py's INPUT_SIZE_MAX because that script is tuned for @@ -292,7 +297,12 @@ def main(argv): flags_file_path = os.path.join(output_dir, get_file_name(FLAGS_FILENAME_PREFIX, i)) with open(flags_file_path, 'w') as file: - file.write(FUZZER_FLAGS_FILE_CONTENTS) + flags = FUZZER_FLAGS + # Some of the time add an additional flag for V8 + if OPTIONAL_FUZZER_FLAGS and system_random.random() < 0.5: + flags += ' ' + system_random.choice(OPTIONAL_FUZZER_FLAGS) + + file.write(flags) print(f'Created testcase: {testcase_file_path}') From fea341ebdc5226b8a06793ed4d888b75791f70d9 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 Apr 2025 14:48:24 -0700 Subject: [PATCH 2/3] style --- scripts/clusterfuzz/run.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/clusterfuzz/run.py b/scripts/clusterfuzz/run.py index 95b46289d7b..70bc5a2bde9 100755 --- a/scripts/clusterfuzz/run.py +++ b/scripts/clusterfuzz/run.py @@ -298,10 +298,9 @@ def main(argv): get_file_name(FLAGS_FILENAME_PREFIX, i)) with open(flags_file_path, 'w') as file: flags = FUZZER_FLAGS - # Some of the time add an additional flag for V8 + # Some of the time add an additional flag for V8. if OPTIONAL_FUZZER_FLAGS and system_random.random() < 0.5: flags += ' ' + system_random.choice(OPTIONAL_FUZZER_FLAGS) - file.write(flags) print(f'Created testcase: {testcase_file_path}') From b25f0ecfe3aeaf84705c5edd15443af65290e39d Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 30 Apr 2025 14:53:06 -0700 Subject: [PATCH 3/3] update unit test --- test/unit/test_cluster_fuzz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/test_cluster_fuzz.py b/test/unit/test_cluster_fuzz.py index 72197939d76..50e2f99ac87 100644 --- a/test/unit/test_cluster_fuzz.py +++ b/test/unit/test_cluster_fuzz.py @@ -186,7 +186,7 @@ def test_file_contents(self): # The flags file must contain --wasm-staging with open(flags_file) as f: - self.assertEqual(f.read(), '--wasm-staging') + self.assertIn('--wasm-staging', f.read()) # Extract the wasm file(s) from the JS. Make sure to not notice # stale files.