From patchwork Fri Aug 14 20:16:20 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5238 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:798a:b0:87d:ab56:3700 with SMTP id o10csp190399maz; Fri, 14 Aug 2026 13:17:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AHgh+Rr7wahdNoNTDxjrSaD5m3KKXIWiFr7Hr/OV8uJJ9fPXcRBukI/cNYq4QiVDm+1vxjlVqOeQxwGNWbU=@openvpn.net X-Received: by 2002:a05:6870:2c4b:b0:43d:38f1:854e with SMTP id 586e51a60fabf-45e9236132fmr7900397fac.16.1786738633054; Fri, 14 Aug 2026 13:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1786738633; cv=none; d=google.com; s=arc-20260327; b=U0RTYNvAdlBVD9yvQ6BUg+jxE8fRLsnm2fPK15iPSmHl+ZisK6MhlxKEYq8wEoWM0B YXlak0Y07qoDa9wVK+scWj+ZkVp2pz3QVnAU+BzielCKB0rdrPgxUzGGJGUEWBBt4bsr RiM0mBuJuNiYtdS0zcJHQwOvCr2ScEPMDfG8z+OGSlyShopDBnXg2PYP4X0NI0WO/af4 FsQMUoT1IBhpNurPXqPip+weP2D8FNb959J+hQgbaGIn43r++gx33P9jZLQqFovm7PMm ap+fl+2lEwW0AbULjheEMSxHBYGeXIq02GqZB1UXkLlNxluXNL6BRqk8JxEzl4gnnpB3 geHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=UvvyB4yT65brUWT5jBbo7j965QWwYsw4WIkynwD713Y=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=EDG1SIbsbTrhFz/cOHVBD/Zi7zSCdXfbGoP6G+kKwHOA011r3d3eTyoagBs2E1++b1 N63moFc0VYRAtkfXQHoOEw66voNAzl64u+mvwMnZbOKiFQvTWz+PePb0nqRcyaRx1+hT vkwE2RRW0xcwA409vnCqCC3vT8k6ync58GBDLkVAr6IHGETZm9vBUxqnOlAPt8zAwLRY 4EpKUtvCLCX7FeUU9oB7VpXsQYbiiSltCeE8KsuxQO0udc83Bu1hx6GHoRCpdnZBCFAB 9MKFE8NNYv6gSB1PdDnO7SjU7p5DN4u9P7C+EzhhFj1zh6V578lonsHrBwwDNBQLPEVr SxjQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=fSs4utHQ; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Q/D+CTLs"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mxqKuh0w; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-45e8f996fbasi4704821fac.97.2026.08.14.13.17.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Aug 2026 13:17:12 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=fSs4utHQ; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b="Q/D+CTLs"; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mxqKuh0w; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UvvyB4yT65brUWT5jBbo7j965QWwYsw4WIkynwD713Y=; b=fSs4utHQQUL9FaKNpffBpTHsJz pU3YeBBSmV0cllxLPKe0PlEW+rBNF/630rsXbilRKA4Wc7YCLa2695SspgTOtekfcLnrjD1mC+Hs6 f04p6/GIdpiiaU9lA6YqGGUYsXWuiMw8G9cn1/r6sBGInabiIF+0+K/I6P3/SNKzeP9M=; Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1wuyKu-0007YA-VL; Fri, 14 Aug 2026 20:17:05 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1wuyKf-0007Wb-BB for openvpn-devel@lists.sourceforge.net; Fri, 14 Aug 2026 20:16:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=s4rFZLU8eIg7WQYdUSwG0kE/6UVluTdixC5Hd8+VNsc=; b=Q/D+CTLsN+caTbtaS+YmgWb9ZZ JdgkeFki3SBlgAvBsDU8phYdoN6O6ePcVlIEV98O6CE+KoaK2JMF4Rg4cXFYseuXRmwCN8apTyxu4 RO+3zeYXa4xjUOHA6UCbHJKX9tzQgziXgdhf1zJSUMeySmi6kAk17UMaHQ75Amqgx2kE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=s4rFZLU8eIg7WQYdUSwG0kE/6UVluTdixC5Hd8+VNsc=; b=mxqKuh0w9uhsU0kAGzMCwhnrGQ jUy6EkdQ/VJEBiS0MaHlD46JfBlF7NIbAwQLm6RbWj8HHe08nLZCdCJhO3I1TXVCLshwPITPO+MGD JmK2bvj+OELfA0Aol7oUR1RvOJpWoHal++5gk1BUpYBq/dq8U5cuqUhRTJwQsZJJDXqY=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wuyKc-00041K-Rn for openvpn-devel@lists.sourceforge.net; Fri, 14 Aug 2026 20:16:50 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 67EKGUW8011170 for ; Fri, 14 Aug 2026 22:16:30 +0200 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 67EKGUNT011169 for openvpn-devel@lists.sourceforge.net; Fri, 14 Aug 2026 22:16:30 +0200 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Fri, 14 Aug 2026 22:16:20 +0200 Message-ID: <20260814201630.11152-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.53.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld Can be used like this ./configure --enable-code-coverage make make check make code-coverage-capture Change-Id: I79b2dc4a550b1c5068a45407976b0dfc2f765b33 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/o [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1wuyKc-00041K-Rn Subject: [Openvpn-devel] [PATCH v1] configure: Add --enable-code-coverage X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1873531248532058624 X-GMAIL-MSGID: 1873531248532058624 From: Frank Lichtenheld Can be used like this ./configure --enable-code-coverage make make check make code-coverage-capture Change-Id: I79b2dc4a550b1c5068a45407976b0dfc2f765b33 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1592 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1592 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru 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 = -I m4 MAINTAINERCLEANFILES = \ @@ -89,3 +91,7 @@ doxygen: $(MAKE) -C doc/doxygen doxygen + +CODE_COVERAGE_LCOV_SHOPTS=--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 @<:@default=yes@:>@])], @@ -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" = "yes"; then + [CFLAGS="`echo $CFLAGS | $SED -e 's/-O[s0-9]\\?//g'`"] +fi + if test "${enable_pedantic}" = "yes"; then CFLAGS="${CFLAGS} -pedantic" AC_DEFINE([PEDANTIC], [1], [Enable pedantic mode]) @@ -1374,10 +1381,10 @@ TEST_LDFLAGS="${OPTIONAL_CRYPTO_LIBS} ${OPTIONAL_PKCS11_HELPER_LIBS} ${OPTIONAL_LIBCAPNG_LIBS}" TEST_LDFLAGS="${TEST_LDFLAGS} ${OPTIONAL_LIBNL_GENL_LIBS}" -TEST_LDFLAGS="${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS}" +TEST_LDFLAGS="${TEST_LDFLAGS} ${OPTIONAL_LZO_LIBS} ${CMOCKA_LIBS} ${CODE_COVERAGE_LIBS}" TEST_CFLAGS="${OPTIONAL_CRYPTO_CFLAGS} ${OPTIONAL_PKCS11_HELPER_CFLAGS} ${OPTIONAL_LIBCAPNG_CFLAGS}" TEST_CFLAGS="${TEST_CFLAGS} ${OPTIONAL_LIBNL_GENL_CFLAGS} ${OPTIONAL_LZO_CFLAGS}" -TEST_CFLAGS="${TEST_CFLAGS} -I\$(top_srcdir)/include ${CMOCKA_CFLAGS}" +TEST_CFLAGS="${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="-lgcov"], [CODE_COVERAGE_LIBS=""]) - dnl Build the code coverage flags dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility CODE_COVERAGE_CPPFLAGS="-DNDEBUG" - CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" - CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage" + CODE_COVERAGE_CFLAGS="-O0 -g --coverage" + CODE_COVERAGE_CXXFLAGS="-O0 -g --coverage" + CODE_COVERAGE_LIBS="--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=\"${plugindir}\" \ -DDEFAULT_DNS_UPDOWN=\"${scriptdir}/dns-updown\" +AM_LIBS = $(CODE_COVERAGE_LIBS) + if WIN32 # we want unicode entry point but not the macro AM_CFLAGS += -municode -UUNICODE