dmce

dmce compares code coverage to changed lines in a git repo
git clone https://noulin.net/git/dmce.git
Log | Files | Refs | LICENSE

commit 17c8e2a54cbaa02890eca91465e643b347ef0900
parent 6f9e767014493d3d052c6ae6fd91215a78b6fb25
Author: Remy Noulin <loader2x@gmail.com>
Date:   Wed, 23 Oct 2019 14:42:36 +0200

check gcov file date and exit when gcov file is old

dmce.c      | 7 +++++++
package.yml | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)

Diffstat:
Mdmce.c | 7+++++++
Mpackage.yml | 2+-
2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/dmce.c b/dmce.c @@ -47,6 +47,7 @@ int MAIN(int ARGC, char** ARGV) { createAllocateSmallArray(rawCov); // load gcov file + time_t gcovTime = getModificationTimeG(g); // store source code coverage in coverage list readFileG(rawCov, ssGet(g)); forEachSmallArray(rawCov, l) { @@ -64,6 +65,11 @@ int MAIN(int ARGC, char** ARGV) { sliceG(g,0,-5); printf("--- %s\n\n", ssGet(g)); printf("\n"); + time_t time = getModificationTimeG(g); + if (gcovTime < time) { + logE("Gcov file for %s is old.", ssGet(g)); + XFailure; + } // create git diff command char *cmd; cmd = appendS("git diff --no-prefix -U100000 ", ssGet(g)); { @@ -90,6 +96,7 @@ int MAIN(int ARGC, char** ARGV) { //print 'cov: %d - %s', lines+5, coverage[lines+5] // check new lines have been executed smallStringt *s = getG(coverage, rtSmallStringt, lines+5); + if (not s) logXFailure(".c and .c.gcov files probably don't match"); if (hasG(s, "#####:")) { // print new code that has not been executed in the unit tests printf("%10d: %s", lines, ssGet(L)); diff --git a/package.yml b/package.yml @@ -1,6 +1,6 @@ --- name: dmce - version: 0.0.2 + version: 0.0.3 description: dmce compares code coverage to changed lines in a git repo bin: ./dmce.c scripts: