-
Notifications
You must be signed in to change notification settings - Fork 8k
use semihosting for collecting coverage data #94079
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
base: main
Are you sure you want to change the base?
Conversation
nashif
commented
Aug 4, 2025
- testsuite: coverage: Support semihosting
- testsuite: split coverage kconfig into own file
- tests: workqueue: increase stacks to allow coverage
- tests: increase stack sizes to support coverage
- samples: increase stack sizes to support coverage
- kernel: set DYNAMIC_THREAD_STACK_SIZE to 4096 for coverage
- tests: increase stacks to allow coverage
- tests: kernel: fatal: fix test name for no-mt
54e7404
to
91fec41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the majority of use cases this seems like the better solution.
I believe this wouldn't work as is for the reboot case (#72561), since each reboot would just overwrite the previous file.
I'm not sure if there's an easy way to support that, since the console version is relying on the gcov tool to merge the files to the expected path.
hmm, something to look at, I tried semihosting with both qemu and hardware and it seems to work, now sure how this works with gcov across multiple runs in general. |
1db8789
to
9ae86bf
Compare
merge_tool = self.gcov_tool + '-tool' | ||
for d1, d2 in zip(dirs[:-1], dirs[1:], strict=False): | ||
cmd = [merge_tool, 'merge', d1, d2, '--output', d2] | ||
print(f"Running command: {' '.join(cmd)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this stay in? Unsure if it's for debug purposes.
9ae86bf
to
c736671
Compare
kernel/Kconfig
Outdated
default 4096 if X86 | ||
default 1024 if !X86 && !64BIT | ||
default 2048 if !X86 && 64BIT | ||
default 4096 if COVERAGE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defaults are picked up on a first match basis, I think this needs to be up the top, unless you want the stack size to be 1024 when !X86 && !64BIT && COVERAGE
c736671
to
bda0116
Compare
@nordic-piks Maybe you could have a look at this? you have quite some experience with coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In its current state this leaves CONFIG_COVERAGE_DUMP
enabled when running twister tests. This would change if rebased on #96126.
It will also need its own conditional as added in #96042.
I used this PR as a base and added reboot support downstream in Embeint@3920b82
Not saying it needs to be part of this PR, but it is possible.
af51d15
to
38fc026
Compare
38fc026
to
d02fe08
Compare
@JordanYates please revisit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. There are two separate commits that are increasing test stack sizes that could be merged together, but won't block on that.
d02fe08
to
2a0553c
Compare
b372f58
to
98f3b09
Compare
Use semihosting to collect coverage data instead of dumping data to serial console. Signed-off-by: Anas Nashif <[email protected]>
Coverage options deserve their own kconfig, otherwise the testsuite Kconfig will be very crowded and difficult to read. Signed-off-by: Anas Nashif <[email protected]>
Test was failing to build on some scenarios when coverage was enabled. Signed-off-by: Anas Nashif <[email protected]>
Increase stack sizes to allow coverage to complete. Signed-off-by: Anas Nashif <[email protected]>
Increase stack sizes to allow coverage to complete. Signed-off-by: Anas Nashif <[email protected]>
Increase stack sizes to allow coverage to complete. Signed-off-by: Anas Nashif <[email protected]>
98f3b09
to
9fa6eb8
Compare
|