Commit a8e0cfb1 authored by Rusty Russell's avatar Rusty Russell

ccanlint: handle gcov where there's actually no C code

Macro packages do this.
parent 93aefd28
...@@ -150,7 +150,7 @@ static bool run_test(struct ccanlint *i, ...@@ -150,7 +150,7 @@ static bool run_test(struct ccanlint *i,
else else
this_score = 0; this_score = 0;
bad = (this_score == 0); bad = (this_score == 0 && i->total_score != 0);
good = (this_score >= i->total_score); good = (this_score >= i->total_score);
if (verbose || (bad && !quiet)) { if (verbose || (bad && !quiet)) {
......
...@@ -47,7 +47,7 @@ static void analyze_coverage(struct manifest *m, ...@@ -47,7 +47,7 @@ static void analyze_coverage(struct manifest *m,
unsigned int i, total_lines = 0; unsigned int i, total_lines = 0;
bool lines_matter = false; bool lines_matter = false;
/* FIXME: We assume GCOV mentions all files! /*
Output looks like: Output looks like:
File '../../../ccan/tdb2/private.h' File '../../../ccan/tdb2/private.h'
Lines executed:0.00% of 8 Lines executed:0.00% of 8
...@@ -99,10 +99,13 @@ static void analyze_coverage(struct manifest *m, ...@@ -99,10 +99,13 @@ static void analyze_coverage(struct manifest *m,
} }
} }
/* Nothing covered? */ /* Nothing covered? We can't tell if there's a source file which
if (total_lines == 0) * 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; res->uncovered = 1.0;
else run_coverage_tests.total_score = 0;
} else
res->uncovered = 1.0 - covered_lines / total_lines; res->uncovered = 1.0 - covered_lines / total_lines;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment