Commit 950be741 authored by Jonathan Metzman's avatar Jonathan Metzman Committed by Commit Bot

Add gn arg archive_seed_corpus

archive_seed_corpus is false by default. If it is true then seed
corpora won't get built. This will be used to reduce build sizes on
most fuzzer build bots since they don't all need seed corpora.

Bug: 952412
Change-Id: I67b925756763e6221e88a3d47961f20c5a831054
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1566418
Commit-Queue: Jonathan Metzman <metzman@chromium.org>
Reviewed-by: default avatarMax Moroz <mmoroz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#650500}
parent 12baf6d6
...@@ -113,6 +113,9 @@ declare_args() { ...@@ -113,6 +113,9 @@ declare_args() {
# happens with no extra flags. This is useful when in component build # happens with no extra flags. This is useful when in component build
# enabling sanitizers only in some of the components. # enabling sanitizers only in some of the components.
use_sanitizer_configs_without_instrumentation = false use_sanitizer_configs_without_instrumentation = false
# When true, seed corpora archives are built.
archive_seed_corpus = true
} }
# Disable sanitizers for non-default toolchains. # Disable sanitizers for non-default toolchains.
......
...@@ -25,8 +25,10 @@ def main(): ...@@ -25,8 +25,10 @@ def main():
nargs='+') nargs='+')
parser.add_argument('--output', metavar='output_archive_name.zip', parser.add_argument('--output', metavar='output_archive_name.zip',
required=True) required=True)
args = parser.parse_args() parser.add_argument('--dry_run', default=False, action='store_true',
help="Don't actually create the output archive.")
args = parser.parse_args()
corpus_files = [] corpus_files = []
seed_corpus_path = args.output seed_corpus_path = args.output
...@@ -39,6 +41,9 @@ def main(): ...@@ -39,6 +41,9 @@ def main():
full_filename = os.path.join(dirpath, filename) full_filename = os.path.join(dirpath, filename)
corpus_files.append(full_filename) corpus_files.append(full_filename)
if args.dry_run:
return
with zipfile.ZipFile(seed_corpus_path, 'w') as z: with zipfile.ZipFile(seed_corpus_path, 'w') as z:
# Turn warnings into errors to interrupt the build: crbug.com/653920. # Turn warnings into errors to interrupt the build: crbug.com/653920.
with warnings.catch_warnings(): with warnings.catch_warnings():
......
...@@ -74,6 +74,12 @@ template("fuzzer_test") { ...@@ -74,6 +74,12 @@ template("fuzzer_test") {
} }
} }
# Tell the script not to actually zip the seed corpus if we have been
# instructed not to build it.
if (!archive_seed_corpus) {
args += [ "--dry_run" ]
}
outputs = [ outputs = [
out, out,
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment