Skip to contentSkip to conversation

selftests: mptcp: Restore packet capture option in join tests

PATCH In review Mat Martineau 3 participants 3 messages Mar 3, 2021 – Mar 6, 2021

Subsystems (3)
lore
Share & tools
lore

Mat Martineau

author
#0 lore raw

PATCH 1/1 selftests: mptcp: Restore packet capture option in join tests

The join self tests previously used the '-c' command line option to enable creation of pcap files for the tests that run, but the change to allow running a subset of the join tests made overlapping use of that option.

Restore the capture functionality with '-c' and move the syncookie test option to '-k'.

Fixes 1002b89f23ea ("selftests: mptcp: add command line arguments for mptcp_join.sh")
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 26 ++++++++++++-------
 1 file changed, 16 insertions(+), 10 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +16 -10
index 96379ede5925..4d7dab0bce7a 100755
@@ -12,6 +12,7 @@ timeout_poll=30
 timeout_test=$((timeout_poll * 2 + 1))
 mptcp_connect=""
 capture=0
+do_all_tests=1
 
 TEST_COUNT=0
 
@@ -123,12 +124,6 @@ reset_with_add_addr_timeout()
 		-j DROP
 }
 
-for arg in "$@"; do
-	if [ "$arg" = "-c" ]; then
-		capture=1
-	fi
-done
-
 ip -Version > /dev/null 2>&1
 if [ $? -ne 0 ];then
 	echo "SKIP: Could not run test without ip tool"
@@ -1368,7 +1363,8 @@ usage()
 	echo "  -4 v4mapped_tests"
 	echo "  -b backup_tests"
 	echo "  -p add_addr_ports_tests"
-	echo "  -c syncookies_tests"
+	echo "  -k syncookies_tests"
+	echo "  -c capture pcap files"
 	echo "  -h help"
 }
 
@@ -1382,12 +1378,20 @@ make_file "$cin" "client" 1
 make_file "$sin" "server" 1
 trap cleanup EXIT
 
-if [ -z $1 ]; then
+for arg in "$@"; do
+	if [ "$arg" = "-c" ]; then
+		capture=1
+	else
+		do_all_tests=0
+	fi
+done
+
+if [ $do_all_tests -eq 1 ]; then
 	all_tests
 	exit $ret
 fi
 
-while getopts 'fsltra64bpch' opt; do
+while getopts 'fsltra64bpkch' opt; do
 	case $opt in
 		f)
 			subflows_tests
@@ -1419,9 +1423,11 @@ while getopts 'fsltra64bpch' opt; do
 		p)
 			add_addr_ports_tests
 			;;
-		c)
+		k)
 			syncookies_tests
 			;;
+		c)
+			;;
 		h | *)
 			usage
 			;;
Signature · 1 line
2.30.1
#1 lore raw

Hi Mat,

I tested this patch, it works well. Thanks.

Acked-and-tested-by: Geliang Tang <geliangtang(a)gmail.com>

-Geliang

Quoted 89 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年3月4日周四 上午6:43写道:

The join self tests previously used the '-c' command line option to enable creation of pcap files for the tests that run, but the change to allow running a subset of the join tests made overlapping use of that option.

Restore the capture functionality with '-c' and move the syncookie test option to '-k'.

Fixes 1002b89f23ea ("selftests: mptcp: add command line arguments for mptcp_join.sh")
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>
---
 .../testing/selftests/net/mptcp/mptcp_join.sh | 26 ++++++++++++-------
 1 file changed, 16 insertions(+), 10 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +16 -11
index 96379ede5925..4d7dab0bce7a 100755
@@ -12,6 +12,7 @@ timeout_poll=30
 timeout_test=$((timeout_poll * 2 + 1))
 mptcp_connect=""
 capture=0
+do_all_tests=1
 
 TEST_COUNT=0
 
@@ -123,12 +124,6 @@ reset_with_add_addr_timeout()
                -j DROP
 }
 
-for arg in "$@"; do
-       if [ "$arg" = "-c" ]; then
-               capture=1
-       fi
-done
-
 ip -Version > /dev/null 2>&1
 if [ $? -ne 0 ];then
        echo "SKIP: Could not run test without ip tool"
@@ -1368,7 +1363,8 @@ usage()
        echo "  -4 v4mapped_tests"
        echo "  -b backup_tests"
        echo "  -p add_addr_ports_tests"
-       echo "  -c syncookies_tests"
+       echo "  -k syncookies_tests"
+       echo "  -c capture pcap files"
        echo "  -h help"
 }
 
@@ -1382,12 +1378,20 @@ make_file "$cin" "client" 1
 make_file "$sin" "server" 1
 trap cleanup EXIT
 
-if [ -z $1 ]; then
+for arg in "$@"; do
+       if [ "$arg" = "-c" ]; then
+               capture=1
+       else
+               do_all_tests=0
+       fi
+done
+
+if [ $do_all_tests -eq 1 ]; then
        all_tests
        exit $ret
 fi
 
-while getopts 'fsltra64bpch' opt; do
+while getopts 'fsltra64bpkch' opt; do
        case $opt in
                f)
                        subflows_tests
@@ -1419,9 +1423,11 @@ while getopts 'fsltra64bpch' opt; do
                p)
                        add_addr_ports_tests
                        ;;
-               c)
+               k)
                        syncookies_tests
                        ;;
+               c)
+                       ;;
                h | *)
                        usage
                        ;;
--

2.30.1

#2 lore raw
In reply to Mat Martineau

Hi Mat, Geliang,

Quoted 10 lines · Mat Martineau

The join self tests previously used the '-c' command line option to enable creation of pcap files for the tests that run, but the change to allow running a subset of the join tests made overlapping use of that option.

Restore the capture functionality with '-c' and move the syncookie test option to '-k'.

Fixes 1002b89f23ea ("selftests: mptcp: add command line arguments for mptcp_join.sh")
Signed-off-by Mat Martineau <mathew.j.martineau(a)linux.intel.com>

Thank you for this patch and the review!
Just applied in our tree with Geliang's Ack+Test tag and my RvB one:

- ac06939a6d2b: selftests: mptcp: Restore packet capture option in join tests
- Results: 20b4296239fa..31d85a0e0974

Tests + export have been queued!

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net