Skip to content

Commit

Permalink
Add Fuzzilli cases to the test-input archive (#4504)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mi-ac authored Dec 17, 2024
1 parent f9d516c commit 65e0e7b
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/python/other-bots/chromium-tests-syncer/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import os
import re
import subprocess
import tarfile
import time

from clusterfuzz._internal.base import utils
Expand Down Expand Up @@ -208,6 +209,39 @@ def create_gecko_tests_directory(tests_directory, gecko_checkout_subdirectory,
target_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'

# Ensure we have an empty directory with no leftovers from a previous run.
shell.remove_directory(fuzzilli_tests_directory, recreate=True)

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
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_members)

# 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."""
Expand Down Expand Up @@ -264,6 +298,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',
Expand Down

0 comments on commit 65e0e7b

Please sign in to comment.