@@ -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,33 @@ def filter_members(member, path):
253236 shell .remove_file (local_archive )
254237
255238
239+ def rename_testcase_files (directory ):
240+ # Rename all fuzzed testcase files as regular files.
241+ for root , _ , files in os .walk (directory ):
242+ for filename in files :
243+ if not filename .startswith (testcase_manager .FUZZ_PREFIX ):
244+ continue
245+
246+ file_path = os .path .join (root , filename )
247+ stripped_file_name = os .path .basename (file_path )[len (
248+ testcase_manager .FUZZ_PREFIX ):]
249+ stripped_file_path = os .path .join (
250+ os .path .dirname (file_path ), stripped_file_name )
251+ try :
252+ os .rename (file_path , stripped_file_path )
253+ except Exception as e :
254+ raise RuntimeError (f'Failed to rename testcase { file_path } ' ) from e
255+
256+
257+ def clean_up_filenames (tests_directory , test_folders ):
258+ """Rename files with the 'fuzz-' prefix to avoid picking them up for fuzzing
259+ without modifying them with a fuzzer.
260+ """
261+ for folder in test_folders :
262+ logs .info (f'Renaming testcase files in { folder } ' )
263+ rename_testcase_files (os .path .join (tests_directory , folder ))
264+
265+
256266def sync_tests (tests_archive_bucket : str , tests_archive_name : str ,
257267 tests_directory : str ):
258268 """Main sync routine."""
@@ -301,22 +311,28 @@ def sync_tests(tests_archive_bucket: str, tests_archive_name: str,
301311 create_symbolic_link (tests_directory , 'src/third_party/blink/web_tests' ,
302312 'LayoutTests' )
303313
314+ test_folders = [
315+ 'CrashTests' ,
316+ 'LayoutTests' ,
317+ 'WebKit/JSTests/es6' ,
318+ 'WebKit/JSTests/stress' ,
319+ 'WebKit/LayoutTests' ,
320+ 'fuzzilli' ,
321+ 'gecko-tests' ,
322+ 'v8/test/mjsunit' ,
323+ 'spidermonkey' ,
324+ 'chakra' ,
325+ 'webgl-conformance-tests' ,
326+ ]
327+
328+ clean_up_filenames (tests_directory , test_folders )
329+
304330 subprocess .check_call (
305331 [
306332 'zip' ,
307333 '-r' ,
308334 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' ,
335+ ] + test_folders + [
320336 '-x' ,
321337 '*.cc' ,
322338 '-x' ,
0 commit comments