X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fccanlint%2Ftests%2Frun-coverage.c;h=886aebd54424b9019eb212eca4a91e649c799dd7;hp=a46b02e0722beea2941ee6aa2b184979f3cff72d;hb=3cd1d24a9e2e578890951d723e0461ed13444650;hpb=24908e18c8db7543084e16707b7b82ef5a094d7a diff --git a/tools/ccanlint/tests/run-coverage.c b/tools/ccanlint/tests/run-coverage.c index a46b02e0..886aebd5 100644 --- a/tools/ccanlint/tests/run-coverage.c +++ b/tools/ccanlint/tests/run-coverage.c @@ -47,7 +47,7 @@ static void analyze_coverage(struct manifest *m, unsigned int i, total_lines = 0; bool lines_matter = false; - /* FIXME: We assume GCOV mentions all files! + /* Output looks like: File '../../../ccan/tdb2/private.h' Lines executed:0.00% of 8 @@ -99,10 +99,13 @@ static void analyze_coverage(struct manifest *m, } } - /* Nothing covered? */ - if (total_lines == 0) + /* Nothing covered? We can't tell if there's a source file which + * was never executed, or there really is no code to execute, so + * assume the latter: this test deserves no score. */ + if (total_lines == 0) { res->uncovered = 1.0; - else + run_coverage_tests.total_score = 0; + } else res->uncovered = 1.0 - covered_lines / total_lines; }