From nobody Tue Feb 10 06:58:42 2026 Delivered-To: wpasupplicant.patchew@gmail.com Received: by 2002:a05:6638:bd2:0:0:0:0 with SMTP id g18csp1566005jad; Thu, 24 Feb 2022 05:57:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJyj1XZULBsaz45VdW2sgUjeeX3oFCxniJlFh7SfRYwkMzfIIRX7r9wpo+f8hIRFGmJN9cix X-Received: by 2002:a17:906:8244:b0:6ce:7070:b485 with SMTP id f4-20020a170906824400b006ce7070b485mr2365383ejx.347.1645711023640; Thu, 24 Feb 2022 05:57:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645711023; cv=none; d=google.com; s=arc-20160816; b=OFhfrgqDvtZpJuotDe1v3GlUaXs7/RknmtWdFQq9bdiWG12+oDTV7FZueBeejx4lpA 6Nw0w6B2jkbeQSMUuV/O0GkbNlpBHYWH0idp9k5JRzLiWQLB/JXOs5FXBZ6SR0uWKAyn CCsmT24IEKdsbfN0/lsu4dtcvUQkMus75kPccZd57iwFmG60qyLxuPutcx3OeLck07Bc Rdkz6BCbVCUmPbHCcLcj82MJ9X7QVxDauyk14cBs59+iFBijS3D0eW6hVGIy893YewXj E+lwrCjXM0wSwsPx27aDwRTaYw12IjdWPctWAr2OeICkUOwgTiOFjJjGH3tuwnCyG4Ad uJJw== 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=S3Jrr7A6MiE8JCHkBT/ROfwZdMN2UJR8MM2XF951x4s=; b=SyGgvytI8GJjecKGba70wIy1HsE0CqOIFK9VuVZFaJnfZDVO0fKpwlHwipOPLeGgv4 7zL6051jmR8y3KBOdkmMWYpRNnvOdAvqdpKRU0Ncxz4nzSZyxbWy+ykQRBW5ihKJKp// 7pfnO5PJy4ajj+Lrgs4Wp1pEUAh4G+FQ/NT8dzQgkbLkk5QVW34IfDnsSZR/UbbtDFqW pAMYWT70hLeaknPYwjk2klcUq8Kl9meTuZVtXuxPN+9fc0ZRbkehNE0QSByKmJ5aJtWE qnwNWKGwc9cI30HiBTQ3AsacDf7943mun/4LgwnmgQMjrjtW4KjKsXBuBwd1sGQKPqmZ 4btA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=62ZqmZ+0; spf=pass (google.com: domain of mptcp+bounces-3989-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-3989-wpasupplicant.patchew=gmail.com@lists.linux.dev" Return-Path: Received: from ewr.edge.kernel.org (ewr.edge.kernel.org. [147.75.197.195]) by mx.google.com with ESMTPS id f11si1581643edr.39.2022.02.24.05.57.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Feb 2022 05:57:03 -0800 (PST) Received-SPF: pass (google.com: domain of mptcp+bounces-3989-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) client-ip=147.75.197.195; Authentication-Results: mx.google.com; dkim=pass header.i=@tessares-net.20210112.gappssmtp.com header.s=20210112 header.b=62ZqmZ+0; spf=pass (google.com: domain of mptcp+bounces-3989-wpasupplicant.patchew=gmail.com@lists.linux.dev designates 147.75.197.195 as permitted sender) smtp.mailfrom="mptcp+bounces-3989-wpasupplicant.patchew=gmail.com@lists.linux.dev" 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 ewr.edge.kernel.org (Postfix) with ESMTPS id 855481C0EE1 for ; Thu, 24 Feb 2022 13:57:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B38D1747C; Thu, 24 Feb 2022 13:56:56 +0000 (UTC) X-Original-To: mptcp@lists.linux.dev Received: from mail-ed1-f48.google.com (mail-ed1-f48.google.com [209.85.208.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA5681B62 for ; Thu, 24 Feb 2022 13:56:53 +0000 (UTC) Received: by mail-ed1-f48.google.com with SMTP id z22so2983757edd.1 for ; Thu, 24 Feb 2022 05:56:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tessares-net.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=S3Jrr7A6MiE8JCHkBT/ROfwZdMN2UJR8MM2XF951x4s=; b=62ZqmZ+0jj3Wj+F5BvyPo8cS/KRfdv4fhNFDGk4P10nCJVVEx2yBwLm/NkMvQgwIVx 9yEfGgmSVtcxtKNokz7ZaEcT9zgVB7ihWMhLRAsrPYGja40Wx6tWhHiVQYf3UIHkkSv2 E7BTkGjbEPN9vw31FX4fTfCbBYxoc+7fS4yIwGFJDCQxPbYYlzWMaDtbjLnus/PCrtlz lCdLgfjwGhoouqhbyIYuqQIYuAo2h1qfkZ85HgPDNTO5rJa66V9CRBitfZuuXOgXdgAc 8T7NRKH7nx/Rn2/D33hkM5UkGpG9jBcH/NccglyLMIYZbmUaYaBWOuOSnVJ08t5Tz1gD JNyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=S3Jrr7A6MiE8JCHkBT/ROfwZdMN2UJR8MM2XF951x4s=; b=WBcAPAr3ONiFEL4BD/MAsDuLGMrJIp55qROtcjOBndln4TvrGjLxsrPMMGW1eQ+uQz Sw13Fwx3Bpq81i9lAHF87k1cl5io8LpCGi375LKpFrWQp+/e/O05Xy5Y3E7Sn5+6AIZ4 QrYrdtWnPcIkLhfygqElV0+1QKRcGOVxJqBttYVhQZ1YQSTkIUZbLu+7WfHR1/NgWcMP e4M5B0dU8Qj5bHy1HUHkiWJBj7qI0zvaeboMOm9mTnDfnHCC7wgnvIQc/tUknUDKmFM7 Rxv3NOelMZ0vwenrCTS7OVGK9ay2dD2/JndP9qKIbmw0oM9RUnpAPXVXencv9UY6/dz9 qvvA== X-Gm-Message-State: AOAM532VkK1GJkdsm1IWaSy9+LItTWEWsNrLnMshnjNqFUtX2z2z6snr Uw2SzmWVn0frX9C7UFzdnrNxiDAbkUqZ4MXRu4I= X-Received: by 2002:a05:6402:35c8:b0:410:dd43:3c09 with SMTP id z8-20020a05640235c800b00410dd433c09mr2414464edc.256.1645711011767; Thu, 24 Feb 2022 05:56:51 -0800 (PST) Received: from tsr-vdi-mbaerts.nix.tessares.net (static.23.216.130.94.clients.your-server.de. [94.130.216.23]) by smtp.gmail.com with ESMTPSA id 7sm1360733edw.37.2022.02.24.05.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 05:56:51 -0800 (PST) From: Matthieu Baerts To: mptcp@lists.linux.dev Cc: Matthieu Baerts , Mat Martineau Subject: [PATCH mptcp-next v3 10/12] selftests: mptcp: join: avoid backquotes Date: Thu, 24 Feb 2022 14:56:17 +0100 Message-Id: <20220224135619.2523272-11-matthieu.baerts@tessares.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220224135619.2523272-1-matthieu.baerts@tessares.net> References: <20220224135619.2523272-1-matthieu.baerts@tessares.net> 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" 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 Reviewed-by: Mat Martineau Signed-off-by: Matthieu Baerts --- .../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 f5e17cd2a7df..f61c3804f5e0 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -84,7 +84,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 @@ -103,7 +103,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 @@ -1014,7 +1014,7 @@ chk_csum_nr() echo -n " " fi printf " %-36s %s" "$msg" "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 @@ -1025,7 +1025,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 @@ -1046,7 +1046,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" @@ -1057,7 +1057,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" @@ -1199,7 +1199,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" @@ -1210,8 +1210,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 @@ -1229,7 +1229,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" @@ -1263,9 +1263,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 ] || @@ -1301,10 +1301,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 @@ -1318,7 +1318,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" @@ -1330,7 +1330,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" @@ -1341,8 +1341,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 \ @@ -1354,8 +1354,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 \ @@ -1367,8 +1367,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 \ @@ -1380,8 +1380,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 \ @@ -1393,8 +1393,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 \ @@ -1440,7 +1440,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" @@ -1451,7 +1451,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}') @@ -1493,7 +1493,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" @@ -1504,7 +1504,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" @@ -1523,8 +1523,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.34.1