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

Commit 17b967b0 authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Disable LL tests based on controller features"

parents 48639e1c b5c19bdb
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -9,6 +9,14 @@ from typing import Optional
from hci_packets import ErrorCode


class LeFeatures:

    def __init__(self, le_features: int):
        self.mask = le_features
        self.ll_privacy = (le_features & hci.LLFeaturesBits.LL_PRIVACY) != 0
        self.le_extended_advertising = (le_features & hci.LLFeaturesBits.LE_EXTENDED_ADVERTISING) != 0


class Controller(rootcanal.BaseController):
    """Binder class to DualModeController.
    The methods send_cmd, send_hci, send_ll are used to inject HCI or LL
@@ -115,6 +123,12 @@ class ControllerTest(unittest.IsolatedAsyncioTestCase):
        await controller.expect_evt(hci.SetEventMaskComplete(status=ErrorCode.SUCCESS, num_hci_command_packets=1))
        controller.send_cmd(hci.LeSetEventMask(le_event_mask=0xffffffffffffffff))
        await controller.expect_evt(hci.LeSetEventMaskComplete(status=ErrorCode.SUCCESS, num_hci_command_packets=1))
        controller.send_cmd(hci.LeReadLocalSupportedFeatures())

        # Load the local supported features to be able to disable tests
        # that rely on unsupported features.
        evt = await self.expect_cmd_complete(hci.LeReadLocalSupportedFeaturesComplete)
        controller.le_features = LeFeatures(evt.le_features)

    async def expect_evt(self, expected_evt: hci.Event, timeout: int = 3):
        packet = await asyncio.wait_for(self.controller.receive_evt(), timeout=timeout)
+3 −0
Original line number Diff line number Diff line
@@ -24,6 +24,9 @@ class Test(ControllerTest):
        peer_identity_address_type = hci.PeerAddressType.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS
        peer_resolvable_address = Address(rootcanal.generate_rpa(peer_irk))

        if not controller.le_features.ll_privacy:
            self.skipTest("LL privacy not supported")

        # 1. The Upper Tester populates the IUT resolving list with the peer IRK
        # and identity address.
        controller.send_cmd(
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ class Test(ControllerTest):
        local_resolvable_address_1 = Address(rootcanal.generate_rpa(local_irk))
        local_resolvable_address_2 = Address(rootcanal.generate_rpa(local_irk))

        if not controller.le_features.ll_privacy:
            self.skipTest("LL privacy not supported")

        # 1. The Upper Tester sets a resolvable private address for the IUT to use.
        controller.send_cmd(hci.LeSetRandomAddress(random_address=local_resolvable_address_1))

+3 −0
Original line number Diff line number Diff line
@@ -28,6 +28,9 @@ class Test(ControllerTest):
        peer_identity_address_type = hci.PeerAddressType.PUBLIC_DEVICE_OR_IDENTITY_ADDRESS
        peer_resolvable_address = Address(rootcanal.generate_rpa(peer_irk))

        if not controller.le_features.ll_privacy:
            self.skipTest("LL privacy not supported")

        # 1. Upper Tester sends an HCI_LE_Set_Random_Address to the IUT with a
        # random static address.
        controller.send_cmd(hci.LeSetRandomAddress(random_address=local_random_address))