Skip to content

Commit b7a2169

Browse files
committed
tests: accept %p printing in uppercase and without leading 0x
the output of the specifier %p is implementation defined, and mpaland-printf gives something different than newlib
1 parent c0cc617 commit b7a2169

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

tests/core/msg_queue_print/tests/01-run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def expect_content(child, counter):
4646
else:
4747
child.expect(r'type: 0x0000, content: 0 \((0x)?0+\)')
4848
else:
49-
child.expect_exact(f'type: 0x{counter:04x}, content: {counter} (0x{counter:x})')
49+
child.expect(f'type: 0x{counter:04x}, content: {counter} \((0x)?0*{counter:x}\)')
5050

5151

5252
def testfunc(child):

tests/net/gnrc_ipv6_fwd_w_sub/tests/01-run.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ def testfunc(child):
3131
child.expect(r"00000020 55 44 33 FF FE 22 11 00 54 B8 59 AF 3A B4 5C 85")
3232
child.expect(r"00000030 1E CE E2 EB 05 4E A3 85")
3333
child.sendline("pktbuf")
34-
child.expect(r"packet buffer: first byte: (0x[0-9a-fA-F]+), "
35-
r"last byte: 0x[0-9a-fA-F]+ \(size: (\d+)\)")
34+
child.expect(r"packet buffer: first byte: ((0x)?[0-9a-fA-F]+), "
35+
r"last byte: (0x)?[0-9a-fA-F]+ \(size: (\d+)\)")
3636
start_addr = child.match.group(1)
37-
size = child.match.group(2)
37+
size = child.match.group(4)
38+
print(start_addr, size)
3839
child.expect(r" position of last byte used: \d+")
3940
child.expect(r"~ unused: {} \(next: (\(nil\)|0(x0+)?), size: +{}\) ~"
4041
.format(start_addr, size))

tests/riotboot/tests/01-run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ def check_current_slot_and_app_ver(self, child):
6666
# Ask for data of all slots
6767
child.expect_exact('>')
6868
child.sendline("dumpaddrs")
69-
child.expect(r"slot 0: metadata: 0x[0-9a-fA-F]{1,8} "
69+
child.expect(r"slot 0: metadata: (0x)?[0-9a-fA-F]{1,8} "
7070
r"image: 0x[0-9a-fA-F]{8}\r\n")
71-
child.expect(r"slot 1: metadata: 0x[0-9a-fA-F]{1,8} "
71+
child.expect(r"slot 1: metadata: (0x)?[0-9a-fA-F]{1,8} "
7272
r"image: 0x[0-9a-fA-F]{8}\r\n")
7373
child.expect_exact('>')
7474

tests/sys/heap_cmd/tests/01-run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ def testfunc(child):
1717
if ret == 1:
1818
return
1919
child.sendline('malloc 100')
20-
child.expect('allocated 0x')
20+
child.expect('allocated (0x)?')
2121
addr = child.readline()
2222
addr = addr[:-2]
2323
child.expect_exact('> ')
2424
child.sendline('heap')
2525
child.expect(r'heap: \d+ \(used \d+, free \d+\) \[bytes\]')
2626
child.sendline('free 0x' + addr)
27-
child.expect('freeing 0x' + addr)
27+
child.expect('freeing (0x)?' + addr)
2828
child.expect_exact('>')
2929
child.sendline('heap')
3030
child.expect(r'heap: \d+ \(used \d+, free \d+\) \[bytes\]')

tests/sys/malloc/tests/01-run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def testfunc(child):
2222
number_of_tests = int(child.match.group(1))
2323
initial_allocations = 0
2424
for _ in range(number_of_tests):
25-
child.expect(r"Allocated {} Bytes at 0x[a-z0-9]+, total [a-z0-9]+\r\n"
25+
child.expect(r"Allocated {} Bytes at (0x)?[a-z0-9]+, total [a-z0-9]+\r\n"
2626
.format(chunk_size))
2727
child.expect(r'Allocations count: (\d+)\r\n',
2828
timeout=ALLOCATION_TIMEOUT)
@@ -31,7 +31,7 @@ def testfunc(child):
3131
if initial_allocations == 0:
3232
initial_allocations = allocations
3333
assert initial_allocations == allocations
34-
child.expect(r"Free {} Bytes at 0x[a-z0-9]+, total [a-z0-9]+\r\n"
34+
child.expect(r"Free {} Bytes at (0x)?[a-z0-9]+, total [a-z0-9]+\r\n"
3535
.format(chunk_size))
3636
child.expect(r'Free count: (\d+)\r\n', timeout=FREE_TIMEOUT)
3737
freed = int(child.match.group(1))

tests/sys/memarray/tests/01-run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ def testfunc(child):
2222
for test in range(number_of_tests):
2323
child.expect_exact("TEST #{}:".format(test + 1))
2424
for i in range(max_number_blocks):
25-
child.expect(r'\({}, @@@@@@@\) Allocated \d+ Bytes at 0x[a-z0-9]+,'
25+
child.expect(r'\({}, @@@@@@@\) Allocated \d+ Bytes at (0x)?[a-zA-Z0-9]+,'
2626
r' total [0-9]+\r\n'.format(i))
2727
for i in range(max_number_blocks):
28-
child.expect(r'Free \({}\) \d+ Bytes at 0x[a-z0-9]+,'
28+
child.expect(r'Free \({}\) \d+ Bytes at (0x)?[a-zA-Z0-9]+,'
2929
' total [0-9]+\r\n'.format(i))
3030

3131
child.expect_exact("Extend and reduce tests")

0 commit comments

Comments
 (0)