aboutsummaryrefslogtreecommitdiff
path: root/crosperf
diff options
context:
space:
mode:
authorZhizhou Yang <zhizhouy@google.com>2019-04-05 14:45:05 -0700
committerchrome-bot <chrome-bot@chromium.org>2019-04-08 11:54:41 -0700
commit7a9397f6cf4d1a3b453848b3bf642674f5686bff (patch)
tree74c91af657a80a4b7d0ee8a3b9afb0b187aaa1f1 /crosperf
parent3e36a69f75b86489331e16a5099836ed780303b5 (diff)
downloadtoolchain-utils-7a9397f6cf4d1a3b453848b3bf642674f5686bff.tar.gz
Fix 'result' variable referenced before assignment issue
This issue is caused by lacking of coverage in code. When we are parsing json result, value/values doesn't exist in its filed_dict for a key, this issue will be hitten. TEST=Eliminated the error caused by this issue. BUG=chromium:929519 Change-Id: I81e4c0cf5f92c2dca9662ba86629355b3b048089 Reviewed-on: https://chromium-review.googlesource.com/1553681 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zhizhou Yang <zhizhouy@google.com> Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'crosperf')
-rw-r--r--crosperf/results_cache.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index 419c41eb..39c127bf 100644
--- a/crosperf/results_cache.py
+++ b/crosperf/results_cache.py
@@ -2,6 +2,7 @@
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+
"""Module to deal with result cache."""
from __future__ import print_function
@@ -364,6 +365,8 @@ class Result(object):
result = sum(values) / float(len(values))
else:
result = values
+ else:
+ continue
units = value_dict['units']
new_value = [result, units]
keyvals[keyname] = new_value