Skip to content

Commit

Permalink
selftests: mptcp: join: use += operator to append strings
Browse files Browse the repository at this point in the history
This patch uses addition assignment operator (+=) to append strings instead
of open-coding in mptcp_join.sh. This can make the statements shorter.

Signed-off-by: Geliang Tang <[email protected]>
  • Loading branch information
Geliang Tang authored and intel-lab-lkp committed Mar 8, 2024
1 parent 6790751 commit 947b54c
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -755,18 +755,18 @@ pm_nl_check_endpoint()
line="${line% }"
# the dump order is: address id flags port dev
[ -n "$addr" ] && expected_line="$addr"
expected_line="$expected_line $id"
[ -n "$_flags" ] && expected_line="$expected_line ${_flags//","/" "}"
[ -n "$dev" ] && expected_line="$expected_line $dev"
[ -n "$port" ] && expected_line="$expected_line $port"
expected_line+=" $id"
[ -n "$_flags" ] && expected_line+=" ${_flags//","/" "}"
[ -n "$dev" ] && expected_line+=" $dev"
[ -n "$port" ] && expected_line+=" $port"
else
line=$(ip netns exec $ns ./pm_nl_ctl get $_id)
# the dump order is: id flags dev address port
expected_line="$id"
[ -n "$flags" ] && expected_line="$expected_line $flags"
[ -n "$dev" ] && expected_line="$expected_line $dev"
[ -n "$addr" ] && expected_line="$expected_line $addr"
[ -n "$_port" ] && expected_line="$expected_line $_port"
[ -n "$flags" ] && expected_line+=" $flags"
[ -n "$dev" ] && expected_line+=" $dev"
[ -n "$addr" ] && expected_line+=" $addr"
[ -n "$_port" ] && expected_line+=" $_port"
fi
if [ "$line" = "$expected_line" ]; then
print_ok
Expand Down Expand Up @@ -1217,7 +1217,7 @@ chk_csum_nr()
print_check "sum"
count=$(mptcp_lib_get_counter ${ns1} "MPTcpExtDataCsumErr")
if [ "$count" != "$csum_ns1" ]; then
extra_msg="$extra_msg ns1=$count"
extra_msg+=" ns1=$count"
fi
if [ -z "$count" ]; then
print_skip
Expand All @@ -1230,7 +1230,7 @@ chk_csum_nr()
print_check "csum"
count=$(mptcp_lib_get_counter ${ns2} "MPTcpExtDataCsumErr")
if [ "$count" != "$csum_ns2" ]; then
extra_msg="$extra_msg ns2=$count"
extra_msg+=" ns2=$count"
fi
if [ -z "$count" ]; then
print_skip
Expand Down Expand Up @@ -1274,7 +1274,7 @@ chk_fail_nr()
print_check "ftx"
count=$(mptcp_lib_get_counter ${ns_tx} "MPTcpExtMPFailTx")
if [ "$count" != "$fail_tx" ]; then
extra_msg="$extra_msg,tx=$count"
extra_msg+=",tx=$count"
fi
if [ -z "$count" ]; then
print_skip
Expand All @@ -1288,7 +1288,7 @@ chk_fail_nr()
print_check "failrx"
count=$(mptcp_lib_get_counter ${ns_rx} "MPTcpExtMPFailRx")
if [ "$count" != "$fail_rx" ]; then
extra_msg="$extra_msg,rx=$count"
extra_msg+=",rx=$count"
fi
if [ -z "$count" ]; then
print_skip
Expand Down Expand Up @@ -1323,7 +1323,7 @@ chk_fclose_nr()
if [ -z "$count" ]; then
print_skip
elif [ "$count" != "$fclose_tx" ]; then
extra_msg="$extra_msg,tx=$count"
extra_msg+=",tx=$count"
fail_test "got $count MP_FASTCLOSE[s] TX expected $fclose_tx"
else
print_ok
Expand All @@ -1334,7 +1334,7 @@ chk_fclose_nr()
if [ -z "$count" ]; then
print_skip
elif [ "$count" != "$fclose_rx" ]; then
extra_msg="$extra_msg,rx=$count"
extra_msg+=",rx=$count"
fail_test "got $count MP_FASTCLOSE[s] RX expected $fclose_rx"
else
print_ok
Expand Down Expand Up @@ -1703,7 +1703,7 @@ chk_rm_nr()
count=$((count + cnt))
if [ "$count" != "$rm_subflow_nr" ]; then
suffix="$count in [$rm_subflow_nr:$((rm_subflow_nr*2))]"
extra_msg="$extra_msg simult"
extra_msg+=" simult"
fi
if [ $count -ge "$rm_subflow_nr" ] && \
[ "$count" -le "$((rm_subflow_nr *2 ))" ]; then
Expand Down

0 comments on commit 947b54c

Please sign in to comment.