From nobody Sat May 18 15:38:16 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 317241442F7; Thu, 11 Apr 2024 10:07:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830048; cv=none; b=BwFw2IXWhnUIe6Z2Z7TAhKDYCfMgXvW6TikQE5/oGNruEXwo1BgbRA64CibgpvFG8AOY5FIu4NJWiN1DlRBFDzkIfFcvkyQHOOKN+EQUJXfKLzhFTGGS/onvYSU3pYymDi8O3oKWcSn3+gOXMO9PGaKeYmEHqOiPU5RLT4AddsE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830048; c=relaxed/simple; bh=EM7oU+a0+p9LBUZQI2VWIcmwX9fMR+0QBaEkatEEWZw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fMq44HWIWbLA9g2OfwsmNxSMbffeu6KZnQ0Y5If4hwXMYefjSrqywvxhJ9kNWOCayykX2bd9RQa5gxDJKVndbDmrQD77wDpOMA06dk6W179w8K8OvLXE7uU5YcG/Lh2DK6G5a57VuMV81UgMaCIH0scZ8yEn+unjWXpZhDhrhMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=iJUpC6S3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="iJUpC6S3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71A43C43394; Thu, 11 Apr 2024 10:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712830048; bh=EM7oU+a0+p9LBUZQI2VWIcmwX9fMR+0QBaEkatEEWZw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJUpC6S34sgiBulNE15mhDs0ua2xOmB/ZczqSCMCowdYVgo4nUpVuDZBvdQXtb+X6 FnRZaI9Lh5aSuj15/262DpaS+BGpSGjtel5202QHqLspB+7Ku6BU/Puuj0pB3AxTk5 UuAPNjxNYfnWpI2/y3IADOoFCcO3DY1j6O3nIqxBaCtEx7zZcMOgA/TzybGLSfPCIG cTTDaY6Wq98KT+blcDdJB++1H2m2yOhYi2TwuwRfnvm1b3PgCD2JLbtwGCNgyK8rND W3P8/dnHPNToMXCN0w2q7b+llEZXakm3sKYrGeP4gkkcSQf+dzqZeX1SBY+59li2uN a6D9JICOde6ig== From: "Matthieu Baerts (NGI0)" To: stable@vger.kernel.org, gregkh@linuxfoundation.org Cc: MPTCP Upstream , Geliang Tang , Matthieu Baerts , Jakub Kicinski Subject: [PATCH 6.6.y] selftests: mptcp: use += operator to append strings Date: Thu, 11 Apr 2024 12:07:10 +0200 Message-ID: <20240411100709.367235-2-matttbe@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <2024040520-unselect-antitrust-a41b@gregkh> References: <2024040520-unselect-antitrust-a41b@gregkh> Precedence: bulk X-Mailing-List: mptcp@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=9406; i=matttbe@kernel.org; h=from:subject; bh=oBQ+Js1KpqPYckmQKim+8PXm2le7XI4J1nqauNb637Q=; b=owEBbQKS/ZANAwAIAfa3gk9CaaBzAcsmYgBmF7ZNYABbvKdKYnhXZ9aFgH5/sIkg0T1QWzLyA i4q5QG1wAeJAjMEAAEIAB0WIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZhe2TQAKCRD2t4JPQmmg c5qDD/9pOEKo5Obn2K/Mnoj2vFs5za4bNqId6bDZjCqkqgSlQoCqF4prGPRUuccOjyHK4MfXlbx Xch2u/RYmoUpnX6vm+OJdwMghhN3WipVh58JQTF+42mxzJLyNeWyLm2hutPfH9F8mrcjvZcx+Nb ltHRtDvKdOCFmolGEUZg0++v14Y8JUxgW15R2oQewmBbSRX3GOx78g2MgjXePO3z8hCEOemEsRx y728jyOJlDSPpy4WF39Sq3hBD7YFdw7u+vE3v2/ctJhlZ+EN1TVldM1oQkL+T1cbOXpA5THRBiH BoryOXdQbE6K1WW0XhHj2jkILl5mkcmdumbC7AhXQbquzRpF1SLP4qiA50NYCAZCmRu4hrFBCCc Mzden/0er++WoPQZ9elHbWTnq9z8T4tXTHlurW8jBda+LsPapQin+FUPYbOa5f+sdFQcWJSqDNv +2M4CXiObz9wCuF6+CHSXMhEh3OAnjwySZm2FGBSAX6lTNCioBgltH88ookS3tWa0ArsaXU9Xfj EmelxG25qZ5SgJFqbU0jz6LIMqkBuawuXej6gyF9JLbWyLriP34xrowsvk4P5xt7WlWsxOwl772 x24rDAvmSnGddWqJY2oKA2ONc/cj+z3yUg1Q8GJKVgdCPn7nxeQeCBCeh/9ID+Sp5h+k3E998ud yKTGAqDd9+YEQNw== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Geliang Tang commit e7c42bf4d320affe37337aa83ae0347832b3f568 upstream. This patch uses addition assignment operator (+=3D) to append strings instead of duplicating the variable name in mptcp_connect.sh and mptcp_join.sh. This can make the statements shorter. Note: in mptcp_connect.sh, add a local variable extra in do_transfer to save the various extra warning logs, using +=3D to append it. And add a new variable tc_info to save various tc info, also using +=3D to append it. This can make the code more readable and prepare for the next commit. Signed-off-by: Geliang Tang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) Link: https://lore.kernel.org/r/20240308-upstream-net-next-20240308-selftes= ts-mptcp-unification-v1-8-4f42c347b653@kernel.org Signed-off-by: Jakub Kicinski [ Conflicts in mptcp_connect.sh: this commit was supposed to be backported before commit 7a1b3490f47e ("mptcp: don't account accept() of non-MPC client as fallback to TCP"). The new condition added by this commit was then not expected, and was in fact at the wrong place in v6.6: in case of issue, the problem would not have been reported correctly. ] Signed-off-by: Matthieu Baerts (NGI0) --- .../selftests/net/mptcp/mptcp_connect.sh | 53 ++++++++++--------- .../testing/selftests/net/mptcp/mptcp_join.sh | 30 +++++------ 2 files changed, 43 insertions(+), 40 deletions(-) diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/tes= ting/selftests/net/mptcp/mptcp_connect.sh index 7647c74adb26..d203d314b7b2 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh @@ -374,15 +374,15 @@ do_transfer() TEST_COUNT=3D$((TEST_COUNT+1)) =20 if [ "$rcvbuf" -gt 0 ]; then - extra_args=3D"$extra_args -R $rcvbuf" + extra_args+=3D" -R $rcvbuf" fi =20 if [ "$sndbuf" -gt 0 ]; then - extra_args=3D"$extra_args -S $sndbuf" + extra_args+=3D" -S $sndbuf" fi =20 if [ -n "$testmode" ]; then - extra_args=3D"$extra_args -m $testmode" + extra_args+=3D" -m $testmode" fi =20 if [ -n "$extra_args" ] && $options_log; then @@ -503,6 +503,7 @@ do_transfer() check_transfer $cin $sout "file received by server" rets=3D$? =20 + local extra=3D"" local stat_synrx_now_l local stat_ackrx_now_l local stat_cookietx_now @@ -538,7 +539,7 @@ do_transfer() "${stat_ackrx_now_l}" "${expect_ackrx}" 1>&2 rets=3D1 else - printf "[ Note ] fallback due to TCP OoO" + extra+=3D" [ Note ] fallback due to TCP OoO" fi fi =20 @@ -561,13 +562,6 @@ do_transfer() fi fi =20 - if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then - printf "[ OK ]" - mptcp_lib_result_pass "${TEST_GROUP}: ${result_msg}" - else - mptcp_lib_result_fail "${TEST_GROUP}: ${result_msg}" - fi - if [ ${stat_ooo_now} -eq 0 ] && [ ${stat_tcpfb_last_l} -ne ${stat_tcpfb_n= ow_l} ]; then mptcp_lib_pr_fail "unexpected fallback to TCP" rets=3D1 @@ -575,30 +569,39 @@ do_transfer() =20 if [ $cookies -eq 2 ];then if [ $stat_cookietx_last -ge $stat_cookietx_now ] ;then - printf " WARN: CookieSent: did not advance" + extra+=3D" WARN: CookieSent: did not advance" fi if [ $stat_cookierx_last -ge $stat_cookierx_now ] ;then - printf " WARN: CookieRecv: did not advance" + extra+=3D" WARN: CookieRecv: did not advance" fi else if [ $stat_cookietx_last -ne $stat_cookietx_now ] ;then - printf " WARN: CookieSent: changed" + extra+=3D" WARN: CookieSent: changed" fi if [ $stat_cookierx_last -ne $stat_cookierx_now ] ;then - printf " WARN: CookieRecv: changed" + extra+=3D" WARN: CookieRecv: changed" fi fi =20 if [ ${stat_synrx_now_l} -gt ${expect_synrx} ]; then - printf " WARN: SYNRX: expect %d, got %d (probably retransmissions)" \ - "${expect_synrx}" "${stat_synrx_now_l}" + extra+=3D" WARN: SYNRX: expect ${expect_synrx}," + extra+=3D" got ${stat_synrx_now_l} (probably retransmissions)" fi if [ ${stat_ackrx_now_l} -gt ${expect_ackrx} ]; then - printf " WARN: ACKRX: expect %d, got %d (probably retransmissions)" \ - "${expect_ackrx}" "${stat_ackrx_now_l}" + extra+=3D" WARN: ACKRX: expect ${expect_ackrx}," + extra+=3D" got ${stat_ackrx_now_l} (probably retransmissions)" + fi + + if [ $retc -eq 0 ] && [ $rets -eq 0 ]; then + printf "[ OK ]%s\n" "${extra}" + mptcp_lib_result_pass "${TEST_GROUP}: ${result_msg}" + else + if [ -n "${extra}" ]; then + printf "%s\n" "${extra:1}" + fi + mptcp_lib_result_fail "${TEST_GROUP}: ${result_msg}" fi =20 - echo cat "$capout" [ $retc -eq 0 ] && [ $rets -eq 0 ] } @@ -924,8 +927,8 @@ mptcp_lib_result_code "${ret}" "ping tests" stop_if_error "Could not even run ping tests" =20 [ -n "$tc_loss" ] && tc -net "$ns2" qdisc add dev ns2eth3 root netem loss = random $tc_loss delay ${tc_delay}ms -echo -n "INFO: Using loss of $tc_loss " -test "$tc_delay" -gt 0 && echo -n "delay $tc_delay ms " +tc_info=3D"loss of $tc_loss " +test "$tc_delay" -gt 0 && tc_info+=3D"delay $tc_delay ms " =20 reorder_delay=3D$((tc_delay / 4)) =20 @@ -936,17 +939,17 @@ if [ -z "${tc_reorder}" ]; then =20 if [ $reorder_delay -gt 0 ] && [ $reorder1 -lt 100 ] && [ $reorder2 -gt 0= ]; then tc_reorder=3D"reorder ${reorder1}% ${reorder2}%" - echo -n "$tc_reorder with delay ${reorder_delay}ms " + tc_info+=3D"$tc_reorder with delay ${reorder_delay}ms " fi elif [ "$tc_reorder" =3D "0" ];then tc_reorder=3D"" elif [ "$reorder_delay" -gt 0 ];then # reordering requires some delay tc_reorder=3D"reorder $tc_reorder" - echo -n "$tc_reorder with delay ${reorder_delay}ms " + tc_info+=3D"$tc_reorder with delay ${reorder_delay}ms " fi =20 -echo "on ns3eth4" +echo "INFO: Using ${tc_info}on ns3eth4" =20 tc -net "$ns3" qdisc add dev ns3eth4 root netem delay ${reorder_delay}ms $= tc_reorder =20 diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testin= g/selftests/net/mptcp/mptcp_join.sh index 1e1c3d713360..371583009a66 100755 --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh @@ -822,18 +822,18 @@ pm_nl_check_endpoint() line=3D"${line% }" # the dump order is: address id flags port dev [ -n "$addr" ] && expected_line=3D"$addr" - expected_line=3D"$expected_line $id" - [ -n "$_flags" ] && expected_line=3D"$expected_line ${_flags//","/" "}" - [ -n "$dev" ] && expected_line=3D"$expected_line $dev" - [ -n "$port" ] && expected_line=3D"$expected_line $port" + expected_line+=3D" $id" + [ -n "$_flags" ] && expected_line+=3D" ${_flags//","/" "}" + [ -n "$dev" ] && expected_line+=3D" $dev" + [ -n "$port" ] && expected_line+=3D" $port" else line=3D$(ip netns exec $ns ./pm_nl_ctl get $_id) # the dump order is: id flags dev address port expected_line=3D"$id" - [ -n "$flags" ] && expected_line=3D"$expected_line $flags" - [ -n "$dev" ] && expected_line=3D"$expected_line $dev" - [ -n "$addr" ] && expected_line=3D"$expected_line $addr" - [ -n "$_port" ] && expected_line=3D"$expected_line $_port" + [ -n "$flags" ] && expected_line+=3D" $flags" + [ -n "$dev" ] && expected_line+=3D" $dev" + [ -n "$addr" ] && expected_line+=3D" $addr" + [ -n "$_port" ] && expected_line+=3D" $_port" fi if [ "$line" =3D "$expected_line" ]; then print_ok @@ -1256,7 +1256,7 @@ chk_csum_nr() print_check "sum" count=3D$(mptcp_lib_get_counter ${ns1} "MPTcpExtDataCsumErr") if [ "$count" !=3D "$csum_ns1" ]; then - extra_msg=3D"$extra_msg ns1=3D$count" + extra_msg+=3D" ns1=3D$count" fi if [ -z "$count" ]; then print_skip @@ -1269,7 +1269,7 @@ chk_csum_nr() print_check "csum" count=3D$(mptcp_lib_get_counter ${ns2} "MPTcpExtDataCsumErr") if [ "$count" !=3D "$csum_ns2" ]; then - extra_msg=3D"$extra_msg ns2=3D$count" + extra_msg+=3D" ns2=3D$count" fi if [ -z "$count" ]; then print_skip @@ -1313,7 +1313,7 @@ chk_fail_nr() print_check "ftx" count=3D$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFailTx") if [ "$count" !=3D "$fail_tx" ]; then - extra_msg=3D"$extra_msg,tx=3D$count" + extra_msg+=3D",tx=3D$count" fi if [ -z "$count" ]; then print_skip @@ -1327,7 +1327,7 @@ chk_fail_nr() print_check "failrx" count=3D$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFailRx") if [ "$count" !=3D "$fail_rx" ]; then - extra_msg=3D"$extra_msg,rx=3D$count" + extra_msg+=3D",rx=3D$count" fi if [ -z "$count" ]; then print_skip @@ -1362,7 +1362,7 @@ chk_fclose_nr() if [ -z "$count" ]; then print_skip elif [ "$count" !=3D "$fclose_tx" ]; then - extra_msg=3D"$extra_msg,tx=3D$count" + extra_msg+=3D",tx=3D$count" fail_test "got $count MP_FASTCLOSE[s] TX expected $fclose_tx" else print_ok @@ -1373,7 +1373,7 @@ chk_fclose_nr() if [ -z "$count" ]; then print_skip elif [ "$count" !=3D "$fclose_rx" ]; then - extra_msg=3D"$extra_msg,rx=3D$count" + extra_msg+=3D",rx=3D$count" fail_test "got $count MP_FASTCLOSE[s] RX expected $fclose_rx" else print_ok @@ -1742,7 +1742,7 @@ chk_rm_nr() count=3D$((count + cnt)) if [ "$count" !=3D "$rm_subflow_nr" ]; then suffix=3D"$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]" - extra_msg=3D"$extra_msg simult" + extra_msg+=3D" simult" fi if [ $count -ge "$rm_subflow_nr" ] && \ [ "$count" -le "$((rm_subflow_nr *2 ))" ]; then --=20 2.43.0