From: "cron2 (Code Review)" Date: Fri, 8 Mar 2024 11:51:46 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., a@...2181... Message-ID: <8628c7b7910dce262f02b27f51576df46d66df25-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="m4GTE1yuMZk="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: t_client.sh: Allow to skip tests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: flichtenheld Cc: plaisthos , openvpn-devel --m4GTE1yuMZk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/52= 1?usp=3Demail ) Change subject: t_client.sh: Allow to skip tests ...................................................................... t_client.sh: Allow to skip tests Individual tests can define a script to run to test whether they should be skipped. Included in this commit is an example check which checks whether we can do NTLM checks. This fails e.g. on recent versions of Fedora with mbedTLS (tested with Fedora 39) or when NTLM support is not compiled in. v2: - ntlm_support: - support OpenSSL 3 - allow to build without cmocka v3: - add example to t_client.rc-sample - t_client.sh code style - use syshead.h in error.h v5: - rename SKIP_x to CHECK_SKIP_x Change-Id: I13ea6752c8d102eabcc579e391828c05d5322899 Signed-off-by: Frank Lichtenheld Acked-by: Gert Doering Message-Id: <20240308102818.9249-1-gert@...1296...> URL: https://www.mail-archive.com/search?l=3Dmid&q=3D20240308102818.9249-1-= gert@...1296... Signed-off-by: Gert Doering --- M src/openvpn/error.h M tests/Makefile.am A tests/ntlm_support.c M tests/t_client.rc-sample M tests/t_client.sh.in M tests/unit_tests/openvpn/mock_msg.c 6 files changed, 119 insertions(+), 15 deletions(-) diff --git a/src/openvpn/error.h b/src/openvpn/error.h index 1225b13..be3484d 100644 --- a/src/openvpn/error.h +++ b/src/openvpn/error.h @@ -25,16 +25,10 @@ #define ERROR_H #include "basic.h" - -#include -#include +#include "syshead.h" #include -#if _WIN32 -#include -#endif - /* #define ABORT_ON_ERROR */ #if defined(ENABLE_PKCS11) || defined(ENABLE_MANAGEMENT) diff --git a/tests/Makefile.am b/tests/Makefile.am index 6c71067..6bc02b4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -18,6 +18,8 @@ if !WIN32 test_scripts =3D t_client.sh t_lpback.sh t_cltsrv.sh + +check_PROGRAMS =3D ntlm_support if HAVE_SITNL test_scripts +=3D t_net.sh endif @@ -35,3 +37,15 @@ dist_noinst_DATA =3D \ t_client.rc-sample + +ntlm_support_CFLAGS =3D -I$(top_srcdir)/src/openvpn -I$(top_srcdir)/src/c= ompat -I$(top_srcdir)/tests/unit_tests/openvpn -DNO_CMOCKA @TEST_CFLAGS@ +ntlm_support_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_srcdir)/src/openvpn $(OPTI= ONAL_CRYPTO_LIBS) +ntlm_support_SOURCES =3D ntlm_support.c \ + unit_tests/openvpn/mock_msg.c unit_tests/openvpn/mock_msg.h \ + $(top_srcdir)/src/openvpn/buffer.c \ + $(top_srcdir)/src/openvpn/crypto.c \ + $(top_srcdir)/src/openvpn/crypto_openssl.c \ + $(top_srcdir)/src/openvpn/crypto_mbedtls.c \ + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/packet_id.c \ + $(top_srcdir)/src/openvpn/platform.c diff --git a/tests/ntlm_support.c b/tests/ntlm_support.c new file mode 100644 index 0000000..2d7da86 --- /dev/null +++ b/tests/ntlm_support.c @@ -0,0 +1,52 @@ +/* + * OpenVPN -- An application to securely tunnel IP networks + * over a single UDP port, with support for SSL/TLS-based + * session authentication and key exchange, + * packet encryption, packet authentication, and + * packet compression. + * + * Copyright (C) 2023 OpenVPN Inc + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "syshead.h" + +#include "crypto.h" +#include "error.h" + +int +main(void) +{ +#if defined(ENABLE_CRYPTO_OPENSSL) + crypto_load_provider("legacy"); + crypto_load_provider("default"); +#endif +#ifdef NTLM + if (!md_valid("MD4")) + { + msg(M_FATAL, "MD4 not supported"); + } + if (!md_valid("MD5")) + { + msg(M_FATAL, "MD5 not supported"); + } +#else /* ifdef NTLM */ + msg(M_FATAL, "NTLM support not compiled in"); +#endif +} diff --git a/tests/t_client.rc-sample b/tests/t_client.rc-sample index 355e8bb..d61ecc4 100644 --- a/tests/t_client.rc-sample +++ b/tests/t_client.rc-sample @@ -27,7 +27,7 @@ # # tests to run (list suffixes for config stanzas below) # -TEST_RUN_LIST=3D"1 2" +TEST_RUN_LIST=3D"1 2 2n" # # use "sudo" (etc) to give openvpn the necessary privileges @@ -53,14 +53,24 @@ # # if something is not defined here, the corresponding test is not run # -# possible test options: +# common test options: # -# RUN_TITLE_x=3D"what is being tested on here" (purely informational) -# OPENVPN_CONF_x =3D "how to call ./openvpn" [mandatory] +# RUN_TITLE_x =3D "what is being tested on here" (purely informatio= nal) +# OPENVPN_CONF_x =3D "how to call ./openvpn" [mandatory] # EXPECT_IFCONFIG4_x =3D "this IPv4 address needs to show up in ifconfig" # EXPECT_IFCONFIG6_x =3D "this IPv6 address needs to show up in ifconfig" -# PING4_HOSTS_x =3D "these hosts musts ping when openvpn is up (IPv4 fping= )" -# PING6_HOSTS_x =3D "these hosts musts ping when openvpn is up (IPv6 fping= 6)" +# PING4_HOSTS_x =3D "these hosts musts ping when openvpn is up (IPv4 = fping)" +# PING6_HOSTS_x =3D "these hosts musts ping when openvpn is up (IPv6 = fping6)" +# +# hook test options: +# +# CHECK_SKIP_x =3D "commands to execute before openvpn, skip test on = failure" +# PREPARE_x =3D "commands to execute before openvpn" +# POSTINIT_CMD_x =3D "commands to execute after openvpn but before ping" +# CLEANUP_x =3D "commands to execute after the test" +# +# Note: all hooks are "eval"ed, so run in the original shell of the t_clie= nt.sh +# script, not a child process. # # Test 1: UDP / p2mp tun # specify IPv4+IPv6 addresses expected from server and ping targets @@ -76,10 +86,18 @@ OPENVPN_CONF_2=3D"$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMOT= E --port 51194" PING4_HOSTS_2=3D"10.100.51.1 10.100.0.1" PING6_HOSTS_2=3D"2001:db8::1 2001:db8:a051::1" -# # run command after openvpn initialization is done - here: delay 5 seconds POSTINIT_CMD_2=3D"sleep 5" +# Test 2n: TCP / p2mp tun / via NTLM proxy +RUN_TITLE_2n=3D"testing tun/tcp/ntlm-proxy" +OPENVPN_CONF_2n=3D"$OPENVPN_BASE_P2MP --dev tun --proto tcp --remote $REMO= TE --port 51194 + --http-proxy 192.168.1.2 8080 $KEYBASE/t_client_auth.txt ntlm --http-prox= y-option VERSION 1.1" +PING4_HOSTS_2n=3D"10.100.51.1 10.100.0.1" +PING6_HOSTS_2n=3D"2001:db8::1 2001:db8:a051::1" +# skip test if NTLM support is not available +CHECK_SKIP_2n=3D"${top_builddir}/tests/ntlm_support" + # Test 3: UDP / p2p tun # ... diff --git a/tests/t_client.sh.in b/tests/t_client.sh.in index 99e6f9c..f6654dd 100755 --- a/tests/t_client.sh.in +++ b/tests/t_client.sh.in @@ -291,12 +291,14 @@ # main test loop # ---------------------------------------------------------- SUMMARY_OK=3D +SUMMARY_SKIP=3D SUMMARY_FAIL=3D for SUF in $TEST_RUN_LIST do # get config variables eval test_prep=3D\"\$PREPARE_$SUF\" + eval test_check_skip=3D\"\$CHECK_SKIP_$SUF\" eval test_postinit=3D\"\$POSTINIT_CMD_$SUF\" eval test_cleanup=3D\"\$CLEANUP_$SUF\" eval test_run_title=3D\"\$RUN_TITLE_$SUF\" @@ -318,6 +320,16 @@ output_start "### test run $SUF: '$test_run_title' ###" fail_count=3D0 + if [ -n "$test_check_skip" ]; then + output "check whether we need to skip: '$test_check_skip'" + if eval $test_check_skip; then : + else + output "skip check failed, SKIP test $SUF." + SUMMARY_SKIP=3D"$SUMMARY_SKIP $SUF" + echo -e "$outbuf" ; continue + fi + fi + if [ -n "$test_prep" ]; then output "running preparation: '$test_prep'" eval $test_prep @@ -455,8 +467,10 @@ done if [ -z "$SUMMARY_OK" ] ; then SUMMARY_OK=3D" none"; fi +if [ -z "$SUMMARY_SKIP" ] ; then SUMMARY_SKIP=3D" none"; fi if [ -z "$SUMMARY_FAIL" ] ; then SUMMARY_FAIL=3D" none"; fi echo "Test sets succeeded:$SUMMARY_OK." +echo "Test sets skipped:$SUMMARY_SKIP." echo "Test sets failed:$SUMMARY_FAIL." # remove trap handler diff --git a/tests/unit_tests/openvpn/mock_msg.c b/tests/unit_tests/openvpn= /mock_msg.c index d74efaa..a291f8f 100644 --- a/tests/unit_tests/openvpn/mock_msg.c +++ b/tests/unit_tests/openvpn/mock_msg.c @@ -31,8 +31,9 @@ #include #include #include +#ifndef NO_CMOCKA #include - +#endif =20 #include "errlevel.h" #include "error.h" @@ -74,6 +75,8 @@ va_end(arglist); } +/* Allow to use mock_msg.c outside of UT */ +#ifndef NO_CMOCKA void assert_failed(const char *filename, int line, const char *condition) { @@ -81,6 +84,15 @@ /* Keep compiler happy. Should not happen, mock_assert() does not ret= urn */ exit(1); } +#else /* ifndef NO_CMOCKA */ +void +assert_failed(const char *filename, int line, const char *condition) +{ + msg(M_FATAL, "Assertion failed at %s:%d (%s)", filename, line, conditi= on ? condition : ""); + _exit(1); +} +#endif + /* * Fail memory allocation. Don't use msg() because it tries -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/521?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I13ea6752c8d102eabcc579e391828c05d5322899 Gerrit-Change-Number: 521 Gerrit-PatchSet: 6 Gerrit-Owner: flichtenheld Gerrit-Reviewer: cron2 Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-CC: ordex Gerrit-MessageType: merged --m4GTE1yuMZk= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 submitted this change.

