check_seed_corpus_archive.py 736 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python3
  2. # Copyright 2017 The Chromium Authors. All rights reserved.
  3. # Use of this source code is governed by a BSD-style license that can be
  4. # found in the LICENSE file.
  5. # Script that prints out number of files in given zip-archive. Used for testing.
  6. import os
  7. import sys
  8. import zipfile
  9. if sys.version_info.major == 2:
  10. from ConfigParser import ConfigParser
  11. else:
  12. from configparser import ConfigParser
  13. seed_corpus_archive_path = os.path.join(os.path.dirname(sys.argv[0]),
  14. sys.argv[1])
  15. if not os.path.exists(seed_corpus_archive_path):
  16. sys.exit(-1)
  17. archive = zipfile.ZipFile(seed_corpus_archive_path)
  18. sys.stdout.write('%d\n' % len(archive.namelist()))