selftests: mptcp: adjust output alignment for more tests
Subsystems (3)
PATCH 1/1 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.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +13 -12
@@ -20,6 +20,7 @@ check_invert=0 do_all_tests=1 TEST_COUNT=0 +nr_blank=40 # generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || # (ip6 && (ip6[74] & 0xf0) == 0x30)'"
@@ -743,9 +744,9 @@ chk_csum_nr() local dump_stats if [ ! -z "$msg" ]; then - printf "%02u" "$TEST_COUNT" + printf "%03u" "$TEST_COUNT" else - echo -n " " + echo -n " " fi printf " %-36s %s" "$msg" "sum" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'`
@@ -777,7 +778,7 @@ chk_fail_nr() local count local dump_stats - printf "%-39s %s" " " "ftx" + printf "%-${nr_blank}s %s" " " "ftx" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$mp_fail_nr_tx" ]; then
@@ -809,7 +810,7 @@ chk_infi_nr() local count local dump_stats - printf "%-39s %s" " " "itx" + printf "%-${nr_blank}s %s" " " "itx" count=`ip netns exec $ns2 nstat -as | grep InfiniteMapTx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$mp_infi_nr_tx" ]; then
@@ -843,7 +844,7 @@ chk_join_nr() local count local dump_stats - printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn" + printf "%03u %-36s %s" "$TEST_COUNT" "$msg" "syn" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$syn_nr" ]; then
@@ -898,7 +899,7 @@ chk_stale_nr() local stale_nr local recover_nr - printf "%-39s %-18s" " " "stale" + printf "%-${nr_blank}s %-18s" " " "stale" stale_nr=`ip netns exec $ns nstat -as | grep MPTcpExtSubflowStale | awk '{print $2}'` [ -z "$stale_nr" ] && stale_nr=0 recover_nr=`ip netns exec $ns nstat -as | grep MPTcpExtSubflowRecover | awk '{print $2}'`
@@ -936,7 +937,7 @@ chk_add_nr() local count local dump_stats - printf "%-39s %s" " " "add" + printf "%-${nr_blank}s %s" " " "add" count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$add_nr" ]; then
@@ -970,7 +971,7 @@ chk_add_nr() echo "[ ok ]" fi - printf "%-39s %s" " " "syn" + printf "%-${nr_blank}s %s" " " "syn" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx | awk '{print $2}'` [ -z "$count" ] && count=0
@@ -1009,7 +1010,7 @@ chk_add_nr() echo "[ ok ]" fi - printf "%-39s %s" " " "syn" + printf "%-${nr_blank}s %s" " " "syn" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx | awk '{print $2}'` [ -z "$count" ] && count=0
@@ -1059,7 +1060,7 @@ chk_rm_nr() subflow_ns=$ns1 fi - printf "%-39s %s" " " "rm " + printf "%-${nr_blank}s %s" " " "rm " count=`ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$rm_addr_nr" ]; then
@@ -1091,7 +1092,7 @@ chk_prio_nr() local count local dump_stats - printf "%-39s %s" " " "ptx" + printf "%-${nr_blank}s %s" " " "ptx" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$mp_prio_nr_tx" ]; then
@@ -1127,7 +1128,7 @@ chk_link_usage() local tx_rate=$((tx_link * 100 / $tx_total)) local tolerance=5 - printf "%-39s %-18s" " " "link usage" + printf "%-${nr_blank}s %-18s" " " "link usage" if [ $tx_rate -lt $((expected_rate - $tolerance)) -o \ $tx_rate -gt $((expected_rate + $tolerance)) ]; then echo "[fail] got $tx_rate% usage, expected $expected_rate%"
Signature · 1 line
2.31.1
Quoted 3 lines · Geliang Tang
The number of self tests in
mptcp_join.shwill soon be more than 100, the output alignment is no longer OK. This patch adjusted it.
Good idea, thanks.
Quoted 124 lines
Signed-off-by Geliang Tang <[email protected]>---
.../testing/selftests/net/mptcp/mptcp_join.sh| 25 ++++++++++---------1 file changed, 13 insertions(+), 12 deletions(-)tools/testing/selftests/net/mptcp/mptcp_join.sh +0
-0@@ -20,6 +20,7 @@ check_invert=0do_all_tests=1
TEST_COUNT=0
+nr_blank=40# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) || # (ip6 && (ip6[74] & 0xf0) == 0x30)'"tools/testing/selftests/net/mptcp/mptcp_join.sh +12
-12@@ -743,9 +744,9 @@ chk_csum_nr() local dump_stats if [ ! -z "$msg" ]; then - printf "%02u" "$TEST_COUNT" + printf "%03u" "$TEST_COUNT" else - echo -n " " + echo -n " " fi printf " %-36s %s" "$msg" "sum" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtDataCsumErr | awk '{print $2}'`@@ -777,7 +778,7 @@ chk_fail_nr() local count local dump_stats - printf "%-39s %s" " " "ftx" + printf "%-${nr_blank}s %s" " " "ftx" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$mp_fail_nr_tx" ]; then@@ -809,7 +810,7 @@ chk_infi_nr() local count local dump_stats - printf "%-39s %s" " " "itx" + printf "%-${nr_blank}s %s" " " "itx" count=`ip netns exec $ns2 nstat -as | grep InfiniteMapTx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$mp_infi_nr_tx" ]; then@@ -843,7 +844,7 @@ chk_join_nr() local count local dump_stats - printf "%02u %-36s %s" "$TEST_COUNT" "$msg" "syn" + printf "%03u %-36s %s" "$TEST_COUNT" "$msg" "syn" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinSynRx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$syn_nr" ]; then@@ -898,7 +899,7 @@ chk_stale_nr() local stale_nr local recover_nr - printf "%-39s %-18s" " " "stale" + printf "%-${nr_blank}s %-18s" " " "stale" stale_nr=`ip netns exec $ns nstat -as | grep MPTcpExtSubflowStale | awk '{print $2}'` [ -z "$stale_nr" ] && stale_nr=0 recover_nr=`ip netns exec $ns nstat -as | grep MPTcpExtSubflowRecover | awk '{print $2}'`@@ -936,7 +937,7 @@ chk_add_nr() local count local dump_stats - printf "%-39s %s" " " "add" + printf "%-${nr_blank}s %s" " " "add" count=`ip netns exec $ns2 nstat -as | grep MPTcpExtAddAddr | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$add_nr" ]; then@@ -970,7 +971,7 @@ chk_add_nr() echo "[ ok ]" fi - printf "%-39s %s" " " "syn" + printf "%-${nr_blank}s %s" " " "syn" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPJoinPortSynRx | awk '{print $2}'` [ -z "$count" ] && count=0@@ -1009,7 +1010,7 @@ chk_add_nr() echo "[ ok ]" fi - printf "%-39s %s" " " "syn" + printf "%-${nr_blank}s %s" " " "syn" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMismatchPortSynRx | awk '{print $2}'` [ -z "$count" ] && count=0@@ -1059,7 +1060,7 @@ chk_rm_nr() subflow_ns=$ns1 fi - printf "%-39s %s" " " "rm " + printf "%-${nr_blank}s %s" " " "rm " count=`ip netns exec $addr_ns nstat -as | grep MPTcpExtRmAddr | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$rm_addr_nr" ]; then@@ -1091,7 +1092,7 @@ chk_prio_nr() local count local dump_stats - printf "%-39s %s" " " "ptx" + printf "%-${nr_blank}s %s" " " "ptx" count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPPrioTx | awk '{print $2}'` [ -z "$count" ] && count=0 if [ "$count" != "$mp_prio_nr_tx" ]; then@@ -1127,7 +1128,7 @@ chk_link_usage() local tx_rate=$((tx_link * 100 / $tx_total)) local tolerance=5 - printf "%-39s %-18s" " " "link usage" + printf "%-${nr_blank}s %-18s" " " "link usage" if [ $tx_rate -lt $((expected_rate - $tolerance)) -o \ $tx_rate -gt $((expected_rate + $tolerance)) ]; then echo "[fail] got $tx_rate% usage, expected $expected_rate%"Signature · 1 line
2.31.1
--
Mat Martineau
Intel
Hi Geliang, Mat,
Quoted 2 lines · Geliang Tang
The number of self tests in
mptcp_join.shwill soon be more than 100, the output alignment is no longer OK. This patch adjusted it.
Thank you for the patch and the review!
Now in our tree (feat. for net-next) with Mat's RvB tag:
- 14b3f02f7484: selftests: mptcp: adjust output alignment for more tests
- Results: ce83a4acc66a..f092cd7abb9f
Builds and tests are now in progress:
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220208T093806
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net