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

Unified Diff: testing/libfuzzer/archive_corpus.py

Issue 2520983002: [libfuzzer] Turn warnings from zipfile into errors while archiving seed corpus. (Closed)
Patch Set: Rebase. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/libfuzzer/archive_corpus.py
diff --git a/testing/libfuzzer/archive_corpus.py b/testing/libfuzzer/archive_corpus.py
index 7e39bb54e449812ecf275775b07a9454f3e94923..71c132b5b215f5a666578cc757eeb2d52d8ee367 100755
--- a/testing/libfuzzer/archive_corpus.py
+++ b/testing/libfuzzer/archive_corpus.py
@@ -13,6 +13,7 @@ from __future__ import print_function
import argparse
import os
import sys
+import warnings
import zipfile
@@ -31,8 +32,13 @@ def main():
corpus_files.append(full_filename)
with zipfile.ZipFile(args.output, 'w') as z:
- for corpus_file in corpus_files:
- z.write(corpus_file, os.path.basename(corpus_file))
+ # Turn warnings into errors to interrupt the build: crbug.com/653920.
+ with warnings.catch_warnings():
+ warnings.simplefilter("error")
+ for i, corpus_file in enumerate(corpus_files):
+ # To avoid duplication of filenames inside the archive, use numbers.
+ arcname = '%016d' % i
mmoroz 2016/11/29 13:53:41 I thought to use subdirectory_name + '_' + os.path
+ z.write(corpus_file, arcname)
if __name__ == '__main__':
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698