Skip to content

Commit c9161a0

Browse files
Geliang Tangkuba-moo
authored andcommitted
selftests: mptcp: connect: fix misaligned output
The first [ OK ] in the output of mptcp_connect.sh misaligns with the others: New MPTCP socket can be blocked via sysctl [ OK ] INFO: validating network environment with pings INFO: Using loss of 0.85% delay 16 ms reorder 95% 70% with delay 4ms on ns1 MPTCP -> ns1 (10.0.1.1:10000 ) MPTCP (duration 184ms) [ OK ] ns1 MPTCP -> ns1 (10.0.1.1:10001 ) TCP (duration 50ms) [ OK ] ns1 TCP -> ns1 (10.0.1.1:10002 ) MPTCP (duration 55ms) [ OK ] This patch aligns them by using 69 chars to display the first two lines, and 50 chars for the other. Since 19 chars are used to display duration time. Also print out a [ OK ] at the end of the 2nd line for consistency. Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org> Link: https://lore.kernel.org/r/20240308-upstream-net-next-20240308-selftests-mptcp-unification-v1-3-4f42c347b653@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 01ed983 commit c9161a0

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

tools/testing/selftests/net/mptcp/mptcp_connect.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,11 +248,17 @@ else
248248
set_ethtool_flags "$ns4" ns4eth3 "$ethtool_args"
249249
fi
250250

251+
print_larger_title() {
252+
# here we don't have the time, a bit longer for the alignment
253+
printf "%-69s" "${@}"
254+
}
255+
251256
check_mptcp_disabled()
252257
{
253258
local disabled_ns
254259
mptcp_lib_ns_init disabled_ns
255260

261+
print_larger_title "New MPTCP socket can be blocked via sysctl"
256262
# net.mptcp.enabled should be enabled by default
257263
if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
258264
echo -e "net.mptcp.enabled sysctl is not 1 by default\t\t[ FAIL ]"
@@ -274,7 +280,7 @@ check_mptcp_disabled()
274280
return 1
275281
fi
276282

277-
echo -e "New MPTCP socket can be blocked via sysctl\t\t[ OK ]"
283+
echo "[ OK ]"
278284
mptcp_lib_result_pass "New MPTCP socket can be blocked via sysctl"
279285
return 0
280286
}
@@ -342,7 +348,7 @@ do_transfer()
342348
addr_port=$(printf "%s:%d" ${connect_addr} ${port})
343349
local result_msg
344350
result_msg="$(printf "%.3s %-5s -> %.3s (%-20s) %-5s" ${connector_ns} ${cl_proto} ${listener_ns} ${addr_port} ${srv_proto})"
345-
printf "%s\t" "${result_msg}"
351+
printf "%-50s" "${result_msg}"
346352

347353
if $capture; then
348354
local capuser
@@ -835,7 +841,7 @@ check_mptcp_disabled
835841

836842
stop_if_error "The kernel configuration is not valid for MPTCP"
837843

838-
echo "INFO: validating network environment with pings"
844+
print_larger_title "Validating network environment with pings"
839845
for sender in "$ns1" "$ns2" "$ns3" "$ns4";do
840846
do_ping "$ns1" $sender 10.0.1.1
841847
do_ping "$ns1" $sender dead:beef:1::1
@@ -857,6 +863,7 @@ done
857863
mptcp_lib_result_code "${ret}" "ping tests"
858864

859865
stop_if_error "Could not even run ping tests"
866+
echo "[ OK ]"
860867

861868
[ -n "$tc_loss" ] && tc -net "$ns2" qdisc add dev ns2eth3 root netem loss random $tc_loss delay ${tc_delay}ms
862869
echo -n "INFO: Using loss of $tc_loss "

0 commit comments

Comments
 (0)