From patchwork Tue Jul 21 09:55:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1320 X-Patchwork-Delegate: gert@greenie.muc.de Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id sOFRDbFIF1/JAQAAIUCqbw for ; Tue, 21 Jul 2020 15:57:37 -0400 Received: from proxy11.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id EPMNDbFIF19DWQAAovjBpQ (envelope-from ) for ; Tue, 21 Jul 2020 15:57:37 -0400 Received: from smtp4.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy11.mail.ord1d.rsapps.net with LMTP id IGT1HK5IF19oPwAAgKDEHA ; Tue, 21 Jul 2020 15:57:34 -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: smtp4.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: 6c1ff6d4-cb8c-11ea-9ea0-525400760ffc-1-1 Received: from [216.105.38.7] ([216.105.38.7:48128] helo=lists.sourceforge.net) by smtp4.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 4D/4B-19228-0B8471F5; Tue, 21 Jul 2020 15:57:36 -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 1jxyNd-0004Rq-Gi; Tue, 21 Jul 2020 19:56:49 +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 1jxyNc-0004Rh-Pa for openvpn-devel@lists.sourceforge.net; Tue, 21 Jul 2020 19:56:48 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=dt/UagURJc9AYU1RuxogmeFvTpUHlDFE/V1oedsNM6w=; b=BXjNtM9KBiZhl1lE8AxYnRMrXx jzW1UY6GYpYjVbHjD0ncQ8Vn9+nKw5T8OOG3I6J8jza8wak2gr5BKTc303mLowUJdzeZ7UpKy8kkh QzrxIJ7/x68dCjqxgjnBZ2iU/s59i5C0BrdeuO7h2G5D/QS6CcLdbfhLAWrzVvM0a9vA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=dt/UagURJc9AYU1RuxogmeFvTpUHlDFE/V1oedsNM6w=; b=fhoo7FkwHC8gs6r7nbRaAvq9uN G8IWxCianG9GP2unlZ5q0Rz8j5dirsYuIcZ2hBlrhYqFMmSB1qKxcaN24tLun6iFb2G2gQG5bFugz mM0JF7ifc8ek9f5f2/bcNHpl/MO8QPzFTb44X/XE5KFZP9MkFiLmooXRVzCTqMCoUKiU=; 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.92.2) id 1jxyNb-003Yv2-6h for openvpn-devel@lists.sourceforge.net; Tue, 21 Jul 2020 19:56:48 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Tue, 21 Jul 2020 21:55:18 +0200 Message-Id: <20200721195518.14358-1-a@unstable.cc> In-Reply-To: References: 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: unstable.cc] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1jxyNb-003Yv2-6h Subject: [Openvpn-devel] [PATCH v2] t_net.sh: drop hard dependency on t_client.rc 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 Right now t_net.sh depends on t_client.rc in order to source the RUN_SUDO variable only. However, t_client.rc is something that a few people only have configured and thus this would result in t_net.sh almost never executed even if it just could. Drop dependency on t_client.rc by falling back to RUN_SUDO=sudo when the file is missing and no RUN_SUDO is passed via env. While at it, reword the error message to better match the current logic flow. Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- Changes from v1: * default to sudo when no RUN_SUDO is set externally * change warning message tests/t_net.sh | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/tests/t_net.sh b/tests/t_net.sh index c67c3df2..eef3c5d1 100755 --- a/tests/t_net.sh +++ b/tests/t_net.sh @@ -76,10 +76,6 @@ if [ -r "${top_builddir}"/t_client.rc ]; then . "${top_builddir}"/t_client.rc elif [ -r "${srcdir}"/t_client.rc ]; then . "${srcdir}"/t_client.rc -else - echo "$0: cannot find 't_client.rc' in build dir ('${top_builddir}')" >&2 - echo "$0: or source directory ('${srcdir}'). SKIPPING TEST." >&2 - exit 77 fi if [ ! -x "$openvpn" ]; then @@ -117,18 +113,18 @@ else if [ -z "$RUN_SUDO" ] then - echo "$0: this test must run be as root, or RUN_SUDO=... " >&2 - echo " must be set correctly in 't_client.rc'. SKIP." >&2 - exit 77 + echo "$0: no RUN_SUDO=... in t_client.rc or environment, defaulting to 'sudo'." >&2 + echo " if that does not work, set RUN_SUDO= correctly for your system." >&2 + RUN_SUDO="sudo" + fi + + # check that we can run the unit-test binary with sudo + if $RUN_SUDO $UNIT_TEST test + then + echo "$0: $RUN_SUDO $UNIT_TEST succeeded, good." else - # check that we can run the unit-test binary with sudo - if $RUN_SUDO $UNIT_TEST test - then - echo "$0: $RUN_SUDO $UNIT_TEST succeeded, good." - else - echo "$0: $RUN_SUDO $UNIT_TEST failed, cannot go on. SKIP." >&2 - exit 77 - fi + echo "$0: $RUN_SUDO $UNIT_TEST failed, cannot go on. SKIP." >&2 + exit 77 fi fi