aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
authorCaroline Tice <cmtice@google.com>2016-03-30 11:00:18 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-03-30 22:11:08 +0000
commit285a66e9ee9d59c3e3051512db060ee485c440f0 (patch)
tree795aa1c4cad3444344bb546e3ef546c048d06a4a /crosperf
parentf637a050cc27b206824d7b1262d2aa9de0668bef (diff)
downloadtoolchain-utils-285a66e9ee9d59c3e3051512db060ee485c440f0.tar.gz
[crosperf] Don't fail completely on missing result field.
After running to completion, while generating the json report Crosperf sometimes tries to look for a result field that should be there but isn't. Previously this would cause a runtime exception and Crosperf would fail without generating any reports at all. This CL fixes that (now a report still gets generated, without the one missing field). BUG=None TEST=Tested this in nightly tests. Change-Id: I35043e8c90fad6dbb5bfd5dede1905a2238bd3b7 Reviewed-on: https://chrome-internal-review.googlesource.com/253035 Commit-Ready: Caroline Tice <cmtice@google.com> Tested-by: Caroline Tice <cmtice@google.com> Reviewed-by: Han Shen <shenhan@google.com>
Diffstat (limited to 'crosperf')
-rw-r--r--crosperf/results_report.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/crosperf/results_report.py b/crosperf/results_report.py
index f5d71aee..2a245b3b 100644
--- a/crosperf/results_report.py
+++ b/crosperf/results_report.py
@@ -607,11 +607,12 @@ class JSONResultsReport(ResultsReport):
default_result_fields = self.defaults.GetDefault()[test]
value = []
for f in default_result_fields:
- v = iter_results[f]
- if type(v) == list:
- v = v[0]
- item = (f, float(v))
- value.append(item)
+ if f in iter_results:
+ v = iter_results[f]
+ if type(v) == list:
+ v = v[0]
+ item = (f, float(v))
+ value.append(item)
json_results['overall_result'] = value
# Get detailed results.
detail_results = dict()