mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
post_build_ninja_summary.py: Gracefully handle empty .ninja_log files
These are currently produced by Siso, until b/298594790 is addressed.
Before:
$ post_build_ninja_summary.py -C out/fastbuild-siso-reclient
Traceback (most recent call last):
File "/usr/local/google/home/philwo/depot_tools/post_build_ninja_summary.py", line 366, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/google/home/philwo/depot_tools/post_build_ninja_summary.py", line 356, in main
entries = ReadTargets(log, False)
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/google/home/philwo/depot_tools/post_build_ninja_summary.py", line 123, in ReadTargets
assert header == '# ninja log v5\n', \
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: unrecognized ninja log version ''
After:
$ post_build_ninja_summary.py -C out/fastbuild-siso-reclient
<nothing>
Bug: b/298594790
Fixed: b/297349353
Change-Id: I10d4613e7386707276003fe0fd05cb5b0914be46
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/4846349
Reviewed-by: Takuto Ikuta <tikuta@chromium.org>
Auto-Submit: Philipp Wollermann <philwo@google.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
This commit is contained in:
committed by
LUCI CQ
parent
b64ee7f525
commit
c3d210d605
@@ -116,6 +116,10 @@ def ReadTargets(log, show_all):
|
||||
|
||||
The result is a list of Target objects."""
|
||||
header = log.readline()
|
||||
# TODO: b/298594790 - Siso currently generates empty .ninja_log files.
|
||||
# Handle them gracefully by silently returning an empty list of targets.
|
||||
if not header:
|
||||
return []
|
||||
assert header == '# ninja log v5\n', \
|
||||
'unrecognized ninja log version %r' % header
|
||||
targets_dict = {}
|
||||
@@ -350,8 +354,9 @@ def main():
|
||||
try:
|
||||
with open(log_file, 'r') as log:
|
||||
entries = ReadTargets(log, False)
|
||||
SummarizeEntries(entries, args.step_types,
|
||||
args.elapsed_time_sorting)
|
||||
if entries:
|
||||
SummarizeEntries(entries, args.step_types,
|
||||
args.elapsed_time_sorting)
|
||||
except IOError:
|
||||
print('Log file %r not found, no build summary created.' % log_file)
|
||||
return errno.ENOENT
|
||||
|
||||
Reference in New Issue
Block a user