Skip to content

Commit 9a0a936

Browse files
geliangtangkuba-moo
authored andcommitted
selftests: mptcp: adjust output alignment for more tests
The number of self tests in mptcp_join.sh will soon be more than 100, the output alignment is no longer OK. This patch adjusted it. Signed-off-by: Geliang Tang <[email protected]> Signed-off-by: Mat Martineau <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 43ff0d7 commit 9a0a936

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ do_all_tests=1
2020
init=0
2121

2222
TEST_COUNT=0
23+
nr_blank=40
2324

2425
# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
2526
# (ip6 && (ip6[74] & 0xf0) == 0x30)'"
@@ -732,9 +733,9 @@ chk_csum_nr()
732733
local dump_stats
733734

734735
if [ ! -z "$msg" ]; then
735-
printf "%02u" "$TEST_COUNT"
736+
printf "%03u" "$TEST_COUNT"
736737
else
737-
echo -n " "
738+
echo -n " "
738739
fi
739740
printf " %-36s %s" "$msg" "sum"
740741
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'`
@@ -766,7 +767,7 @@ chk_fail_nr()
766767
local count
767768
local dump_stats
768769

769-
printf "%-39s %s" " " "ftx"
770+
printf "%-${nr_blank}s %s" " " "ftx"
770771
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}'`
771772
[ -z "$count" ] && count=0
772773
if [ "$count" != "$mp_fail_nr_tx" ]; then
@@ -801,7 +802,7 @@ chk_join_nr()
801802
local dump_stats
802803
local with_cookie
803804

804-
printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn"
805+
printf "%03u %-36s %s" "$TEST_COUNT" "$msg" "syn"
805806
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'`
806807
[ -z "$count" ] && count=0
807808
if [ "$count" != "$syn_nr" ]; then
@@ -863,7 +864,7 @@ chk_stale_nr()
863864
local stale_nr
864865
local recover_nr
865866

866-
printf "%-39s %-18s" " " "stale"
867+
printf "%-${nr_blank}s %-18s" " " "stale"
867868
stale_nr=`ip netns exec $ns nstat -as | grep MPTcpExtSubflowStale | awk '{print $2}'`
868869
[ -z "$stale_nr" ] && stale_nr=0
869870
recover_nr=`ip netns exec $ns nstat -as | grep MPTcpExtSubflowRecover | awk '{print $2}'`
@@ -904,7 +905,7 @@ chk_add_nr()
904905

905906
timeout=`ip netns exec $ns1 sysctl -n net.mptcp.add_addr_timeout`
906907

907-
printf "%-39s %s" " " "add"
908+
printf "%-${nr_blank}s %s" " " "add"
908909
count=`ip netns exec $ns2 nstat -as MPTcpExtAddAddr | grep MPTcpExtAddAddr | awk '{print $2}'`
909910
[ -z "$count" ] && count=0
910911

@@ -941,7 +942,7 @@ chk_add_nr()
941942
echo "[ ok ]"
942943
fi
943944

944-
printf "%-39s %s" " " "syn"
945+
printf "%-${nr_blank}s %s" " " "syn"
945946
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx |
946947
awk '{print $2}'`
947948
[ -z "$count" ] && count=0
@@ -980,7 +981,7 @@ chk_add_nr()
980981
echo "[ ok ]"
981982
fi
982983

983-
printf "%-39s %s" " " "syn"
984+
printf "%-${nr_blank}s %s" " " "syn"
984985
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx |
985986
awk '{print $2}'`
986987
[ -z "$count" ] && count=0
@@ -1030,7 +1031,7 @@ chk_rm_nr()
10301031
subflow_ns=$ns1
10311032
fi
10321033

1033-
printf "%-39s %s" " " "rm "
1034+
printf "%-${nr_blank}s %s" " " "rm "
10341035
count=`ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'`
10351036
[ -z "$count" ] && count=0
10361037
if [ "$count" != "$rm_addr_nr" ]; then
@@ -1062,7 +1063,7 @@ chk_prio_nr()
10621063
local count
10631064
local dump_stats
10641065

1065-
printf "%-39s %s" " " "ptx"
1066+
printf "%-${nr_blank}s %s" " " "ptx"
10661067
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}'`
10671068
[ -z "$count" ] && count=0
10681069
if [ "$count" != "$mp_prio_nr_tx" ]; then
@@ -1098,7 +1099,7 @@ chk_link_usage()
10981099
local tx_rate=$((tx_link * 100 / $tx_total))
10991100
local tolerance=5
11001101

1101-
printf "%-39s %-18s" " " "link usage"
1102+
printf "%-${nr_blank}s %-18s" " " "link usage"
11021103
if [ $tx_rate -lt $((expected_rate - $tolerance)) -o \
11031104
$tx_rate -gt $((expected_rate + $tolerance)) ]; then
11041105
echo "[fail] got $tx_rate% usage, expected $expected_rate%"

0 commit comments

Comments
 (0)