From 677e2fb19a9e1642ba78e8db1b2e832b2e79ed14 Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Wed, 21 Dec 2022 10:39:15 +0800 Subject: [PATCH 1/2] CI: fix test case test_base_mac_address --- examples/system/base_mac_address/pytest_base_mac_address.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/system/base_mac_address/pytest_base_mac_address.py b/examples/system/base_mac_address/pytest_base_mac_address.py index fd294080e9..55a1b0c1ed 100644 --- a/examples/system/base_mac_address/pytest_base_mac_address.py +++ b/examples/system/base_mac_address/pytest_base_mac_address.py @@ -31,7 +31,7 @@ def test_base_mac_address(dut: Dut) -> None: # Format the new string to match the expected output from the app (includes stripping leading zeroes) return ', '.join('0x{}'.format(hex_string[i:i + 2].lstrip('0')) for i in range(0, len(hex_string), 2)) - return ', '.join(['0x{}'.format(m.decode('utf8')) for m in mac_m[:-1]] + [hex(int(mac_m[-1], 16) + increment)]) + return ', '.join(['0x{}'.format(m.decode('utf8')) for m in mac_m[:-1]] + [hex((int(mac_m[-1], 16) + increment) & 0xFF)]) sdkconfig = dut.app.sdkconfig From 4af4edc3dadc23ae652c6300526f9fe381242cbd Mon Sep 17 00:00:00 2001 From: Chen Yudong Date: Wed, 21 Dec 2022 10:50:11 +0800 Subject: [PATCH 2/2] CI: fix pattern in test case test_examples_protocol_mqtt5 --- examples/protocols/mqtt5/pytest_mqtt5.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/protocols/mqtt5/pytest_mqtt5.py b/examples/protocols/mqtt5/pytest_mqtt5.py index 045ec40df1..603be68c12 100644 --- a/examples/protocols/mqtt5/pytest_mqtt5.py +++ b/examples/protocols/mqtt5/pytest_mqtt5.py @@ -26,24 +26,24 @@ def test_examples_protocol_mqtt5(dut: Dut) -> None: # check if connected or not dut.expect_exact('MQTT_EVENT_CONNECTED', timeout=30) # check log - res = dut.expect(r'sent publish successful, msg_id=(\d+)') + res = dut.expect(r'sent publish successful, msg_id=(\d+)[^\d]') msgid_pub1 = res.group(1).decode('utf8') - res = dut.expect(r'sent subscribe successful, msg_id=(\d+)') + res = dut.expect(r'sent subscribe successful, msg_id=(\d+)[^\d]') msgid_sub1 = res.group(1).decode('utf8') - res = dut.expect(r'sent subscribe successful, msg_id=(\d+)') + res = dut.expect(r'sent subscribe successful, msg_id=(\d+)[^\d]') msgid_sub2 = res.group(1).decode('utf8') - res = dut.expect(r'sent unsubscribe successful, msg_id=(\d+)') + res = dut.expect(r'sent unsubscribe successful, msg_id=(\d+)[^\d]') msgid_unsub = res.group(1).decode('utf8') - res = dut.expect(r'MQTT_EVENT_PUBLISHED, msg_id=(\d+)') + res = dut.expect(r'MQTT_EVENT_PUBLISHED, msg_id=(\d+)[^\d]') msgid_pubd = res.group(1).decode('utf8') assert msgid_pubd == msgid_pub1 - res = dut.expect(r'MQTT_EVENT_SUBSCRIBED, msg_id=(\d+)') + res = dut.expect(r'MQTT_EVENT_SUBSCRIBED, msg_id=(\d+)[^\d]') msgid_subd = res.group(1).decode('utf8') assert msgid_subd == msgid_sub1 dut.expect_exact('sent publish successful, msg_id=0') - res = dut.expect(r'MQTT_EVENT_SUBSCRIBED, msg_id=(\d+)') + res = dut.expect(r'MQTT_EVENT_SUBSCRIBED, msg_id=(\d+)[^\d]') msgid_subd = res.group(1).decode('utf8') assert msgid_subd == msgid_sub2 @@ -57,7 +57,7 @@ def test_examples_protocol_mqtt5(dut: Dut) -> None: dut.expect_exact('correlation_data is 123456') dut.expect_exact('TOPIC=/topic/qos1') dut.expect_exact('DATA=data_3') - res = dut.expect(r'MQTT_EVENT_UNSUBSCRIBED, msg_id=(\d+)') + res = dut.expect(r'MQTT_EVENT_UNSUBSCRIBED, msg_id=(\d+)[^\d]') msgid_unsubd = res.group(1).decode('utf8') assert msgid_unsubd == msgid_unsub