ztest and code coverage on actual hardware


We are trying to get twister working to run zephyr tests with code coverage using real hardware (Nordic-based) but seem to be having issues with this:
  1. The nrfjprog reset does not seem to work - the kernel tests halt when they run the oops function and the `nrfjprog --reset` function does not work when the module is in this state, it seems to only work when using --debugreset and it doesn't look like twister can use this (I've opened a support ticket with nordic on this separately)
  2. With code coverage enabled for our modules in the boards file and running twister with it enabled, tests do not seem to run, the start up code gets stuck on https://github.com/zephyrproject-rtos/zephyr/blob/main/subsys/testsuite/coverage/coverage.c#L273 where it faults, if we enable code coverage with a normal non-test application e.g. hello_world, we see it run and then output the gcov data, if we run the test without code coverage enabled, it works. It only seems to be when both ztest and code coverage are enabled that this does not work
  3. It mentions in one of the MPU files that userspace is required for code coverage but I don't understand the reason for this, e.g. with the hello_world example it is not using userspace and can still output data (I haven't checked the data to see if it's valid or not). This raises an issue because if we try building one of the kernel tests with code coverage and userspace mode enabled, the required RAM is about 300KB - we are aiming to test on modules with 64-256KB RAM so a 300KB requirement is unworkable
Does anyone have ideas for these issues or do code coverage checks on real hardware?

Join devel@lists.zephyrproject.org to automatically receive all group messages.