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
tests: support coverage report for unit tests #2442
Comments
I should have a PR ready for this today, still testing... |
Currently, make check runs the unit tests and reports pass/fail, but we have no way to guage how much of the code is covered by these tests. gcov provides those statistics on a per source file basis, but requires special CFLAGS and LDFLAGS. Here, we add the --enable-gcov configure option to setup those options correctly. We also add a make target called check-coverage, which runs the unit tests, runs gcov and uploads the data to the codecov.io cloud service for display. Finally, we include a Dockerfile.gcov which creates a container image in alpine linux to run the tests. To create the image: $ docker build \ --build-arg commit=`git rev-parse HEAD` \ --build-arg token=<upload token from codecov.io> \ -t frr-gcov:latest \ -f docker/alpine/Dockerfile.gcov . and to create and upload the report: $ docker run -it --rm frr-gcov:latest Testing done: Created and uploaded a report from my fork using alpine linux 3.7 Issue: FRRouting#2442 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
With the PR referenced here, it should be easy for me to setup a nightly (or so) coverage report on my local Bamboo instance which I can push out to here: https://codecov.io/gh/ajones-rvbd/frr/. The details for how I would be running that are in the commit messages. I think that PR is ready to go in... |
Currently, make check runs the unit tests and reports pass/fail, but we have no way to guage how much of the code is covered by these tests. gcov provides those statistics on a per source file basis, but requires special CFLAGS and LDFLAGS. Here, we add the --enable-gcov configure option to setup those options correctly. We also add a make target called check-coverage, which runs the unit tests, runs gcov and uploads the data to the codecov.io cloud service for display. Finally, we include a Dockerfile.gcov which creates a container image in alpine linux to run the tests. To create the image: $ docker build \ --build-arg commit=`git rev-parse HEAD` \ --build-arg token=<upload token from codecov.io> \ -t frr-gcov:latest \ -f docker/alpine/Dockerfile.gcov . and to create and upload the report: $ docker run -it --rm frr-gcov:latest Testing done: Created and uploaded a report from my fork using alpine linux 3.7 Issue: FRRouting#2442 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
Ugh, looks like I forgot to open the PR... Re-based the commit and added a PR for this... |
Currently, make check runs the unit tests and reports pass/fail, but we have no way to guage how much of the code is covered by these tests. gcov provides those statistics on a per source file basis, but requires special CFLAGS and LDFLAGS. Here, we add the --enable-gcov configure option to setup those options correctly. We also add a make target called check-coverage, which runs the unit tests, runs gcov and uploads the data to the codecov.io cloud service for display. Finally, we include a Dockerfile-coverage which creates a container image in alpine linux to run the tests. To create the image: $ docker build \ --build-arg commit=`git rev-parse HEAD` \ --build-arg token=<upload token from codecov.io> \ -t frr-gcov:latest \ -f docker/alpine/Dockerfile-coverage . and to create and upload the report: $ docker run -it --rm frr-gcov:latest Testing done: Created and uploaded a report from my fork using alpine linux 3.7. Non-coverage alpine 3.7 build still works. Issue: FRRouting#2442 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
Currently, make check runs the unit tests and reports pass/fail, but we have no way to guage how much of the code is covered by these tests. gcov provides those statistics on a per source file basis, but requires special CFLAGS and LDFLAGS. Here, we add the --enable-gcov configure option to setup those options correctly. We also add a make target called check-coverage, which runs the unit tests, runs gcov and uploads the data to the codecov.io cloud service for display. Finally, we include a Dockerfile-coverage which creates a container image in alpine linux to run the tests. To create the image: $ docker build \ --build-arg commit=`git rev-parse HEAD` \ --build-arg token=<upload token from codecov.io> \ -t frr-gcov:latest \ -f docker/alpine/Dockerfile-coverage . and to create and upload the report: $ docker run -it --rm frr-gcov:latest Testing done: Created and uploaded a report from my fork using alpine linux 3.7. Non-coverage alpine 3.7 build still works. Issue: FRRouting#2442 Signed-off-by: Arthur Jones <arthur.jones@riverbed.com>
Fixed pushed... |
A sample make check coverage report is here: https://codecov.io/gh/ajones-rvbd/frr
It requires gcov and a new make target, let's add that to the repo...
The text was updated successfully, but these errors were encountered: