Skip to content

Commit 45f3c26

Browse files
authored
[Fuzzing] Fuzz V8 with the revectorize flag on ClusterFuzz (#7564)
(some of the time)
1 parent efb987b commit 45f3c26

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

scripts/clusterfuzz/run.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@
3333

3434
# The V8 flags we put in the "fuzzer flags" files, which tell ClusterFuzz how to
3535
# run V8. By default we apply all staging flags.
36-
FUZZER_FLAGS_FILE_CONTENTS = '--wasm-staging'
36+
FUZZER_FLAGS = '--wasm-staging'
37+
38+
# Optional V8 flags to add to FUZZER_FLAGS, some of the time.
39+
OPTIONAL_FUZZER_FLAGS = [
40+
'--experimental-wasm-revectorize',
41+
]
3742

3843
# Maximum size of the random data that we feed into wasm-opt -ttf. This is
3944
# smaller than fuzz_opt.py's INPUT_SIZE_MAX because that script is tuned for
@@ -292,7 +297,11 @@ def main(argv):
292297
flags_file_path = os.path.join(output_dir,
293298
get_file_name(FLAGS_FILENAME_PREFIX, i))
294299
with open(flags_file_path, 'w') as file:
295-
file.write(FUZZER_FLAGS_FILE_CONTENTS)
300+
flags = FUZZER_FLAGS
301+
# Some of the time add an additional flag for V8.
302+
if OPTIONAL_FUZZER_FLAGS and system_random.random() < 0.5:
303+
flags += ' ' + system_random.choice(OPTIONAL_FUZZER_FLAGS)
304+
file.write(flags)
296305

297306
print(f'Created testcase: {testcase_file_path}')
298307

test/unit/test_cluster_fuzz.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def test_file_contents(self):
186186

187187
# The flags file must contain --wasm-staging
188188
with open(flags_file) as f:
189-
self.assertEqual(f.read(), '--wasm-staging')
189+
self.assertIn('--wasm-staging', f.read())
190190

191191
# Extract the wasm file(s) from the JS. Make sure to not notice
192192
# stale files.

0 commit comments

Comments
 (0)