Skip to content

Commit 65e0e7b

Browse files
authored
Add Fuzzilli cases to the test-input archive (#4504)
This adds 9 archives from Fuzzilli to the general test-input archives used by fuzzers on Clusterfuzz. The Fuzzilli-side archives are refreshed every few days. We'll add a freshness metric in a follow up. This was tested locally with butler. See bug: https://crbug.com/362963886
1 parent f9d516c commit 65e0e7b

File tree

1 file changed

+35
-0
lines changed
  • src/python/other-bots/chromium-tests-syncer

1 file changed

+35
-0
lines changed

src/python/other-bots/chromium-tests-syncer/run.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import os
2424
import re
2525
import subprocess
26+
import tarfile
2627
import time
2728

2829
from clusterfuzz._internal.base import utils
@@ -208,6 +209,39 @@ def create_gecko_tests_directory(tests_directory, gecko_checkout_subdirectory,
208209
target_subdirectory)
209210

210211

212+
def create_fuzzilli_tests_directory(tests_directory):
213+
"""Create Fuzzilli tests directory from the autozilli GCS archives."""
214+
logs.info('Syncing fuzzilli tests.')
215+
fuzzilli_tests_directory = os.path.join(tests_directory, 'fuzzilli')
216+
remote_archive_tmpl = 'gs://autozilli/autozilli-%d.tgz'
217+
218+
# Ensure we have an empty directory with no leftovers from a previous run.
219+
shell.remove_directory(fuzzilli_tests_directory, recreate=True)
220+
221+
def filter_members(member, path):
222+
# We only need JS files and the settings.json from the archive.
223+
if member.name.endswith('fzil') or member.name.startswith('fuzzdir/stats'):
224+
return None
225+
return tarfile.data_filter(member, path)
226+
227+
for i in range(1, 10):
228+
# Download archives number 1-9.
229+
remote_archive = remote_archive_tmpl % i
230+
logs.info(f'Processing {remote_archive}')
231+
local_archive = os.path.join(fuzzilli_tests_directory, 'tmp.tgz')
232+
subprocess.check_call(['gsutil', 'cp', remote_archive, local_archive])
233+
234+
# Extract relevant files.
235+
with tarfile.open(local_archive) as tar:
236+
tar.extractall(path=fuzzilli_tests_directory, filter=filter_members)
237+
238+
# Clean up.
239+
os.rename(
240+
os.path.join(fuzzilli_tests_directory, 'fuzzdir'),
241+
os.path.join(fuzzilli_tests_directory, f'fuzzdir-{i}'))
242+
shell.remove_file(local_archive)
243+
244+
211245
def sync_tests(tests_archive_bucket: str, tests_archive_name: str,
212246
tests_directory: str):
213247
"""Main sync routine."""
@@ -264,6 +298,7 @@ def sync_tests(tests_archive_bucket: str, tests_archive_name: str,
264298
'WebKit/JSTests/es6',
265299
'WebKit/JSTests/stress',
266300
'WebKit/LayoutTests',
301+
'fuzzilli',
267302
'gecko-tests',
268303
'v8/test/mjsunit',
269304
'spidermonkey',

0 commit comments

Comments
 (0)