Skip to content

Commit 26c5502

Browse files
authored
[NFC] Run ClusterFuzz only after some time has passed (#7306)
This avoids the annoying experience of seeing ClusterFuzz block for many seconds as you watch the fuzzer begin to run.
1 parent 3d5a10d commit 26c5502

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

scripts/fuzz_opt.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,13 @@ def ensure(self):
16731673
tar.extractall(path=self.clusterfuzz_dir)
16741674
tar.close()
16751675

1676+
def can_run_on_wasm(self, wasm):
1677+
# Do not run ClusterFuzz in the first seconds of fuzzing: the first time
1678+
# it runs is very slow (to build the bundle), which is annoying when you
1679+
# are just starting the fuzzer and looking for any obvious problems.
1680+
seconds = 30
1681+
return time.time() - start_time > seconds
1682+
16761683

16771684
# Tests linking two wasm files at runtime, and that optimizations do not break
16781685
# anything. This is similar to Split(), but rather than split a wasm file into
@@ -2058,6 +2065,8 @@ def get_random_opts():
20582065
print('The v8 shell, d8, must be in the path')
20592066
sys.exit(1)
20602067

2068+
start_time = time.time()
2069+
20612070
if __name__ == '__main__':
20622071
# if we are given a seed, run exactly that one testcase. otherwise,
20632072
# run new ones until we fail
@@ -2083,7 +2092,6 @@ def get_random_opts():
20832092
total_wasm_size = 0
20842093
total_input_size = 0
20852094
total_input_size_squares = 0
2086-
start_time = time.time()
20872095
while True:
20882096
counter += 1
20892097
if given_seed is not None:

0 commit comments

Comments
 (0)