From: "flichtenheld (Code Review)" Date: Wed, 25 Mar 2026 15:09:46 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: <8034c83b7e5c709f79b786d48346fa78e7fde4b6-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="p7DySUWHWss="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: configure: Add --enable-code-coverage List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --p7DySUWHWss= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1592?usp=3Demail to review the following change. Change subject: configure: Add --enable-code-coverage ...................................................................... configure: Add --enable-code-coverage Can be used like this ./configure --enable-code-coverage make make check make code-coverage-capture Change-Id: I79b2dc4a550b1c5068a45407976b0dfc2f765b33 Signed-off-by: Frank Lichtenheld --- M .gitignore M Makefile.am M configure.ac M m4/ax_code_coverage.m4 M src/openvpn/Makefile.am 5 files changed, 24 insertions(+), 6 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/92/1592/1 diff --git a/.gitignore b/.gitignore index 04523af..e25e591 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ *.[oa] *.l[oa] +*.gcda +*.gcno *.dll *.exe *.exe.* @@ -18,6 +20,7 @@ Makefile Makefile.in aclocal.m4 +aminclude_static.am autodefs.h autom4te.cache config.guess diff --git a/Makefile.am b/Makefile.am index 362ae96..4af5e7e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -22,6 +22,8 @@ # with this program; if not, see . # +include $(top_srcdir)/aminclude_static.am + ACLOCAL_AMFLAGS =3D -I m4 MAINTAINERCLEANFILES =3D \ @@ -89,3 +91,7 @@ doxygen: $(MAKE) -C doc/doxygen doxygen + +CODE_COVERAGE_LCOV_SHOPTS=3D--config-file $(srcdir)/lcovrc +clean-local: code-coverage-clean +distclean-local: code-coverage-dist-clean diff --git a/configure.ac b/configure.ac index 5da877a..82d3bce 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,8 @@ AC_CANONICAL_HOST AC_USE_SYSTEM_EXTENSIONS +AX_CODE_COVERAGE + AC_ARG_ENABLE( [lzo], [AS_HELP_STRING([--disable-lzo], [disable LZO compression support @<:@def= ault=3Dyes@:>@])], @@ -1255,6 +1257,11 @@ ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type]) fi +# If coverage is enabled remove -O arguments from CFLAGS +if test "$enable_code_coverage" =3D "yes"; then + [CFLAGS=3D"`echo $CFLAGS | $SED -e 's/-O[s0-9]\\?//g'`"] +fi + if test "${enable_pedantic}" =3D "yes"; then CFLAGS=3D"${CFLAGS} -pedantic" AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) @@ -1374,10 +1381,10 @@ TEST_LDFLAGS=3D"${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_HELPER_LIBS} ${O= PTIONAL_LIBCAPNG_LIBS}" TEST_LDFLAGS=3D"${TEST_LDFLAGS} ${OPTIONAL_LIBNL_GENL_LIBS}" -TEST_LDFLAGS=3D"${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS}" +TEST_LDFLAGS=3D"${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS} ${CODE= _COVERAGE_LIBS}" TEST_CFLAGS=3D"${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_HELPER_CFLAGS} = ${OPTIONAL_LIBCAPNG_CFLAGS}" TEST_CFLAGS=3D"${TEST_CFLAGS} ${OPTIONAL_LIBNL_GENL_CFLAGS} ${OPTIONAL_LZO= _CFLAGS}" -TEST_CFLAGS=3D"${TEST_CFLAGS} -I\$(top_srcdir)/include ${CMOCKA_CFLAGS}" +TEST_CFLAGS=3D"${TEST_CFLAGS} -I\$(top_srcdir)/include ${CMOCKA_CFLAGS} ${= CODE_COVERAGE_CFLAGS}" AC_SUBST([TEST_LDFLAGS]) AC_SUBST([TEST_CFLAGS]) diff --git a/m4/ax_code_coverage.m4 b/m4/ax_code_coverage.m4 index 216708a4..4a01ce6 100644 --- a/m4/ax_code_coverage.m4 +++ b/m4/ax_code_coverage.m4 @@ -232,13 +232,12 @@ AC_MSG_ERROR([Could not find genhtml from the lcov package]) ]) - AC_CHECK_LIB([gcov], [_gcov_init], [CODE_COVERAGE_LIBS=3D"-lgcov"], [CODE= _COVERAGE_LIBS=3D""]) - dnl Build the code coverage flags dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility CODE_COVERAGE_CPPFLAGS=3D"-DNDEBUG" - CODE_COVERAGE_CFLAGS=3D"-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_CXXFLAGS=3D"-O0 -g -fprofile-arcs -ftest-coverage" + CODE_COVERAGE_CFLAGS=3D"-O0 -g --coverage" + CODE_COVERAGE_CXXFLAGS=3D"-O0 -g --coverage" + CODE_COVERAGE_LIBS=3D"--coverage" AC_SUBST([CODE_COVERAGE_CPPFLAGS]) AC_SUBST([CODE_COVERAGE_CFLAGS]) diff --git a/src/openvpn/Makefile.am b/src/openvpn/Makefile.am index ff8cc54..47a4926 100644 --- a/src/openvpn/Makefile.am +++ b/src/openvpn/Makefile.am @@ -31,9 +31,12 @@ $(OPTIONAL_SYSTEMD_CFLAGS) \ $(OPTIONAL_PKCS11_HELPER_CFLAGS) \ $(OPTIONAL_INOTIFY_CFLAGS) \ + $(CODE_COVERAGE_CFLAGS) \ -DPLUGIN_LIBDIR=3D\"${plugindir}\" \ -DDEFAULT_DNS_UPDOWN=3D\"${scriptdir}/dns-updown\" +AM_LIBS =3D $(CODE_COVERAGE_LIBS) + if WIN32 # we want unicode entry point but not the macro AM_CFLAGS +=3D -municode -UUNICODE -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1592?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I79b2dc4a550b1c5068a45407976b0dfc2f765b33 Gerrit-Change-Number: 1592 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --p7DySUWHWss= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

