Add the device_status dimension to all triggered CrOS device tests.
This will ensure the tests only run on bots with healthy devices. Note
that we're not using a bot's quarantining method to do so since we also
want tasks that can heal an unhealthy device to still run.
Bug: 866062
Change-Id: Ieac1b8f5e58c2c49813952d039337dbfba20373c
Reviewed-on: https://chromium-review.googlesource.com/c/1474287
Reviewed-by: John Budorick <jbudorick@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632906}
diff --git a/testing/test.gni b/testing/test.gni
index a7dd581..eac0fdd 100644
--- a/testing/test.gni
+++ b/testing/test.gni
@@ -353,6 +353,9 @@
data = []
}
+ # We use a special trigger script for CrOS hardware tests.
+ data += [ "//testing/trigger_scripts/chromeos_device_trigger.py" ]
+
testonly = true
output_name = target_name
write_runtime_deps = _runtime_deps_file
diff --git a/testing/trigger_scripts/chromeos_device_trigger.py b/testing/trigger_scripts/chromeos_device_trigger.py
index 61ce229..7ac28fa2 100755
--- a/testing/trigger_scripts/chromeos_device_trigger.py
+++ b/testing/trigger_scripts/chromeos_device_trigger.py
@@ -101,8 +101,17 @@
# Insert our modified dimension args in between the 1st and 2nd args of the
# initial `swarming.py` invocation. This avoids the presence of the special
# `--` arg from causing swarming.py to ignore them.
+ needs_device_status = True
for k, v in args.dimensions:
new_args.extend(['--dimension', k, v])
+ if k == 'device_status':
+ needs_device_status = False
+
+ # Only CrOS device bots with a device_status dimension of "available" should
+ # run tests. So target those explicitly if we aren't already.
+ if needs_device_status:
+ new_args.extend(['--dimension', 'device_status', 'available'])
+
new_args.extend([
'--optional-dimension',
'device_os',