Fix generate_emma_html.py failing due to 0-length .em files

This also makes it return non-zero when the .html is not actually
created.

BUG=587983

Review URL: https://codereview.chromium.org/1711983002

Cr-Original-Commit-Position: refs/heads/master@{#376348}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: ae67350c3a10889adb6bf3f47002227546245737
This commit is contained in:
agrieve 2016-02-18 18:20:30 -08:00 коммит произвёл Commit bot
Родитель 85d83d3199
Коммит 5a4b7eca3d
1 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@ -58,6 +58,9 @@ def main():
coverage_files = _GetFilesWithExt(options.coverage_dir, 'ec')
metadata_files = _GetFilesWithExt(options.metadata_dir, 'em')
# Filter out zero-length files. These are created by emma_instr.py when a
# target has no classes matching the coverage filter.
metadata_files = [f for f in metadata_files if os.path.getsize(f)]
print 'Found coverage files: %s' % str(coverage_files)
print 'Found metadata files: %s' % str(metadata_files)
@ -87,6 +90,10 @@ def main():
for f in coverage_files:
os.remove(f)
# Command tends to exit with status 0 when it actually failed.
if not exit_code and not os.path.exists(options.output):
exit_code = 1
return exit_code