Skip to content

Commit

Permalink
Merge branch 'ci/optimize_some_test_cases' into 'master'
Browse files Browse the repository at this point in the history
Ci: optimize some test cases

See merge request espressif/esp-idf!21729
  • Loading branch information
ydesp committed Dec 21, 2022
2 parents e5926d1 + 4af4edc commit e0d564f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions examples/protocols/mqtt5/pytest_mqtt5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def get_expected_mac_string(increment: int, target: str) -> str:
# 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

Expand Down

0 comments on commit e0d564f

Please sign in to comment.