From nobody Mon Feb 9 04:44:28 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6402:2547:0:0:0:0 with SMTP id l7csp459285edb; Wed, 9 Mar 2022 11:17:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkcspcD/8GAJd1AqOElaNkVPHUB51ABnjA5T2gr6c0aRh6tLjBhoeB+KkcZYdpiaz9+e5L X-Received: by 2002:a17:902:ea09:b0:151:f547:90a with SMTP id s9-20020a170902ea0900b00151f547090amr992939plg.63.1646853422629; Wed, 09 Mar 2022 11:17:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646853422; cv=none; d=google.com; s=arc-20160816; b=rC+UbzHrRHsnZBiQF0FhxTqwqGHf6HkIXME1j7ljd72eSVzHHRSmN9FuIQ0UFzs/n9 Yw8lJI8Kj+18EotzKNGI/TlSYy4DLm0MrwQpzI52/XwTZqLbXfRIU3PfBpl0mcI343Rj Ku3XZkaVnyd+X1kthNgSUJkpTm1N5LsPrZ29/gb//3s69p+jYD6J8whFS6hv4C3sE9BL X+oet73Ct87jQ4yUsWt6DhsI0tCiwXzTylovxvOlxK86xy4q39nGf2Z7oebyMlQ1TQVV shiep8Lel4Eo9DjVZKzT8iQuffrkMe0HxYAxD1juW9hNz4xRYXnW/1OxcZi0IvgqMi9u sTnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=TycQkdsPx9lQ4Qn8alut8HyNj6eW47sGMZBqYjpBcu4=; b=YS8roVyhAsZxBWQ+UO5WIGn2cgc32icUFTGc2+T6fyGiRa+Ytv6WUvGXKN3eHc+DcD 62AlqYdYcYJ/NQEI+TVEifzFVJbAAE+slJuOwjPYT3TYMSWCkwscobJOx6i8JplUhTWm LfFg4jQ4S8ZtqGHh7CvU1M1SgGWU/gafXzFTbTOE9Ixe1Wtd4t8c2Y69vif5/eUU2yDe RZAiyPc6cdxrWP0Nn7Qom4fqTla1mJdNic8OXm0k+te7YUfvTNGe2prdspzHD1ihA8lf jD99v0dPcCzvKJd4hW/VvO4dm3EfbKU+pz63EwYMF1vPmT7ahgGOZ/yzAoJBHBJSunyI jRGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aJA4ZpVP; spf=pass (google.com: domain of mptcp+bounces-4197-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-4197-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sjc.edge.kernel.org (sjc.edge.kernel.org. [147.75.69.165]) by mx.google.com with ESMTPS id l10-20020a170902d34a00b00151d89dcddcsi2508441plk.481.2022.03.09.11.17.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Mar 2022 11:17:02 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-4197-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) client-ip=147.75.69.165; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aJA4ZpVP; spf=pass (google.com: domain of mptcp+bounces-4197-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.69.165 as permitted sender) smtp.mailfrom="mptcp+bounces-4197-wpasupplicant.patchew=gmail.com@lists.linux.dev"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sjc.edge.kernel.org (Postfix) with ESMTPS id E3FC73E0F52 for ; Wed, 9 Mar 2022 19:17:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC955511C; Wed, 9 Mar 2022 19:16:56 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6EBC0511A for ; Wed, 9 Mar 2022 19:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646853415; x=1678389415; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HKPfuNLPeP7ul1ZVKp3YujPPqt7Si2b52xWp2zWhw3U=; b=aJA4ZpVPpU3yC3HKcpNXwiBw6Ff2a77qnx0+v367TVVs0o4z/Psw0OkE ebDH1XqQQJksw6gpGKvxfDi+DIGdOtx+GsSzsYw+bzOBsvtDhUzOoZT5L G1yhzex/PgS+BX8jbrNTMH6qxhCygVJI6ff77yXUIJZVh2TYKHIx2Eddm XmWHuaPq2VbajB2kqfFeFP4tD7FiWpTPq4a4Ll9OR6hbwIX+5vL6t0xVL 1SwiMrZVRuTeFwioZp4/FAg7u9MQx8yoDyfVggaNqvrgSeb9J6RKcwwVf HMs+gWUIYsvcGhPI053ba8GJDAZHSIGDLjvxrQgefv6zW+8lrw3fo66PI Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10281"; a="255011996" X-IronPort-AV: E=Sophos;i="5.90,168,1643702400"; d="scan'208";a="255011996" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 11:16:46 -0800 X-IronPort-AV: E=Sophos;i="5.90,168,1643702400"; d="scan'208";a="495957066" Received: from mjmartin-desk2.amr.corp.intel.com (HELO mjmartin-desk2.intel.com) ([10.212.194.198]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Mar 2022 11:16:46 -0800 From: Mat Martineau To: netdev@vger.kernel.org Cc: Matthieu Baerts , davem@davemloft.net, kuba@kernel.org, mptcp@lists.linux.dev, Mat Martineau Subject: [PATCH net-next 09/10] selftests: mptcp: join: avoid backquotes Date: Wed, 9 Mar 2022 11:16:35 -0800 Message-Id: <20220309191636.258232-10-mathew.j.martineau@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220309191636.258232-1-mathew.j.martineau@linux.intel.com> References: <20220309191636.258232-1-mathew.j.martineau@linux.intel.com> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Matthieu Baerts As explained on ShellCheck's wiki [1], it is recommended to avoid backquotes `...` in favour of parenthesis $(...): > Backtick command substitution `...` is legacy syntax with several > issues. > > - It has a series of undefined behaviors related to quoting in POSIX. > - It imposes a custom escaping mode with surprising results. > - It's exceptionally hard to nest. > > $(...) command substitution has none of these problems, and is > therefore strongly encouraged. [1] https://www.shellcheck.net/wiki/SC2006 Signed-off-by: Matthieu Baerts Signed-off-by: Mat Martineau --- .../testing/selftests/net/mptcp/mptcp_join.sh | 66 ++++++++++--------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index d8dc36fcdb56..f5391d027af2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -83,7 +83,7 @@ init_partial() # ns1eth4 ns2eth4 =20 local i - for i in `seq 1 4`; do + for i in $(seq 1 4); do ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$n= s2" ip -net "$ns1" addr add 10.0.$i.1/24 dev ns1eth$i ip -net "$ns1" addr add dead:beef:$i::1/64 dev ns1eth$i nodad @@ -102,7 +102,7 @@ init_partial() init_shapers() { local i - for i in `seq 1 4`; do + for i in $(seq 1 4); do tc -n $ns1 qdisc add dev ns1eth$i root netem rate 20mbit delay 1 tc -n $ns2 qdisc add dev ns2eth$i root netem rate 20mbit delay 1 done @@ -969,7 +969,7 @@ chk_csum_nr() fi =20 printf "%-${nr_blank}s %s" " " "sum" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{= print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '= {print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D $csum_ns1 -a $allow_multi_errors_ns1 -eq 0 ] || [ "$count" -lt $csum_ns1 -a $allow_multi_errors_ns1 -eq 1 ]; then @@ -980,7 +980,7 @@ chk_csum_nr() echo -n "[ ok ]" fi echo -n " - csum " - count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '{= print $2}'` + count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtDataCsumErr | awk '= {print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D $csum_ns2 -a $allow_multi_errors_ns2 -eq 0 ] || [ "$count" -lt $csum_ns2 -a $allow_multi_errors_ns2 -eq 1 ]; then @@ -1001,7 +1001,7 @@ chk_fail_nr() local dump_stats =20 printf "%-${nr_blank}s %s" " " "ftx" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{pri= nt $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{pr= int $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$fail_tx" ]; then echo "[fail] got $count MP_FAIL[s] TX expected $fail_tx" @@ -1012,7 +1012,7 @@ chk_fail_nr() fi =20 echo -n " - failrx" - count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{pri= nt $2}'` + count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{pr= int $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$fail_rx" ]; then echo "[fail] got $count MP_FAIL[s] RX expected $fail_rx" @@ -1121,7 +1121,7 @@ chk_join_nr() fi =20 printf "%03u %-36s %s" "${TEST_COUNT}" "${title}" "syn" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{= print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '= {print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$syn_nr" ]; then echo "[fail] got $count JOIN[s] syn expected $syn_nr" @@ -1132,8 +1132,8 @@ chk_join_nr() fi =20 echo -n " - synack" - with_cookie=3D`ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies` - count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | awk= '{print $2}'` + with_cookie=3D$(ip netns exec $ns2 sysctl -n net.ipv4.tcp_syncookies) + count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinSynAckRx | aw= k '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$syn_ack_nr" ]; then # simult connections exceeding the limit with cookie enabled could go up= to @@ -1151,7 +1151,7 @@ chk_join_nr() fi =20 echo -n " - ack" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinAckRx | awk '{= print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinAckRx | awk '= {print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$ack_nr" ]; then echo "[fail] got $count JOIN[s] ack expected $ack_nr" @@ -1184,9 +1184,9 @@ chk_stale_nr() local recover_nr =20 printf "%-${nr_blank}s %-18s" " " "stale" - stale_nr=3D`ip netns exec $ns nstat -as | grep MPTcpExtSubflowStale | awk= '{print $2}'` + stale_nr=3D$(ip netns exec $ns nstat -as | grep MPTcpExtSubflowStale | aw= k '{print $2}') [ -z "$stale_nr" ] && stale_nr=3D0 - recover_nr=3D`ip netns exec $ns nstat -as | grep MPTcpExtSubflowRecover |= awk '{print $2}'` + recover_nr=3D$(ip netns exec $ns nstat -as | grep MPTcpExtSubflowRecover = | awk '{print $2}') [ -z "$recover_nr" ] && recover_nr=3D0 =20 if [ $stale_nr -lt $stale_min ] || @@ -1222,10 +1222,10 @@ chk_add_nr() local dump_stats local timeout =20 - timeout=3D`ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout` + timeout=3D$(ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout) =20 printf "%-${nr_blank}s %s" " " "add" - count=3D`ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAddA= ddr | awk '{print $2}'` + count=3D$(ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAdd= Addr | awk '{print $2}') [ -z "$count" ] && count=3D0 =20 # if the test configured a short timeout tolerate greater then expected @@ -1239,7 +1239,7 @@ chk_add_nr() fi =20 echo -n " - echo " - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{prin= t $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtEchoAdd | awk '{pri= nt $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$echo_nr" ]; then echo "[fail] got $count ADD_ADDR echo[s] expected $echo_nr" @@ -1251,7 +1251,7 @@ chk_add_nr() =20 if [ $port_nr -gt 0 ]; then echo -n " - pt " - count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{pri= nt $2}'` + count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{pr= int $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$port_nr" ]; then echo "[fail] got $count ADD_ADDR[s] with a port-number expected $port_n= r" @@ -1262,8 +1262,8 @@ chk_add_nr() fi =20 printf "%-${nr_blank}s %s" " " "syn" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx | - awk '{print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx | + awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$syn_nr" ]; then echo "[fail] got $count JOIN[s] syn with a different \ @@ -1275,8 +1275,8 @@ chk_add_nr() fi =20 echo -n " - synack" - count=3D`ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinPortSynAckRx | - awk '{print $2}'` + count=3D$(ip netns exec $ns2 nstat -as | grep MPTcpExtMPJoinPortSynAckRx= | + awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$syn_ack_nr" ]; then echo "[fail] got $count JOIN[s] synack with a different \ @@ -1288,8 +1288,8 @@ chk_add_nr() fi =20 echo -n " - ack" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortAckRx | - awk '{print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortAckRx | + awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$ack_nr" ]; then echo "[fail] got $count JOIN[s] ack with a different \ @@ -1301,8 +1301,8 @@ chk_add_nr() fi =20 printf "%-${nr_blank}s %s" " " "syn" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx | - awk '{print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx | + awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$mis_syn_nr" ]; then echo "[fail] got $count JOIN[s] syn with a mismatched \ @@ -1314,8 +1314,8 @@ chk_add_nr() fi =20 echo -n " - ack " - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortAckRx | - awk '{print $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortAckRx | + awk '{print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$mis_ack_nr" ]; then echo "[fail] got $count JOIN[s] ack with a mismatched \ @@ -1361,7 +1361,7 @@ chk_rm_nr() fi =20 printf "%-${nr_blank}s %s" " " "rm " - count=3D`ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{p= rint $2}'` + count=3D$(ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{= print $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$rm_addr_nr" ]; then echo "[fail] got $count RM_ADDR[s] expected $rm_addr_nr" @@ -1372,7 +1372,7 @@ chk_rm_nr() fi =20 echo -n " - rmsf " - count=3D`ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | a= wk '{print $2}'` + count=3D$(ip netns exec $subflow_ns nstat -as | grep MPTcpExtRmSubflow | = awk '{print $2}') [ -z "$count" ] && count=3D0 if [ -n "$simult" ]; then local cnt=3D$(ip netns exec $addr_ns nstat -as | grep MPTcpExtRmSubflow = | awk '{print $2}') @@ -1414,7 +1414,7 @@ chk_prio_nr() local dump_stats =20 printf "%-${nr_blank}s %s" " " "ptx" - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{pri= nt $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{pr= int $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$mp_prio_nr_tx" ]; then echo "[fail] got $count MP_PRIO[s] TX expected $mp_prio_nr_tx" @@ -1425,7 +1425,7 @@ chk_prio_nr() fi =20 echo -n " - prx " - count=3D`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioRx | awk '{pri= nt $2}'` + count=3D$(ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioRx | awk '{pr= int $2}') [ -z "$count" ] && count=3D0 if [ "$count" !=3D "$mp_prio_nr_rx" ]; then echo "[fail] got $count MP_PRIO[s] RX expected $mp_prio_nr_rx" @@ -1444,8 +1444,10 @@ chk_link_usage() local link=3D$2 local out=3D$3 local expected_rate=3D$4 - local tx_link=3D`ip netns exec $ns cat /sys/class/net/$link/statistics/tx= _bytes` - local tx_total=3D`ls -l $out | awk '{print $5}'` + + local tx_link tx_total + tx_link=3D$(ip netns exec $ns cat /sys/class/net/$link/statistics/tx_byte= s) + tx_total=3D$(ls -l $out | awk '{print $5}') local tx_rate=3D$((tx_link * 100 / $tx_total)) local tolerance=3D5 =20 --=20 2.35.1