Skip to contentSkip to conversation

t_net.sh: fixes for the networking test script

PATCH Superseded Antonio Quartulli 2 participants 5 messages Jun 17, 2019

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 t_net.sh: fixes for the networking test script

From: Antonio Quartulli <[email protected]...>

1) The test_networking driver needs the cmocka library at runtime, therefore LD_LIBRARY_PATH has to be properly configured. The running framework takes care of that for the other unit-tests, but since we run the networking driver from within t_net.sh, we have to be sure that we also set LD_LIBRARY_PATH accordingly.

2) Building the networking unit-test when SITNL is not enabled does not make much sense right now.
Make compilation dependent on having SITNL configured.

3) Remove some no-op mock_msg function calls.

4) Remove obsolete comment and declarations

---
 tests/t_net.sh                             |  8 ++------
 tests/unit_tests/openvpn/Makefile.am       |  2 ++
 tests/unit_tests/openvpn/test_networking.c | 16 ----------------
 3 files changed, 4 insertions(+), 22 deletions(-)
tests/t_net.sh +2 -6
index 70e8517d..c6a7d5c8 100755
@@ -1,12 +1,9 @@
 #!/usr/bin/env bash
 
 IFACE="dummy0"
-UNIT_TEST="./unit_tests/openvpn/networking_testdriver"
+UNIT_TEST="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../vendor/dist/lib/ ./unit_tests/openvpn/networking_testdriver"
 MAX_TEST=${1:-7}
 
-KILL_EXEC=`which kill`
-CC=${CC:-gcc}
-
 srcdir="${srcdir:-.}"
 top_builddir="${top_builddir:-..}"
 openvpn="${top_builddir}/src/openvpn/openvpn"
@@ -99,8 +96,7 @@ fi
 # Ensure PREFER_KSU is in a known state
 PREFER_KSU="${PREFER_KSU:-0}"
 
-# make sure we have permissions to run ifconfig/route from OpenVPN
-# can't use "id -u" here - doesn't work on Solaris
+# make sure we have permissions to run the networking unit-test
 ID=`id`
 if expr "$ID" : "uid=0" >/dev/null
 then :
tests/unit_tests/openvpn/Makefile.am +2 -0
index e61c57c4..d015b293 100644
@@ -78,6 +78,7 @@ tls_crypt_testdriver_SOURCES = test_tls_crypt.c mock_msg.c mock_msg.h \
 	$(openvpn_srcdir)/platform.c \
 	$(openvpn_srcdir)/run_command.c
 
+if HAVE_SITNL
 networking_testdriver_CFLAGS = @TEST_CFLAGS@ \
 	-I$(openvpn_includedir) -I$(compat_srcdir) -I$(openvpn_srcdir) \
 	$(OPTIONAL_CRYPTO_CFLAGS)
@@ -92,3 +93,4 @@ networking_testdriver_SOURCES = test_networking.c mock_msg.c \
 	$(openvpn_srcdir)/otime.c \
 	$(openvpn_srcdir)/packet_id.c \
 	$(openvpn_srcdir)/platform.c
+endif
tests/unit_tests/openvpn/test_networking.c +0 -16
index 6c50da92..22d8babe 100644
@@ -2,13 +2,9 @@
 #include "syshead.h"
 #include "networking.h"
 
-#include "mock_msg.h"
-
 
 static char *iface = "dummy0";
 
-#ifdef ENABLE_SITNL
-
 static int
 net__iface_up(bool up)
 {
@@ -177,8 +173,6 @@ main(int argc, char *argv[])
 {
     int test;
 
-    mock_set_debug_level(10);
-
     if (argc < 2)
     {
         usage(argv[0]);
@@ -223,13 +217,3 @@ main(int argc, char *argv[])
     usage(argv[0]);
     return -1;
 }
-
-#else
-
-int
-main(int argc, char *argv[])
-{
-    return 0;
-}
-
-#endif /* ENABLE_SITNL */
Signature · 1 line
2.22.0
#1 lore raw

PATCH 2/2 route.c: fix windows build by removing mismatching function parameter

From: Antonio Quartulli <[email protected]...>

---
 src/openvpn/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/route.c +1 -1
index c92a1343..4cdc4a9f 100644
@@ -2799,7 +2799,7 @@ windows_route_find_if_index(const struct route_ipv4 *r, const struct tuntap *tt)
  */
 void
 get_default_gateway_ipv6(struct route_ipv6_gateway_info *rgi6,
-                         const struct in6_addr *dest, openvpn_net_ctx_t *ctx)
+                         const struct in6_addr *dest)
 {
     struct gc_arena gc = gc_new();
     MIB_IPFORWARD_ROW2 BestRoute;
Signature · 1 line
2.22.0
Acked-by on v1 2/2
#2 lore raw

[Openvpn-devel] [PATCH applied] Re: route.c: fix windows build by removing mismatching function parameter

"Because it's the quick fix, reverting one too-eager argument change while we do not have the rest of the get_default_gateway_ipv6() stuff in-tree"

I have not test-compiled it, but it looks very reasonable :-)

Your patch has been applied to the master branch.

commit 22020547cbfa4a7199925bc4f32d95e84c504af2

Author: Antonio Quartulli
Date:   Mon Jun 17 14:41:10 2019 +0200
     route.c: fix windows build by removing mismatching function parameter

     Signed-off-by: Antonio Quartulli <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg18551.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#3 lore raw
In reply to Antonio Quartulli

Hi,

Quoted 1 line · Antonio Quartulli

+UNIT_TEST="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../vendor/dist/lib/ ./unit_tests/openvpn/networking_testdriver"

While this *looks* promising, it fails the

if [ ! -x "$UNIT_TEST" ]; then
echo "no test_networking driver available. SKIPPING TEST." >&2 exit 77
fi

test later on. Well, it quiets the buildbot failures, but a test that is always skipped cannot be the goal - so, NAK on this, sorry.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#4 lore raw

Hi,

Quoted 7 lines · Gert Doering

Hi,

Quoted 1 line · Antonio Quartulli

+UNIT_TEST="LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../vendor/dist/lib/ ./unit_tests/openvpn/networking_testdriver"

While this *looks* promising, it fails the

Quoted 8 lines

if [ ! -x "$UNIT_TEST" ]; then
echo "no test_networking driver available. SKIPPING TEST." >&2 exit 77
fi

test later on. Well, it quiets the buildbot failures, but a test that is always skipped cannot be the goal - so, NAK on this, sorry.

Absolutely right. In the jungle of tests I must have missed that. Will send v2 of this.

Regards,

Quoted 2 lines

gert

Signature · 1 line
Antonio Quartulli