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

Commit bf720f96 authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Remove potential source of flakiness in LL tests

Timings can cause LL.DDI.ADV.BV_11_C to fail because of reordering
of LL pdus

Bug: 323271676
Test: atest rootcanal_ll_test
Flag: EXEMPT, tool change
Change-Id: I0f71bed0e1018231c813e8d6d9c1f46afc13a397
parent c8958243
Loading
Loading
Loading
Loading
+29 −19
Original line number Diff line number Diff line
@@ -305,13 +305,23 @@ class ControllerTest(unittest.IsolatedAsyncioTestCase):

    async def expect_ll(self,
                        expected_pdus: typing.Union[list, typing.Union[ll.LinkLayerPacket, type]],
                        ignored_pdus: typing.Union[list, type] = [],
                        timeout: int = 3) -> ll.LinkLayerPacket:
        if not isinstance(ignored_pdus, list):
            ignored_pdus = [ignored_pdus]

        if not isinstance(expected_pdus, list):
            expected_pdus = [expected_pdus]

        packet = await asyncio.wait_for(self.controller.receive_ll(), timeout=timeout)
        async with asyncio.timeout(timeout):
            while True:
                packet = await asyncio.wait_for(self.controller.receive_ll())
                pdu = ll.LinkLayerPacket.parse_all(packet)

                for ignored_pdu in ignored_pdus:
                    if isinstance(pdu, ignored_pdu):
                        continue

                for expected_pdu in expected_pdus:
                    if isinstance(expected_pdu, type) and isinstance(pdu, expected_pdu):
                        return pdu
+2 −1
Original line number Diff line number Diff line
@@ -123,7 +123,8 @@ class Test(ControllerTest):
                                 advertising_address_type=ll.AddressType.PUBLIC,
                                 conn_interval=self.LL_initiator_connInterval,
                                 conn_peripheral_latency=self.LL_initiator_connPeripheralLatency,
                                 conn_supervision_timeout=self.LL_initiator_connSupervisionTimeout))
                                 conn_supervision_timeout=self.LL_initiator_connSupervisionTimeout),
            ignored_pdus=[ll.LeLegacyAdvertisingPdu])

        # 11. Upper Tester receives an HCI_LE_Connection_Complete event from the IUT including the
        # parameters sent to the IUT in step 8.