[autotest] Add a dummy test for testbed.
This change also updates the special task control segments to support testbed.
BUG=chromium:574173
TEST=local run the dummy test.
Change-Id: I233511fa340050b74df3fdbcc76c4a408ded5fcf
Reviewed-on: https://chromium-review.googlesource.com/320204
Commit-Ready: Dan Shi <[email protected]>
Tested-by: Dan Shi <[email protected]>
Reviewed-by: Simran Basi <[email protected]>
diff --git a/server/control_segments/crashdumps b/server/control_segments/crashdumps
index 4917794..ff9f837 100644
--- a/server/control_segments/crashdumps
+++ b/server/control_segments/crashdumps
@@ -4,7 +4,8 @@
def crashdumps(machine):
- host = hosts.create_host(machine, initialize=False, auto_monitor=False)
+ host = hosts.create_target_machine(machine, initialize=False,
+ auto_monitor=False)
try:
crashcollect.get_crashdumps(host, test_start_time)
except Exception as e:
diff --git a/server/control_segments/reset b/server/control_segments/reset
index c03369a..7db915e 100644
--- a/server/control_segments/reset
+++ b/server/control_segments/reset
@@ -14,17 +14,18 @@
timer = None
try:
job.record('START', None, 'reset')
- host = hosts.create_host(machine, initialize=False, auto_monitor=False)
+ target = hosts.create_target_machine(machine, initialize=False,
+ auto_monitor=False)
timer = autotest_stats.Timer('reset_time')
timer.start()
# Assume cleanup always runs first.
- host.cleanup()
- provision.run_special_task_actions(job, host, labels_list,
+ target.cleanup()
+ provision.run_special_task_actions(job, target, labels_list,
provision.Cleanup)
- host.verify()
- provision.run_special_task_actions(job, host, labels_list,
+ target.verify()
+ provision.run_special_task_actions(job, target, labels_list,
provision.Verify)
except Exception as e:
logging.exception(e)
diff --git a/server/control_segments/verify_job_repo_url b/server/control_segments/verify_job_repo_url
index 459e09b..a073fcc 100644
--- a/server/control_segments/verify_job_repo_url
+++ b/server/control_segments/verify_job_repo_url
@@ -1,4 +1,11 @@
+from autotest_lib.server import utils
+
+
def install(machine):
+ if utils.machine_is_testbed(machine):
+ logging.info('testbed does not need to verify job repo url.')
+ return
+
logging.info('Verifying job repo url for machine %s', machine)
host = hosts.create_host(machine, initialize=False, auto_monitor=False)
host.verify_job_repo_url(job.tag)
diff --git a/server/hosts/testbed.py b/server/hosts/testbed.py
index 42604ca..da82134 100644
--- a/server/hosts/testbed.py
+++ b/server/hosts/testbed.py
@@ -32,6 +32,7 @@
self.hostname = hostname
self.teststation = teststation_host.create_teststationhost(
hostname=hostname)
+ self.is_client_install_supported = False
serials_from_attributes = host_attributes.get('serials')
if serials_from_attributes:
serials_from_attributes = serials_from_attributes.split(',')
@@ -143,3 +144,10 @@
"""Run through verify on all the devices."""
for device in self.get_all_hosts():
device.verify()
+
+
+ def cleanup(self):
+ """Run through cleanup on all the devices."""
+ for adb_device in self.get_adb_devices().values():
+ adb_device.cleanup()
+
diff --git a/server/site_tests/testbed_DummyTest/control b/server/site_tests/testbed_DummyTest/control
new file mode 100644
index 0000000..e6b866b
--- /dev/null
+++ b/server/site_tests/testbed_DummyTest/control
@@ -0,0 +1,22 @@
+# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+AUTHOR = 'dshi'
+NAME = 'testbed_DummyTest'
+TIME = 'SHORT'
+TEST_TYPE = 'Server'
+SUITE = ''
+# All android tests do not support server-side packaging.
+REQUIRE_SSP = False
+
+DOC = """
+A dummy test to verify testbed can run basic provision and adb command to
+connected Android devices.
+"""
+
+def run(machine):
+ job.run_test('testbed_DummyTest',
+ testbed=hosts.create_target_machine(machine))
+
+parallel_simple(run, machines)
diff --git a/server/site_tests/testbed_DummyTest/testbed_DummyTest.py b/server/site_tests/testbed_DummyTest/testbed_DummyTest.py
new file mode 100644
index 0000000..0f825e2
--- /dev/null
+++ b/server/site_tests/testbed_DummyTest/testbed_DummyTest.py
@@ -0,0 +1,22 @@
+# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import common
+from autotest_lib.server import test
+
+
+class testbed_DummyTest(test.test):
+ """A dummy test to verify testbed can access connected Android devices."""
+ version = 1
+
+ def run_once(self, testbed=None):
+ """A dummy test to verify testbed can access connected Android devices.
+
+ Prerequisite: All connected DUTs are in ADB mode.
+
+ @param testbed: host object representing the testbed.
+ """
+ self.testbed = testbed
+ for device in self.testbed.get_all_hosts():
+ device.run('true')
diff --git a/server/test.py b/server/test.py
index a46b472..6af056b 100644
--- a/server/test.py
+++ b/server/test.py
@@ -97,7 +97,8 @@
def _install(self):
if not self.host:
from autotest_lib.server import hosts, autotest
- self.host = hosts.create_host(self.job.machine_dict_list[0])
+ self.host = hosts.create_target_machine(
+ self.job.machine_dict_list[0])
# TODO(kevcheng): remove when host client install is supported for
# ADBHost. crbug.com/543702
if not self.host.is_client_install_supported: