From patchwork Sat Jun 15 13:02:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 755 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director11.mail.ord1d.rsapps.net ([172.27.255.52]) by backend30.mail.ord1d.rsapps.net with LMTP id iO0/J315BV10eAAAIUCqbw for ; Sat, 15 Jun 2019 19:04:29 -0400 Received: from proxy3.mail.iad3a.rsapps.net ([172.27.255.52]) by director11.mail.ord1d.rsapps.net with LMTP id +OgsJH15BV3HGAAAvGGmqA ; Sat, 15 Jun 2019 19:04:29 -0400 Received: from smtp40.gate.iad3a ([172.27.255.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.iad3a.rsapps.net with LMTP id kGiKHX15BV3XVQAAYaqY3Q ; Sat, 15 Jun 2019 19:04:29 -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: smtp40.gate.iad3a.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: ed605b6a-8fc1-11e9-8a2f-5254003a14f9-1-1 Received: from [216.105.38.7] ([216.105.38.7:33832] helo=lists.sourceforge.net) by smtp40.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 4D/D5-10206-D79750D5; Sat, 15 Jun 2019 19:04:29 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1hcHhg-0003Ez-DG; Sat, 15 Jun 2019 23:03:20 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1hcHhf-0003Es-IZ for openvpn-devel@lists.sourceforge.net; Sat, 15 Jun 2019 23:03:19 +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=2k2PKSgdNG8vt+J0L+dA1ISSvH7SNKvsirDqd3WshMo=; b=CJwb2uRazz5xMa9Xm0JfIfoL9C vYTnFfZ6f6q4NLjGDKgbOk0dEKyikzpljJTO6/zCLMM00QXuPtbu/r79zoGwRfP4GCd5P3kHSoCGj RDW38SvBAHZh0GPEM3LFlI50hKy7rZS6SR2PTIWRBDzvLVosc+VTR7a9sNHTvXu+6BTE=; 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=2k2PKSgdNG8vt+J0L+dA1ISSvH7SNKvsirDqd3WshMo=; b=jeNDZJQcvSleSi6FOeDgWOglaM 6pjAqaTzc7QMkdSv3SQGM02AKncjd7batYqqE2guK42kh6MykpGL5XtBF4go6w4C58AtNAPMOZm7D /wlWiwFodFy/ktscSBacFMFtc13eP65sjyEdv8O6+s9Hw+buRJkwA29YRYM+WpHPqqyo=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-4.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hcHhb-00FXuw-PX for openvpn-devel@lists.sourceforge.net; Sat, 15 Jun 2019 23:03:19 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Sun, 16 Jun 2019 01:02:13 +0200 Message-Id: <20190615230213.14888-2-a@unstable.cc> In-Reply-To: <20190615230213.14888-1-a@unstable.cc> References: <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 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 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1hcHhb-00FXuw-PX Subject: [Openvpn-devel] [PATCH 2/2] t_net.sh: properly perform sudo check and print test steps 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 current script is performing a tes ton the "kill" command, but this is not useful to the t_net.sh script as it never really executes it. Rather test that "sudo " really works. has to be added to the sudoers file if this test has to be performend unattanded. The path is: ./unit_tests/openvpn/networking_testdriver On to pof that, print a simple OK for every test that is succesful. Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- tests/t_net.sh | 12 +++++------- tests/unit_tests/openvpn/test_networking.c | 6 ++++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/t_net.sh b/tests/t_net.sh index 1940ec92..70e8517d 100755 --- a/tests/t_net.sh +++ b/tests/t_net.sh @@ -125,14 +125,12 @@ else echo " must be set correctly in 't_client.rc'. SKIP." >&2 exit 77 else - # We have to use sudo. Make sure that we (hopefully) do not have - # to ask the users password during the test. This is done to - # prevent timing issues, e.g. when the waits for openvpn to start - if $RUN_SUDO $KILL_EXEC -0 $$ + # check that we can run the unit-test binary with sudo + if $RUN_SUDO $UNIT_TEST test then - echo "$0: $RUN_SUDO $KILL_EXEC -0 succeeded, good." + echo "$0: $RUN_SUDO $UNIT_TEST succeeded, good." else - echo "$0: $RUN_SUDO $KILL_EXEC -0 failed, cannot go on. SKIP." >&2 + echo "$0: $RUN_SUDO $UNIT_TEST failed, cannot go on. SKIP." >&2 exit 77 fi fi @@ -172,7 +170,7 @@ for i in $(seq 0 $MAX_TEST); do exit 1 fi done - + echo "Test $i: OK" done # remove interface for good diff --git a/tests/unit_tests/openvpn/test_networking.c b/tests/unit_tests/openvpn/test_networking.c index 66035011..6c50da92 100644 --- a/tests/unit_tests/openvpn/test_networking.c +++ b/tests/unit_tests/openvpn/test_networking.c @@ -185,6 +185,12 @@ main(int argc, char *argv[]) return -1; } + /* the t_net script can use this command to perform a dry-run test */ + if (strcmp(argv[1], "test") == 0) + { + return 0; + } + if (argc > 3) { iface = argv[2];