diff --git a/examples/suit_update/tests/01-run.py b/examples/suit_update/tests/01-run.py index 9935e472be..2462f11ad3 100755 --- a/examples/suit_update/tests/01-run.py +++ b/examples/suit_update/tests/01-run.py @@ -119,7 +119,7 @@ def testfunc(child): # get version of currently running image # "Image Version: 0x00000000" - child.expect(r"Image Version: (?P0x[0-9a-fA-F:]+)") + child.expect(r"Image Version: (?P0x[0-9a-fA-F:]+)\r\n") current_app_ver = int(child.match.group("app_ver"), 16) for version in [current_app_ver + 1, current_app_ver + 2]: @@ -139,7 +139,7 @@ def testfunc(child): child.expect_exact("suit_coap: trigger received") child.expect_exact("suit: verifying manifest signature...") child.expect( - r"riotboot_flashwrite: initializing update to target slot (\d+)", + r"riotboot_flashwrite: initializing update to target slot (\d+)\r\n", timeout=MANIFEST_TIMEOUT, ) target_slot = int(child.match.group(1)) @@ -148,7 +148,7 @@ def testfunc(child): pass # Verify running slot - child.expect(r"running from slot (\d+)") + child.expect(r"running from slot (\d+)\r\n") assert target_slot == int(child.match.group(1)), "BOOTED FROM SAME SLOT" print("TEST PASSED") diff --git a/tests/gnrc_ipv6_ext/tests/01-run.py b/tests/gnrc_ipv6_ext/tests/01-run.py index 9d2f5e7d8c..6d429d8162 100755 --- a/tests/gnrc_ipv6_ext/tests/01-run.py +++ b/tests/gnrc_ipv6_ext/tests/01-run.py @@ -595,9 +595,9 @@ def testfunc(child): lladdr_src = get_host_lladdr(tap) child.sendline("ifconfig") - child.expect("HWaddr: (?P[A-Fa-f:0-9]+)") + child.expect(r"HWaddr: (?P[A-Fa-f:0-9]+)\s") hwaddr_dst = child.match.group("hwaddr").lower() - child.expect("(?Pfe80::[A-Fa-f:0-9]+)") + child.expect(r"(?Pfe80::[A-Fa-f:0-9]+)\s") lladdr_dst = child.match.group("lladdr").lower() def run(func): diff --git a/tests/gnrc_ipv6_ext_frag/tests/01-run.py b/tests/gnrc_ipv6_ext_frag/tests/01-run.py index 46e2ce6443..b99f261224 100755 --- a/tests/gnrc_ipv6_ext_frag/tests/01-run.py +++ b/tests/gnrc_ipv6_ext_frag/tests/01-run.py @@ -260,7 +260,7 @@ def _fwd_setup(child, ll_dst, g_src, g_dst): child.expect(r"fe80::1 dev #7 lladdr\s+-") # get TAP MAC address child.sendline("ifconfig 6") - child.expect("HWaddr: ([0-9A-F:]+)") + child.expect(r"HWaddr: ([0-9A-F:]+)\s") hwaddr = child.match.group(1) # consume MTU for later calls of `ifconfig 7` child.expect(r"MTU:(\d+)") @@ -337,7 +337,7 @@ def testfunc(child): print("FAILED") raise e - child.expect(r"Sending UDP test packets to port (\d+)") + child.expect(r"Sending UDP test packets to port (\d+)\r\n") port = int(child.match.group(1)) with socket.socket(socket.AF_INET6, socket.SOCK_DGRAM) as s: @@ -368,7 +368,7 @@ def testfunc(child): # link-local address becomes valid time.sleep(1) child.sendline("ifconfig") - child.expect("HWaddr: (?P[A-Fa-f:0-9]+)") + child.expect(r"HWaddr: (?P[A-Fa-f:0-9]+)\s") hwaddr_dst = child.match.group("hwaddr").lower() res = child.expect([ r"(?Pfe80::[A-Fa-f:0-9]+)\s+scope:\s+link\s+VAL", diff --git a/tests/gnrc_netif_ieee802154/tests/01-run.py b/tests/gnrc_netif_ieee802154/tests/01-run.py index 74b6ae5676..5249f0bda7 100755 --- a/tests/gnrc_netif_ieee802154/tests/01-run.py +++ b/tests/gnrc_netif_ieee802154/tests/01-run.py @@ -19,7 +19,7 @@ ZEP_V2_TYPE_DATA = 1 def testfunc(child): with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s: s.bind(("", 17754)) - child.expect("l2_addr: ([0-9A-F:]+)") + child.expect(r"l2_addr: ([0-9A-F:]+)\r\n") dst = int(child.match.group(1).replace(':', ''), base=16) # first send valid packet to check if communication is set up correctly diff --git a/tests/gnrc_rpl_srh/tests/01-run.py b/tests/gnrc_rpl_srh/tests/01-run.py index 47a50215dd..ef8a889141 100755 --- a/tests/gnrc_rpl_srh/tests/01-run.py +++ b/tests/gnrc_rpl_srh/tests/01-run.py @@ -143,7 +143,7 @@ def unregister(child): def get_first_interface(child): child.sendline("ifconfig") - child.expect(r"Iface\s+(\d+)") + child.expect(r"Iface\s+(\d+)\s") return int(child.match.group(1)) @@ -342,9 +342,9 @@ def testfunc(child): print("." * int(child.match.group(1)), end="", flush=True) lladdr_src = get_host_lladdr(tap) child.sendline("ifconfig") - child.expect("HWaddr: (?P[A-Fa-f:0-9]+)") + child.expect(r"HWaddr: (?P[A-Fa-f:0-9]+)\s") hwaddr_dst = child.match.group("hwaddr").lower() - child.expect("(?Pfe80::[A-Fa-f:0-9]+)") + child.expect(r"(?Pfe80::[A-Fa-f:0-9]+)\s") lladdr_dst = child.match.group("lladdr").lower() sniffer = Sniffer(tap) sniffer.start() diff --git a/tests/gnrc_tcp/tests/05-garbage-pkts.py b/tests/gnrc_tcp/tests/05-garbage-pkts.py index de3e08ca0a..7b31826571 100755 --- a/tests/gnrc_tcp/tests/05-garbage-pkts.py +++ b/tests/gnrc_tcp/tests/05-garbage-pkts.py @@ -35,7 +35,7 @@ def testfunc(func): child.sendline('gnrc_tcp_open_passive AF_INET6 {}'.format(port)) child.expect(r'gnrc_tcp_open_passive: argc=3, ' r'argv\[0\] = gnrc_tcp_open_passive, ' - r'argv\[1\] = AF_INET6, argv\[2\] = (\d+)') + r'argv\[1\] = AF_INET6, argv\[2\] = (\d+)\r\n') assert int(child.match.group(1)) == port try: diff --git a/tests/gnrc_tcp/tests/shared_func.py b/tests/gnrc_tcp/tests/shared_func.py index 4895eb20da..f3a9d1d7d6 100644 --- a/tests/gnrc_tcp/tests/shared_func.py +++ b/tests/gnrc_tcp/tests/shared_func.py @@ -58,26 +58,26 @@ def get_host_ll_addr(interface): def get_riot_l2_addr(child): child.sendline('ifconfig') - child.expect('HWaddr: ([A-F-a-f0-9:]+)') + child.expect(r'HWaddr: ([A-F-a-f0-9:]+)\s') return child.match.group(1) def get_riot_ll_addr(child): child.sendline('ifconfig') - child.expect('(fe80:[0-9a-f:]+)') + child.expect(r'(fe80:[0-9a-f:]+)\s') return child.match.group(1).strip() def get_riot_if_id(child): child.sendline('ifconfig') - child.expect(r'Iface\s+(\d+)') + child.expect(r'Iface\s+(\d+)\s') return child.match.group(1).strip() def setup_internal_buffer(child): child.sendline('buffer_init') child.sendline('buffer_get_max_size') - child.expect(r'returns (\d+)') + child.expect(r'returns (\d+)\s') return int(child.match.group(1).strip()) diff --git a/tests/lwip/tests/01-run.py b/tests/lwip/tests/01-run.py index 386ce8ce08..fe9cc555ac 100755 --- a/tests/lwip/tests/01-run.py +++ b/tests/lwip/tests/01-run.py @@ -185,7 +185,7 @@ class TestStrategy(ApplicationStrategy): def get_ipv6_address(spawn): spawn.sendline(u"ifconfig") - spawn.expect(u"[A-Za-z0-9]{2}_[0-9]+: inet6 (fe80::[0-9a-f:]+)") + spawn.expect(r"[A-Za-z0-9]{2}_[0-9]+: inet6 (fe80::[0-9a-f:]+)\s") return spawn.match.group(1) diff --git a/tests/lwip_sock_ip/tests/01-run.py b/tests/lwip_sock_ip/tests/01-run.py index f33598cece..735cb4134f 100755 --- a/tests/lwip_sock_ip/tests/01-run.py +++ b/tests/lwip_sock_ip/tests/01-run.py @@ -19,7 +19,7 @@ def _ipv4_tests(code): def testfunc(child): - child.expect(u"code (0x[0-9a-f]{2})") + child.expect(r"code (0x[0-9a-f]{2}\s)") code = int(child.match.group(1), base=16) if _ipv4_tests(code): child.expect_exact(u"Calling test_sock_ip_create4__EAFNOSUPPORT()") diff --git a/tests/lwip_sock_tcp/tests/01-run.py b/tests/lwip_sock_tcp/tests/01-run.py index c9da01e205..cbe361242d 100755 --- a/tests/lwip_sock_tcp/tests/01-run.py +++ b/tests/lwip_sock_tcp/tests/01-run.py @@ -23,7 +23,7 @@ def _ipv4_tests(code): def testfunc(child): - child.expect(u"code (0x[0-9a-f]{2})") + child.expect(r"code (0x[0-9a-f]{2}\s)") code = int(child.match.group(1), base=16) if _ipv4_tests(code): if _reuse_tests(code): diff --git a/tests/lwip_sock_udp/tests/01-run.py b/tests/lwip_sock_udp/tests/01-run.py index 5fba61af8b..a95a787af7 100755 --- a/tests/lwip_sock_udp/tests/01-run.py +++ b/tests/lwip_sock_udp/tests/01-run.py @@ -23,7 +23,7 @@ def _ipv4_tests(code): def testfunc(child): - child.expect(u"code (0x[0-9a-f]{2})") + child.expect(r"code (0x[0-9a-f]{2})\s") code = int(child.match.group(1), base=16) if _ipv4_tests(code): if _reuse_tests(code): diff --git a/tests/periph_cpuid/tests/01-run.py b/tests/periph_cpuid/tests/01-run.py index 07381477b7..03c9595dc5 100755 --- a/tests/periph_cpuid/tests/01-run.py +++ b/tests/periph_cpuid/tests/01-run.py @@ -13,7 +13,7 @@ from testrunner import run def testfunc(child): child.expect_exact('Test for the CPUID driver') child.expect_exact('This test is reading out the CPUID of the platforms CPU') - child.expect(r'CPUID_LEN: (\d+)') + child.expect(r'CPUID_LEN: (\d+)\r\n') cpuid_len = int(child.match.group(1)) child.expect(r'CPUID:( 0x[0-9a-fA-F]{2})+\s*\r\n') assert child.match.group(0).count(' 0x') == cpuid_len diff --git a/tests/periph_timer/tests/01-run.py b/tests/periph_timer/tests/01-run.py index cf8f5ddea6..e7fa3e09ad 100755 --- a/tests/periph_timer/tests/01-run.py +++ b/tests/periph_timer/tests/01-run.py @@ -11,7 +11,7 @@ from testrunner import run def testfunc(child): - child.expect(r'Available timers: (\d+)') + child.expect(r'Available timers: (\d+)\r\n') timers_num = int(child.match.group(1)) for timer in range(timers_num): child.expect_exact('Testing TIMER_{}'.format(timer)) diff --git a/tests/periph_wdt/tests/01-run.py b/tests/periph_wdt/tests/01-run.py index 509fbc382b..cc54a216af 100755 --- a/tests/periph_wdt/tests/01-run.py +++ b/tests/periph_wdt/tests/01-run.py @@ -38,7 +38,7 @@ def get_reset_time(child): def testfunc(child): child.sendline("range") - child.expect(r"lower_bound: (\d+) upper_bound: (\d+)", + child.expect(r"lower_bound: (\d+) upper_bound: (\d+)\s*\r\n", timeout=1) wdt_lower_bound = int(child.match.group(1)) wdt_upper_bound = int(child.match.group(2)) diff --git a/tests/pkg_libfixmath/tests/01-run.py b/tests/pkg_libfixmath/tests/01-run.py index a32a2471c2..5722290363 100755 --- a/tests/pkg_libfixmath/tests/01-run.py +++ b/tests/pkg_libfixmath/tests/01-run.py @@ -5,28 +5,28 @@ from testrunner import run, test_utils_interactive_sync def expect_unary(child): - child.expect(r'COUNT: (\d+)') + child.expect(r'COUNT: (\d+)\r\n') count = int(child.match.group(1)) assert count > 0 for _ in range(count): for op_name in ('abs', 'sq', 'atan', 'exp'): child.expect(r'{}\(-?\d+\.\d+\) = -?\d+\.\d+'.format(op_name)) - child.expect(r'COUNT: (\d+)') + child.expect(r'COUNT: (\d+)\r\n') count = int(child.match.group(1)) assert count > 0 for _ in range(count): for op_name in ('sin', 'cos', 'tan'): child.expect(r'{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name)) - child.expect(r'COUNT: (\d+)') + child.expect(r'COUNT: (\d+)\r\n') count = int(child.match.group(1)) assert count > 0 for _ in range(count): for op_name in ('asin', 'acos'): child.expect(r'{}\(-?\d+.\d+\) = -?\d+.\d+'.format(op_name)) - child.expect(r'COUNT: (\d+)') + child.expect(r'COUNT: (\d+)\r\n') count = int(child.match.group(1)) assert count > 0 for _ in range(count): @@ -35,7 +35,7 @@ def expect_unary(child): def expect_binary(child): - child.expect(r'COUNT: (\d+)') + child.expect(r'COUNT: (\d+)\r\n') count = int(child.match.group(1)) assert count > 0 for _ in range(count): diff --git a/tests/pthread_barrier/tests/01-run.py b/tests/pthread_barrier/tests/01-run.py index 97c82a4e40..f65080c506 100755 --- a/tests/pthread_barrier/tests/01-run.py +++ b/tests/pthread_barrier/tests/01-run.py @@ -5,7 +5,7 @@ from testrunner import run def testfunc(child): - child.expect(r'NUM_CHILDREN: (\d+), NUM_ITERATIONS: (\d+)') + child.expect(r'NUM_CHILDREN: (\d+), NUM_ITERATIONS: (\d+)\r\n') children = int(child.match.group(1)) iterations = int(child.match.group(2)) for i in range(children): diff --git a/tests/trace/tests/01-run.py b/tests/trace/tests/01-run.py index 41062e51b0..e1c4c1361e 100755 --- a/tests/trace/tests/01-run.py +++ b/tests/trace/tests/01-run.py @@ -11,10 +11,10 @@ from testrunner import run def testfunc(child): - child.expect(r"TRACE_SIZE: (\d+)") + child.expect(r"TRACE_SIZE: (\d+)\r\n") trace_size = int(child.match.group(1)) for i in range(trace_size): - child.expect("0x[0-9a-f]{7,8}") + child.expect(r"0x[0-9a-f]{7,8}") print("All tests successful")