tests/periph/selftest_shield: Improve error output#20101
Merged
maribu merged 3 commits intoRIOT-OS:masterfrom Nov 22, 2023
Merged
tests/periph/selftest_shield: Improve error output#20101maribu merged 3 commits intoRIOT-OS:masterfrom
maribu merged 3 commits intoRIOT-OS:masterfrom
Conversation
This makes it easier to use common error reporting such as `strerror()` or `tiny_strerror()` to give more insight on why something failed. The custom error codes via `enum` have been updated to be synonymous with the `errno` codes for backward compatibility. In addition, `pcf857x_init()` has been updated to no longer or together the return code, but rather abort on the first fail transaction and return the error code as is. Otherwise (when both fail due to different error codes) the returned error code may be garbage.
Use `tiny_strerror()` to report back errors when calling initialization functions.
Move it to the correct place
6349ac1 to
fb9abe3
Compare
benpicco
approved these changes
Nov 22, 2023
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
While debugging the I2C bug on STM32F1, I found the output of the test application lacking. This addresses this by using
tiny_strerror()to print the error codes indicating what went wrong (not only for pcf857x, but for every other initialization call as well).In order to make use of this, the
pcf857xdriver was updated to return negative errno codes. This also as the advantage to provide more details on what specifically went wrong when the I2C communication fails, rather than just a single I2C error code.Testing procedure
Run the test on a board without the peripheral selftest shield attach. Upon initialization of the PCF587x chip the test should fail with a meaningful error message.
Issues/PRs references
None