[infra] profile command: do not fail hard if some fuzz targets have no corpus. (#1719)

* [infra] profile command: do not fail hard if some fuzz targets have no corpus.

* Change listing to corpus_listing to be more explicit.

* Address review comment from Abhishek
This commit is contained in:
Max Moroz 2018-08-16 11:41:39 -07:00 committed by GitHub
parent 137bc2c9de
commit f1e7093d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 2 deletions

View File

@ -534,9 +534,19 @@ def _get_latest_corpus(project_name, fuzz_target, base_corpus_dir):
'ls',
corpus_backup_url
]
output = subprocess.check_output(command).splitlines()
corpus_listing = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = corpus_listing.communicate()
# Some fuzz targets (e.g. new ones) may not have corpus yet, just skip those.
if corpus_listing.returncode:
print('WARNING: corpus for {0} not found:\n{1}'.format(fuzz_target, error),
file=sys.stderr)
return
if output:
latest_backup_url = output[-1]
latest_backup_url = output.splitlines()[-1]
archive_path = corpus_dir + '.zip'
command = [
'gsutil',