.../testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-)
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 <geliang.tang@suse.com>
---
.../testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 007223364718..2ddb373b7c1d 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -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%"
--
2.31.1
On Mon, 7 Feb 2022, Geliang Tang wrote: > 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. > Good idea, thanks. Reviewed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> > Signed-off-by: Geliang Tang <geliang.tang@suse.com> > --- > .../testing/selftests/net/mptcp/mptcp_join.sh | 25 ++++++++++--------- > 1 file changed, 13 insertions(+), 12 deletions(-) > > diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh > index 007223364718..2ddb373b7c1d 100755 > --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh > +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh > @@ -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%" > -- > 2.31.1 > > > -- Mat Martineau Intel
Hi Geliang, Mat, On 07/02/2022 07:16, Geliang Tang wrote: > 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. 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 -- Tessares | Belgium | Hybrid Access Solutions www.tessares.net
© 2016 - 2024 Red Hat, Inc.