View Change

t_client.sh: Allow to skip tests

Indivi= dual tests can define a script to run to test
whether they should be ski= pped.

Included in this commit is an example check which
checks wh= ether we can do NTLM checks. This fails
e.g. on recent versions of Fedor= a with mbedTLS
(tested with Fedora 39) or when NTLM support is not
co= mpiled in.

v2:
- ntlm_support:
- support OpenSSL 3
-= allow to build without cmocka
v3:
- add example to t_client.rc-samp= le
- t_client.sh code style
- use syshead.h in error.h
v5:
-= rename SKIP_x to CHECK_SKIP_x

Change-Id: I13ea6752c8d102eabcc579e39= 1828c05d5322899
Signed-off-by: Frank Lichtenheld <frank@...2641...>= ;
Acked-by: Gert Doering <gert@...1296...>
Message-Id: <2024= 0308102818.9249-1-gert@...1296...>
URL: https://www.mail-archive.com/= search?l=3Dmid&q=3D20240308102818.9249-1-gert@...1296...
Signed-off-= by: Gert Doering <gert@...1296...>
---
M src/openvpn/error.hM tests/Makefile.am
A tests/ntlm_support.c
M tests/t_client.rc-sampl= e
M tests/t_client.sh.in
M tests/unit_tests/openvpn/mock_msg.c
6 f= iles changed, 119 insertions(+), 15 deletions(-)

diff --git a/src/openvpn/error.h b/src/openvpn/error.h
i= ndex 1225b13..be3484d 100644
--- a/src/openvpn/error.h
+++ b/src/openvpn/error.h
@@ -25,16 +25,10 @@
#define ERROR_H

#include= "basic.h"
-<= /span>
-#include <errno.h&g= t;
-#include <stdboo= l.h>
+#include &qu= ot;syshead.h"

#include <assert.h= >

= -#if _WIN32
-#include &= lt;windows.h>
-#endi= f
-
/*= #define ABORT_ON_ERROR */

#if defined(E= NABLE_PKCS11) || defined(ENABLE_MANAGEMENT)
diff --git a/te= sts/Makefile.am b/tests/Makefile.am
index 6c71067..6bc02b4 = 100644
--- a/tests/Makefile.am
+++ b/tests/= Makefile.am
@@ -18,6 +18,8 @@

<= span> if !WIN32

test_scripts =3D t_client.sh t_lpback.sh t= _cltsrv.sh
++check_PROGRAMS =3D ntlm_supp= ort
if HAVE_SITNL
test_scripts +=3D t_net= .sh
endif
@@ -35,3 +37,15 @@

dist_noinst_DATA =3D \
t_client.rc-= sample
+
+ntlm_support_CFLAGS =3D -I$(top= _srcdir)/src/openvpn -I$(top_srcdir)/src/compat -I$(top_srcdir)/tests/unit_= tests/openvpn -DNO_CMOCKA @TEST_CFLAGS@

