do coverage test without install lcov
Hi, hackers
In [1]https://www.postgresql.org/docs/13/regress-coverage.html wrote:
If you don't have lcov or prefer text output over an HTML report, you can also run
make coverage
[1]: https://www.postgresql.org/docs/13/regress-coverage.html
It seems the lcov is not a necessary program to run a coverage test.
But when I configure with --enable-coverage, then error was reported:
checking for lcov... no
configure: error: lcov not found
Because it's a little difficult to install lcov in offline environment and we can get a
text format result by running make coverage. How about change this action, when
there is no lcov in system, only a warning message is reported.
The patch attached. Thought ?
Best regards
Shenhao Wang
Attachments:
0001-make-enable-coverage-success-without-lcov.patchapplication/octet-stream; name=0001-make-enable-coverage-success-without-lcov.patchDownload
From 3cd9b06134a7503f6cfbb7b8c1847aac026e7280 Mon Sep 17 00:00:00 2001
From: Shenhao Wang <wangsh.fnst@cn.fujitsu.com>
Date: Mon, 22 Feb 2021 16:10:17 +0800
Subject: [PATCH] make --enable-coverage success without lcov
---
configure | 10 ++++++++--
configure.ac | 6 ++++--
src/Makefile.global.in | 7 +++++--
3 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/configure b/configure
index ce9ea36999..aceadaf7f6 100755
--- a/configure
+++ b/configure
@@ -3476,7 +3476,10 @@ $as_echo "$LCOV" >&6; }
fi
if test -z "$LCOV"; then
- as_fn_error $? "lcov not found" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+*** Without lcov you will not be able to generate HTML format report." >&5
+$as_echo "$as_me: WARNING:
+*** Without lcov you will not be able to generate HTML format report." >&2;}
fi
if test -z "$GENHTML"; then
for ac_prog in genhtml
@@ -3533,7 +3536,10 @@ $as_echo "$GENHTML" >&6; }
fi
if test -z "$GENHTML"; then
- as_fn_error $? "genhtml not found" "$LINENO" 5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
+*** Without genhtml you will not be able to generate HTML format report." >&5
+$as_echo "$as_me: WARNING:
+*** Without genhtml you will not be able to generate HTML format report." >&2;}
fi
;;
no)
diff --git a/configure.ac b/configure.ac
index f54f65febe..459b90474b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -221,11 +221,13 @@ if test -z "$GCOV"; then
fi
PGAC_PATH_PROGS(LCOV, lcov)
if test -z "$LCOV"; then
- AC_MSG_ERROR([lcov not found])
+ AC_MSG_WARN([
+*** Without lcov you will not be able to generate HTML format report.])
fi
PGAC_PATH_PROGS(GENHTML, genhtml)
if test -z "$GENHTML"; then
- AC_MSG_ERROR([genhtml not found])
+ AC_MSG_WARN([
+*** Without genhtml you will not be able to generate HTML format report.])
fi])
AC_SUBST(enable_coverage)
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 74b3a6acd2..3286368408 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -1003,12 +1003,15 @@ coverage-html-stamp: lcov_base.info lcov_test.info
$(GENHTML) $(GENHTML_FLAGS) -o coverage --title='$(GENHTML_TITLE)' --num-spaces=4 $(if $(filter no,$(vpath_build)),--prefix='$(abs_top_srcdir)') $^
touch $@
-LCOV += --gcov-tool $(GCOV)
-LCOVFLAGS = -q --no-external
+LCOVFLAGS = --gcov-tool $(GCOV) -q --no-external
all_gcno_files = $(shell find . -name '*.gcno' -print)
lcov_base.info: $(all_gcno_files)
+ifeq ($(LCOV),)
+ @echo "please install lcov and re-configure"; \
+ false;
+endif
$(LCOV) $(LCOVFLAGS) -c -i -d . -d $(srcdir) -o $@
all_gcda_files = $(shell find . -name '*.gcda' -print)
--
2.26.2
"wangsh.fnst@fujitsu.com" <wangsh.fnst@fujitsu.com> writes:
Because it's a little difficult to install lcov in offline environment and we can get a
text format result by running make coverage. How about change this action, when
there is no lcov in system, only a warning message is reported.
The patch attached. Thought ?
This should use the "missing" mechanism that's already used for,
e.g., flex and bison.
regards, tom lane