[Openvpn-devel,v2] t_net.sh: fixes for the networking test script

Message ID 20190618163435.26431-1-a@unstable.cc
State Accepted
Headers show
Series
  • [Openvpn-devel,v2] t_net.sh: fixes for the networking test script
Related show

Commit Message

Antonio Quartulli June 18, 2019, 4:34 p.m.
From: Antonio Quartulli <antonio@openvpn.net>

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

2) Remove some no-op mock_msg function calls.

3) Remove obsolete comment and declarations

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
---

Changes from v1:
- get rid of LD_LIBRARY_PATH: consensus is to have cmocka installed
  system-wide

 tests/t_net.sh                             |  6 +-----
 tests/unit_tests/openvpn/Makefile.am       |  2 ++
 tests/unit_tests/openvpn/test_networking.c | 16 ----------------
 3 files changed, 3 insertions(+), 21 deletions(-)

Comments

David Sommerseth June 20, 2019, 7:02 p.m. | #1
On 18/06/2019 18:34, Antonio Quartulli wrote:
> From: Antonio Quartulli <antonio@openvpn.net>
> 
> 1) Building the networking unit-test when SITNL is not enabled does not
> make much sense right now.
> Make compilation dependent on having SITNL configured.
> 
> 2) Remove some no-op mock_msg function calls.
> 
> 3) Remove obsolete comment and declarations
> 
> Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
> ---
> 
> Changes from v1:
> - get rid of LD_LIBRARY_PATH: consensus is to have cmocka installed
>   system-wide
> 
>  tests/t_net.sh                             |  6 +-----
>  tests/unit_tests/openvpn/Makefile.am       |  2 ++
>  tests/unit_tests/openvpn/test_networking.c | 16 ----------------
>  3 files changed, 3 insertions(+), 21 deletions(-)


Only glared at the code changes, and it makes sense after some clarifications
on IRC.

Acked-by: David Sommerseth <davids@openvpn.net>
Gert Doering June 20, 2019, 7:08 p.m. | #2
Your patch has been applied to the master branch.

commit 06f65a0cbfcb1a3093e3086a10b3e95350eb3c04
Author: Antonio Quartulli
Date:   Tue Jun 18 18:34:35 2019 +0200

     t_net.sh: fixes for the networking test script

     Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
     Acked-by: David Sommerseth <davids@openvpn.net>
     Message-Id: <20190618163435.26431-1-a@unstable.cc>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg18556.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering

Patch

diff --git a/tests/t_net.sh b/tests/t_net.sh
index 70e8517d..18799d12 100755
--- a/tests/t_net.sh
+++ b/tests/t_net.sh
@@ -4,9 +4,6 @@  IFACE="dummy0"
 UNIT_TEST="./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 :
diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am
index e61c57c4..d015b293 100644
--- a/tests/unit_tests/openvpn/Makefile.am
+++ b/tests/unit_tests/openvpn/Makefile.am
@@ -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
diff --git a/tests/unit_tests/openvpn/test_networking.c b/tests/unit_tests/openvpn/test_networking.c
index 6c50da92..22d8babe 100644
--- a/tests/unit_tests/openvpn/test_networking.c
+++ b/tests/unit_tests/openvpn/test_networking.c
@@ -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 */