Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84cd9ab5 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes Idbb12b55,Id1e4cb30 into tm-dev

* changes:
  Test: Further stability improvements to ACL tests
  SL4A: Throw exception when test fails and clear paired devices
parents 2bf92910 df236fc7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@
#   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 time
from abc import ABC, abstractmethod


@@ -37,3 +37,5 @@ class Closable(ABC):
def safeClose(closable):
    if closable is not None:
        closable.close()
        # sleep for 100ms because GrpcEventQueue takes at most 100 ms to close
        time.sleep(0.1)
+3 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ from blueberry.tests.gd.cert.gd_device import MOBLY_CONTROLLER_CONFIG_NAME as GD
from blueberry.tests.gd_sl4a.lib.ble_lib import enable_bluetooth, disable_bluetooth, BleLib
from blueberry.facade import rootservice_pb2 as facade_rootservice
from blueberry.tests.gd.cert import gd_device
from blueberry.utils.bt_test_utils import clear_bonded_devices


class GdSl4aBaseTestClass(BaseTestClass):
@@ -90,9 +91,11 @@ class GdSl4aBaseTestClass(BaseTestClass):
        # Then enable Bluetooth
        enable_bluetooth(self.dut.sl4a, self.dut.ed)
        self.dut.sl4a.bluetoothDisableBLE()
        clear_bonded_devices(self.dut)
        return True

    def teardown_test(self):
        clear_bonded_devices(self.dut)
        # Make sure BLE is disabled and Bluetooth is disabled after test
        self.dut.sl4a.bluetoothDisableBLE()
        disable_bluetooth(self.dut.sl4a, self.dut.ed)
+98 −57

File changed.

Preview size limit exceeded, changes collapsed.

+1 −4
Original line number Diff line number Diff line
@@ -60,12 +60,9 @@ def setup_gatt_connection(central: AndroidDevice,
        close_gatt_client(central, bluetooth_gatt)
        raise GattTestUtilsError("Could not establish a connection to "
                                 "peripheral. Expected event: {}".format(expected_event))
    logging.info("Got connection event {}".format(event))
    if event['data']['State'] != GattConnectionState.STATE_CONNECTED:
        close_gatt_client(central, bluetooth_gatt)
        try:
            central.sl4a.gattClientClose(bluetooth_gatt)
        except Exception:
            logging.debug("Failed to close gatt client.")
        raise GattTestUtilsError("Could not establish a connection to "
                                 "peripheral. Event Details: {}".format(pprint.pformat(event)))
    return bluetooth_gatt, gatt_callback
+2 −2
Original line number Diff line number Diff line
@@ -51,8 +51,8 @@ class GrpcEventQueue {
    using namespace std::chrono_literals;
    LOG_INFO("%s: Entering Loop", log_name_.c_str());
    while (!context->IsCancelled()) {
      // Wait for 500 ms so that cancellation can be caught in amortized 250 ms latency
      if (pending_events_.wait_to_take(500ms)) {
      // Wait for 100 ms so that cancellation can be caught in amortized 50 ms latency
      if (pending_events_.wait_to_take(100ms)) {
        LOG_INFO("%s: Got event from queue", log_name_.c_str());
        writer->Write(pending_events_.take());
      }
Loading