bisect-kit: revise eval_cros_autotest.py error handling
BUG=None
TEST=no exception if run eval_cros_autotest.py with "--metric NOT-EXIST-METRIC"
Change-Id: If92ae1de132d44b3806449afb70f2918d16b2fa3
Reviewed-on: https://chromium-review.googlesource.com/1170728
Commit-Ready: Kuang-che Wu <kcwu@chromium.org>
Tested-by: Kuang-che Wu <kcwu@chromium.org>
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
diff --git a/eval_cros_autotest.py b/eval_cros_autotest.py
index f578ed7..1991624 100755
--- a/eval_cros_autotest.py
+++ b/eval_cros_autotest.py
@@ -120,7 +120,7 @@
data = json.load(open(json_path))
if metric not in data:
logger.error('metric "%s" not in %s', metric, json_path)
- return None
+ return []
summary = data[metric]['summary']
if 'values' in summary:
@@ -240,6 +240,9 @@
logger.info('failed before test start; FATAL')
return FATAL
+ if result_dir is None:
+ return FATAL
+
passed, values = gather_test_result(opts, result_dir)
if opts.metric: