From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [RFC PATCH net-next 10/12] selftests: forwarding: Allow to get netdev interfaces names from commandline Date: Mon, 15 Jan 2018 21:18:51 +0200 Message-ID: <20180115191853.26129-11-idosch@mellanox.com> References: <20180115191853.26129-1-idosch@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: davem@davemloft.net, shuah@kernel.org, dsahern@gmail.com, nikolay@cumulusnetworks.com, roopa@cumulusnetworks.com, andy@greyhouse.net, jiri@mellanox.com, mlxsw@mellanox.com, saeedm@mellanox.com, tariqt@mellanox.com, jhs@mojatatu.com, lucasb@mojatatu.com, f.fainelli@gmail.com, vivien.didelot@savoirfairelinux.com, andrew@lunn.ch, jakub.kicinski@netronome.com, simon.horman@netronome.com, Ido Schimmel To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Return-path: Received: from mail-db5eur01on0088.outbound.protection.outlook.com ([104.47.2.88]:4752 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751309AbeAOTUx (ORCPT ); Mon, 15 Jan 2018 14:20:53 -0500 In-Reply-To: <20180115191853.26129-1-idosch@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Jiri Pirko Signed-off-by: Jiri Pirko Signed-off-by: Ido Schimmel --- tools/testing/selftests/forwarding/lib.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/testing/selftests/forwarding/lib.sh b/tools/testing/selftests/forwarding/lib.sh index ddc3ef77f21d..85dbbe83a243 100644 --- a/tools/testing/selftests/forwarding/lib.sh +++ b/tools/testing/selftests/forwarding/lib.sh @@ -34,6 +34,20 @@ fi source forwarding.config +# Load netdev names from command line + +count=0 + +while [[ $# -gt 0 ]]; do + if [[ "$count" -eq "0" ]]; then + unset NETIFS + declare -A NETIFS + fi + count=$((count + 1)) + NETIFS[p$count]="$1" + shift +done + for i in $(eval echo {1..$NUM_NETIFS}); do ip link show dev ${NETIFS[p$i]} &> /dev/null if [[ $? -ne 0 ]]; then -- 2.14.3