[autotest] Allow test to skip provision job
This change adds a new actionable label `skip_provision`. If the label
is listed in the DEPENDENCIES of a test, provision job won't run before
the test starts.
This is useful for AU test which doesn't require dut has a particular
build installed before test starts.
BUG=chromium:582353
TEST=in a devserver, modify the test control file for the dummy suite by
inject following line in the control file:
DEPENDENCIES = "skip_provision"
run dummy suite for the build:
./site_utils/run_suite.py -b veyron_jerry -i veyron_jerry-release/R50-7871.0.0 -s dummy
confirm no provision job was started, instead, reset is run.
Change-Id: I1755eb65327bd7db9f66011fbfa8f71a5e5dd8dd
Reviewed-on: https://chromium-review.googlesource.com/328392
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Fang Deng <fdeng@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/server/cros/provision.py b/server/cros/provision.py
index c12f48f..0215f3f 100644
--- a/server/cros/provision.py
+++ b/server/cros/provision.py
@@ -15,6 +15,9 @@
FW_RW_VERSION_PREFIX = 'fwrw-version'
FW_RO_VERSION_PREFIX = 'fwro-version'
+# Special label to skip provision and run reset instead.
+SKIP_PROVISION = 'skip_provision'
+
# Default number of provisions attempts to try if we believe the devserver is
# flaky.
FLAKY_DEVSERVER_ATTEMPTS = 2
@@ -119,7 +122,11 @@
configurations = set()
for label in labels:
- if cls.acts_on(label):
+ if label == SKIP_PROVISION:
+ # skip_provision is neither actionable or a capability label.
+ # It doesn't need any handling.
+ continue
+ elif cls.acts_on(label):
configurations.add(label)
else:
capabilities.add(label)
@@ -223,7 +230,8 @@
return (Verify.acts_on(label) or
Provision.acts_on(label) or
Cleanup.acts_on(label) or
- Repair.acts_on(label))
+ Repair.acts_on(label) or
+ label == SKIP_PROVISION)
def filter_labels(labels):