From patchwork Sat Jun 15 13:02:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 756 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id yHimE5h5BV07GQAAIUCqbw for ; Sat, 15 Jun 2019 19:04:56 -0400 Received: from proxy18.mail.iad3b.rsapps.net ([172.31.255.6]) by director8.mail.ord1d.rsapps.net with LMTP id 2MSdEJh5BV2ICAAAfY0hYg ; Sat, 15 Jun 2019 19:04:56 -0400 Received: from smtp11.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.iad3b.rsapps.net with LMTP id 2FYDCph5BV1tRgAA3NpJmQ ; Sat, 15 Jun 2019 19:04:56 -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: smtp11.gate.iad3b.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: fd488f0c-8fc1-11e9-941a-52540070b5bb-1-1 Received: from [216.105.38.7] ([216.105.38.7:33872] helo=lists.sourceforge.net) by smtp11.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 51/E5-01483-799750D5; Sat, 15 Jun 2019 19:04:55 -0400 Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1hcHhi-0003Lz-HO; Sat, 15 Jun 2019 23:03:22 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hcHhh-0003Ls-1f for openvpn-devel@lists.sourceforge.net; Sat, 15 Jun 2019 23:03: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=Ms3O3JHR6gPMxBmvHpbnDFp9ayFwxvYdm6LNYJhPsbg=; b=VDTWY84Gk7G5dl/pXxm8SlHLqn 3DmKe3ewigkNy42CQTqrRazURE0439YGMG4hrj96v++Pji5Wg6bNN4wIZVheldm77UQvuRrhbs8GN Oepo84Z9hJZS9HOWnCxPVIUWnbQu2BmPwWfNGY9ERAoWRDgAPfA7g+Bwr4ZqC7DGIOP4=; 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=Ms3O3JHR6gPMxBmvHpbnDFp9ayFwxvYdm6LNYJhPsbg=; b=L DupS9Qrzv2fdKkyg0apwx025jno0VOS4yBnQ6jbpFhhw8Q4iyIfZP4Sedq1akQRrvqH2UQ26T3pB7 yYKRnRaZetqTjHQVQNCb8Q5uqy9skwFvZmkLFp5N0mQBD2B0aBZTajXTT0/GzfbyQW8Zb00PY1zNa 7dGRXm6rFsVE29jo=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hcHha-00Fwq3-89 for openvpn-devel@lists.sourceforge.net; Sat, 15 Jun 2019 23:03:18 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Sun, 16 Jun 2019 01:02:12 +0200 Message-Id: <20190615230213.14888-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 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: makefile.am] -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: 1hcHha-00Fwq3-89 Subject: [Openvpn-devel] [PATCH 1/2] t_net.sh: make bash dep explicit and run only if SITNL is compiled 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 The t_net script currently has #!/bin/sh but it implicitly assume to be using bash. This is fine on most distros, but some do not have sh pointing to bash by default, thus breaking the script. Explicitly use bash to avoid failures. On the other hand, run this unit-test only if SITNL was enabled at compile time. This test was designed with SITNL in mind and it is not yet ready for other backends. Running only when SITNL is enabled implies running on Linux only therefore we are guaranteed that bash will always work. While at it, also add a comment as of why the t_client.rc file is sourced. Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- configure.ac | 3 +++ tests/Makefile.am | 7 ++++--- tests/t_net.sh | 3 ++- tests/unit_tests/openvpn/Makefile.am | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 2d78098e..8c95e310 100644 --- a/configure.ac +++ b/configure.ac @@ -1226,11 +1226,14 @@ else enable_plugin_down_root="no" fi +AM_CONDITIONAL([HAVE_SITNL], [false]) + if test "${enable_iproute2}" = "yes"; then test -z "${IPROUTE}" && AC_MSG_ERROR([ip utility is required but missing]) AC_DEFINE([ENABLE_IPROUTE], [1], [enable iproute2 support]) else if test "${have_sitnl}" = "yes"; then AC_DEFINE([ENABLE_SITNL], [1], [enable sitnl support]) + AM_CONDITIONAL([HAVE_SITNL], [true]) else if test "${WIN32}" != "yes" -a "${have_sitnl}" != "yes"; then test -z "${ROUTE}" && AC_MSG_ERROR([route utility is required but missing]) test -z "${IFCONFIG}" && AC_MSG_ERROR([ifconfig utility is required but missing]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 67acf7e3..801192ed 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,9 +14,10 @@ MAINTAINERCLEANFILES = \ SUBDIRS = unit_tests -test_scripts = t_net.sh -test_scripts += t_client.sh -test_scripts += t_lpback.sh t_cltsrv.sh +test_scripts = t_client.sh t_lpback.sh t_cltsrv.sh +if HAVE_SITNL +test_scripts += t_net.sh +endif TESTS_ENVIRONMENT = top_srcdir="$(top_srcdir)" TESTS = $(test_scripts) diff --git a/tests/t_net.sh b/tests/t_net.sh index 0be5bb42..1940ec92 100755 --- a/tests/t_net.sh +++ b/tests/t_net.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash IFACE="dummy0" UNIT_TEST="./unit_tests/openvpn/networking_testdriver" @@ -74,6 +74,7 @@ run_test() ## execution starts here +# t_client.rc required only for RUN_SUDO definition if [ -r "${top_builddir}"/t_client.rc ]; then . "${top_builddir}"/t_client.rc elif [ -r "${srcdir}"/t_client.rc ]; then diff --git a/tests/unit_tests/openvpn/Makefile.am b/tests/unit_tests/openvpn/Makefile.am index c6da91a8..e61c57c4 100644 --- a/tests/unit_tests/openvpn/Makefile.am +++ b/tests/unit_tests/openvpn/Makefile.am @@ -14,7 +14,7 @@ endif TESTS = $(test_binaries) check_PROGRAMS = $(test_binaries) -if TARGET_LINUX +if HAVE_SITNL check_PROGRAMS += networking_testdriver endif