[autotest] Pipe check_hosts parameter down into dynamic_suite
The builders need to schedule a test suite and then wait for it to
complete. They probably want to check to make sure the suite can be
scheduled, and error out if not. That's great. For suites that we
schedule once a day or asynchronously in some other way, we probably
don't want to bail just because the testbed has too many hosts that
need Repair or something. We want to fire and forget.
To support these two modes of operation, pipe a 'check_hosts' paramter
all the way from the create_suite_job() RPC, down through control
files, all the way to dynamic_suite.reimage_and_run(). Ensure that we
tolerate check_hosts being left unset in reimage_and_run(). Also,
make 'atest suite create' able to toggle this value.
BUG=chromium-os:27526
TEST=dynamic_suite_unittest.py, site_rpc_interface_unittest.py
TEST=./server/autoserv test_suites/dev_harness with check_hosts set both ways.
TEST=install the patch on an autotest instance, and re-run a test suite against the new interface. The suite should check for hosts and behave appropriately.
Change-Id: I10c3f42dbc37f26d7af3c40439ce212ebf74cfcd
Reviewed-on: https://gerrit.chromium.org/gerrit/17633
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Commit-Ready: Chris Masone <cmasone@chromium.org>
diff --git a/frontend/afe/site_rpc_interface.py b/frontend/afe/site_rpc_interface.py
index e817217..4e25714 100644
--- a/frontend/afe/site_rpc_interface.py
+++ b/frontend/afe/site_rpc_interface.py
@@ -31,7 +31,11 @@
return rpc_utils
-def create_suite_job(suite_name, board, build, pool):
+def canonicalize_suite_name(suite_name):
+ return 'test_suites/control.%s' % suite_name
+
+
+def create_suite_job(suite_name, board, build, pool, check_hosts=True):
"""
Create a job to run a test suite on the given device with the given image.
@@ -43,17 +47,18 @@
@param build: unique name by which to refer to the image from now on.
@param pool: Specify the pool of machines to use for scheduling
purposes.
+ @param check_hosts: require appropriate live hosts to exist in the lab.
- @throws ControlFileNotFound if a unique suite control file doesn't exist.
- @throws NoControlFileList if we can't list the control files at all.
- @throws StageBuildFailure if the dev server throws 500 while staging build.
- @throws ControlFileEmpty if the control file exists on the server, but
+ @raises ControlFileNotFound if a unique suite control file doesn't exist.
+ @raises NoControlFileList if we can't list the control files at all.
+ @raises StageBuildFailure if the dev server throws 500 while staging build.
+ @raises ControlFileEmpty if the control file exists on the server, but
can't be read.
@return: the job ID of the suite; -1 on error.
"""
# All suite names are assumed under test_suites/control.XX.
- suite_name = 'test_suites/control.%s' % suite_name
+ suite_name = canonicalize_suite_name(suite_name)
# Ensure |build| is staged is on the dev server.
ds = dev_server.DevServer.create()
if not ds.trigger_download(build):
@@ -68,6 +73,7 @@
# prepend build and board to the control file
inject_dict = {'board': board,
'build': build,
+ 'check_hosts': check_hosts,
'pool': pool}
control_file = dynamic_suite.inject_vars(inject_dict, control_file_in)