[PATCH mptcp-next v2 23/32] selftests: mptcp: netlink: print out test counter

Geliang Tang posted 32 patches 2 years, 2 months ago
There is a newer version of this series
[PATCH mptcp-next v2 23/32] selftests: mptcp: netlink: print out test counter
Posted by Geliang Tang 2 years, 2 months ago
This patch prints out TEST_COUNT for every tests in script pm_netlink.sh.

The output looks like:

  1 defaults addr list                        [ OK ]
  2 simple add/get addr                       [ OK ]
  3 dump addrs                                [ OK ]
  4 simple del addr                           [ OK ]
  5 dump addrs after del                      [ OK ]
  6 duplicate addr                            [ OK ]
  7 id addr increment                         [ OK ]
  8 hard addr limit                           [ OK ]
  9 above hard addr limit                     [ OK ]

Having test counters helps to quickly identify issues when looking at a
long list of output logs and results.

Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
 tools/testing/selftests/net/mptcp/pm_netlink.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh
index 32265d4ecb41..e89b78e7d4a0 100755
--- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
+++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
@@ -45,6 +45,8 @@ ip netns exec $ns1 sysctl -q net.mptcp.enabled=1
 
 check()
 {
+	TEST_COUNT=$((TEST_COUNT+1))
+	printf "%2u " "$TEST_COUNT"
 	# ${*} doesn't work here since there're spaces in some arguments.
 	mptcp_lib_check "${1}" "${2}" "${3}"
 	local rc=$?
-- 
2.35.3