From patchwork Fri Aug 7 19:31:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 262648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26AE4C433DF for ; Fri, 7 Aug 2020 19:31:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0B89F204EC for ; Fri, 7 Aug 2020 19:31:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726388AbgHGTbi (ORCPT ); Fri, 7 Aug 2020 15:31:38 -0400 Received: from mailrelay110.isp.belgacom.be ([195.238.20.137]:57815 "EHLO mailrelay110.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgHGTbg (ORCPT ); Fri, 7 Aug 2020 15:31:36 -0400 IronPort-SDR: 1fyfjNk7TYh21MnooOaHM1kLQxRmr0IVJ7A7BlV4g0PWoDOGvC8XN9SL1+2z3btx+xdbm3uS1g JSDcBoiWM+a9CAfT0oQ+6QpcOH1qEZnRJz+4MvHLGsBfs4mpDkhsGTfE6qLi1soXu9GO+CsghI VYQTiFmiYt4F5rvxd+PrTltxnMHUp/iKMcDtaZ/kZHj4yrZ4pirwD6hrxhlETB0AliSP9tVebK ZdDMTG/aaj+QS//ZfVUmRgo6Qex/6aiRcFm/2HQKJNtA5M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gfhQqBQT+BEYNOijQEjz0jpkKCbIMLhFl9kSYPIaANkiuhQ4F6TSAYgyQJRxkNnGhCMDcCBggBAQMJVwE9AZANAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 07 Aug 2020 21:31:24 +0200 From: Fabian Frederick To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Fabian Frederick Subject: [PATCH 1/3 linux-next] selftests: netfilter: add checktool function Date: Fri, 7 Aug 2020 21:31:11 +0200 Message-Id: <20200807193111.12625-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org avoid repeating the same test for different toolcheck Signed-off-by: Fabian Frederick --- .../selftests/netfilter/nft_flowtable.sh | 33 +++++++------------ 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/tools/testing/selftests/netfilter/nft_flowtable.sh b/tools/testing/selftests/netfilter/nft_flowtable.sh index d3e0809ab3681..68a183753c6c3 100755 --- a/tools/testing/selftests/netfilter/nft_flowtable.sh +++ b/tools/testing/selftests/netfilter/nft_flowtable.sh @@ -21,29 +21,18 @@ ns2out="" log_netns=$(sysctl -n net.netfilter.nf_log_all_netns) -nft --version > /dev/null 2>&1 -if [ $? -ne 0 ];then - echo "SKIP: Could not run test without nft tool" - exit $ksft_skip -fi - -ip -Version > /dev/null 2>&1 -if [ $? -ne 0 ];then - echo "SKIP: Could not run test without ip tool" - exit $ksft_skip -fi - -which nc > /dev/null 2>&1 -if [ $? -ne 0 ];then - echo "SKIP: Could not run test without nc (netcat)" - exit $ksft_skip -fi +checktool (){ + $1 > /dev/null 2>&1 + if [ $? -ne 0 ];then + echo "SKIP: Could not $2" + exit $ksft_skip + fi +} -ip netns add nsr1 -if [ $? -ne 0 ];then - echo "SKIP: Could not create net namespace" - exit $ksft_skip -fi +checktool "nft --version" "run test without nft tool" +checktool "ip -Version" "run test without ip tool" +checktool "which nc" "run test without nc (netcat)" +checktool "ip netns add nsr1" "create net namespace" ip netns add ns1 ip netns add ns2 From patchwork Fri Aug 7 19:32:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 262647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBBE3C433E0 for ; Fri, 7 Aug 2020 19:32:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C3973204EC for ; Fri, 7 Aug 2020 19:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726577AbgHGTce (ORCPT ); Fri, 7 Aug 2020 15:32:34 -0400 Received: from mailrelay110.isp.belgacom.be ([195.238.20.137]:57908 "EHLO mailrelay110.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725893AbgHGTce (ORCPT ); Fri, 7 Aug 2020 15:32:34 -0400 IronPort-SDR: V7AeIIJajMKV4ffn7ai1WZh4wGwVr3S6XxuFEUdpd/hcVCppxJWoEGlocw5gdFcvmvC9eayo0/ QekAqwLNr4+wgQ/Q1vZbdk3akSiZdK68n3EEahz4Xm7HfOhq8wfWrFtpXcZcGBqs+Xtw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QECBAEBhEyCOSU4EwIDAQEBAwIFAQEGAQEBAQEBBQQBhg9Fgjcig0YLASMjgT8SgyYBglcptj0zhBCFIoFAgTiIH4UKgUE/hF+KNASPPaZlgmyDC4RZfZEmDyGgDY1lhEahQ4F6TSAYgyQJRxkNjisXjiZCMDcCBggBAQMJVwE9AZANAQE Received: from 16.165-182-91.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([91.182.165.16]) by relay.skynet.be with ESMTP; 07 Aug 2020 21:32:32 +0200 From: Fabian Frederick To: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de Cc: netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, Fabian Frederick Subject: [PATCH 3/3 linux-next] selftests: netfilter: kill running process only Date: Fri, 7 Aug 2020 21:32:20 +0200 Message-Id: <20200807193220.12735-1-fabf@skynet.be> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Avoid noise like the following: nft_flowtable.sh: line 250: kill: (4691) - No such process Signed-off-by: Fabian Frederick --- tools/testing/selftests/netfilter/nft_flowtable.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/netfilter/nft_flowtable.sh b/tools/testing/selftests/netfilter/nft_flowtable.sh index e98cac6f8bfdd..a47d1d8322104 100755 --- a/tools/testing/selftests/netfilter/nft_flowtable.sh +++ b/tools/testing/selftests/netfilter/nft_flowtable.sh @@ -250,8 +250,14 @@ test_tcp_forwarding_ip() sleep 3 - kill $lpid - kill $cpid + if ps -p $lpid > /dev/null;then + kill $lpid + fi + + if ps -p $cpid > /dev/null;then + kill $cpid + fi + wait check_transfer "$ns1in" "$ns2out" "ns1 -> ns2"