diff mbox series

[mptcp-next] selftests: mptcp: support capture with other options

Message ID 20210308135131.2517940-1-matthieu.baerts@tessares.net
State Accepted, archived
Commit e2c177867c7757d8fa459a70e30afb8c822fce21
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-next] selftests: mptcp: support capture with other options | expand

Commit Message

Matthieu Baerts March 8, 2021, 1:51 p.m. UTC
A capture was not started when multiple short options were combined,
e.g.

  ./mptcp_join.sh -fc

A regex is now used to handle this case.

Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---

Notes:
    If we want to reduce the number of commits, we might want to squash this
    one in "selftests: mptcp: Restore packet capture option in join tests"
    commit we have in our tree.
    Either is fine for me.

 tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Mat Martineau March 8, 2021, 7:11 p.m. UTC | #1
On Mon, 8 Mar 2021, Matthieu Baerts wrote:

> A capture was not started when multiple short options were combined,
> e.g.
>
>  ./mptcp_join.sh -fc
>
> A regex is now used to handle this case.
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
>
> Notes:
>    If we want to reduce the number of commits, we might want to squash this
>    one in "selftests: mptcp: Restore packet capture option in join tests"
>    commit we have in our tree.
>    Either is fine for me.
>

Thanks for fixing that - would be best to squash it, please update tags 
for attribution!

Mat


> tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index ca5bf22ca204..abeb24b7f8ec 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -1410,9 +1410,13 @@ make_file "$sin" "server" 1
> trap cleanup EXIT
>
> for arg in "$@"; do
> -	if [ "$arg" = "-c" ]; then
> +	# check for "capture" arg before launching tests
> +	if [[ "${arg}" =~ ^"-"[0-9a-zA-Z]*"c"[0-9a-zA-Z]*$ ]]; then
> 		capture=1
> -	else
> +	fi
> +
> +	# exception for the capture option, the rest means: a part of the tests
> +	if [ "${arg}" != "-c" ]; then
> 		do_all_tests=0
> 	fi
> done
> -- 
> 2.30.1
>
>

--
Mat Martineau
Intel
Matthieu Baerts March 9, 2021, 10:27 p.m. UTC | #2
Hi Mat,

On 08/03/2021 20:11, Mat Martineau wrote:
> 
> On Mon, 8 Mar 2021, Matthieu Baerts wrote:
> 
>> A capture was not started when multiple short options were combined,
>> e.g.
>>
>>  ./mptcp_join.sh -fc
>>
>> A regex is now used to handle this case.
>>
>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
>> ---
>>
>> Notes:
>>    If we want to reduce the number of commits, we might want to squash 
>> this
>>    one in "selftests: mptcp: Restore packet capture option in join tests"
>>    commit we have in our tree.
>>    Either is fine for me.
>>
> 
> Thanks for fixing that - would be best to squash it, please update tags 
> for attribution!

Thank you for the review!

- e2c177867c77: "squashed" in "selftests: mptcp: Restore packet capture 
option in join tests"
- 9d1789345096: "Signed-off-by" + "Co-developed-by"
- Results: 433f124e57a9..808bd0248f2f

Cheers,
Matt
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index ca5bf22ca204..abeb24b7f8ec 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -1410,9 +1410,13 @@  make_file "$sin" "server" 1
 trap cleanup EXIT
 
 for arg in "$@"; do
-	if [ "$arg" = "-c" ]; then
+	# check for "capture" arg before launching tests
+	if [[ "${arg}" =~ ^"-"[0-9a-zA-Z]*"c"[0-9a-zA-Z]*$ ]]; then
 		capture=1
-	else
+	fi
+
+	# exception for the capture option, the rest means: a part of the tests
+	if [ "${arg}" != "-c" ]; then
 		do_all_tests=0
 	fi
 done