File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -737,6 +737,39 @@ and IO errors are difficult to simulate in C.) Code coverage statistics are
737
737
automatically tracked using [ CodeCov] ( https://codecov.io/gh/tskit-dev/tskit/ ) .
738
738
739
739
740
+ ### Viewing coverage reports
741
+
742
+ To generate and view coverage reports for the C tests locally:
743
+
744
+ Compile with coverage enabled:
745
+ ``` bash
746
+ $ cd c
747
+ $ meson build -D b_coverage=true
748
+ $ ninja -C build
749
+ ```
750
+
751
+ Run the tests:
752
+ ``` bash
753
+ $ ninja -C build test
754
+ ```
755
+
756
+ Generate coverage data:
757
+ ``` bash
758
+ $ cd build
759
+ $ find ../tskit/* .c -type f -printf " %f\n" | xargs -i gcov -pb libtskit.a.p/tskit_{}.gcno ../tskit/{}
760
+ ```
761
+
762
+ The generated ` .gcov ` files can then be viewed directly with ` cat filename.c.gcov ` .
763
+ Lines prefixed with ` ##### ` were never executed, lines with numbers show execution counts, and lines with ` - ` are non-executable code.
764
+
765
+ ` lcov ` can be used to create browsable HTML coverage reports:
766
+ ``` bash
767
+ $ sudo apt-get install lcov # if needed
768
+ $ lcov --capture --directory build-gcc --output-file coverage.info
769
+ $ genhtml coverage.info --output-directory coverage_html
770
+ $ firefox coverage_html/index.html
771
+ ```
772
+
740
773
### Coding conventions
741
774
742
775
The code is written using the [ C99] ( https://en.wikipedia.org/wiki/C99 ) standard. All
You can’t perform that action at this time.
0 commit comments