Skip to content

Commit

Permalink
wid: gap: Add workaround for conflicting MMIs
Browse files Browse the repository at this point in the history
This commit implements a temporary workaround for PTS issue 136305 which causes
invalid sequence of events in some GAP/SEC/SEM test cases. There are two
conflicting MMIs that affect test case verdict when handled in incorrect order.
  • Loading branch information
piotrnarajowski committed Sep 24, 2024
1 parent c4de233 commit 98445f0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
3 changes: 3 additions & 0 deletions autopts/ptsprojects/stack/layers/gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ def __init__(self, name, manufacturer_data, appearance, svc_data, flags,
self.periodic_sync_established_rxed = False
self.periodic_transfer_received = False

# Used for MMI handling
self.delay_mmi = False

def add_connection(self, addr, addr_type):
self.connections[addr] = GapConnection(addr=addr,
addr_type=addr_type)
Expand Down
36 changes: 31 additions & 5 deletions autopts/wid/gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,15 @@ def hdl_wid_108(params: WIDParams):
if params.description.startswith('Please configure the IUT into LE Security and start pairing process.'):
return True

stack = get_stack()

if params.test_case_name in ['GAP/SEC/SEM/BV-28-C', 'GAP/SEC/SEM/BV-42-C']:
if not stack.gap.delay_mmi:
# Note: this is part of a workaround related to PTS issue 136305 which
# is needed to properly handle two conflicting MMIs (208 and 227)
hdl_wid_227(params, 7)
stack.gap.delay_mmi = True

btp.gap_pair()
return True

Expand Down Expand Up @@ -1051,8 +1060,18 @@ def hdl_wid_206(params: WIDParams):
return True


def hdl_wid_208(_: WIDParams):
def hdl_wid_208(params: WIDParams):
stack = get_stack()

if params.test_case_name in ['GAP/SEC/SEM/BV-26-C']:
if not stack.gap.delay_mmi:
# Note: this is part of a workaround related to PTS issue 136305 which
# is needed to properly handle two conflicting MMIs (208 and 227)
hdl_wid_227(params, 7)
stack.gap.delay_mmi = True

btp.gap_pair()

return True


Expand All @@ -1077,19 +1096,25 @@ def hdl_wid_226(_: WIDParams):
return True


def hdl_wid_227(params: WIDParams):
def hdl_wid_227(params: WIDParams, desc_handle=None):
# There seems to be issue in PTS regarding using WID112 and WID227 in that test
# Should be removed if PTS fix this.
stack = get_stack()

if params.test_case_name in ['GAP/SEC/SEM/BV-26-C', 'GAP/SEC/SEM/BV-28-C', 'GAP/SEC/SEM/BV-42-C']:
# Note: this is part of a workaround related to PTS issue 136305 which
# is needed to properly handle two conflicting MMIs (208 and 227)
if stack.gap.delay_mmi is True:
return True

if params.test_case_name in ['GAP/SEC/AUT/BV-19-C']:
btp.gap_pair()
return True

stack = get_stack()

bd_addr = btp.pts_addr_get()
bd_addr_type = btp.pts_addr_type_get()

handle = btp.parse_handle_description(params.description)
handle = btp.parse_handle_description(params.description) or desc_handle
if not handle:
return False

Expand All @@ -1109,6 +1134,7 @@ def hdl_wid_227(params: WIDParams):
if (btp.verify_att_error("insufficient encryption")):
btp.gap_pair()

stack.gap.delay_mmi = True
return True


Expand Down

0 comments on commit 98445f0

Please sign in to comment.