@@ -123,23 +123,6 @@ def unpack_crash_testcases(crash_testcases_directory):
123123
124124 shell .remove_directory (directory_path )
125125
126- # Rename all fuzzed testcase files as regular files.
127- logs .info ('Renaming testcase files.' )
128- for root , _ , files in os .walk (crash_testcases_directory ):
129- for filename in files :
130- if not filename .startswith (testcase_manager .FUZZ_PREFIX ):
131- continue
132-
133- file_path = os .path .join (root , filename )
134- stripped_file_name = os .path .basename (file_path )[len (
135- testcase_manager .FUZZ_PREFIX ):]
136- stripped_file_path = os .path .join (
137- os .path .dirname (file_path ), stripped_file_name )
138- try :
139- os .rename (file_path , stripped_file_path )
140- except Exception as e :
141- raise RuntimeError (f'Failed to rename testcase { file_path } ' ) from e
142-
143126 # Remove empty files and dirs to avoid the case where a fuzzer randomly
144127 # chooses an empty dir/file and generates zero testcases.
145128 shell .remove_empty_files (crash_testcases_directory )
@@ -253,6 +236,34 @@ def filter_members(member, path):
253236 shell .remove_file (local_archive )
254237
255238
239+ def rename_testcase_files (directory ):
240+ """Rename files with the 'fuzz-' prefix to avoid picking them up for fuzzing
241+ without modifying them with a fuzzer.
242+ """
243+ # Rename all fuzzed testcase files as regular files.
244+ for root , _ , files in os .walk (directory ):
245+ for filename in files :
246+ if not filename .startswith (testcase_manager .FUZZ_PREFIX ):
247+ continue
248+
249+ file_path = os .path .join (root , filename )
250+ stripped_file_name = os .path .basename (file_path )[len (
251+ testcase_manager .FUZZ_PREFIX ):]
252+ stripped_file_path = os .path .join (
253+ os .path .dirname (file_path ), stripped_file_name )
254+ try :
255+ os .rename (file_path , stripped_file_path )
256+ except Exception as e :
257+ raise RuntimeError (f'Failed to rename testcase { file_path } ' ) from e
258+
259+
260+ def clean_up_filenames (tests_directory , test_folders ):
261+ """Rename files with the 'fuzz-' prefix in all test folders."""
262+ for folder in test_folders :
263+ logs .info (f'Renaming testcase files in { folder } ' )
264+ rename_testcase_files (os .path .join (tests_directory , folder ))
265+
266+
256267def sync_tests (tests_archive_bucket : str , tests_archive_name : str ,
257268 tests_directory : str ):
258269 """Main sync routine."""
@@ -301,22 +312,28 @@ def sync_tests(tests_archive_bucket: str, tests_archive_name: str,
301312 create_symbolic_link (tests_directory , 'src/third_party/blink/web_tests' ,
302313 'LayoutTests' )
303314
315+ test_folders = [
316+ 'CrashTests' ,
317+ 'LayoutTests' ,
318+ 'WebKit/JSTests/es6' ,
319+ 'WebKit/JSTests/stress' ,
320+ 'WebKit/LayoutTests' ,
321+ 'fuzzilli' ,
322+ 'gecko-tests' ,
323+ 'v8/test/mjsunit' ,
324+ 'spidermonkey' ,
325+ 'chakra' ,
326+ 'webgl-conformance-tests' ,
327+ ]
328+
329+ clean_up_filenames (tests_directory , test_folders )
330+
304331 subprocess .check_call (
305332 [
306333 'zip' ,
307334 '-r' ,
308335 tests_archive_local ,
309- 'CrashTests' ,
310- 'LayoutTests' ,
311- 'WebKit/JSTests/es6' ,
312- 'WebKit/JSTests/stress' ,
313- 'WebKit/LayoutTests' ,
314- 'fuzzilli' ,
315- 'gecko-tests' ,
316- 'v8/test/mjsunit' ,
317- 'spidermonkey' ,
318- 'chakra' ,
319- 'webgl-conformance-tests' ,
336+ ] + test_folders + [
320337 '-x' ,
321338 '*.cc' ,
322339 '-x' ,
0 commit comments