[Brillo] Added tests to pre and post submit suites
TEST=Executed tests on lab devices. Verified changed tests on moblab
against edison.
BUG=None
Change-Id: Icdbb05540374660c6e62d2365db028cf503a0565
Reviewed-on: https://chromium-review.googlesource.com/373581
Commit-Ready: Justin Giorgi <jgiorgi@google.com>
Tested-by: Justin Giorgi <jgiorgi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/server/site_tests/brillo_ADBFileTransfer/control.bvt b/server/site_tests/brillo_ADBFileTransfer/control.bvt
index 33a2245..7e4b3ef 100644
--- a/server/site_tests/brillo_ADBFileTransfer/control.bvt
+++ b/server/site_tests/brillo_ADBFileTransfer/control.bvt
@@ -7,7 +7,7 @@
TIME = 'MEDIUM'
TEST_CATEGORY = 'Functional'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt'
+ATTRIBUTES = 'suite:brillo-bvt, suite:brillo-presubmit, suite:brillo-postsubmit'
DOC = """
Tests whether ADB can handle large/long file transfers.
diff --git a/server/site_tests/brillo_ADBLogcatTest/control b/server/site_tests/brillo_ADBLogcatTest/control
index a32301f..dbe4866 100644
--- a/server/site_tests/brillo_ADBLogcatTest/control
+++ b/server/site_tests/brillo_ADBLogcatTest/control
@@ -7,7 +7,8 @@
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt, suite:brillo-pts'
+ATTRIBUTES = ('suite:brillo-bvt, suite:brillo-pts, suite:brillo-presubmit, '
+ 'suite:brillo-postsubmit')
DOC = """
Tests whether 'adb logcat' and 'adb shell dmesg' work
diff --git a/server/site_tests/brillo_DiskSizeTest/control b/server/site_tests/brillo_DiskSizeTest/control
index 373370f..084d0d4 100644
--- a/server/site_tests/brillo_DiskSizeTest/control
+++ b/server/site_tests/brillo_DiskSizeTest/control
@@ -9,7 +9,8 @@
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt,suite:brillo-smoke'
+ATTRIBUTES = ('suite:brillo-bvt,suite:brillo-smoke,suite:brillo-presubmit,'
+ 'suite:brillo-postsubmit')
DOC = """
Tests whether a Brillo device has sufficient disk size.
diff --git a/server/site_tests/brillo_FastbootTest/control b/server/site_tests/brillo_FastbootTest/control
index 2a613f9..49aee8f 100644
--- a/server/site_tests/brillo_FastbootTest/control
+++ b/server/site_tests/brillo_FastbootTest/control
@@ -7,7 +7,7 @@
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt'
+ATTRIBUTES = 'suite:brillo-bvt, suite:brillo-postsubmit'
DOC = """
Tests whether a Brillo device can reboot into and out of the bootloader.
diff --git a/server/site_tests/brillo_Invariants/brillo_Invariants.py b/server/site_tests/brillo_Invariants/brillo_Invariants.py
index 1ee5d00..2fa91c9 100644
--- a/server/site_tests/brillo_Invariants/brillo_Invariants.py
+++ b/server/site_tests/brillo_Invariants/brillo_Invariants.py
@@ -21,7 +21,7 @@
@param test: the test to perform, without leading dash.
@param negative: if True, test for the negative.
"""
- self.dut.run('test %s -%s %s' % ('!' if negative else '', test, path))
+ self.host.run('test %s -%s %s' % ('!' if negative else '', test, path))
def assert_selinux_context(self, path, ctx):
@@ -34,7 +34,7 @@
"""
# Example output of 'ls -LZ /dev/block/by-name/misc' is:
# u:object_r:misc_block_device:s0 /dev/block/by-name/misc
- tokens = self.dut.run_output('ls -LZ %s' % path).split()
+ tokens = self.host.run_output('ls -LZ %s' % path).split()
path_ctx = tokens[0]
if not ctx in path_ctx:
raise error.TestFail('Context "%s" for path "%s" does not '
@@ -44,7 +44,7 @@
def check_fstab_name(self):
"""Checks that the fstab file has the name /fstab.<ro.hardware>.
"""
- hardware = self.dut.run_output('getprop ro.hardware')
+ hardware = self.host.run_output('getprop ro.hardware')
self.assert_path_test('/fstab.%s' % hardware, 'e')
self.assert_path_test('/fstab.device', 'e', negative=True)
@@ -63,11 +63,11 @@
self.assert_path_test('/dev/block/by-name/userdata', 'b')
- def run_once(self, dut=None):
+ def run_once(self, host=None):
"""Check for things that should look the same on all Brillo devices.
@param dut: host object representing the device under test.
"""
- self.dut = dut
+ self.host = host
self.check_fstab_name()
self.check_block_devices()
diff --git a/server/site_tests/brillo_Invariants/control b/server/site_tests/brillo_Invariants/control
index 802743d..1707aad 100644
--- a/server/site_tests/brillo_Invariants/control
+++ b/server/site_tests/brillo_Invariants/control
@@ -6,13 +6,13 @@
NAME = 'brillo_Invariants'
TIME = 'FAST'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt'
+ATTRIBUTES = 'suite:brillo-bvt,suite:brillo-postsubmit'
DOC = """
Check for things that should look the same on all Brillo devices.
"""
def run(machine):
- job.run_test('brillo_Invariants', dut=hosts.create_host(machine))
+ job.run_test('brillo_Invariants', host=hosts.create_host(machine))
parallel_simple(run, machines)
diff --git a/server/site_tests/brillo_MemorySizeTest/control b/server/site_tests/brillo_MemorySizeTest/control
index 469e32d..6ded646 100644
--- a/server/site_tests/brillo_MemorySizeTest/control
+++ b/server/site_tests/brillo_MemorySizeTest/control
@@ -9,7 +9,8 @@
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt,suite:brillo-smoke'
+ATTRIBUTES = ('suite:brillo-bvt,suite:brillo-smoke,suite:brillo-presubmit,'
+ 'suite:brillo-postsubmit')
DOC = """
Tests whether a Brillo device has sufficient memory.
diff --git a/server/site_tests/brillo_PingTest/brillo_PingTest.py b/server/site_tests/brillo_PingTest/brillo_PingTest.py
index b6b785e..75f529c 100644
--- a/server/site_tests/brillo_PingTest/brillo_PingTest.py
+++ b/server/site_tests/brillo_PingTest/brillo_PingTest.py
@@ -8,6 +8,7 @@
from autotest_lib.client.common_lib import error
from autotest_lib.client.common_lib import global_config
from autotest_lib.client.common_lib import site_utils
+from autotest_lib.client.common_lib.cros import retry
from autotest_lib.server import afe_utils
from autotest_lib.server import test
from autotest_lib.server.brillo import host_utils
@@ -42,12 +43,19 @@
ssid = site_utils.get_wireless_ssid(host.hostname)
passphrase = global_config.global_config.get_config_value(
'CLIENT', 'wireless_password', default=None)
- with host_utils.connect_to_ssid(host, ssid, passphrase):
+ host.run('am startservice -n com.google.wifisetup/.WifiSetupService '
+ '-a WifiSetupService.Connect -e ssid %s -e passphrase %s' %
+ (ssid, passphrase))
+
+ @retry.retry(error.GenericHostRunError, timeout_min=1.5, delay_sec=3)
+ def ping():
cmd = 'ping -q -c %s -W %s %s' % (ping_count, ping_timeout,
ping_host)
- try:
- host.run(cmd)
- except error.GenericHostRunError:
- raise error.TestFail(
- 'Failed to ping %s in %d seconds on all %d attempts' %
- (ping_host, ping_timeout, ping_count))
+ host.run(cmd)
+
+ try:
+ ping()
+ except error.GenericHostRunError:
+ raise error.TestFail(
+ 'Failed to ping %s in %d seconds on all %d attempts' %
+ (ping_host, ping_timeout, ping_count))
diff --git a/server/site_tests/brillo_PingTest/control b/server/site_tests/brillo_PingTest/control
index 9a304ee..cb43563 100644
--- a/server/site_tests/brillo_PingTest/control
+++ b/server/site_tests/brillo_PingTest/control
@@ -9,7 +9,7 @@
TIME = 'SHORT'
TEST_CATEGORY = 'Functional'
TEST_TYPE = 'Server'
-ATTRIBUTES = 'suite:brillo-bvt'
+ATTRIBUTES = 'suite:brillo-bvt,suite:brillo-postsubmit'
DOC = """
Tests whether a Brillo device can ping the Internet.
diff --git a/server/site_tests/platform_BootDevice/control.1 b/server/site_tests/platform_BootDevice/control.1
index c50c59c..9b6e563 100644
--- a/server/site_tests/platform_BootDevice/control.1
+++ b/server/site_tests/platform_BootDevice/control.1
@@ -4,7 +4,7 @@
NAME = "BootDevice1"
AUTHOR = "Brillo Team"
-ATTRIBUTES = "suite:brillo-presubmit"
+ATTRIBUTES = "suite:brillo-presubmit,suite:brillo-postsubmit"
TIME = "SHORT"
TEST_CATEGORY = "functional"
TEST_CLASS = "platform"
diff --git a/test_suites/control.brillo-presubmit b/test_suites/control.brillo-presubmit
index 98ed08d..d180b40 100644
--- a/test_suites/control.brillo-presubmit
+++ b/test_suites/control.brillo-presubmit
@@ -12,7 +12,9 @@
TEST_TYPE = "Server"
DOC = """
-Suite for kicking off the Brillo presubmit testing.
+Suite for kicking off the Brillo presubmit testing. Runs on emulators and
+physical devices. WiFi, fastboot and other hardware or bootloader related tests
+must not be added to this suite.
"""
import common