+ntlm_support_LDFLAGS =3D @TEST_LDFLAGS@ -L$(top_srcdir)= /src/openvpn $(OPTIONAL_CRYPTO_LIBS)
+ntlm_support_SOURCES =3D ntlm_support.c \
+ unit_tests/openvpn/mock_msg.c unit_= tests/openvpn/mock_msg.h \
+ $(top_srcdir)/src/openvpn/buffer.c \
+ $(top_srcdir)/src/openvpn/crypto.c \
+ $(top_srcdir)/src/openvpn/crypt= o_openssl.c \
+ $(top= _srcdir)/src/openvpn/crypto_mbedtls.c \
+ $(top_srcdir)/src/openvpn/otime.c \
+ $(top_srcdir)/src/openvpn/packet_id.c= \
+ $(top_srcdir)/sr= c/openvpn/platform.c
diff --git a/tests/ntlm_support.c b/te= sts/ntlm_support.c
new file mode 100644
ind= ex 0000000..2d7da86
--- /dev/null
+++ b/tes= ts/ntlm_support.c
@@ -0,0 +1,52 @@
+/*
+ * OpenVPN -- An application to securely tunnel IP networks<= /span>
+ * over = a single UDP port, with support for SSL/TLS-based
+ * session authentication and key= exchange,
+ * = packet encryption, packet authentication, and
+ * packet compression.=
+ *
+ * Copyright (C) 2023 OpenVPN Inc <sal= es@...515...>
+ *<= /span>
+ * This program is = free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General= Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will= be useful,
+ * but = WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A= PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Genera= l Public License along
+ * 51 Franklin = Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef = HAVE_CONFIG_H
+#inclu= de "config.h"
+#endif
++#include "syshead.h&quo= t;
+
+#include "crypto.h"=
+#include "error.h&quo= t;
+
+int
+main(void)
+{
+#if = defined(ENABLE_CRYPTO_OPENSSL)
+ crypto_load_provider("legacy");
+ crypto_load_provider("default= ");
+#endif
+#ifdef NTLM
+ if (!md_valid("MD4"= ;))

+ {
= + msg(M_FATAL, "MD4= not supported");
+ if (!md= _valid("MD5"))
+ {
+ m= sg(M_FATAL, "MD5 not supported");
+ }
+#else /* ifdef NTLM */
+ msg(M_FATAL, "NTLM support not compiled in");
+#endif
+}

