[petsc-dev] gcov tests on my machine before CI

Jacob Faibussowitsch jacob.fai at gmail.com
Fri Feb 24 10:26:49 CST 2023


Sorry this slipped my radar yesterday.

> Can one do this trivially now?

Depends on what you call trivial :). Assuming that you can actually run the code on your machine (e.g. it is not a CUDA test and you don’t have a GPU), and assuming you have successfully configured using --with-coverage, then you can do:

$ make cleantest # very important!
$ make test s=query_that_runs_your_test
$ make gcov
$ make mergegcov

This will produce the same coverage report locally as on CI, but should only give you a coverage report on a subset of code. The critical part is `make cleantest`, since `make gcov` will search all test directories for GCOV output files (and compile them all). So the only ones you want in there are the ones you care about, the more specific, the better.

> automatically tells me all new code in my current branch that is not tested?

`make mergegcov` should tell you this.

Best regards,

Jacob Faibussowitsch
(Jacob Fai - booss - oh - vitch)

> On Feb 23, 2023, at 12:59, Barry Smith <bsmith at petsc.dev> wrote:
> 
> 
>  Jacob,
> 
>  When I am adding code it makes sense that the new code I just added is tested, at least to some degree, on my machine before I create an MR. This means that my running appropriate gcov on just my local machine should provide enough information to indicate that my new code is NOT covered (without needing a full run on the entire CI). 
> 
>   Can one do this trivially now? Can the code in the CI that tracks the coverage be modified in some small way to allow me to trivially do the checking myself?
> 
>   For example, some gcov flag for configure and then a gcov flag for make alltests and then alltests automatically tells me all new code in my current branch that is not tested?
> 
>   Thanks
> 
>  Barry
> 
> 
> 



More information about the petsc-dev mailing list