Fix this test for the native_simulator,
and add it as a default test target.
Also be a bit clearer in stdout about the test having
passed or not.
Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
The current error messages are a bit cryptic, rework them to make them
more meaningful:
- add an extra message on the first error to explain what the errors
refer to.
- rework the error message to be more explicit.
- rework the priority string print to use a LEVEL+offset format to
somehow highlight that the number is the offset from the level, not
the actual priority.
- print the init function name in addition to the devicetree path.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Since bb590b5b6e introduced ordinals in the priority sequence, the "same
priority" case cannot happen anymore, furthermore the priority value in
the script is now the position of the function in the init sequence, so
if two devices have the same priority there's something real bad going
on.
Drop all the "same priority" handling code and tests, convert the case
into ane exception instead. Drop the init stubs as well from the test,
they are not required anymore.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Rework check_init_priorities to use the main executable file instead of
the individual object files for discovering the devices.
This should make the script more robust in case of stale files in the
build directory, and also makes it work with LTO object files.
Additionally, keep track of the detected init calls, and add a handy
"-i" option to produce a human readable print of the initcalls in the
call sequence, which can be useful for debugging initialization problems
due to odd SYS_INIT and DEVICE interactions.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add `CONFIG_DEVICE_DEPS` to force two stage linking, otherwise the
following check means the test never runs:
```
if (TARGET zephyr_pre1)
add_dependencies(zephyr_pre1 check_init_priorities_output)
endif()
```
Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
zephyr_pre1 target may not always exists, e.g. if second linking pass is
not needed.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
Add a test specifically for the check_init_priorities scripts.
The test creates a set of fake devices to exercise the three possible
conditions, run a build, run the check script and validate the script
output.
The check is meant to fail the build on error but that's bypassed in
this case as that would fail the twister run. That specific bit is
covered in unit tests anyway.
Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>