tests: accept %p printing in uppercase and without leading 0x#21677
Merged
maribu merged 2 commits intoRIOT-OS:masterfrom Aug 25, 2025
Merged
tests: accept %p printing in uppercase and without leading 0x#21677maribu merged 2 commits intoRIOT-OS:masterfrom
maribu merged 2 commits intoRIOT-OS:masterfrom
Conversation
1 task
maribu
reviewed
Aug 22, 2025
| 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}\)') |
Member
There was a problem hiding this comment.
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):
Contributor
Author
There was a problem hiding this comment.
I think that's only true after applying the patch in #21678
Member
There was a problem hiding this comment.
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
Contributor
Author
|
Ready from my side, should still fix the remaining failing nightly. |
maribu
approved these changes
Aug 25, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
masterand not with these changes.Issues/PRs references
Should fix the failing nightlies after #21438