configure: Add --enable-code-coverage
Can be used like this
./configure --enable-code-coverage
make
ma= ke check
make code-coverage-capture

Change-Id: I79b2dc4a550b1c506= 8a45407976b0dfc2f765b33
Signed-off-by: Frank Lichtenheld <frank@...2375...= 41...>
---
M .gitignore
M Makefile.am
M configure.ac
M m4= /ax_code_coverage.m4
M src/openvpn/Makefile.am
5 files changed, 24 in= sertions(+), 6 deletions(-)

git pull ssh://gerri=
t.openvpn.net:29418/openvpn refs/changes/92/1592/1
diff --git a/.gi=
tignore b/.gitignore
index 04523af..e25e591 100644--- a/.gitignore
+++ b/.gitignore
@= @ -1,5 +1,7 @@
*.[oa]
*.l[oa]
<= span style=3D"color: hsl(120, 100%, 40%);">+*.gcda
+*.gcno
*.dll
*.exe
*.exe.*
@@ -18,6 +20,7 @@<= br> Makefile
Makefile.in
aclocal.m4=
+aminclude_static.am=
autodefs.h
autom4te.cache
config.guess
diff --git a/Makefile.am b/Makefile.am

index 362ae96..4af5e7e 100644
--- a/Makefile.am=
+++ b/Makefile.am
@@ -22,6 +22,8 @@=
# with this program; if not, see <https://www.gnu.org/licens= es/>.
#

+include $(top_srcdir)/aminclude_static.am<= br>+
ACLOCAL_A= MFLAGS =3D -I m4

MAINTAINERCLEANFILES = =3D \
@@ -89,3 +91,7 @@

= doxygen:
$(MAKE) -C doc/doxygen doxygen
+
+CODE_COVERAGE_LCOV_SHOPTS=3D--config-file $(srcdir)/lcov= rc
+clean-local: code= -coverage-clean
+dist= clean-local: code-coverage-dist-clean
diff --git a/configur= e.ac b/configure.ac
index 5da877a..82d3bce 100644--- a/configure.ac
+++ b/configure.ac
@@ -59,6 +59,8 @@
AC_CANONICAL_HOST
AC_= USE_SYSTEM_EXTENSIONS

+AX_CODE_COVERAGE
+
AC_ARG_ENABLE(
[lzo],<= /span>
[AS_HELP_STRING([--disable-lzo], [disable LZO compression= support @<:@default=3Dyes@:>@])],
@@ -1255,6 +1257,1= 1 @@
ACL_CHECK_ADD_COMPILE_FLAGS([-Wno-cast-function-type= ])
fi

+# If coverage is enabled remove -O arguments from CFLA= GS
+if test "$en= able_code_coverage" =3D "yes"; then
+ [CFLAGS=3D"`echo $CFLAGS | $SED -e &= #39;s/-O[s0-9]\\?//g'`"]
+fi
+
if test "${enable_pedantic}" =3D "yes"; = then
CFLAGS=3D"${CFLAGS} -pedantic"
<= span> AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode])

@= @ -1374,10 +1381,10 @@

TEST_LDFLAGS=3D&q= uot;${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_HELPER_LIBS} ${OPTIONAL_LIBCA= PNG_LIBS}"
TEST_LDFLAGS=3D"${TEST_LDFLAGS} ${OPT= IONAL_LIBNL_GENL_LIBS}"
-TEST_LDFLAGS=3D"${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_L= IBS}"
+TEST_LDFL= AGS=3D"${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS} ${CODE_COVE= RAGE_LIBS}"
TEST_CFLAGS=3D"${OPTIONAL_CRYPTO_CFL= AGS} ${OPTIONAL_PKCS11_HELPER_CFLAGS} ${OPTIONAL_LIBCAPNG_CFLAGS}"
TEST_CFLAGS=3D"${TEST_CFLAGS} ${OPTIONAL_LIBNL_GENL_CFLA= GS} ${OPTIONAL_LZO_CFLAGS}"
-TEST_CFLAGS=3D"${TEST_CFLAGS} -I\$(top_srcdir)/include ${CM= OCKA_CFLAGS}"
+T= EST_CFLAGS=3D"${TEST_CFLAGS} -I\$(top_srcdir)/include ${CMOCKA_CFLAGS}= ${CODE_COVERAGE_CFLAGS}"

AC_SUBST(= [TEST_LDFLAGS])
AC_SUBST([TEST_CFLAGS])
di= ff --git a/m4/ax_code_coverage.m4 b/m4/ax_code_coverage.m4
= index 216708a4..4a01ce6 100644
--- a/m4/ax_code_coverage.m4=
+++ b/m4/ax_code_coverage.m4
@@ -232,13 +2= 32,12 @@
AC_MSG_ERROR([Could not find genhtml from the l= cov package])
])

- AC_CHECK_LIB([gcov], [_gcov_init], [CODE_C= OVERAGE_LIBS=3D"-lgcov"], [CODE_COVERAGE_LIBS=3D""])
-
dnl B= uild the code coverage flags
dnl Define CODE_COVERAGE_LDF= LAGS for backwards compatibility
CODE_COVERAGE_CPPFLAGS= =3D"-DNDEBUG"
- CODE_COVERAGE_CFLAGS=3D"-O0 -g -fprofile-arcs -ftest-coverage"=
- CODE_COVERAGE_CXXFLA= GS=3D"-O0 -g -fprofile-arcs -ftest-coverage"
+ CODE_COVERAGE_CFLAGS=3D"-O0 -g --c= overage"
+ CODE_= COVERAGE_CXXFLAGS=3D"-O0 -g --coverage"
+ CODE_COVERAGE_LIBS=3D"--coverage"<= /span>

AC_SUBST([CODE_COVERAGE_CPPFLAGS])

AC_SUBST([CODE_COVERAGE_CFLAGS])
diff --git a= /src/openvpn/Makefile.am b/src/openvpn/Makefile.am
index ff= 8cc54..47a4926 100644
--- a/src/openvpn/Makefile.am<= br>+++ b/src/openvpn/Makefile.am
@@ -31,9 +31,12 @@
$(OPTIONAL_SYSTEMD_CFLAGS) \
$(OPTIONAL_= PKCS11_HELPER_CFLAGS) \
$(OPTIONAL_INOTIFY_CFLAGS) \

+ $(CODE_COVERAGE_CFLAGS)= \
-DPLUGIN_LIBDIR=3D\"${plugindir}\" \<= br> -DDEFAULT_DNS_UPDOWN=3D\"${scriptdir}/dns-updown\"

+AM_LI= BS =3D $(CODE_COVERAGE_LIBS)
+
if WIN32
# we want unicode entr= y point but not the macro
AM_CFLAGS +=3D -municode -UUNICO= DE

To view, visit change 1592. To unsubscri= be, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I79b2dc4a550b1c5068a45407976= b0dfc2f765b33
Gerrit-Change-Number: 1592
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --p7DySUWHWss=--