diff --git a/tes= ts/t_client.rc-sample b/tests/t_client.rc-sample
index 355e= 8bb..d61ecc4 100644
--- a/tests/t_client.rc-sample+++ b/tests/t_client.rc-sample
@@ -27,7 +27,7 @@

#
# tests to run (list suffixes for config = stanzas below)
#
-TEST_RUN_LIST=3D"1 2"
+TEST_RUN_LIST=3D"1 2 2n"
=
#
# use "sudo" (etc) to give = openvpn the necessary privileges
@@ -53,14 +53,24 @@=
#
# if something is not defined here, the corre= sponding test is not run
#
-# possible test options:
+# common test options:
#=
-# RUN_TITLE_x=3D"what i= s being tested on here" (purely informational)
-# OPENVPN_CONF_x =3D "how to call ./op= envpn" [mandatory]
+# RUN_TITLE_x =3D "what is being tested on here" (pure= ly informational)
+# = OPENVPN_CONF_x =3D "how to call ./openvpn" [mandatory]=
# EXPECT_IFCONFIG4_x =3D "this IPv4 address needs to show u= p in ifconfig"
# EXPECT_IFCONFIG6_x =3D "this IP= v6 address needs to show up in ifconfig"
-# PING4_HOSTS_x =3D "these hosts musts ping wh= en openvpn is up (IPv4 fping)"
-# PING6_HOSTS_x =3D "these hosts musts ping when openvpn= is up (IPv6 fping6)"
+# PING4_HOSTS_x =3D "these hosts musts ping when openvpn i= s up (IPv4 fping)"
+# PING6_HOSTS_x =3D "these hosts musts ping when openvpn is u= p (IPv6 fping6)"
+#
+# hook test opti= ons:
+#
+# CHECK_SKIP_x =3D "com= mands to execute before openvpn, skip test on failure"
+# PREPARE_x =3D "comma= nds to execute before openvpn"
+# POSTINIT_CMD_x =3D "commands to execute after ope= nvpn but before ping"
+# CLEANUP_x =3D "commands to execute after the test&quo= t;
+#
+# Note: all hooks are "eval&qu= ot;ed, so run in the original shell of the t_client.sh
+# script, not a child process. #
# Test 1: UDP / p2mp tun
# sp= ecify IPv4+IPv6 addresses expected from server and ping targets
<= span>@@ -76,10 +86,18 @@
OPENVPN_CONF_2=3D"$OPENVPN_B= ASE_P2MP --dev tun --proto tcp --remote $REMOTE --port 51194" PING4_HOSTS_2=3D"10.100.51.1 10.100.0.1"
PING6_HOSTS_2=3D"2001:db8::1 2001:db8:a051::1"
-#
# run command after= openvpn initialization is done - here: delay 5 seconds
PO= STINIT_CMD_2=3D"sleep 5"

+# Test 2n: TCP / p2mp tun / via NTLM prox= y
+RUN_TITLE_2n=3D&qu= ot;testing tun/tcp/ntlm-proxy"
+OPENVPN_CONF_2n=3D"$OPENVPN_BASE_P2MP --dev tun --prot= o tcp --remote $REMOTE --port 51194
+ --http-proxy 192.168.1.2 8080 $KEYBASE/t_client_auth.txt n= tlm --http-proxy-option VERSION 1.1"
+PING4_HOSTS_2n=3D"10.100.51.1 10.100.0.1"
+PING6_HOSTS_2n=3D&quo= t;2001:db8::1 2001:db8:a051::1"
+# skip test if NTLM support is not available
+CHECK_SKIP_2n=3D"${top_build= dir}/tests/ntlm_support"

