Running our test suite creates coverage information in coverage.out:
$ ./run-tests.sh 6.1
Fetching linux-6.1-amd64.tgz
Fetching linux-6.1-amd64-selftests-bpf.tgz
...
$ ls -lh coverage.out
-rw-r--r--. 1 lorenz lorenz 521K Dec 6 14:12 coverage.out
That can be turned into a html report like so:
$ go tool cover -html=coverage.out -o coverage.html
$ ls -lh coverage.html
-rw-r--r--. 1 lorenz lorenz 899K Dec 6 14:56 coverage.html
We should integrate this into our CI:
- Upload each generated
coverage.out as an artifact for that job
- Collect all
coverage.out from the various jobs and merge them using go tool covdata merge
- Generate a single .html which shows overall test coverage and upload attach that to the build somehow
- Brownie points if its possible to look at the coverage html by just clicking on a link instead of downloading + extracting
Running our test suite creates coverage information in
coverage.out:That can be turned into a html report like so:
We should integrate this into our CI:
coverage.outas an artifact for that jobcoverage.outfrom the various jobs and merge them usinggo tool covdata merge