sys/embunit: fix return value on failure#21468
Merged
maribu merged 1 commit intoRIOT-OS:masterfrom May 7, 2025
Merged
Conversation
When using `OUTPUT=COLORTEST` the return value of the unit test's
`main()` on failure was `0`, while it should be `1`. As a result,
running the unit tests from a script using
$ OUTPUT=COLORTEXT make BOARD=native64 RIOT_TERMINAL=native -j32 flash term -C tests/unittests
would not catch a test failure.
This commit changes the behavior so that `0` is returned on success
and `1` on failure for both regular and colored text output.
benpicco
approved these changes
May 6, 2025
Member
Author
|
Thx :) |
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
When using
OUTPUT=COLORTESTthe return value of the unit test'smain()on failure was0, while it should be1. As a result, running the unit tests from a script usingwould not catch a test failure.
This commit changes the behavior so that
0is returned on success and1on failure for both regular and colored text output.Testing procedure
Run
and
The former will fail, the latter succeed. But both will have an exit code of
0(echo $?) inmaster, while ommitting theOUTPUT=COLORTEXTwill cause the failed test to have an exit code of1.With this PR, failures will have an exit code of
1and success an exit code of0, regardless of output.Issues/PRs references
None