Skip to content
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

dts: edtlib: Improve error for wrong reg/ranges/interrupts size + add helper for testing error messages from edtlib #21615

Merged
merged 2 commits into from Jan 13, 2020

Conversation

ulfalizer
Copy link
Collaborator

@ulfalizer ulfalizer commented Dec 28, 2019

Show how the element size was calculated in the error message when a
'reg', 'ranges', or 'interrupts' property has the wrong size. This
should help with debugging. Also mention that #*-cells properties come
from the parent node, which can be subtle.

Came up in #21607
(though it seems the comment disappeared).

Also add a helper for testing error messages from edtlib (error messages from dtlib are already tested), and use it to verify the new hints:

dts: edtlib: Add helper for testing error messages and test _slice()

Add a helper function verify_error() to testedtlib.py that takes a DTS
source and verifies that it generates a particular EDTError.

Use it to test the hints that the previous commit added to errors
generated by _slice().

@ulfalizer ulfalizer force-pushed the size-hint branch 2 times, most recently from 0f13594 to 0ae9b5f Compare January 2, 2020 22:21
Copy link
Collaborator

@pabigot pabigot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wish these sort of changes came with a change to the test that demonstrates and confirms that the output is as desired.

Show how the element size was calculated in the error message when a
'reg', 'ranges', or 'interrupts' property has the wrong size. This
should help with debugging. Also mention that #*-cells properties come
from the parent node, which can be subtle.

Came up in zephyrproject-rtos#21607
(though it seems the comment disappeared).

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
Add a helper function verify_error() to testedtlib.py that takes a DTS
source and verifies that it generates a particular EDTError.

Use it to test the hints that the previous commit added to errors
generated by _slice().

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
@ulfalizer
Copy link
Collaborator Author

@pabigot

I really wish these sort of changes came with a change to the test that demonstrates and confirms that the output is as desired.

Added a helper for testing error messages from edtlib and used it to test the new messages. See the new commit.

@ulfalizer ulfalizer changed the title dts: edtlib: Improve error for wrong reg/ranges/interrupts size dts: edtlib: Improve error for wrong reg/ranges/interrupts size + add helper for testing error messages from edtlib Jan 9, 2020
@carlescufi carlescufi merged commit 405daa0 into zephyrproject-rtos:master Jan 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants