Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make: fix reported code coverage for *.h
details: https://anonhg.NetBSD.org/src/rev/3b43afb1bd2d
branches: trunk
changeset: 983630:3b43afb1bd2d
user: rillig <rillig%NetBSD.org@localhost>
date: Sun May 30 21:03:08 2021 +0000
description:
make: fix reported code coverage for *.h
In 'make test-coverage', the number of uncovered lines for inline
functions in headers was reported too high. The cause for this is that
gcov reports the coverage for these functions multiple times, once per
translation unit. If some of the translation units don't use these
inline functions, summing the lines containing '#####' quickly leads to
numbers that are obviously too high.
diffstat:
usr.bin/make/Makefile | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diffs (23 lines):
diff -r 9b4a049f3e44 -r 3b43afb1bd2d usr.bin/make/Makefile
--- a/usr.bin/make/Makefile Sun May 30 21:01:43 2021 +0000
+++ b/usr.bin/make/Makefile Sun May 30 21:03:08 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.114 2021/04/11 11:41:27 rillig Exp $
+# $NetBSD: Makefile,v 1.115 2021/05/30 21:03:08 rillig Exp $
# @(#)Makefile 5.2 (Berkeley) 12/28/90
PROG= make
@@ -35,8 +35,11 @@
GCOV_PERL+= $$func = $$1;
GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/ && defined($$file)) {
GCOV_PERL+= my ($$percent, $$lines) = ($$1, $$2);
-GCOV_PERL+= my $$uncovered = `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`;
-GCOV_PERL+= printf("%7.2f %4d/%4d %s%s\n",
+GCOV_PERL+= my $$uncovered = $$file =~ /\.h$$/
+GCOV_PERL+= ? '?'
+GCOV_PERL+= : `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`;
+GCOV_PERL+= chomp($$uncovered);
+GCOV_PERL+= printf("%7.2f %4s/%4d %s%s\n",
GCOV_PERL+= $$percent, $$uncovered, $$lines, $$file, $$func);
GCOV_PERL+= $$file = undef;
GCOV_PERL+= }
Home |
Main Index |
Thread Index |
Old Index