diff options
author | estevenson <estevenson@google.com> | 2015-08-11 18:28:30 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-12 01:29:13 +0000 |
commit | 1167cb33649c82a33bd18f8c08333113458939ff (patch) | |
tree | b4d47a642f5788c6a71d7eac4677eba53bb29ff1 /build/android/emma_coverage_stats.py | |
parent | e6177348063982961a37a4713ffb1586910e26b2 (diff) | |
download | chromium_src-1167cb33649c82a33bd18f8c08333113458939ff.zip chromium_src-1167cb33649c82a33bd18f8c08333113458939ff.tar.gz chromium_src-1167cb33649c82a33bd18f8c08333113458939ff.tar.bz2 |
Changed behavior when no files require coverage.
The android_coverage recipe expects a result file to be saved to the --out directory
regardless of if there were files requiring code coverage or not. If no files
require coverage, the script will now save an empty object to the output
file instead of returning early.
BUG=
Review URL: https://codereview.chromium.org/1290593002
Cr-Commit-Position: refs/heads/master@{#342957}
Diffstat (limited to 'build/android/emma_coverage_stats.py')
-rwxr-xr-x | build/android/emma_coverage_stats.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/build/android/emma_coverage_stats.py b/build/android/emma_coverage_stats.py index 8500890..89a2898 100755 --- a/build/android/emma_coverage_stats.py +++ b/build/android/emma_coverage_stats.py @@ -450,14 +450,15 @@ def GenerateCoverageReport(line_coverage_file, out_file_path, coverage_dir): files_for_coverage = {f: lines for f, lines in potential_files_for_coverage.iteritems() if _EmmaCoverageStats.NeedsCoverage(f)} - if not files_for_coverage: + + coverage_results = {} + if files_for_coverage: + code_coverage = _EmmaCoverageStats(coverage_dir, files_for_coverage.keys()) + coverage_results = code_coverage.GetCoverageDict( + files_for_coverage) + else: logging.info('No Java files requiring coverage were included in %s.', line_coverage_file) - return - - code_coverage = _EmmaCoverageStats(coverage_dir, files_for_coverage.keys()) - coverage_results = code_coverage.GetCoverageDict( - files_for_coverage) with open(out_file_path, 'w+') as out_status_file: json.dump(coverage_results, out_status_file) |