diff options
author | Xianyuan Jia <xianyuanjia@google.com> | 2020-09-29 12:20:25 -0700 |
---|---|---|
committer | Xianyuan Jia <xianyuanjia@google.com> | 2020-09-29 12:20:25 -0700 |
commit | 3f5eb3cd123bfad48fa871a94a778e157b0628ee (patch) | |
tree | 0689169491f2862450b3534d03750b66a23ece7b | |
parent | 6b41e0931a6f051fb84cfb9a4710e5a8df678247 (diff) | |
download | platform_tools_test_connectivity-3f5eb3cd123bfad48fa871a94a778e157b0628ee.tar.gz platform_tools_test_connectivity-3f5eb3cd123bfad48fa871a94a778e157b0628ee.tar.bz2 platform_tools_test_connectivity-3f5eb3cd123bfad48fa871a94a778e157b0628ee.zip |
[DO NOT MERGE] Delete empty test files
Bug: None
Test: local
Change-Id: Ifed4de987df16cc82a32b67f47328a166aa27c2f
40 files changed, 0 insertions, 2429 deletions
diff --git a/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py b/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/api/BleAdvertiseApiTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/api/BleScanApiTest.py b/acts_tests/tests/google/ble/api/BleScanApiTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/api/BleScanApiTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/api/GattApiTest.py b/acts_tests/tests/google/ble/api/GattApiTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/api/GattApiTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py b/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/beacon_tests/BeaconSwarmTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py b/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/bt5/AdvertisingSetTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py b/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/bt5/Bt5ScanTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/bt5/PhyTest.py b/acts_tests/tests/google/ble/bt5/PhyTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/bt5/PhyTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py deleted file mode 100644 index 2af4c05bcc..0000000000 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisementDiscoveryTest.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to test the integrity of LE scan results upon resetting the -Bluetooth stack. -""" - -import concurrent -import os -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import BtTestUtilsError -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import get_advanced_droid_list -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_n_advertisements -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import teardown_n_advertisements -from acts.test_utils.bt.bt_test_utils import scan_and_verify_n_advertisements - - -class ConcurrentBleAdvertisementDiscoveryTest(BluetoothBaseTest): - default_timeout = 10 - max_advertisements = -1 - advertise_callback_list = [] - - def setup_class(self): - super().setup_class() - self.droid_list = get_advanced_droid_list(self.android_devices) - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - self.max_advertisements = self.droid_list[1]['max_advertisements'] - - def setup_test(self): - return reset_bluetooth(self.android_devices) - - def setup_test(self): - super(BluetoothBaseTest, self).setup_test() - self.log.info("Setting up advertisements") - try: - self.advertise_callback_list = setup_n_advertisements( - self.adv_ad, self.max_advertisements) - except BtTestUtilsError: - return False - return True - - def teardown_test(self): - super(BluetoothBaseTest, self).teardown_test() - self.log.info("Tearing down advertisements") - teardown_n_advertisements(self.adv_ad, - len(self.advertise_callback_list), - self.advertise_callback_list) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='e02d6ca6-4db3-4a1d-adaf-98db7c7c2c7a') - def test_max_advertisements_defaults(self): - """Test scan integrity after BT state is reset - - This test is to verify that LE devices are found - successfully after the Bluetooth stack is - reset. This is repeated multiple times in order - to verify that LE devices are not lost in scanning - when the stack is brought back up. - - Steps: - 1. Pre-Condition: Max advertisements are active - 2. With the DUT android device, scan for all advertisements - and verify that all expected advertisements are found. - 3. Reset Bluetooth on DUT. - 4. Repeat steps 2-3 for defined iterations - - Expected Result: - All expected advertisements should be found on all iterations. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency, Scanning - Priority: 2 - """ - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleSetScanSettingsCallbackType( - ble_scan_settings_callback_types['all_matches']) - self.scn_ad.droid.bleSetScanSettingsScanMode(ble_scan_settings_modes[ - 'low_latency']) - iterations = 20 - for _ in range(iterations): - self.log.info("Verify all advertisements found") - try: - if not scan_and_verify_n_advertisements( - self.scn_ad, self.max_advertisements): - self.log.error("Failed to find all advertisements") - return False - except BtTestUtilsError: - return False - if not reset_bluetooth([self.scn_ad]): - self.log.error("Failed to reset Bluetooth state") - return False - return True diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py deleted file mode 100644 index 94ee0f771e..0000000000 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentBleAdvertisingTest.py +++ /dev/null @@ -1,631 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Test script to exercises different ways Ble Advertisements can run in -concurrency. This test was designed to be run in a shield box. -""" - -import concurrent -import os -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import BtTestUtilsError -from acts.test_utils.bt.bt_constants import ble_advertise_settings_modes -from acts.test_utils.bt.bt_constants import ble_scan_settings_callback_types -from acts.test_utils.bt.bt_constants import ble_scan_settings_modes -from acts.test_utils.bt.bt_constants import adv_succ -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import get_advanced_droid_list -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import scan_and_verify_n_advertisements -from acts.test_utils.bt.bt_constants import scan_result -from acts.test_utils.bt.bt_test_utils import setup_n_advertisements -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import teardown_n_advertisements - - -class ConcurrentBleAdvertisingTest(BluetoothBaseTest): - default_timeout = 10 - max_advertisements = -1 - - def setup_class(self): - super().setup_class() - self.droid_list = get_advanced_droid_list(self.android_devices) - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - self.max_advertisements = self.droid_list[1]['max_advertisements'] - - def setup_test(self): - super(BluetoothBaseTest, self).setup_test() - return reset_bluetooth(self.android_devices) - - def _verify_n_advertisements(self, num_advertisements): - try: - advertise_callback_list = setup_n_advertisements( - self.adv_ad, num_advertisements) - except BtTestUtilsError: - return False - try: - scan_and_verify_n_advertisements(self.scn_ad, num_advertisements) - except BtTestUtilsError: - return False - teardown_n_advertisements(self.adv_ad, - len(advertise_callback_list), - advertise_callback_list) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='abc03874-6d7a-4b5d-9f29-18731a102793') - def test_max_advertisements_defaults(self): - """Testing max advertisements. - - Test that a single device can have the max advertisements - concurrently advertising. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Start scanning on the max_advertisements as defined in the script. - 4. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 0 - """ - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='50ee137e-eb71-40ef-b72f-a5fd646190d2') - def test_max_advertisements_include_device_name_and_filter_device_name( - self): - """Testing max advertisement variant. - - Test that a single device can have the max advertisements - concurrently advertising. Include the device name as a part of the filter - and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include device name in each advertisement. - 4. Include device name filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='f7e9ba2b-6286-4510-a8a0-f1df831056c0') - def test_max_advertisements_exclude_device_name_and_filter_device_name( - self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the device name as a part of the filter but not the - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include device name filter in the scanner. - 4. Start scanning on the max_advertisements as defined in the script. - 5. Verify that no advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(False) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - return not self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6ce102d7-61e1-4ca0-bcfb-767437b86c2b') - def test_max_advertisements_with_manufacturer_data(self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the manufacturer data as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include manufacturer data in each advertisement. - 4. Include manufacturer data filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.scn_ad.droid.bleSetScanFilterManufacturerData(1, [1]) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(1, [1]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='2fc7d5e8-1539-42a8-8681-ce0b8bfc0924') - def test_max_advertisements_with_manufacturer_data_mask(self): - """Test max advertisements variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the manufacturer data mask as a part of the filter - and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include manufacturer data in each advertisement. - 4. Include manufacturer data mask filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.scn_ad.droid.bleSetScanFilterManufacturerData(1, [1], [1]) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(1, [1]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ef615ed-1705-44ae-ab5b-f7e8fb4bb770') - def test_max_advertisements_with_service_data(self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the service data as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include service data in each advertisement. - 4. Include service data filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - test_result = True - filter_list = self.scn_ad.droid.bleGenFilterList() - self.scn_ad.droid.bleSetScanFilterServiceData( - "0000110A-0000-1000-8000-00805F9B34FB", [11, 17, 80]) - self.adv_ad.droid.bleAddAdvertiseDataServiceData( - "0000110A-0000-1000-8000-00805F9B34FB", [11, 17, 80]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='9ef615ed-1705-44ae-ab5b-f7e8fb4bb770') - def test_max_advertisements_with_manufacturer_data_mask_and_include_device_name( - self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the device name and manufacturer data as a part of - the filter and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include device name and manufacturer data in each advertisement. - 4. Include device name and manufacturer data filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - self.scn_ad.droid.bleSetScanFilterManufacturerData(1, [1], [1]) - self.adv_ad.droid.bleAddAdvertiseDataManufacturerId(1, [1]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c2ca85fb-6663-431d-aa30-5286a85dbbe0') - def test_max_advertisements_with_service_uuids(self): - """Test max advertisement variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the service uuid as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include service uuid in each advertisement. - 4. Include service uuid filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - self.scn_ad.droid.bleSetScanFilterServiceUuid( - "00000000-0000-1000-8000-00805f9b34fb") - self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( - ["00000000-0000-1000-8000-00805f9b34fb"]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='756e026f-64d7-4a2f-935a-3790c0ac4503') - def test_max_advertisements_with_service_uuid_and_service_mask(self): - """Test max advertisements variant. - - Test that a single device can have the max advertisements concurrently - advertising. Include the service mask as a part of the filter and - advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Include service uuid in each advertisement. - 4. Include service mask filter in the scanner. - 5. Start scanning on the max_advertisements as defined in the script. - 6. Verify that all advertisements are found. - - Expected Result: - All advertisements should start without errors. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - self.scn_ad.droid.bleSetScanFilterServiceUuid( - "00000000-0000-1000-8000-00805f9b34fb", - "00000000-0000-1000-8000-00805f9b34fb") - self.adv_ad.droid.bleSetAdvertiseDataSetServiceUuids( - ["00000000-0000-1000-8000-00805f9b34fb"]) - return self._verify_n_advertisements(self.max_advertisements) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='79c4b6cd-9f07-49a9-829f-69b29ea8d322') - def test_max_advertisements_plus_one(self): - """Test max advertisements plus one. - - Test that a single device can have the max advertisements concurrently - advertising but fail on starting the max advertisements plus one. - filter and advertisement data. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Start max_advertisements + 1. - - Expected Result: - The last advertisement should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 0 - """ - return not self._verify_n_advertisements(self.max_advertisements + 1) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0bd6e490-a501-4fe1-88e5-9b77970c0b95') - def test_start_two_advertisements_on_same_callback(self): - """Test invalid advertisement scenario. - - Test that a single device cannot have two advertisements start on the - same callback. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Call start ble advertising on the same callback. - - Expected Result: - The second call of start advertising on the same callback should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - test_result = True - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - return False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}" - .format(error)) - try: - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - test_result = False - except Empty as error: - self.log.debug("Test passed with Empty error: {}".format(error)) - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test passed, filtering callback onSuccess never occurred: {}" - .format(error)) - - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12632b31-22b9-4121-80b6-1263b9d90909') - def test_toggle_advertiser_bt_state(self): - """Test forcing stopping advertisements. - - Test that a single device resets its callbacks when the bluetooth state is - reset. There should be no advertisements. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Call start ble advertising. - 4. Toggle bluetooth on and off. - 5. Scan for any advertisements. - - Expected Result: - No advertisements should be found after toggling Bluetooth on the - advertising device. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 2 - """ - test_result = True - self.adv_ad.droid.bleSetAdvertiseDataIncludeDeviceName(True) - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - return False - except concurrent.futures._base.TimeoutError as error: - self.log.error( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - self.scn_ad.droid.bleSetScanSettingsScanMode( - ble_scan_settings_modes['low_latency']) - self.scn_ad.droid.bleSetScanFilterDeviceName( - self.adv_ad.droid.bluetoothGetLocalName()) - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleBuildScanFilter(filter_list) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - try: - self.scn_ad.ed.pop_event( - scan_result.format(scan_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with: {}".format(error)) - return False - self.scn_ad.droid.bleStopBleScan(scan_callback) - test_result = reset_bluetooth([self.android_devices[1]]) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - if not test_result: - return False - try: - expected_event = scan_result.format(scan_callback) - event = self.scn_ad.ed.pop_event(expected_event, - self.default_timeout) - self.log.error("Event {} not expected. Found: {}".format( - expected_event, event)) - return False - except Empty as error: - self.log.debug("Test passed with: {}".format(error)) - self.scn_ad.droid.bleStopBleScan(scan_callback) - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='785c5c77-d5d4-4d0f-8b7b-3eb1f1646d2c') - def test_restart_advertise_callback_after_bt_toggle(self): - """Test starting an advertisement on a cleared out callback. - - Test that a single device resets its callbacks when the bluetooth state - is reset. - - Steps: - 1. Setup the scanning android device. - 2. Setup the advertiser android device. - 3. Call start ble advertising. - 4. Toggle bluetooth on and off. - 5. Call start ble advertising on the same callback. - - Expected Result: - Starting an advertisement on a callback id after toggling bluetooth - should fail. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - test_result = True - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - test_result = reset_bluetooth([self.android_devices[1]]) - if not test_result: - return test_result - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format(error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='dd5529b7-6774-4580-8b29-d84568c15442') - def test_timeout(self): - """Test starting advertiser with timeout. - - Test that when a timeout is used, the advertiser is cleaned properly, - and next one can be started. - - Steps: - 1. Setup the advertiser android device with 4 second timeout. - 2. Call start ble advertising. - 3. Wait 5 seconds, to make sure advertiser times out. - 4. Repeat steps 1-4 four times. - - Expected Result: - Starting the advertising should succeed each time. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Concurrency - Priority: 1 - """ - advertise_timeout_s = 4 - num_iterations = 4 - test_result = True - - for i in range(0, num_iterations): - advertise_callback, advertise_data, advertise_settings = ( - generate_ble_advertise_objects(self.adv_ad.droid)) - - self.adv_ad.droid.bleSetAdvertiseSettingsTimeout( - advertise_timeout_s * 1000) - - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - try: - self.adv_ad.ed.pop_event( - adv_succ.format(advertise_callback), self.default_timeout) - except Empty as error: - self.log.error("Test failed with Empty error: {}".format( - error)) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug( - "Test failed, filtering callback onSuccess never occurred: {}". - format(error)) - - if not test_result: - return test_result - - time.sleep(advertise_timeout_s + 1) - - return test_result diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentBleScanningTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py b/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/concurrency/ConcurrentGattConnectTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py b/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/conn_oriented_chan/BleCoc2ConnTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py b/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py deleted file mode 100644 index 97ace9bbbb..0000000000 --- a/acts_tests/tests/google/ble/conn_oriented_chan/BleCocTest.py +++ /dev/null @@ -1,587 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright 2017 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Test script to execute Bluetooth Connection-orient Channel (CoC) functionality -test cases. This test was designed to be run in a shield box. -""" - -import threading -import time - -from acts import utils -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_coc_test_utils import orchestrate_coc_connection -from acts.test_utils.bt.bt_coc_test_utils import do_multi_connection_throughput -from acts.test_utils.bt.bt_constants import default_le_data_length -from acts.test_utils.bt.bt_constants import l2cap_coc_header_size -from acts.test_utils.bt.bt_constants import l2cap_max_inactivity_delay_after_disconnect -from acts.test_utils.bt.bt_test_utils import clear_bonded_devices -from acts.test_utils.bt.bt_test_utils import kill_bluetooth_process -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import take_btsnoop_logs -from acts.test_utils.bt.bt_test_utils import write_read_verify_data -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected - - -class BleCocTest(BluetoothBaseTest): - message = ( - "Space: the final frontier. These are the voyages of " - "the starship Enterprise. Its continuing mission: to explore " - "strange new worlds, to seek out new life and new civilizations," - " to boldly go where no man has gone before.") - - def setup_class(self): - super().setup_class() - self.client_ad = self.android_devices[0] - # The client which is scanning will need location to be enabled in order to - # start scan and get scan results. - utils.set_location_service(self.client_ad, True) - self.server_ad = self.android_devices[1] - # Note that some tests required a third device. - if len(self.android_devices) > 2: - self.server2_ad = self.android_devices[2] - - return setup_multiple_devices_for_bt_test(self.android_devices) - - def teardown_test(self): - self.client_ad.droid.bluetoothSocketConnStop() - self.server_ad.droid.bluetoothSocketConnStop() - # Give sufficient time for the physical LE link to be disconnected. - time.sleep(l2cap_max_inactivity_delay_after_disconnect) - - def _run_coc_connection_throughput( - self, - is_secured, - buffer_size, - le_connection_interval=0, - le_tx_data_length=default_le_data_length): - - # The num_iterations is that number of repetitions of each - # set of buffers r/w. - # number_buffers is the total number of data buffers to transmit per - # set of buffers r/w. - # buffer_size is the number of bytes per L2CAP data buffer. - number_buffers = 100 - num_iterations = 10 - - self.log.info( - "_run_coc_connection_throughput: calling " - "orchestrate_coc_connection. is_secured={}, Connection Interval={}msec, " - "buffer_size={}bytes".format(is_secured, le_connection_interval, - buffer_size)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured, - le_connection_interval, le_tx_data_length) - if not status: - return False - - list_server_ad = [self.server_ad] - list_client_conn_id = [client_conn_id] - data_rate = do_multi_connection_throughput( - self.client_ad, list_server_ad, list_client_conn_id, - num_iterations, number_buffers, buffer_size) - if data_rate <= 0: - return False - self.log.info( - "_run_coc_connection_throughput: throughput=%d bytes per sec", - data_rate) - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='b6989966-c504-4934-bcd7-57fb4f7fde9c') - def test_coc_secured_connection(self): - """Test Bluetooth LE CoC secured connection - - Test LE CoC though establishing a basic connection with security. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC Secured connection from the client to the server AD. - 3. Verify that the LE CoC connection is active from both the client and - server. - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = True - self.log.info( - "_test_coc_secured_connection: calling orchestrate_coc_connection but " - "isBle=1 and securedConn={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6587792c-78fb-469f-9084-772c249f97de') - def test_coc_insecured_connection(self): - """Test Bluetooth LE CoC insecured connection - - Test LE CoC though establishing a basic connection with no security. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC Secured connection from the client to the server AD. - 3. Verify that the LE CoC connection is active from both the client and - server. - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = False - self.log.info( - "test_coc_insecured_connection: calling orchestrate_coc_connection but " - "isBle=1 and securedConn={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='32a7b02e-f2b5-4193-b414-36c8815ac407') - def test_coc_secured_connection_write_ascii(self): - """Test LE CoC secured connection writing and reading ascii data - - Test LE CoC though establishing a secured connection and reading and writing ascii data. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC connection from the client to the server AD. The security of - connection is TRUE. - 3. Verify that the LE CoC connection is active from both the client and - server. - 4. Write data from the client and read received data from the server. - 5. Verify data matches from client and server - 6. Disconnect the LE CoC connection. - - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = True - self.log.info( - "test_coc_secured_connection_write_ascii: calling " - "orchestrate_coc_connection. is_secured={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - if not write_read_verify_data(self.client_ad, self.server_ad, - self.message, False): - return False - if not verify_server_and_client_connected(self.client_ad, - self.server_ad): - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='12537d27-79c9-40a0-8bdb-d023b0e36b58') - def test_coc_insecured_connection_write_ascii(self): - """Test LE CoC insecured connection writing and reading ascii data - - Test LE CoC though establishing a connection. - - Steps: - 1. Get the mac address of the server device. - 2. Establish an LE CoC connection from the client to the server AD. The security of - connection is FALSE. - 3. Verify that the LE CoC connection is active from both the client and - server. - 4. Write data from the client and read received data from the server. - 5. Verify data matches from client and server - 6. Disconnect the LE CoC connection. - - Expected Result: - LE CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - is_secured = False - self.log.info( - "test_coc_secured_connection_write_ascii: calling " - "orchestrate_coc_connection. is_secured={}".format(is_secured)) - status, client_conn_id, server_conn_id = orchestrate_coc_connection( - self.client_ad, self.server_ad, True, is_secured) - if not status: - return False - if not write_read_verify_data(self.client_ad, self.server_ad, - self.message, False): - return False - if not verify_server_and_client_connected(self.client_ad, - self.server_ad): - return False - - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='214037f4-f0d1-47db-86a7-5230c71bdcac') - def test_coc_secured_connection_throughput(self): - """Test LE CoC writing and measured data throughput with security - - Test CoC thoughput by establishing a secured connection and sending data. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server AD. - 3. Verify that the L2CAP CoC connection is active from both the client - and server. - 4. Write data from the client to server. - 5. Verify data matches from client and server - 6. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = True - # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length - return self._run_coc_connection_throughput(is_secured, 117) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6dc019bb-c3bf-4c98-978e-e2c5755058d7') - def test_coc_insecured_connection_throughput(self): - """Test LE CoC writing and measured data throughput without security. - - Test CoC thoughput by establishing an insecured connection and sending data. - - Steps: - 1. Get the mac address of the server device. - 2. Establish a L2CAP CoC connection from the client to the server AD. - 3. Verify that the L2CAP CoC connection is active from both the client - and server. - 4. Write data from the client to server. - 5. Verify data matches from client and server - 6. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established then disconnected succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 1 - """ - - is_secured = False - # Note: A 117 octets buffer size would fix nicely to a 123 bytes Data Length - return self._run_coc_connection_throughput(is_secured, 117) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='0af94805-1550-426c-bfdd-191b8b3a4c12') - def test_coc_connection_throughput_NOSEC_10CI_60SIZE(self): - """Test LE CoC data throughput with 10msec CI and 60bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 10msec - Connection Interval and 60 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 10msec. - 3. Change Payload Buffer Size to 60 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 60 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='c32dac07-623a-4fdd-96c6-387a76afb2af') - def test_coc_connection_throughput_NOSEC_10CI_80SIZE(self): - """Test LE CoC data throughput with 10msec CI and 80bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 10msec - Connection Interval and 80 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 10msec. - 3. Change Payload Buffer Size to 80 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 80 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='45d1b0c1-73b6-483f-ac6b-c3cec805da32') - def test_coc_connection_throughput_NOSEC_10CI_120SIZE(self): - """Test LE CoC data throughput with 10msec CI and 120bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 10msec - Connection Interval and 120 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 10msec. - 3. Change Payload Buffer Size to 120 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 10 - buffer_size = 120 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='85f07f07-1017-42db-b38d-df0bf2fce804') - def test_coc_connection_throughput_NOSEC_15CI_120SIZE(self): - """Test LE CoC data throughput with 15msec CI and 120bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 15msec - Connection Interval and 120 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 15msec. - 3. Change Payload Buffer Size to 120 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 15 - buffer_size = 120 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='4d3d4a06-7bbb-4a8c-9016-f326560cebb0') - def test_coc_connection_throughput_NOSEC_15CI_180SIZE(self): - """Test LE CoC data throughput with 15msec CI and 180bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 15msec - Connection Interval and 180 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 15msec. - 3. Change Payload Buffer Size to 180 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 15 - buffer_size = 180 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='124d85ba-41e6-4ab7-a017-99a88db7524a') - def test_coc_connection_throughput_NOSEC_20CI_240SIZE(self): - """Test LE CoC data throughput with 20msec CI and 240bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 20msec - Connection Interval and 240 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 20msec. - 3. Change Payload Buffer Size to 240 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 20 - buffer_size = 240 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='218932bc-ebb0-4c2b-96ad-220c600b50b1') - def test_coc_connection_throughput_NOSEC_30CI_240SIZE(self): - """Test LE CoC data throughput with 30msec CI and 240bytes buffer size. - - Test CoC thoughput by establishing a connection and sending data with 30msec - Connection Interval and 240 bytes data buffer size. - - Steps: - 1. Get the mac address of the server device. - 2. Change the Connection Interval to 30msec. - 3. Change Payload Buffer Size to 240 bytes. - 4. Establish a L2CAP CoC connection from the client to the server AD. - 5. Verify that the L2CAP CoC connection is active from both the client - and server. - 6. Write data from the client to server. - 7. Verify data matches from client and server - 8. Disconnect the L2CAP CoC connections. - - Expected Result: - CoC connection is established, check transmitted data contents, then disconnected - succcessfully. - - Returns: - Pass if True - Fail if False - - TAGS: BLE, CoC - Priority: 2 - """ - - is_secured = False - le_connection_interval = 30 - buffer_size = 240 - le_tx_data_length = buffer_size + l2cap_coc_header_size - return self._run_coc_connection_throughput( - is_secured, buffer_size, le_connection_interval, le_tx_data_length) diff --git a/acts_tests/tests/google/ble/examples/BleExamplesTest.py b/acts_tests/tests/google/ble/examples/BleExamplesTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/examples/BleExamplesTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/examples/GattServerExampleTest.py b/acts_tests/tests/google/ble/examples/GattServerExampleTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/examples/GattServerExampleTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/filtering/FilteringTest.py b/acts_tests/tests/google/ble/filtering/FilteringTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/filtering/FilteringTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py b/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/filtering/UniqueFilteringTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/gatt/GattConnectTest.py b/acts_tests/tests/google/ble/gatt/GattConnectTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/gatt/GattConnectTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/gatt/GattNotifyTest.py b/acts_tests/tests/google/ble/gatt/GattNotifyTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/gatt/GattNotifyTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/gatt/GattReadTest.py b/acts_tests/tests/google/ble/gatt/GattReadTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/gatt/GattReadTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/gatt/GattToolTest.py b/acts_tests/tests/google/ble/gatt/GattToolTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/gatt/GattToolTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/gatt/GattWriteTest.py b/acts_tests/tests/google/ble/gatt/GattWriteTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/gatt/GattWriteTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py b/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/scan/BleBackgroundScanTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py b/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/scan/BleOnLostOnFoundTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py b/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/scan/BleOpportunisticScanTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py b/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/scan/BleScanScreenStateTest.py +++ /dev/null diff --git a/acts_tests/tests/google/ble/system_tests/BleStressTest.py b/acts_tests/tests/google/ble/system_tests/BleStressTest.py deleted file mode 100644 index f97907ff0e..0000000000 --- a/acts_tests/tests/google/ble/system_tests/BleStressTest.py +++ /dev/null @@ -1,354 +0,0 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2016 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -""" -Basic LE Stress tests. -""" - -import concurrent -import pprint -import time - -from queue import Empty -from acts.test_decorators import test_tracker_info -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import BtTestUtilsError -from acts.test_utils.bt.bt_test_utils import clear_bonded_devices -from acts.test_utils.bt.bt_test_utils import generate_ble_advertise_objects -from acts.test_utils.bt.bt_test_utils import generate_ble_scan_objects -from acts.test_utils.bt.bt_test_utils import get_advanced_droid_list -from acts.test_utils.bt.bt_test_utils import get_mac_address_of_generic_advertisement -from acts.test_utils.bt.bt_test_utils import reset_bluetooth -from acts.test_utils.bt.bt_constants import scan_result - - -class BleStressTest(BluetoothBaseTest): - default_timeout = 10 - PAIRING_TIMEOUT = 20 - - def setup_class(self): - super().setup_class() - self.droid_list = get_advanced_droid_list(self.android_devices) - self.scn_ad = self.android_devices[0] - self.adv_ad = self.android_devices[1] - - def teardown_test(self): - super(BluetoothBaseTest, self).teardown_test() - self.log_stats() - - def bleadvertise_verify_onsuccess_handler(self, event): - test_result = True - self.log.debug("Verifying onSuccess event") - self.log.debug(pprint.pformat(event)) - return test_result - - def _verify_successful_bond(self, target_address): - end_time = time.time() + self.PAIRING_TIMEOUT - self.log.info("Verifying devices are bonded") - while time.time() < end_time: - bonded_devices = self.scn_ad.droid.bluetoothGetBondedDevices() - if target_address in {d['address'] for d in bonded_devices}: - self.log.info("Successfully bonded to device") - return True - return False - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='22f98085-6ed8-4ad8-b62d-b8d1eae20b89') - def test_loop_scanning_1000(self): - """Stress start/stop scan instances. - - This test will start and stop scan instances as fast as possible. This - will guarantee that the scan instances are properly being cleaned up - when the scan is stopped. - - Steps: - 1. Start a scan instance. - 2. Stop the scan instance. - 3. Repeat steps 1-2 1000 times. - - Expected Result: - Neither starting or stopping scan instances causes any failures. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress - Priority: 1 - """ - test_result = True - for _ in range(1000): - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='6caa84c2-50ac-46f2-a5e5-f942fd2cd6f6') - def test_loop_scanning_100_verify_no_hci_timeout(self): - """Stress start/stop scan instances variant. - - This test will start and stop scan instances with a one second timeout - in between each iteration. This testcase was added because the specific - timing combination caused hci timeouts. - - Steps: - 1. Start a scan instance. - 2. Stop the scan instance. - 3. Sleep for 1 second. - 4. Repeat steps 1-3 100 times. - - Expected Result: - Neither starting or stopping scan instances causes any failures. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress - Priority: 1 - """ - for _ in range(self.droid_list[1]['max_advertisements']): - adv_callback, adv_data, adv_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising(adv_callback, adv_data, - adv_settings) - for _ in range(100): - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - self.log.info( - self.scn_ad.ed.pop_event(scan_result.format(scan_callback))) - self.scn_ad.droid.bleStopBleScan(scan_callback) - time.sleep(1) - return True - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='5e9e4c8d-b72e-4767-81e5-f907c1834430') - def test_loop_advertising_100(self): - """Stress start/stop advertising instances. - - This test will start and stop advertising instances as fast as possible. - - Steps: - 1. Start a advertising instance. - 2. Find that an onSuccess callback is triggered. - 3. Stop the advertising instance. - 4. Repeat steps 1-3 100 times. - - Expected Result: - Neither starting or stopping advertising instances causes any failures. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Stress - Priority: 1 - """ - test_result = True - for _ in range(100): - advertise_callback, advertise_data, advertise_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - expected_advertise_event_name = "".join( - ["BleAdvertise", - str(advertise_callback), "onSuccess"]) - worker = self.adv_ad.ed.handle_event( - self.bleadvertise_verify_onsuccess_handler, - expected_advertise_event_name, ([]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - self.log.debug(" ".join( - ["Test failed with Empty error:", - str(error)])) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug(" ".join([ - "Test failed, filtering callback onSuccess never occurred:", - str(error) - ])) - test_result = False - self.adv_ad.droid.bleStopBleAdvertising(advertise_callback) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='11a2f51b-7178-4c32-bb5c-7eddd100a50f') - def test_restart_advertise_callback_after_bt_toggle(self): - """Test to reuse an advertise callback. - - This will verify if advertising objects can be reused after a bluetooth - toggle. - - Steps: - 1. Start a advertising instance. - 2. Find that an onSuccess callback is triggered. - 3. Stop the advertising instance. - 4. Toggle bluetooth off and on. - 5. Start an advertising instance on the same objects used in step 1. - 6. Find that an onSuccess callback is triggered. - - Expected Result: - Advertisement should start successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Advertising, Stress - Priority: 1 - """ - test_result = True - advertise_callback, advertise_data, advertise_settings = generate_ble_advertise_objects( - self.adv_ad.droid) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - expected_advertise_event_name = "".join( - ["BleAdvertise", - str(advertise_callback), "onSuccess"]) - worker = self.adv_ad.ed.handle_event( - self.bleadvertise_verify_onsuccess_handler, - expected_advertise_event_name, ([]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - self.log.debug(" ".join( - ["Test failed with Empty error:", - str(error)])) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug(" ".join([ - "Test failed, filtering callback onSuccess never occurred:", - str(error) - ])) - test_result = reset_bluetooth([self.scn_ad]) - if not test_result: - return test_result - time.sleep(5) - self.adv_ad.droid.bleStartBleAdvertising( - advertise_callback, advertise_data, advertise_settings) - worker = self.adv_ad.ed.handle_event( - self.bleadvertise_verify_onsuccess_handler, - expected_advertise_event_name, ([]), self.default_timeout) - try: - self.log.debug(worker.result(self.default_timeout)) - except Empty as error: - self.log.debug(" ".join( - ["Test failed with Empty error:", - str(error)])) - test_result = False - except concurrent.futures._base.TimeoutError as error: - self.log.debug(" ".join([ - "Test failed, filtering callback onSuccess never occurred:", - str(error) - ])) - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='88f3c068-41be-41df-920c-c0ecaae1a619') - def test_restart_scan_callback_after_bt_toggle(self): - """Test to reuse an scan callback. - - This will verify if scan objects can be reused after a bluetooth - toggle. - - Steps: - 1. Start a scanning instance. - 3. Stop the scanning instance. - 4. Toggle bluetooth off and on. - 5. Start an scanning instance on the same objects used in step 1. - - Expected Result: - Scanner should start successfully. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress - Priority: 1 - """ - test_result = True - filter_list, scan_settings, scan_callback = generate_ble_scan_objects( - self.scn_ad.droid) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - reset_bluetooth([self.scn_ad]) - self.scn_ad.droid.bleStartBleScan(filter_list, scan_settings, - scan_callback) - - return test_result - - @BluetoothBaseTest.bt_test_wrap - @test_tracker_info(uuid='ce8adfc0-384f-4751-9438-13a76cada8da') - def test_le_pairing(self): - """Test LE pairing transport stress - - This will test LE pairing between two android devices. - - Steps: - 1. Start an LE advertisement on secondary device. - 2. Find address from primary device. - 3. Discover and bond to LE address. - 4. Stop LE advertisement on secondary device. - 5. Repeat steps 1-4 100 times - - Expected Result: - LE pairing should pass 100 times. - - Returns: - Pass if True - Fail if False - - TAGS: LE, Scanning, Stress, Pairing - Priority: 1 - """ - iterations = 100 - for i in range(iterations): - try: - target_address, adv_callback, scan_callback = get_mac_address_of_generic_advertisement( - self.scn_ad, self.adv_ad) - except BtTestUtilsError as err: - self.log.error(err) - return False - self.log.info("Begin interation {}/{}".format(i + 1, iterations)) - self.scn_ad.droid.bluetoothStartPairingHelper() - self.adv_ad.droid.bluetoothStartPairingHelper() - start_time = self.start_timer() - self.scn_ad.droid.bluetoothDiscoverAndBond(target_address) - if not self._verify_successful_bond(target_address): - self.log.error("Failed to bond devices.") - return False - self.log.info("Total time (ms): {}".format(self.end_timer())) - if not self._verify_successful_bond(self.adv_ad.droid.bluetoothGetLocalAddress()): - self.log.error("Failed to bond BREDR devices.") - return False - if not self.scn_ad.droid.bluetoothUnbond(target_address): - self.log.error("Failed to unbond device from scanner.") - return False - time.sleep(2) - if not self.adv_ad.droid.bluetoothUnbond(self.scn_ad.droid.bluetoothGetLocalAddress()): - self.log.error("Failed to unbond device from advertiser.") - return False - self.adv_ad.droid.bleStopBleAdvertising(adv_callback) - self.scn_ad.droid.bleStopBleScan(scan_callback) - # Magic sleep to let unbonding finish - time.sleep(2) - return True diff --git a/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py b/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/ble/system_tests/GattLongevityTest.py +++ /dev/null diff --git a/acts_tests/tests/google/experimental/BluetoothLatencyTest.py b/acts_tests/tests/google/experimental/BluetoothLatencyTest.py deleted file mode 100644 index 811a41cca0..0000000000 --- a/acts_tests/tests/google/experimental/BluetoothLatencyTest.py +++ /dev/null @@ -1,139 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -import random -import statistics -import string -import time -from acts import asserts -from acts.base_test import BaseTestClass -from acts.signals import TestPass -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected -from acts.test_utils.bt.bt_test_utils import write_read_verify_data -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.test_utils.bt.loggers.protos import bluetooth_metric_pb2 as proto_module -from acts.utils import set_location_service - - -class BluetoothLatencyTest(BaseTestClass): - """Connects two Android phones and tests the RFCOMM latency. - - Attributes: - client_device: An Android device object that will be sending data - server_device: An Android device object that will be receiving data - bt_logger: The proxy logger instance for each test case - data_transfer_type: Data transfer protocol used for the test - """ - - def setup_class(self): - super().setup_class() - - # Sanity check of the devices under test - # TODO(b/119051823): Investigate using a config validator to replace this. - if len(self.android_devices) < 2: - raise ValueError( - 'Not enough android phones detected (need at least two)') - - # Data will be sent from the client_device to the server_device - self.client_device = self.android_devices[0] - self.server_device = self.android_devices[1] - self.bt_logger = BluetoothMetricLogger.for_test_case() - self.data_transfer_type = proto_module.BluetoothDataTestResult.RFCOMM - self.log.info('Successfully found required devices.') - - def setup_test(self): - setup_multiple_devices_for_bt_test(self.android_devices) - self._connect_rfcomm() - - def teardown_test(self): - if verify_server_and_client_connected( - self.client_device, self.server_device, log=False): - self.client_device.droid.bluetoothSocketConnStop() - self.server_device.droid.bluetoothSocketConnStop() - - def _connect_rfcomm(self): - """Establishes an RFCOMM connection between two phones. - - Connects the client device to the server device given the hardware - address of the server device. - """ - - set_location_service(self.client_device, True) - set_location_service(self.server_device, True) - server_address = self.server_device.droid.bluetoothGetLocalAddress() - self.log.info('Pairing and connecting devices') - asserts.assert_true(self.client_device.droid - .bluetoothDiscoverAndBond(server_address), - 'Failed to pair and connect devices') - - # Create RFCOMM connection - asserts.assert_true(orchestrate_rfcomm_connection - (self.client_device, self.server_device), - 'Failed to establish RFCOMM connection') - - def _measure_latency(self): - """Measures the latency of data transfer over RFCOMM. - - Sends data from the client device that is read by the server device. - Calculates the latency of the transfer. - - Returns: - The latency of the transfer milliseconds. - """ - - # Generates a random message to transfer - message = (''.join(random.choice(string.ascii_letters + string.digits) - for _ in range(6))) - - start_time = time.perf_counter() - write_read_successful = write_read_verify_data(self.client_device, - self.server_device, - message, - False) - end_time = time.perf_counter() - asserts.assert_true(write_read_successful, - 'Failed to send/receive message') - return (end_time - start_time) * 1000 - - @BluetoothBaseTest.bt_test_wrap - def test_bluetooth_latency(self): - """Tests the latency for a data transfer over RFCOMM""" - - metrics = {} - latency_list = [] - - for _ in range(300): - latency_list.append(self._measure_latency()) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_latency_min_millis'] = int(min(latency_list)) - metrics['data_latency_max_millis'] = int(max(latency_list)) - metrics['data_latency_avg_millis'] = int(statistics.mean(latency_list)) - self.log.info('Latency: {}'.format(metrics)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_latency_min_millis'] > 0, - 'Minimum latency must be greater than 0!', - extras=proto) - - raise TestPass('Latency test completed successfully', extras=proto) diff --git a/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py b/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py deleted file mode 100644 index e54e4e7417..0000000000 --- a/acts_tests/tests/google/experimental/BluetoothPairAndConnectTest.py +++ /dev/null @@ -1,187 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -"""Bluetooth 1st time force pair and connect test implementation.""" -# Quick way to get the Apollo serial number: -# python3.5 -c "from acts.controllers.buds_lib.apollo_lib import get_devices; [print(d['serial_number']) for d in get_devices()]" - -import statistics -import time - -from acts import logger -from acts.base_test import BaseTestClass -from acts.controllers.buds_lib.test_actions.bt_utils import BTUtils -from acts.controllers.buds_lib.test_actions.bt_utils import BTUtilsError -from acts.controllers.buds_lib.test_actions.apollo_acts import ApolloTestActions -from acts.signals import TestFailure -from acts.signals import TestPass -from acts.test_utils.bt.bt_test_utils import factory_reset_bluetooth -from acts.test_utils.bt.bt_test_utils import enable_bluetooth -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.utils import set_location_service - - -# The number of pairing and connection attempts -PAIR_CONNECT_ATTEMPTS = 200 - - -class BluetoothPairConnectError(TestFailure): - pass - - -class BluetoothPairAndConnectTest(BaseTestClass): - """Pairs and connects a phone and an Apollo buds device. - - Attributes: - phone: An Android phone object - apollo: An Apollo earbuds object - apollo_act: An Apollo test action object - dut_bt_addr: The Bluetooth address of the Apollo earbuds - bt_utils: BTUtils test action object - """ - - def setup_class(self): - super().setup_class() - # Sanity check of the devices under test - # TODO(b/119051823): Investigate using a config validator to replace this. - if not self.android_devices: - raise ValueError( - 'Cannot find android phone (need at least one).') - self.phone = self.android_devices[0] - - if not self.buds_devices: - raise ValueError( - 'Cannot find apollo device (need at least one).') - self.apollo = self.buds_devices[0] - self.log.info('Successfully found needed devices.') - - # Staging the test, create result object, etc. - self.apollo_act = ApolloTestActions(self.apollo, self.log) - self.dut_bt_addr = self.apollo.bluetooth_address - self.bt_utils = BTUtils() - self.bt_logger = BluetoothMetricLogger.for_test_case() - - def setup_test(self): - # Make sure Bluetooth is on - enable_bluetooth(self.phone.droid, self.phone.ed) - set_location_service(self.phone, True) - factory_reset_bluetooth([self.phone]) - self.apollo_act.factory_reset() - self.log.info('===== START BLUETOOTH PAIR AND CONNECT TEST =====') - - def teardown_test(self): - self.log.info('Teardown test, shutting down all services...') - self.apollo_act.factory_reset() - self.apollo.close() - - def _get_device_pair_and_connect_times(self): - """Gets the pair and connect times of the phone and buds device. - - Pairs the phone with the buds device. Gets the pair and connect times. - Unpairs the devices. - - Returns: - pair_time: The time it takes to pair the devices in ms. - connection_time: The time it takes to connect the devices for the - first time after pairing. - - Raises: - BluetoothPairConnectError - """ - - try: - pair_time = self.bt_utils.bt_pair(self.phone, self.apollo) - except BTUtilsError: - raise BluetoothPairConnectError('Failed to pair devices') - - pair_time *= 1000 - connection_start_time = time.perf_counter() - if not self.apollo_act.wait_for_bluetooth_a2dp_hfp(30): - raise BluetoothPairConnectError('Failed to connect devices') - connection_end_time = time.perf_counter() - connection_time = (connection_end_time - - connection_start_time) * 1000 - - return pair_time, connection_time - - def test_bluetooth_connect(self): - # Store metrics - metrics = {} - pair_connect_success = 0 - pair_connect_failures = [] - pair_times = [] - connect_times = [] - first_connection_failure = None - - for attempt in range(PAIR_CONNECT_ATTEMPTS): - self.log.info('Pair and connection attempt {}'.format(attempt + 1)) - pair_connect_timestamp = time.strftime(logger.log_line_time_format, - time.localtime()) - try: - pair_time, connect_time = (self. - _get_device_pair_and_connect_times()) - except BluetoothPairConnectError as err: - self.log.error(err) - failure_data = {'timestamp': pair_connect_timestamp, - 'error': str(err), - 'pair_and_connect_attempt': attempt + 1} - pair_connect_failures.append(failure_data) - if not first_connection_failure: - first_connection_failure = err - else: - connect_times.append(connect_time) - pair_times.append(pair_time) - pair_connect_success += 1 - - factory_reset_bluetooth([self.phone]) - self.log.info('Factory resetting Apollo device...') - self.apollo_act.factory_reset() - - # Buffer between pair and connect attempts - time.sleep(3) - - metrics['pair_attempt_count'] = PAIR_CONNECT_ATTEMPTS - metrics['pair_successful_count'] = pair_connect_success - metrics['pair_failed_count'] = (PAIR_CONNECT_ATTEMPTS - - pair_connect_success) - - if len(pair_times) > 0: - metrics['pair_max_time_millis'] = int(max(pair_times)) - metrics['pair_min_time_millis'] = int(min(pair_times)) - metrics['pair_avg_time_millis'] = int(statistics.mean(pair_times)) - - if len(connect_times) > 0: - metrics['first_connection_max_time_millis'] = int( - max(connect_times)) - metrics['first_connection_min_time_millis'] = int( - min(connect_times)) - metrics['first_connection_avg_time_millis'] = int( - (statistics.mean(connect_times))) - - if pair_connect_failures: - metrics['pair_conn_failure_info'] = pair_connect_failures - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.phone, - self.apollo) - - self.log.info('Metrics: {}'.format(metrics)) - - if PAIR_CONNECT_ATTEMPTS != pair_connect_success: - raise TestFailure(str(first_connection_failure), extras=proto) - else: - raise TestPass('Bluetooth pair and connect test passed', - extras=proto) diff --git a/acts_tests/tests/google/experimental/BluetoothReconnectTest.py b/acts_tests/tests/google/experimental/BluetoothReconnectTest.py deleted file mode 100644 index a03ec7b14b..0000000000 --- a/acts_tests/tests/google/experimental/BluetoothReconnectTest.py +++ /dev/null @@ -1,177 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. -"""Bluetooth disconnect and reconnect verification.""" -# Quick way to get the Apollo serial number: -# python3.5 -c "from acts.controllers.buds_lib.apollo_lib import get_devices; [print(d['serial_number']) for d in get_devices()]" - -import statistics -import time -from acts import asserts -from acts.base_test import BaseTestClass -from acts.controllers.buds_lib.test_actions.apollo_acts import ApolloTestActions -from acts.signals import TestPass, TestFailure -from acts.test_utils.bt.bt_test_utils import enable_bluetooth -from acts.test_utils.bt.bt_test_utils import factory_reset_bluetooth -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.utils import set_location_service - -# The number of reconnections to be attempted during the test -RECONNECTION_ATTEMPTS = 200 - - -class BluetoothReconnectError(TestFailure): - pass - - -class BluetoothReconnectTest(BaseTestClass): - """Connects a phone to Apollo earbuds to test Bluetooth reconnection. - - Attributes: - phone: An Android phone object - apollo: An Apollo earbuds object - apollo_act: An Apollo test action object - dut_bt_addr: The Bluetooth address of the Apollo earbuds - """ - - def setup_class(self): - super().setup_class() - # sanity check of the dut devices. - # TODO(b/119051823): Investigate using a config validator to replace this. - if not self.android_devices: - raise ValueError( - 'Cannot find android phone (need at least one).') - self.phone = self.android_devices[0] - - if not self.buds_devices: - raise ValueError( - 'Cannot find apollo device (need at least one).') - self.apollo = self.buds_devices[0] - self.log.info('Successfully found needed devices.') - - # Staging the test, create result object, etc. - self.apollo_act = ApolloTestActions(self.apollo, self.log) - self.dut_bt_addr = self.apollo.bluetooth_address - self.bt_logger = BluetoothMetricLogger.for_test_case() - - def setup_test(self): - # Make sure Bluetooth is on - enable_bluetooth(self.phone.droid, self.phone.ed) - set_location_service(self.phone, True) - factory_reset_bluetooth([self.phone]) - self.apollo_act.factory_reset() - - # Initial pairing and connection of devices - self.phone.droid.bluetoothDiscoverAndBond(self.dut_bt_addr) - paired_and_connected = self.apollo_act.wait_for_bluetooth_a2dp_hfp() - asserts.assert_true(paired_and_connected, - 'Failed to pair and connect devices') - time.sleep(20) - self.log.info('===== START BLUETOOTH RECONNECT TEST =====') - - def teardown_test(self): - self.log.info('Teardown test, shutting down all services...') - self.apollo_act.factory_reset() - self.apollo.close() - - def _reconnect_bluetooth_from_phone(self): - """Reconnects Bluetooth from the phone. - - Disables and then re-enables Bluetooth from the phone when Bluetooth - disconnection has been verified. Measures the reconnection time. - - Returns: - The time it takes to connect Bluetooth in milliseconds. - - Raises: - BluetoothReconnectError - """ - - # Disconnect Bluetooth from the phone side - self.log.info('Disconnecting Bluetooth from phone') - self.phone.droid.bluetoothDisconnectConnected(self.dut_bt_addr) - if not self.apollo_act.wait_for_bluetooth_disconnection(): - raise BluetoothReconnectError('Failed to disconnect Bluetooth') - self.log.info('Bluetooth disconnected successfully') - - # Buffer between disconnect and reconnect - time.sleep(3) - - # Reconnect Bluetooth from the phone side - self.log.info('Connecting Bluetooth from phone') - start_time = time.perf_counter() - self.phone.droid.bluetoothConnectBonded(self.dut_bt_addr) - self.log.info('Bluetooth connected successfully') - if not self.apollo_act.wait_for_bluetooth_a2dp_hfp(): - raise BluetoothReconnectError('Failed to connect Bluetooth') - end_time = time.perf_counter() - return (end_time - start_time) * 1000 - - def test_bluetooth_reconnect(self): - """Reconnects Bluetooth between a phone and Apollo device a specified - number of times and reports connection time statistics.""" - - # Store metrics - metrics = {} - connection_success = 0 - connection_times = [] - reconnection_failures = [] - first_connection_failure = None - - for attempt in range(RECONNECTION_ATTEMPTS): - self.log.info("Reconnection attempt {}".format(attempt + 1)) - reconnect_timestamp = time.strftime('%Y-%m-%d %H:%M:%S', - time.localtime()) - try: - connection_time = self._reconnect_bluetooth_from_phone() - except BluetoothReconnectError as err: - self.log.error(err) - failure_data = {'timestamp': reconnect_timestamp, - 'error': str(err), - 'reconnect_attempt': attempt + 1} - reconnection_failures.append(failure_data) - if not first_connection_failure: - first_connection_failure = err - else: - connection_times.append(connection_time) - connection_success += 1 - - # Buffer between reconnection attempts - time.sleep(3) - - metrics['connection_attempt_count'] = RECONNECTION_ATTEMPTS - metrics['connection_successful_count'] = connection_success - metrics['connection_failed_count'] = (RECONNECTION_ATTEMPTS - - connection_success) - if len(connection_times) > 0: - metrics['connection_max_time_millis'] = int(max(connection_times)) - metrics['connection_min_time_millis'] = int(min(connection_times)) - metrics['connection_avg_time_millis'] = int(statistics.mean( - connection_times)) - - if reconnection_failures: - metrics['connection_failure_info'] = reconnection_failures - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.phone, - self.apollo) - - self.log.info('Metrics: {}'.format(metrics)) - - if RECONNECTION_ATTEMPTS != connection_success: - raise TestFailure(str(first_connection_failure), extras=proto) - else: - raise TestPass('Bluetooth reconnect test passed', extras=proto) diff --git a/acts_tests/tests/google/experimental/BluetoothThroughputTest.py b/acts_tests/tests/google/experimental/BluetoothThroughputTest.py deleted file mode 100644 index 3403ded238..0000000000 --- a/acts_tests/tests/google/experimental/BluetoothThroughputTest.py +++ /dev/null @@ -1,230 +0,0 @@ -#/usr/bin/env python3 -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -import statistics -from acts import asserts -from acts.base_test import BaseTestClass -from acts.signals import TestPass -from acts.test_utils.bt.BluetoothBaseTest import BluetoothBaseTest -from acts.test_utils.bt.bt_test_utils import orchestrate_rfcomm_connection -from acts.test_utils.bt.bt_test_utils import setup_multiple_devices_for_bt_test -from acts.test_utils.bt.bt_test_utils import verify_server_and_client_connected -from acts.test_utils.bt.loggers.bluetooth_metric_logger import BluetoothMetricLogger -from acts.test_utils.bt.loggers.protos import bluetooth_metric_pb2 as proto_module -from acts.utils import set_location_service - - -class BluetoothThroughputTest(BaseTestClass): - """Connects two Android phones and tests the throughput between them. - - Attributes: - client_device: An Android device object that will be sending data - server_device: An Android device object that will be receiving data - bt_logger: The proxy logger instance for each test case - data_transfer_type: Data transfer protocol used for the test - """ - - def setup_class(self): - super().setup_class() - - # Sanity check of the devices under test - # TODO(b/119051823): Investigate using a config validator to replace this. - if len(self.android_devices) < 2: - raise ValueError( - 'Not enough android phones detected (need at least two)') - - # Data will be sent from the client_device to the server_device - self.client_device = self.android_devices[0] - self.server_device = self.android_devices[1] - self.bt_logger = BluetoothMetricLogger.for_test_case() - self.data_transfer_type = proto_module.BluetoothDataTestResult.RFCOMM - self.log.info('Successfully found required devices.') - - def setup_test(self): - setup_multiple_devices_for_bt_test(self.android_devices) - self._connect_rfcomm() - - def teardown_test(self): - if verify_server_and_client_connected( - self.client_device, self.server_device, log=False): - self.client_device.droid.bluetoothSocketConnStop() - self.server_device.droid.bluetoothSocketConnStop() - - def _connect_rfcomm(self): - """Establishes an RFCOMM connection between two phones. - - Connects the client device to the server device given the hardware - address of the server device. - """ - - set_location_service(self.client_device, True) - set_location_service(self.server_device, True) - server_address = self.server_device.droid.bluetoothGetLocalAddress() - self.log.info('Pairing and connecting devices') - asserts.assert_true(self.client_device.droid - .bluetoothDiscoverAndBond(server_address), - 'Failed to pair and connect devices') - - # Create RFCOMM connection - asserts.assert_true(orchestrate_rfcomm_connection - (self.client_device, self.server_device), - 'Failed to establish RFCOMM connection') - - def _measure_throughput(self, num_of_buffers, buffer_size): - """Measures the throughput of a data transfer. - - Sends data from the client device that is read by the server device. - Calculates the throughput for the transfer. - - Args: - num_of_buffers: An integer value designating the number of buffers - to be sent. - buffer_size: An integer value designating the size of each buffer, - in bytes. - - Returns: - The throughput of the transfer in bytes per second. - """ - - # TODO(b/119638242): Need to fix throughput send/receive methods - (self.client_device.droid - .bluetoothConnectionThroughputSend(num_of_buffers, buffer_size)) - - throughput = (self.server_device.droid - .bluetoothConnectionThroughputRead(num_of_buffers, - buffer_size)) - return throughput - - @BluetoothBaseTest.bt_test_wrap - def test_bluetooth_throughput_large_buffer(self): - """Tests the throughput over a series of data transfers with large - buffer size. - """ - - metrics = {} - throughput_list = [] - - for transfer in range(300): - throughput = self._measure_throughput(1, 300) - self.log.info('Throughput: {} bytes-per-sec'.format(throughput)) - throughput_list.append(throughput) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_packet_size'] = 300 - metrics['data_throughput_min_bytes_per_second'] = int( - min(throughput_list)) - metrics['data_throughput_max_bytes_per_second'] = int( - max(throughput_list)) - metrics['data_throughput_avg_bytes_per_second'] = int(statistics.mean( - throughput_list)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_throughput_min_bytes_per_second'] > 0, - 'Minimum throughput must be greater than 0!', - extras=proto) - raise TestPass('Throughput test (large buffer) completed successfully', - extras=proto) - - @BluetoothBaseTest.bt_test_wrap - def test_bluetooth_throughput_medium_buffer(self): - """Tests the throughput over a series of data transfers with medium - buffer size. - """ - - metrics = {} - throughput_list = [] - - for transfer in range(300): - throughput = self._measure_throughput(1, 100) - self.log.info('Throughput: {} bytes-per-sec'.format(throughput)) - throughput_list.append(throughput) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_packet_size'] = 100 - metrics['data_throughput_min_bytes_per_second'] = int( - min(throughput_list)) - metrics['data_throughput_max_bytes_per_second'] = int( - max(throughput_list)) - metrics['data_throughput_avg_bytes_per_second'] = int(statistics.mean( - throughput_list)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_throughput_min_bytes_per_second'] > 0, - 'Minimum throughput must be greater than 0!', - extras=proto) - raise TestPass('Throughput test (medium buffer) completed successfully', - extras=proto) - - @BluetoothBaseTest.bt_test_wrap - def test_bluetooth_throughput_small_buffer(self): - """Tests the throughput over a series of data transfers with small - buffer size. - """ - - metrics = {} - throughput_list = [] - - for transfer in range(300): - throughput = self._measure_throughput(1, 10) - self.log.info('Throughput: {} bytes-per-sec'.format(throughput)) - throughput_list.append(throughput) - - metrics['data_transfer_protocol'] = self.data_transfer_type - metrics['data_packet_size'] = 10 - metrics['data_throughput_min_bytes_per_second'] = int( - min(throughput_list)) - metrics['data_throughput_max_bytes_per_second'] = int( - max(throughput_list)) - metrics['data_throughput_avg_bytes_per_second'] = int(statistics.mean( - throughput_list)) - - proto = self.bt_logger.get_results(metrics, - self.__class__.__name__, - self.server_device, - self.client_device) - - asserts.assert_true(metrics['data_throughput_min_bytes_per_second'] > 0, - 'Minimum throughput must be greater than 0!', - extras=proto) - raise TestPass('Throughput test (small buffer) completed successfully', - extras=proto) - - @BluetoothBaseTest.bt_test_wrap - def test_maximum_buffer_size(self): - """Calculates the maximum allowed buffer size for one packet.""" - - current_buffer_size = 1 - while True: - self.log.info('Trying buffer size {}'.format(current_buffer_size)) - try: - throughput = self._measure_throughput(1, current_buffer_size) - except Exception: - buffer_msg = ('Max buffer size: {} bytes'. - format(current_buffer_size - 1)) - throughput_msg = ('Max throughput: {} bytes-per-second'. - format(throughput)) - self.log.info(buffer_msg) - self.log.info(throughput_msg) - return True - current_buffer_size += 1 diff --git a/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py b/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/fugu/AndroidFuguRemotePairingTest.py +++ /dev/null diff --git a/acts_tests/tests/google/fugu/fugu_pairing_test.json b/acts_tests/tests/google/fugu/fugu_pairing_test.json deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/fugu/fugu_pairing_test.json +++ /dev/null diff --git a/acts_tests/tests/google/fugu/relay.json b/acts_tests/tests/google/fugu/relay.json deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/fugu/relay.json +++ /dev/null diff --git a/acts_tests/tests/google/native/NativeTest.py b/acts_tests/tests/google/native/NativeTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/native/NativeTest.py +++ /dev/null diff --git a/acts_tests/tests/google/native/bt/BtNativeTest.py b/acts_tests/tests/google/native/bt/BtNativeTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/native/bt/BtNativeTest.py +++ /dev/null diff --git a/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py b/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/nfc/NfcBasicFunctionalityTest.py +++ /dev/null diff --git a/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py b/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/usb/UsbTetheringFunctionsTest.py +++ /dev/null diff --git a/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py b/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py deleted file mode 100644 index e69de29bb2..0000000000 --- a/acts_tests/tests/google/usb/UsbTetheringThroughputTest.py +++ /dev/null |