From d8f9e219d520fca6ed65cd4eb4733f0b08f70a10 Mon Sep 17 00:00:00 2001 From: Michael Achenbach Date: Mon, 16 Dec 2024 11:06:21 +0100 Subject: [PATCH 1/2] Add Fuzzilli cases to the test-input archive --- .../other-bots/chromium-tests-syncer/run.py | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/python/other-bots/chromium-tests-syncer/run.py b/src/python/other-bots/chromium-tests-syncer/run.py index f29f395a31..c13349dc78 100644 --- a/src/python/other-bots/chromium-tests-syncer/run.py +++ b/src/python/other-bots/chromium-tests-syncer/run.py @@ -23,6 +23,7 @@ import os import re import subprocess +import tarfile import time from clusterfuzz._internal.base import utils @@ -208,6 +209,38 @@ def create_gecko_tests_directory(tests_directory, gecko_checkout_subdirectory, target_subdirectory) +def create_fuzzilli_tests_directory(tests_directory): + logs.info('Syncing fuzzilli tests.') + fuzzilli_tests_directory = os.path.join(tests_directory, 'fuzzilli') + remote_archive_tmpl = 'gs://autozilli/autozilli-%d.tgz' + + # Ensure we have an empty directory with no leftovers from a previous run. + shell.remove_directory(fuzzilli_tests_directory, recreate=True) + + def filter(member, path): + # We only need JS files and the settings.json from the archive. + if member.name.endswith('fzil') or member.name.startswith('fuzzdir/stats'): + return None + return tarfile.data_filter(member, path) + + for i in range(1, 10): + # Download archives number 1-9. + remote_archive = remote_archive_tmpl % i + logs.info(f'Processing {remote_archive}') + local_archive = os.path.join(fuzzilli_tests_directory, 'tmp.tgz') + subprocess.check_call(['gsutil', 'cp', remote_archive, local_archive]) + + # Extract relevant files. + with tarfile.open(local_archive) as tar: + tar.extractall(path=fuzzilli_tests_directory, filter=filter) + + # Clean up. + os.rename( + os.path.join(fuzzilli_tests_directory, 'fuzzdir'), + os.path.join(fuzzilli_tests_directory, f'fuzzdir-{i}')) + shell.remove_file(local_archive) + + def sync_tests(tests_archive_bucket: str, tests_archive_name: str, tests_directory: str): """Main sync routine.""" @@ -264,6 +297,7 @@ def sync_tests(tests_archive_bucket: str, tests_archive_name: str, 'WebKit/JSTests/es6', 'WebKit/JSTests/stress', 'WebKit/LayoutTests', + 'fuzzilli', 'gecko-tests', 'v8/test/mjsunit', 'spidermonkey', From 10426b93f787dfcdbb9ab07d3527f0b3bfbfe305 Mon Sep 17 00:00:00 2001 From: Michael Achenbach Date: Mon, 16 Dec 2024 11:23:20 +0100 Subject: [PATCH 2/2] Fix linter --- src/python/other-bots/chromium-tests-syncer/run.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/python/other-bots/chromium-tests-syncer/run.py b/src/python/other-bots/chromium-tests-syncer/run.py index c13349dc78..541ff82fcc 100644 --- a/src/python/other-bots/chromium-tests-syncer/run.py +++ b/src/python/other-bots/chromium-tests-syncer/run.py @@ -210,6 +210,7 @@ def create_gecko_tests_directory(tests_directory, gecko_checkout_subdirectory, def create_fuzzilli_tests_directory(tests_directory): + """Create Fuzzilli tests directory from the autozilli GCS archives.""" logs.info('Syncing fuzzilli tests.') fuzzilli_tests_directory = os.path.join(tests_directory, 'fuzzilli') remote_archive_tmpl = 'gs://autozilli/autozilli-%d.tgz' @@ -217,7 +218,7 @@ def create_fuzzilli_tests_directory(tests_directory): # Ensure we have an empty directory with no leftovers from a previous run. shell.remove_directory(fuzzilli_tests_directory, recreate=True) - def filter(member, path): + def filter_members(member, path): # We only need JS files and the settings.json from the archive. if member.name.endswith('fzil') or member.name.startswith('fuzzdir/stats'): return None @@ -232,7 +233,7 @@ def filter(member, path): # Extract relevant files. with tarfile.open(local_archive) as tar: - tar.extractall(path=fuzzilli_tests_directory, filter=filter) + tar.extractall(path=fuzzilli_tests_directory, filter=filter_members) # Clean up. os.rename(