From patchwork Mon Jun 17 02:41:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 758 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id yE7dCwSLB13tLgAAIUCqbw for ; Mon, 17 Jun 2019 08:43:48 -0400 Received: from proxy7.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id sBmoCwSLB10SOgAApN4f7A ; Mon, 17 Jun 2019 08:43:48 -0400 Received: from smtp21.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy7.mail.ord1d.rsapps.net with LMTP id AAN5CwSLB11kEgAAMe1Fpw ; Mon, 17 Jun 2019 08:43:48 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp21.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 8c5eaadc-90fd-11e9-96ca-525400a98691-1-1 Received: from [216.105.38.7] ([216.105.38.7:44868] helo=lists.sourceforge.net) by smtp21.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 35/32-22047-30B870D5; Mon, 17 Jun 2019 08:43:47 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1hcqxt-0006Sr-5g; Mon, 17 Jun 2019 12:42:25 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hcqxp-0006S1-1L for openvpn-devel@lists.sourceforge.net; Mon, 17 Jun 2019 12:42:21 +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:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ghFaw+f/+laP20sP+IzcQbX6UE7cQ1GRG/45NHI/+oc=; b=j8+r/8ltd8Y0Lgtn3aEwoBUjzW DobJfcijlAkoC78QZ5Kpjt/4ApitN+CuAkl8jySAcKguLKfm+0n63GaJHOItX2MsxIeCz0wx5sNW2 /JlzauiPYnpLzaMZVmE12wcuppPAPXDO/kdXaUlrZnQug+ZTRnw0Nf/N2E3hYPO6Np1U=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=ghFaw+f/+laP20sP+IzcQbX6UE7cQ1GRG/45NHI/+oc=; b=N rYeIG9ZnvrSw2mRQiPfJ6aEpuPSWkAbtH1jZbpOTR7DQBjNH/v7PcOVk5NHDh1robZuFYK2jNcIg4 uzAJRZM0Wx1m5rBqXw5LRGFu3Y8roDwwspDpCR6HOOfwZiYTi7pYEOKhSFDg8zgsQyp15wrrQzo12 bULYycj2wCwOLEmc=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hcqxl-00DIa8-HG for openvpn-devel@lists.sourceforge.net; Mon, 17 Jun 2019 12:42:19 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Mon, 17 Jun 2019 14:41:09 +0200 Message-Id: <20190617124110.30907-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1hcqxl-00DIa8-HG Subject: [Openvpn-devel] [PATCH 1/2] t_net.sh: fixes for the networking test script 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: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox From: Antonio Quartulli 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 Signed-off-by: Antonio Quartulli --- 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(-) diff --git a/tests/t_net.sh b/tests/t_net.sh index 70e8517d..c6a7d5c8 100755 --- a/tests/t_net.sh +++ b/tests/t_net.sh @@ -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 : 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 */