[Bluetooth] Adding suspend_resume and reboot files
Adding control.suspend_resume and control.reboot to separate out
out suspend/resume and reboot tests from
bluetooth_AdapterLEAdvertising. Also removing extraneous arguments from
control.single.
BUG=chromium:716576
TEST= test_that ${DUT_IP}
bluetooth_AdapterLEAdvertising.suspend_resume|reboot
Change-Id: I54753753c58126361399e9c703ac346e80c899a0
Reviewed-on: https://chromium-review.googlesource.com/502071
Commit-Ready: Ruchi Jahagirdar <rjahagir@chromium.org>
Tested-by: Ruchi Jahagirdar <rjahagir@chromium.org>
Tested-by: Shyh-In Hwang <josephsih@chromium.org>
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
diff --git a/server/site_tests/bluetooth_AdapterLEAdvertising/bluetooth_AdapterLEAdvertising.py b/server/site_tests/bluetooth_AdapterLEAdvertising/bluetooth_AdapterLEAdvertising.py
index ca5423b..edc05f3 100644
--- a/server/site_tests/bluetooth_AdapterLEAdvertising/bluetooth_AdapterLEAdvertising.py
+++ b/server/site_tests/bluetooth_AdapterLEAdvertising/bluetooth_AdapterLEAdvertising.py
@@ -1001,12 +1001,13 @@
self.unregister_advertisements(advertisements)
- def run_once(self, host, advertisements, multi_advertising):
+ def run_once(self, host, advertisements, test_type):
"""Running Bluetooth adapter LE advertising autotest.
@param host: device under test host.
@param advertisements: a list of advertisement instances.
- @param multi_advertising: indicating if this is multi-advertising.
+ @param test_type: indicating one of three test types: multi-advertising,
+ single_advertising, reboot, or suspend_resume.
"""
self.host = host
@@ -1024,14 +1025,12 @@
# Reset the adapter to forget previous stored data and turn it on.
self.test_reset_on_adapter()
- if multi_advertising:
+ if test_type == 'multi_advertising':
# Run all test cases for multiple advertisements.
self.test_case_SI200_RA3_CD_UA3()
self.test_case_SI200_RA3_CD_RA1_CD_UA1_CD_UA3()
self.test_case_SI200_RA3_CD_RS()
self.test_case_SI200_RA3_CD_UA1_CD_RS()
- self.test_case_SI200_RA3_CD_PC_CD_UA3()
- self.test_case_SI200_RA3_CD_SR_CD_UA3()
self.test_case_SI200_RA3_CD_UA1_CD_RA2_CD_UA4()
self.test_case_SI200_RA5_CD_FRA1_CD_UA5()
self.test_case_RA3_CD_SI200_CD_UA3()
@@ -1040,10 +1039,8 @@
self.test_case_RA3_CD_SI200_CD_SI2000_CD_UA3()
self.test_case_RA5_CD_SI200_CD_FRA1_CD_UA5()
self.test_case_RA3_CD_SI200_CD_FSI10_CD_FSI20000_CD_UA3()
- self.test_case_RA3_CD_SI200_CD_PC_CD_UA3()
- self.test_case_RA3_CD_SI200_CD_SR_CD_UA3()
- else:
+ elif test_type == 'single_advertising':
# Run all test cases for single advertisement.
# Note: it is required to change the advertisement instance
# so that the advertisement data could be monitored by btmon.
@@ -1051,13 +1048,22 @@
# reused such that the data would not be visible in btmon.
self.test_case_SI200_RA1_CD_UA1()
self.test_case_SI200_RA1_CD_RS()
- self.test_case_SI200_RA1_CD_SR_CD_UA1()
self.test_case_RA1_CD_SI200_CD_UA1()
self.test_case_RA1_CD_SI200_CD_RS()
self.test_case_RA1_CD_SI200_CD_FSI10_UA1_RA1_CD_UA1()
self.test_case_RA1_CD_SI200_CD_FSI20000_UA1_RA1_CD_UA1()
+
+ elif test_type == 'suspend_resume':
+ # Run all test cases for suspend resume testing.
+ self.test_case_SI200_RA3_CD_SR_CD_UA3()
+ self.test_case_RA3_CD_SI200_CD_SR_CD_UA3()
+ self.test_case_SI200_RA1_CD_SR_CD_UA1()
+ self.test_case_RA1_CD_SI200_CD_SR_CD_UA1()
+
+ elif test_type == 'reboot':
+ self.test_case_SI200_RA3_CD_PC_CD_UA3()
+ self.test_case_RA3_CD_SI200_CD_PC_CD_UA3()
self.test_case_RA1_CD_SI200_CD_PC_CD_UA1()
- self.test_case_RA1_CD_SI200_CD_SR_CD_UA1()
if self.fails:
raise error.TestFail(self.fails)
diff --git a/server/site_tests/bluetooth_AdapterLEAdvertising/control.multiple b/server/site_tests/bluetooth_AdapterLEAdvertising/control.multiple
index 344153d..941080d 100644
--- a/server/site_tests/bluetooth_AdapterLEAdvertising/control.multiple
+++ b/server/site_tests/bluetooth_AdapterLEAdvertising/control.multiple
@@ -29,8 +29,6 @@
self.test_case_SI200_RA3_CD_RA1_CD_UA1_CD_UA3()
self.test_case_SI200_RA3_CD_RS()
self.test_case_SI200_RA3_CD_UA1_CD_RS()
- self.test_case_SI200_RA3_CD_PC_CD_UA3()
- self.test_case_SI200_RA3_CD_SR_CD_UA3()
self.test_case_SI200_RA3_CD_UA1_CD_RA2_CD_UA4()
self.test_case_SI200_RA5_CD_FRA1_CD_UA5()
self.test_case_RA3_CD_SI200_CD_UA3()
@@ -39,8 +37,6 @@
self.test_case_RA3_CD_SI200_CD_SI2000_CD_UA3()
self.test_case_RA5_CD_SI200_CD_FRA1_CD_UA5()
self.test_case_RA3_CD_SI200_CD_FSI10_CD_FSI20000_CD_UA3()
- self.test_case_RA3_CD_SI200_CD_PC_CD_UA3()
- self.test_case_RA3_CD_SI200_CD_SR_CD_UA3()
Mnemonics of the test cases:
@@ -96,6 +92,6 @@
job.run_test('bluetooth_AdapterLEAdvertising',
host=host,
advertisements=advertisements_data.ADVERTISEMENTS,
- multi_advertising=True)
+ test_type='multi_advertising')
parallel_simple(run, machines)
diff --git a/server/site_tests/bluetooth_AdapterLEAdvertising/control.reboot b/server/site_tests/bluetooth_AdapterLEAdvertising/control.reboot
new file mode 100644
index 0000000..7406b8c
--- /dev/null
+++ b/server/site_tests/bluetooth_AdapterLEAdvertising/control.reboot
@@ -0,0 +1,70 @@
+# Copyright 2017 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.
+
+from autotest_lib.server import utils
+from autotest_lib.server.cros.bluetooth import advertisements_data
+
+
+AUTHOR = 'rjahagir'
+NAME = 'bluetooth_AdapterLEAdvertising.reboot'
+PURPOSE = 'Test bluetooth adapter advertising.'
+CRITERIA = 'Adapter should advertise with correct parameters.'
+ATTRIBUTES = 'suite:bluetooth, suite:bluetooth_sanity'
+TIME = 'SHORT' # Takes approximately 5 minutes on elm
+TEST_CATEGORY = 'Functional'
+TEST_CLASS = 'bluetooth'
+TEST_TYPE = 'server'
+DEPENDENCIES = 'bluetooth'
+
+DOC = """
+This test case verifies that the Bluetooth adapter of the DUT can
+behave as a Bluetooth low-energy device and register advertisement
+with data and parameters while suspending and resuming correctly.
+
+This autotest include the following test cases:
+ self.test_case_SI200_RA3_CD_PC_CD_UA3()
+ self.test_case_RA3_CD_SI200_CD_PC_CD_UA3()
+ self.test_case_RA1_CD_SI200_CD_PC_CD_UA1()
+
+Specifically, the subtests included in this autotest verify the
+following operations and parameters.
+ - test_register_advertisement
+ * A single advertisement is registered successfully.
+ * The advertising min/max intervals are set correctly.
+ . The intervals are set to specified values.
+ . The intervals are set to default values after reset.
+ * The manufacturer id is set correctly.
+ * The service UUIDs are set correctly.
+ * The service data is set correctly.
+ * Advertising is enabled consequently.
+ - test_set_advertising_intervals
+ * The new advertising intervals are set correctly.
+ - test_reset_advertising
+ * The single advertisement instance is removed.
+ * Advertising is disabled consequently.
+
+Mnemonics of the test cases:
+ CD: check advertising duration and intervals
+ RA: register advertisements
+ UA: unregister advertisements
+ SI: set advertising intervals
+ RS: reset advertising
+ FRA: fail to register extra advertisements when max ones have
+ been registered.
+ FSI: fail to set advertising intervals beyond legitimate range
+ of [20 ms, 10,240 ms].
+ PC: power cycle the bluetooth adapter (controller).
+ SR: suspend and resume the DUT (chromebook)
+
+"""
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+ host = hosts.create_host(machine)
+ job.run_test('bluetooth_AdapterLEAdvertising', host=host,
+ advertisements=advertisements_data.ADVERTISEMENTS,
+ test_type='reboot')
+
+parallel_simple(run, machines)
\ No newline at end of file
diff --git a/server/site_tests/bluetooth_AdapterLEAdvertising/control.single b/server/site_tests/bluetooth_AdapterLEAdvertising/control.single
index 21b56f1..4e0d4cf 100644
--- a/server/site_tests/bluetooth_AdapterLEAdvertising/control.single
+++ b/server/site_tests/bluetooth_AdapterLEAdvertising/control.single
@@ -27,13 +27,10 @@
This autotest include the following test cases:
self.test_case_SI200_RA1_CD_UA1()
self.test_case_SI200_RA1_CD_RS()
- self.test_case_SI200_RA1_CD_SR_CD_UA1()
self.test_case_RA1_CD_SI200_CD_UA1()
self.test_case_RA1_CD_SI200_CD_RS()
self.test_case_RA1_CD_SI200_CD_FSI10_UA1_RA1_CD_UA1()
self.test_case_RA1_CD_SI200_CD_FSI20000_UA1_RA1_CD_UA1()
- self.test_case_RA1_CD_SI200_CD_PC_CD_UA1()
- self.test_case_RA1_CD_SI200_CD_SR_CD_UA1()
Specifically, the subtests included in this autotest verify the
following operations and parameters.
@@ -67,19 +64,13 @@
"""
-
-MIN_ADV_INTERVAL_MS = 300
-MAX_ADV_INTERVAL_MS = 400
-
-
args_dict = utils.args_to_dict(args)
def run(machine):
host = hosts.create_host(machine)
- job.run_test('bluetooth_AdapterLEAdvertising', host=host,
+ job.run_test('bluetooth_AdapterLEAdvertising',
+ host=host,
advertisements=advertisements_data.ADVERTISEMENTS,
- multi_advertising=False,
- min_adv_interval_ms=MIN_ADV_INTERVAL_MS,
- max_adv_interval_ms=MAX_ADV_INTERVAL_MS)
+ test_type='single_advertising')
parallel_simple(run, machines)
diff --git a/server/site_tests/bluetooth_AdapterLEAdvertising/control.suspend_resume b/server/site_tests/bluetooth_AdapterLEAdvertising/control.suspend_resume
new file mode 100644
index 0000000..2140f7d
--- /dev/null
+++ b/server/site_tests/bluetooth_AdapterLEAdvertising/control.suspend_resume
@@ -0,0 +1,71 @@
+# Copyright 2017 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.
+
+from autotest_lib.server import utils
+from autotest_lib.server.cros.bluetooth import advertisements_data
+
+
+AUTHOR = 'rjahagir'
+NAME = 'bluetooth_AdapterLEAdvertising.suspend_resume'
+PURPOSE = 'Test bluetooth adapter advertising.'
+CRITERIA = 'Adapter should advertise with correct parameters.'
+ATTRIBUTES = 'suite:bluetooth, suite:bluetooth_sanity'
+TIME = 'SHORT' # Takes approximately 5 minutes on elm
+TEST_CATEGORY = 'Functional'
+TEST_CLASS = 'bluetooth'
+TEST_TYPE = 'server'
+DEPENDENCIES = 'bluetooth'
+
+DOC = """
+This test case verifies that the Bluetooth adapter of the DUT can
+behave as a Bluetooth low-energy device and register advertisement
+with data and parameters while suspending and resuming correctly.
+
+This autotest include the following test cases:
+ self.test_case_SI200_RA3_CD_SR_CD_UA3()
+ self.test_case_RA3_CD_SI200_CD_SR_CD_UA3()
+ self.test_case_SI200_RA1_CD_SR_CD_UA1()
+ self.test_case_RA1_CD_SI200_CD_SR_CD_UA1()
+
+Specifically, the subtests included in this autotest verify the
+following operations and parameters.
+ - test_register_advertisement
+ * A single advertisement is registered successfully.
+ * The advertising min/max intervals are set correctly.
+ . The intervals are set to specified values.
+ . The intervals are set to default values after reset.
+ * The manufacturer id is set correctly.
+ * The service UUIDs are set correctly.
+ * The service data is set correctly.
+ * Advertising is enabled consequently.
+ - test_set_advertising_intervals
+ * The new advertising intervals are set correctly.
+ - test_reset_advertising
+ * The single advertisement instance is removed.
+ * Advertising is disabled consequently.
+
+Mnemonics of the test cases:
+ CD: check advertising duration and intervals
+ RA: register advertisements
+ UA: unregister advertisements
+ SI: set advertising intervals
+ RS: reset advertising
+ FRA: fail to register extra advertisements when max ones have
+ been registered.
+ FSI: fail to set advertising intervals beyond legitimate range
+ of [20 ms, 10,240 ms].
+ PC: power cycle the bluetooth adapter (controller).
+ SR: suspend and resume the DUT (chromebook)
+
+"""
+
+args_dict = utils.args_to_dict(args)
+
+def run(machine):
+ host = hosts.create_host(machine)
+ job.run_test('bluetooth_AdapterLEAdvertising', host=host,
+ advertisements=advertisements_data.ADVERTISEMENTS,
+ test_type='suspend_resume')
+
+parallel_simple(run, machines)