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

Unified Diff: build/android/generate_emma_html.py

Issue 23345003: [Android] Buildbot changes for EMMA code coverage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds TODO to remove *_sources.txt try/except Created 7 years, 4 months 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 | « build/android/buildbot/bb_utils.py ('k') | build/android/gyp/emma_instr.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/generate_emma_html.py
diff --git a/build/android/generate_emma_html.py b/build/android/generate_emma_html.py
index fa7279263d787405a005f8c6dc39e5ed9d03fa55..a226343e973744a20438342a97c4502474f7f41d 100755
--- a/build/android/generate_emma_html.py
+++ b/build/android/generate_emma_html.py
@@ -11,6 +11,7 @@ import json
import optparse
import os
import sys
+import traceback
from pylib import cmd_helper
from pylib import constants
@@ -54,27 +55,46 @@ def main(argv):
print 'Found coverage files: %s' % str(coverage_files)
print 'Found metadata files: %s' % str(metadata_files)
sources_files = []
+ final_metadata_files = []
+ err = None
for f in metadata_files:
- sources_file = os.path.join(os.path.dirname(f), 'emma_sources.txt')
- with open(sources_file, 'r') as f:
- sources_files.extend(json.load(f))
+ sources_file = os.path.splitext(f)[0] + '_sources.txt'
+ # TODO(gkanwar): Remove this once old coverage.em files have been cleaned
+ # from all bots.
+ # Warn if we have old metadata files lying around that don't correspond
+ # to a *_sources.txt (these should be manually cleaned).
+ try:
+ with open(sources_file, 'r') as sf:
+ sources_files.extend(json.load(sf))
+ except IOError as e:
+ traceback.print_exc()
+ err = e
+ else:
+ final_metadata_files.append(f)
sources_files = [os.path.join(constants.DIR_SOURCE_ROOT, s)
for s in sources_files]
input_args = []
- for f in coverage_files + metadata_files:
+ for f in coverage_files + final_metadata_files:
input_args.append('-in')
input_args.append(f)
output_args = ['-Dreport.html.out.file', options.output]
source_args = ['-sp', ','.join(sources_files)]
- return cmd_helper.RunCmd(
+ exit_code = cmd_helper.RunCmd(
['java', '-cp',
os.path.join(constants.ANDROID_SDK_ROOT, 'tools', 'lib', 'emma.jar'),
'emma', 'report', '-r', 'html']
+ input_args + output_args + source_args)
+ if exit_code > 0:
+ return exit_code
+ elif err:
+ return constants.WARNING_EXIT_CODE
+ else:
+ return 0
+
if __name__ == '__main__':
sys.exit(main(sys.argv))
« no previous file with comments | « build/android/buildbot/bb_utils.py ('k') | build/android/gyp/emma_instr.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698