-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tests: accept %p printing in uppercase and without leading 0x #21677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
child.expect(r'type: 0x0000, content: 0 \((0x)?0+\)') | ||
else: | ||
child.expect_exact(f'type: 0x{counter:04x}, content: {counter} (0x{counter:x})') | ||
child.expect(f'type: 0x{counter:04x}, content: {counter} \((0x)?0*{counter:x}\)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will still not pass with mpaland-printf
, as it also uses "(nil)"
like glibc does on NULL
.
The following would pass:
diff --git a/tests/core/msg_queue_print/tests/01-run.py b/tests/core/msg_queue_print/tests/01-run.py
index a03118d268..f78b50870e 100755
--- a/tests/core/msg_queue_print/tests/01-run.py
+++ b/tests/core/msg_queue_print/tests/01-run.py
@@ -41,12 +41,12 @@ def expect_some(child, size, avail, range_start):
def expect_content(child, counter):
if counter == 0:
- if os.environ.get('BOARD') in ['native', 'native32', 'native64']:
- child.expect_exact('type: 0x0000, content: 0 ((nil))')
- else:
- child.expect(r'type: 0x0000, content: 0 \((0x)?0+\)')
+ child.expect(r'type: 0x0000, content: 0 \((\(nil\)|0x0+\))')
else:
- child.expect_exact(f'type: 0x{counter:04x}, content: {counter} (0x{counter:x})')
+ child.expect(r'type: ((0x)?[a-fA-F0-9]+), content: (\d+) \(((0x)?[a-fA-Z0-9]+)\)')
+ assert int(child.match.group(1), 16) == counter, f"Expected {counter:x} as type, got child.match.group(1)"
+ assert int(child.match.group(2)) == counter, f"Expected {counter} as content, got child.match.group(2)"
+ assert int(child.match.group(3), 16) == counter, f"Expected {counter:x} as ptr, got child.match.group(3)"
def testfunc(child):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's only true after applying the patch in #21678
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. I updated the patch above, I think would now work for all ways to do %p
.
the output of the specifier %p is implementation defined, and mpaland-printf gives something different than newlib
b7a2169
to
ede39c6
Compare
Ready from my side, should still fix the remaining failing nightly. |
Contribution description
The output of the specifier %p is implementation defined, and mpaland-printf gives something different than newlib. Be less strict in what the tests expect.
Testing procedure
Build and run any of the changed tests on a board now pulling mpaland-printf. Notice that they fail on
master
and not with these changes.Issues/PRs references
Should fix the failing nightlies after #21438