aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Lozano <llozano@chromium.org>2015-12-08 12:08:44 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-12-08 23:26:30 +0000
commitdd4176150697727cdc89574698fd53f556c1304d (patch)
treea9eb3a5bd8c03bcc8d336001876368897898f930
parent62422c48de4ab503020b73be0a400873ab96d21d (diff)
downloadtoolchain-utils-dd4176150697727cdc89574698fd53f556c1304d.tar.gz
Print friendlier error message when no benchmark is given.
Catch no-benchmarks and no-labels errors earlier to avoid weird error messages later. BUG=chromium:432616 TEST=tested with different experiment files. Change-Id: I8a05dbac4a47a0f005f0b3c175770a0d88cb4a62 Reviewed-on: https://chrome-internal-review.googlesource.com/241096 Commit-Ready: Luis Lozano <llozano@chromium.org> Tested-by: Luis Lozano <llozano@chromium.org> Reviewed-by: Caroline Tice <cmtice@google.com> Reviewed-by: Luis Lozano <llozano@chromium.org>
-rw-r--r--crosperf/experiment.py12
-rw-r--r--crosperf/experiment_factory.py19
2 files changed, 23 insertions, 8 deletions
diff --git a/crosperf/experiment.py b/crosperf/experiment.py
index d156afef..b0243e3b 100644
--- a/crosperf/experiment.py
+++ b/crosperf/experiment.py
@@ -54,15 +54,23 @@ class Experiment(object):
self.locks_dir = locks_directory
self.locked_machines = []
+ if not remote:
+ raise RuntimeError("No remote hosts specified")
+ if not self.benchmarks:
+ raise RuntimeError("No benchmarks specified")
+ if not self.labels:
+ raise RuntimeError("No labels specified")
+
# We need one chromeos_root to run the benchmarks in, but it doesn't
# matter where it is, unless the ABIs are different.
if not chromeos_root:
for label in self.labels:
if label.chromeos_root:
chromeos_root = label.chromeos_root
+ break
if not chromeos_root:
- raise Exception("No chromeos_root given and could not determine one from "
- "the image path.")
+ raise RuntimeError("No chromeos_root given and could not determine "
+ "one from the image path.")
if test_flag.GetTestMode():
self.machine_manager = MockMachineManager(chromeos_root, acquire_timeout,
diff --git a/crosperf/experiment_factory.py b/crosperf/experiment_factory.py
index 99e305aa..2c63645f 100644
--- a/crosperf/experiment_factory.py
+++ b/crosperf/experiment_factory.py
@@ -204,6 +204,9 @@ class ExperimentFactory(object):
show_all_results, retries, run_local=False)
benchmarks.append(benchmark)
+ if not benchmarks:
+ raise RuntimeError("No benchmarks specified")
+
# Construct labels.
# Some fields are common with global settings. The values are
# inherited and/or merged with the global settings values.
@@ -224,7 +227,7 @@ class ExperimentFactory(object):
if image == "":
build = label_settings.GetField("build")
if len(build) == 0:
- raise Exception("Can not have empty 'build' field!")
+ raise RuntimeError("Can not have empty 'build' field!")
image = label_settings.GetXbuddyPath (build, board, chromeos_root,
log_level)
@@ -239,8 +242,8 @@ class ExperimentFactory(object):
and global_settings.GetField("board") != board)):
my_remote = self.GetDefaultRemotes(board)
if global_settings.GetField("same_machine") and len(my_remote) > 1:
- raise Exception("Only one remote is allowed when same_machine "
- "is turned on")
+ raise RuntimeError("Only one remote is allowed when same_machine "
+ "is turned on")
all_remote += my_remote
image_args = label_settings.GetField("image_args")
if test_flag.GetTestMode():
@@ -252,6 +255,9 @@ class ExperimentFactory(object):
chrome_src)
labels.append(label)
+ if not labels:
+ raise RuntimeError("No labels specified")
+
email = global_settings.GetField("email")
all_remote += list(set(my_remote))
all_remote = list(set(all_remote))
@@ -277,9 +283,10 @@ class ExperimentFactory(object):
if remotes:
return remotes
else:
- raise Exception("There is no remote for {0}".format(board))
+ raise RuntimeError("There is no remote for {0}".format(board))
except IOError:
- raise Exception("IOError while reading file {0}"
+ # TODO: rethrow instead of throwing different exception.
+ raise RuntimeError("IOError while reading file {0}"
.format(default_remotes_file))
else:
- raise Exception("There is not remote for {0}".format(board))
+ raise RuntimeError("There is not remote for {0}".format(board))