feat(openthread): optimize fail cases in CI test

This commit is contained in:
yiwenxiu
2025-11-26 17:50:20 +08:00
parent 8fd5bae580
commit fea3033913
2 changed files with 12 additions and 4 deletions

View File

@@ -140,11 +140,15 @@ def joinThreadNetwork(dut: IdfDut, thread: thread_parameter) -> None:
def wait_for_join(dut: IdfDut, role: str) -> bool:
clean_buffer(dut)
for _ in range(1, 30):
if getDeviceRole(dut) == role:
wait(dut, 5)
time.sleep(1)
execute_command(dut, 'state')
try:
dut.expect(re.compile(role), timeout=5)
return True
wait(dut, 1)
except Exception:
continue
return False

View File

@@ -231,7 +231,11 @@ def test_Bidirectional_IPv6_connectivity(Init_interface:bool, dut: Tuple[IdfDut,
out_bytes = subprocess.check_output(command, shell=True, timeout=5)
out_str = out_bytes.decode('utf-8')
onlinkprefix = ocf.get_onlinkprefix(br)
host_global_unicast_addr = re.findall(r'\W+(%s(?:\w+:){3}\w+)\W+' % onlinkprefix, str(out_str))
pattern = rf'\W+({onlinkprefix}(?:\w+:){{3}}\w+)\W+'
host_global_unicast_addr = re.findall(pattern, out_str)
print(f'host_global_unicast_addr: {host_global_unicast_addr}')
if host_global_unicast_addr is None:
raise Exception(f'onlinkprefix: {onlinkprefix}, host_global_unicast_addr: {host_global_unicast_addr}')
rx_nums = 0
for ip_addr in host_global_unicast_addr:
txrx_nums = ocf.ot_ping(cli, str(ip_addr), count=10)