From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [RFC PATCH net-next 11/12] selftests: forwarding: Allow to pass commandline options Date: Mon, 15 Jan 2018 21:18:52 +0200 Message-ID: <20180115191853.26129-12-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-eopbgr60054.outbound.protection.outlook.com ([40.107.6.54]:31272 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751309AbeAOTU6 (ORCPT ); Mon, 15 Jan 2018 14:20:58 -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 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/forwarding/lib.sh b/tools/testing/selftests/forwarding/lib.sh index 85dbbe83a243..b9b049af93cb 100644 --- a/tools/testing/selftests/forwarding/lib.sh +++ b/tools/testing/selftests/forwarding/lib.sh @@ -34,17 +34,23 @@ fi source forwarding.config -# Load netdev names from command line +# Load options and netdev names from command line count=0 while [[ $# -gt 0 ]]; do - if [[ "$count" -eq "0" ]]; then - unset NETIFS - declare -A NETIFS + echo $1 | grep "=" &> /dev/null + if [[ $? -eq 0 ]]; then + splitarr=(${1//=/ }) + OPTIONS[${splitarr[0]}]=${splitarr[1]} + else + if [[ "$count" -eq "0" ]]; then + unset NETIFS + declare -A NETIFS + fi + count=$((count + 1)) + NETIFS[p$count]="$1" fi - count=$((count + 1)) - NETIFS[p$count]="$1" shift done -- 2.14.3