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 7, 2024
1 parent 5ab0741 commit 0861c13
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -753,18 +753,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 @@ -1032,7 +1032,7 @@ do_transfer()
fi
fi

extra_srv_args="$extra_args $extra_srv_args"
extra_srv_args+=" $extra_args"
if [ "$test_linkfail" -gt 1 ];then
timeout ${timeout_test} \
ip netns exec ${listener_ns} \
Expand All @@ -1048,7 +1048,7 @@ do_transfer()

mptcp_lib_wait_local_port_listen "${listener_ns}" "${port}"

extra_cl_args="$extra_args $extra_cl_args"
extra_cl_args+=" $extra_args"
if [ "$test_linkfail" -eq 0 ];then
timeout ${timeout_test} \
ip netns exec ${connector_ns} \
Expand Down Expand Up @@ -1215,7 +1215,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 @@ -1228,7 +1228,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 @@ -1272,7 +1272,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 @@ -1286,7 +1286,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 @@ -1321,7 +1321,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 @@ -1332,7 +1332,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 @@ -1701,7 +1701,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 0861c13

Please sign in to comment.