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>
diff --git a/crosperf/results_cache.py b/crosperf/results_cache.py
index 419c41e..39c127b 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 @@
result = sum(values) / float(len(values))
else:
result = values
+ else:
+ continue
units = value_dict['units']
new_value = [result, units]
keyvals[keyname] = new_value