Message ID | 1e938f8458821359f085a0815df487581b0da159.1532961216.git.petrm@mellanox.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <linux-kselftest-owner@kernel.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 332E614BC for <patchwork-linux-kselftest@patchwork.kernel.org>; Mon, 30 Jul 2018 14:39:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2361929EFB for <patchwork-linux-kselftest@patchwork.kernel.org>; Mon, 30 Jul 2018 14:39:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 172F529F0C; Mon, 30 Jul 2018 14:39:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E875E29EFB for <patchwork-linux-kselftest@patchwork.kernel.org>; Mon, 30 Jul 2018 14:39:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731902AbeG3QPO (ORCPT <rfc822;patchwork-linux-kselftest@patchwork.kernel.org>); Mon, 30 Jul 2018 12:15:14 -0400 Received: from mail-eopbgr20079.outbound.protection.outlook.com ([40.107.2.79]:21843 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729224AbeG3QPO (ORCPT <rfc822;linux-kselftest@vger.kernel.org>); Mon, 30 Jul 2018 12:15:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=roBLgH6NASWdEk8LJES/dvj/x/STWiHZgpQqXgIupGI=; b=xNmO34sJoGBodNSwNLwIUUImgjhM5+0ah/1iDefmjsoFTy1AxVZbBtoHDBfYHZAXj8m9Cckru2GI9l+lPPstxNd0ZP6oq5+oV6fgimNYZqIAVTjPTqNHVRCPoxfZKrTaDNYzrtnyAf2qJSWJtmNohFZGZNA1iMKoN0sxpnX0eHY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=petrm@mellanox.com; Received: from t540p (78.45.160.211) by DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.995.20; Mon, 30 Jul 2018 14:39:51 +0000 From: Petr Machata <petrm@mellanox.com> To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Cc: davem@davemloft.net, shuah@kernel.org Subject: [PATCH net-next 1/5] selftests: forwarding: lib: Add require_command() In-Reply-To: <cover.1532961216.git.petrm@mellanox.com> References: <cover.1532961216.git.petrm@mellanox.com> Message-Id: <1e938f8458821359f085a0815df487581b0da159.1532961216.git.petrm@mellanox.com> Date: Mon, 30 Jul 2018 16:39:46 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [78.45.160.211] X-ClientProxiedBy: AM4PR05CA0022.eurprd05.prod.outlook.com (2603:10a6:205::35) To DB7PR05MB4186.eurprd05.prod.outlook.com (2603:10a6:5:18::27) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ddf208e4-de84-4733-f689-08d5f62a4efa X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:DB7PR05MB4186; X-Microsoft-Exchange-Diagnostics: 1;DB7PR05MB4186;3:h4lzJUEfYgxXcK5a7uSxM0aCIVrTH93a2feFVpIVyGJPCes9vWABck0eQeUS0aQLTvyP5ANWO1/8YVBV4CiIrx6JeRk9Tpx41x8ueUhvwSWV5UVO+a9PC1TGzZkrLMJSk+lnvtTr8yS+zK2j5dRkVOq5cGpVFEi6ITu9LEjV7Lo/yMJuapugUcrPyizCmOPGxawb9ijOgFGi2y+k0dkjsYvyFR2ooexV8BhobLxt8oEYmLLYezYhMbm/3shTYwKh;25:AwtFz6BpYJFnLBgebDWB7rs+AHnArAHLeO5gRvUTg73EYKu5YOfVLnDfxxXXtuegx4+sKBvZaobdKCEQAeIz+udFxnkjXPAka0n0DDCRjmqyHD4ai7VWm/WwVhnHISQdbXk9QLJ0jFmsMd/2jOymIyzEOVmGpl8mb2YLqarnELxOZSp6LD8Jwz7LiVgTTKQfGxnltK0Yq34gE3PqObt0Kwhf8EDkRZkcxWnSxzPmpxC/fhjQ+yT9R8GwG17/Z1j+BZHXieJwG2makh/hGDwyuGxm5xypSgbZpm+QJ1+QKrUUK8ycbAL0YYr7/FH8hnAlN23/4wVIetFNq8H6zCrqsw==;31:/uNEp4jiEo+MMlfjkYr7rL4I0OGX2OV4RzbgyHYbYBqlLiYGRrbLT/vvpRSdb4xMgj11ObdcpXFZzR9Y0qMxTz0MHyM7CG/hlA44sjlk7BQQFd2v8a27qveQunjcCtX2bOftDcpTN659vils3v0YHXWbThUPSH2rqfdktCfaKvYQowsgzQ7szaiZuoUOaz++StcFe1r/2dtHmqKJNxTQmj+am6oG7y6TcOw8KqruKKg= X-MS-TrafficTypeDiagnostic: DB7PR05MB4186: X-Microsoft-Exchange-Diagnostics: 1;DB7PR05MB4186;20:Qf5QTaTjTpfEJzIDHb/++Siv3XefBT628929XyoRPO3QU510r51Q8uKLhAeobZSsBHFngN0l8d/JekoeBT4WHYsH78stT4UkbjTxLkOSnq2eT+3GXsnXjqW6E0IlaUi/CmtM/Qod6pst1eFoo4rLIorR2h3HC10jLgmVsV+GeEEZbrHtsDIWbtAehpZoXTdNyfLFuB2C5suWaVp65Qo87mavXR/VtJXjFYvmna3nAEAT+GuZ0JN7I+uzAZlxe1xvIVPNk0mMerjidOdc/mzO4kKjRFb7KBBjH5saP//pZFZeM/A31dpnsJ/fnNFSff3HdQ1Mc+1hC9MMnLuR7CV8C28CtkHyC8qCdztjt7GtInDekb9NJRS6DS7fbcmOiqz4xITgYAT2rybREgJ3Q6MZut8UJB2cW0DSGa2kez1FQAkxqxSY8eQASeasMq24j4w7Md4oaE3mXbcnxyIlRrMh1cdL0bwqwwvvDnr4/3SAblhbtsotYogvMp4GvgVt9DvO;4:gdY2BUlqEs/NFJI9DvwaYTeRizu82A3i+hqmsk1dMr0iJ1x9ZiU6Tezr84rqGQz7R8cZMN45b75CACoyYGVX9B0gBZGUUCEAKG0wW613M0kHLyDe8f5qqKONkQDriK+yMM8AxmndUF8bxKHjwIsi/UCxjhSGsSZU/GERylBRvIbzMCAOV51/ycYQUSzXzEyJ3VQUISW9rkPEhOqkZEQYM7FV5xGO4FOV1WPhCuW1tjD8NfKjCT5xLkmA5YrJK8j9/e9WZlEZKd0EDSuRxNEtKA== X-Microsoft-Antispam-PRVS: <DB7PR05MB4186F484B9B5D5201F72D7DEDB2F0@DB7PR05MB4186.eurprd05.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:DB7PR05MB4186;BCL:0;PCL:0;RULEID:;SRVR:DB7PR05MB4186; X-Forefront-PRVS: 0749DC2CE6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(396003)(136003)(366004)(346002)(39860400002)(376002)(199004)(189003)(478600001)(50466002)(48376002)(305945005)(7736002)(8676002)(105586002)(47776003)(66066001)(25786009)(8936002)(106356001)(81156014)(81166006)(476003)(3846002)(2616005)(486006)(4326008)(956004)(97736004)(118296001)(6486002)(36756003)(53936002)(68736007)(2906002)(5660300001)(16526019)(446003)(11346002)(6116002)(86362001)(58126008)(26005)(316002)(76176011)(186003)(6496006)(6666003)(51416003)(16586007)(52116002)(386003);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR05MB4186;H:t540p;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;DB7PR05MB4186;23:/zF6rmQDxMFtv2Bro2P+w2siEHp/gWvZpi//dRCuQRikidg5ZNb/OCJQy/eStBbvC/JeKHuWkIsUfkC2fIONX/u+UiRPNZZP5tyffxWdo8STKSHngqmZagjUs8hvwvpzOACN+tAkKnt8zsQYi4oIsClUavaVJ6z8dK3MMuxoxdVAIAMVkS+TBcoU4VfX+/CL+vgbTsrsunnFtWgU395qwFrrajvbhFGFMPH5DSr36RJnkeXCuyjlFycNkuRdvf7PbDR56jDPYqBwxyiWFeieUWI+653RY15bGP7x5MyTHu8XpESJgfZVckgSdbu09iRHd/hcdRjpZF7LYeGZfLeVS/xfWb/P0vmzgwrzOuBYwSGAPUrJM2yVIEqSPaH/BqdOw3kH51ym0qfFjZjKTW/lFtIpCpuT1Ihmsx8vqvN9Dtj3pOax7IXQoaN7BUDKk2gmldTuBIjF2nafpVFDSLg35hX0IbpfTLEfxz/rFfsA0qF1bQqRVSJxINhiAZ3+/G22EtwGGHJrUcwQuXuH1vwqQSWi0u/VmMAnm70dO+16NRNc/KL6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tzk1gy07O3F1CYwNb5qLm1xzYH1i2vn3PrSJXAPVCiRuIEUiE3qOex8jNUffRZeHvji1i5XA1EBYr4Q6TRvP2q8JlipGsdHV3mvkXP/LFPPUfRQuZ/+G6SrH2RSDq/HqXJ9bw7CR9GN6kn+dHrhTmRuC7j/ExcI/mRDS96gISamGbUNivfGn1LcuM65NNkCBEPrTopCyBBCWaSebq34MDx6zJSDPOBvpk3AHm1rPHznaJIm0iqbJPqOyYgRkR4pW3ZQHxWCip/h4GSF3SFJVXkoH0D6fUmdEwoTnBez2mqHAugFZl6dlE5TD+lFECag11vNPgNwdY5bAQ+OgNLKdVE/Ff3HFlIJESZ2/alYVbwh4oJ/vBqDeILQlqfqYEDmDAoxbWCvePsKVr/bGmNX0fODw0S+5qw==;5:V08QWUWhQuGr9pm56YVlHg6xFFJ7BoY1NUKpYiHUMzaXAFWef1KuH8Q8APvZXL1X2HN4LHXfCiGdmq4iuXnRAXIcGQNB4IDx8nXKu+O1P4TfiaDCsQ9PPwwBZCo6bnbx6cLqXzUUwpRWkKl5Xe/WrWuAGNwIYlx7j7oEUupUw9w=;7:mPNSNwJ3aSSEYr+RaMjR/u5yyHDwH1tnev4lZU5nkhh3+GavPLPjZOZ7XzWoxBsBck/oN+dNXQ14zqCXYvpbYubG+8PWEG7Mr0F0xs0xqBmJjHSP8T4ajqfOd5qwo4jRJn1EFELBA84Jn59t/y7yRy3dGXF9apUMxitLCqSR2nuG5UuGoG5FQCbf1vxf9S84P2PTQwjStW9lE3LjMQfLfD2SZBmtteKld29YcKVroWKv0RiVrz8W7E/VFO6oal7k SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jul 2018 14:39:51.3289 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ddf208e4-de84-4733-f689-08d5f62a4efa X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR05MB4186 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: <linux-kselftest.vger.kernel.org> X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
A test for mirror-to-gretap with team in UL packet path
|
expand
|
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh index 158d59ffee40..81e36157bf16 100644 --- a/tools/testing/selftests/net/forwarding/lib.sh +++ b/tools/testing/selftests/net/forwarding/lib.sh @@ -62,15 +62,18 @@ if [[ "$CHECK_TC" = "yes" ]]; then check_tc_version fi -if [[ ! -x "$(command -v jq)" ]]; then - echo "SKIP: jq not installed" - exit 1 -fi +require_command() +{ + local cmd=$1; shift -if [[ ! -x "$(command -v $MZ)" ]]; then - echo "SKIP: $MZ not installed" - exit 1 -fi + if [[ ! -x "$(command -v "$cmd")" ]]; then + echo "SKIP: $cmd not installed" + exit 1 + fi +} + +require_command jq +require_command $MZ if [[ ! -v NUM_NETIFS ]]; then echo "SKIP: importer does not define \"NUM_NETIFS\""
The logic for testing whether a certain command is available is used several times in the current code base. The tests in follow-up patches add more requirements like that. Therefore extract the logic into a named function, require_command(), that can be used directly from lib.sh as well as from any test that wishes to declare dependence on some command. Signed-off-by: Petr Machata <petrm@mellanox.com> --- tools/testing/selftests/net/forwarding/lib.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)