Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fuzzilli cases to the test-input archive #4504

Merged
merged 2 commits into from
Dec 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this readable by anyone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


# 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
Loading