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

Twister generated code coverage report missing files outside the zephyr repository. #83764

Open
solsbarry opened this issue Jan 9, 2025 · 0 comments
Labels
area: Code Coverage bug The issue is a bug, or the PR is fixing a bug

Comments

@solsbarry
Copy link
Contributor

solsbarry commented Jan 9, 2025

Describe the bug
I have a zephyr workspace style project, and I recently added ztest unit tests to it, and started using twister to execute the tests and generate code coverage. Everything is working great, except in my code coverage report the only files it reports on are files in the zephyr repo. I have several other repos (my own included) that are contributing files, and none of those files shows up in the code coverage report. Also all of the file paths in the code coverage report are relative to zephyr, which I find odd since I would hope it would report on files outside of zephyr

This is a test running on the native_sim platform on a Ubuntu host.
I am using gcov and gcovr.

To Reproduce
Steps to reproduce the behavior:

  1. Create zephyr workspace style project
  2. Add some source code to a folder outside zephyr
  3. Add a unit test project outside zephyr that uses that source code from step 2
  4. Use twister to compile, and execute the unit test, and generate a code coverage report (use --coverage)
  5. View generated code coverage report and see that code from outside zephyr repo is not included.

Expected behavior
I would expect the code coverage to include all source files used to generate the code.

And honestly I only care about the files from my repository. I would love a way to specify directories I want included in the code coverage report. But I am happy to post process the report myself and strip out the information I don't want.

Impact
This is annoying because ultimately if I can't get it to work then I have to generate the report myself, which I see the gcda and gcno files for the source I am interested in. So I guess there is probably a way to generate this myself, but I was so happy when I thought twister would do all this for me.

Logs and console output
coverage.zip
These are the files for the coverage generated for a unit test whose main.c calls all the functions in my source file called database.c, and I don't see database.c in that report.

Environment (please complete the following information):

  • OS: Linux (ubuntu 22.04)
  • Toolchain 0.16.8
  • Commit SHA or Version used 4.0.0

Additional context

I don't know what else would be helpful. But I am happy to provide as much information as I can.
Also I hope I am not just being a fool. Thanks for your help.

@solsbarry solsbarry added the bug The issue is a bug, or the PR is fixing a bug label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Code Coverage bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

2 participants