platformio / platformio/platformio-core
Support generation of code coverage data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.5k
- Forks
- 905
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 2
Description
Tutorials
- https://piolabs.com/blog/insights/test-coverage-on-unit-testing.html
- https://blog.leon0399.ru/platformio-coverage-github-actions
Hi Ivan,
I searched for this kind of topic and didn't find anything but let me know if this is a duplicate.
I have my Transition library being tested on Travis using my ArduinoFrameworkFake library which has been working well since you gave me directions on how to import the library.
I'd now like to gather some information regarding coverage so that I can identify areas where I am not testing my code sufficiently. I tried using the build_flags section in platformio.ini to pass --coverage but was met with a lot of linker errors that I tried (unsuccessfully) to resolve.
Here's a few of the combinations of options I tried using
-g -O0 --coverage -fPIC -shared -Wl,-fprofile-generate -Wl,-shared -Wl,-fPIC
-fprofile-arcs -ftest-coverage -fprofile-generate -Wl,-lgcov --coverage
I am successfully generating coverage using: https://github.com/r89m/Transition/blob/master/.travis.yml#L56
which is giving me the output I'd like (https://coveralls.io/jobs/22116632) but I'd love to be able to do something along the lines of pio test --coverage or similar and generate the necessary gcno and gcda files.
Any help would be appreciated.
Richard
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pio test entry point and the coverage setup in the linked .travis.yml. Compare the existing compiler and linker flags with the requested gcno and gcda outputs, then define how a pio test --coverage workflow should expose them. Done means coverage data is generated without manual flag combinations and can be consumed by the reported coverage tooling.
Written by the indexing model from the issue text.
Assessment
- Domain
- build-system, embedded-iot, testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100