+
# Test 3: UDP / p2p tun
# ...<= /span>

diff --git a/tests/t_client.sh.in b/tests= /t_client.sh.in
index 99e6f9c..f6654dd 100755
--- a/tests/t_client.sh.in

+++ b/tests/t_client.sh.in
@@ -291,12 +291,14 @@
# main test loop

# ----------------------------------------------------------
SUMMARY_OK=3D
+SUMMARY_SKIP=3D
SUMMARY_FAIL=3D
=
for SUF in $TEST_RUN_LIST
do
<= span> # get config variables

eval test_prep=3D\&qu= ot;\$PREPARE_$SUF\"
+ eval test_check_skip=3D\"\$CHECK_SKIP_$SUF\"
<= span> eval test_postinit=3D\"\$POSTINIT_CMD_$SUF\"
= eval test_cleanup=3D\"\$CLEANUP_$SUF\"
eval test_run_title=3D\"\$RUN_TITLE_$SUF\"
= @@ -318,6 +320,16 @@
output_start "### test run $= SUF: '$test_run_title' ###"
fail_count=3D= 0

+= if [ -n "$test_check_skip" ]; then
+ output "check whether we need to = skip: '$test_check_skip'"
+ if eval $test_check_skip; then :
+ else
+ output "skip check faile= d, SKIP test $SUF."
+ SUMMARY_SKIP=3D"$SUMMARY_SKIP $SUF"
+ echo -e "$outbuf" ; cont= inue
+ fi
+ fi
+
if [ -n "$= test_prep" ]; then
output "running prepa= ration: '$test_prep'"
eval $test_prep=
@@ -455,8 +467,10 @@
done

if [ -z "$SUMMARY_OK" ] ; then SUMMARY_OK=3D&= quot; none"; fi
= +if [ -z "$SUMMARY_SKIP" ] ; then SUMMARY_SKIP=3D" none"= ;; fi
if [ -z "$SUMMARY_FAIL" ] ; then SUMMARY_F= AIL=3D" none"; fi
echo "Test sets succeeded= :$SUMMARY_OK."
+= echo "Test sets skipped:$SUMMARY_SKIP."
echo &qu= ot;Test sets failed:$SUMMARY_FAIL."

= # remove trap handler
diff --git a/tests/unit_tests/openvp= n/mock_msg.c b/tests/unit_tests/openvpn/mock_msg.c
index d7= 4efaa..a291f8f 100644
--- a/tests/unit_tests/openvpn/mock_m= sg.c
+++ b/tests/unit_tests/openvpn/mock_msg.c
@@ -31,8 +31,9 @@
#include <stdlib.h>
= #include <setjmp.h>
#include <stdint.h>=
+#ifndef NO_CMOCKA
#include <cmocka.h>
-
= +#endif

#include "errlevel.h"<= /span>
#include "error.h"
@@ -74,6 +75,= 8 @@
va_end(arglist);
}

+/* Allow to use= mock_msg.c outside of UT */
+#ifndef NO_CMOCKA
void
assert_fa= iled(const char *filename, int line, const char *condition)
{

@@ -81,6 +84,15 @@
/* Keep compile= r happy. Should not happen, mock_assert() does not return */
exit(1);
}
+#else /* ifndef NO_CMOCKA */
+void
+assert_failed(const char *filename, int line, const char *condit= ion)
+{
+ msg(M_FATAL, "Assertion = failed at %s:%d (%s)", filename, line, condition ? condition : "&= quot;);
+ _exit(1)= ;
+}
+#endif
+

/*
= * Fail memory allocation. Don't use msg() because it tries


To view, visit change 521. To unsubscribe, or f= or help writing mail filters, visit settings.

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I13ea6752c8d102eabcc579e3918= 28c05d5322899
Gerrit-Change-Number: 521
Gerrit-PatchSet: 6
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-CC: ordex <a@...2181...>
Gerrit-MessageType: merged
--m4GTE1yuMZk=--