Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: testing/libfuzzer/archive_corpus.py

Issue 1885493002: [libfuzzer] Add custom max_len parameter for boringssl fuzzers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove depfile for dry run to test a possible fix. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | testing/libfuzzer/fuzzer_test.gni » ('j') | third_party/boringssl/BUILD.gn » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2 1 #!/usr/bin/python2
2 # 2 #
3 # Copyright 2016 The Chromium Authors. All rights reserved. 3 # Copyright 2016 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Archive corpus file into zip and generate .d depfile. 7 """Archive corpus file into zip and generate .d depfile.
8 8
9 Invoked by GN from fuzzer_test.gni. 9 Invoked by GN from fuzzer_test.gni.
10 """ 10 """
11 11
12 from __future__ import print_function 12 from __future__ import print_function
13 import argparse 13 import argparse
14 import os 14 import os
15 import sys 15 import sys
16 import zipfile 16 import zipfile
17 17
18 18
19 def main(): 19 def main():
20 parser = argparse.ArgumentParser(description="Generate fuzzer config.") 20 parser = argparse.ArgumentParser(description="Generate fuzzer config.")
21 parser.add_argument('--depfile', required=True)
22 parser.add_argument('--corpus', required=True) 21 parser.add_argument('--corpus', required=True)
23 parser.add_argument('--output', required=True) 22 parser.add_argument('--output', required=True)
24 parser.add_argument('--fuzzer', required=True) 23 parser.add_argument('--fuzzer', required=True)
25 args = parser.parse_args() 24 args = parser.parse_args()
26 25
27 corpus_files = [] 26 corpus_files = []
28 # Generate .d file with dependency from corpus archive to individual files. 27
29 with open(args.depfile, 'w') as depfile: 28 for (dirpath, _, filenames) in os.walk(args.corpus):
30 print(os.path.basename(args.output), ":", end="", file=depfile) 29 for filename in filenames:
31 for (dirpath, _, filenames) in os.walk(args.corpus): 30 full_filename = os.path.join(dirpath, filename)
32 for filename in filenames: 31 corpus_files.append(full_filename)
33 full_filename = os.path.join(dirpath, filename)
34 print(" ", full_filename, end="", file=depfile)
35 corpus_files.append(full_filename)
36 # chrome bots complain about this one:
37 # print(" ", args.fuzzer, end="", file=depfile)
38 32
39 with zipfile.ZipFile(args.output, 'w') as z: 33 with zipfile.ZipFile(args.output, 'w') as z:
40 for corpus_file in corpus_files: 34 for corpus_file in corpus_files:
41 z.write(corpus_file, os.path.basename(corpus_file)) 35 z.write(corpus_file, os.path.basename(corpus_file))
42 36
43 37
44 if __name__ == '__main__': 38 if __name__ == '__main__':
45 main() 39 main()
46
OLDNEW
« no previous file with comments | « no previous file | testing/libfuzzer/fuzzer_test.gni » ('j') | third_party/boringssl/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698