These 'endpoint' tests from 'mptcp_join.sh' selftest start a transfer in
the background and check the status during this transfer.
Once the expected events have been recorded, there is no reason to wait
for the data transfer to finish. It can be stopped earlier to reduce the
execution time by more than half.
For these tests, the exchanged data were not verified. Errors, if any,
were ignored but that's fine, plenty of other tests are looking at that.
It is then OK to mute stderr now that we are sure errors will be printed
(and still ignored) because the transfer is stopped before the end.
Fixes: e274f7154008 ("selftests: mptcp: add subflow limits test-cases")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 52484a7c286a..42e3bd1a05f5 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -498,6 +498,12 @@ kill_events_pids()
kill_wait $evts_ns2_pid
}
+kill_tests_wait()
+{
+ kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
+ wait
+}
+
pm_nl_set_limits()
{
local ns=$1
@@ -3089,7 +3095,7 @@ endpoint_tests()
pm_nl_set_limits $ns1 2 2
pm_nl_set_limits $ns2 2 2
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
- run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow &
+ run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow 2>/dev/null &
wait_mpj $ns1
pm_nl_check_endpoint 1 "creation" \
@@ -3102,14 +3108,14 @@ endpoint_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
pm_nl_check_endpoint 0 "modif is allowed" \
$ns2 10.0.2.2 id 1 flags signal
- wait
+ kill_tests_wait
fi
if reset "delete and re-add"; then
pm_nl_set_limits $ns1 1 1
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
- run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 &
+ run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null &
wait_mpj $ns2
pm_nl_del_endpoint $ns2 2 10.0.2.2
@@ -3119,7 +3125,7 @@ endpoint_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
wait_mpj $ns2
chk_subflow_nr "" "after re-add" 2
- wait
+ kill_tests_wait
fi
}
--
2.38.1
Matthieu Baerts <matthieu.baerts@tessares.net> 于2023年1月31日周二 19:23写道:
>
> These 'endpoint' tests from 'mptcp_join.sh' selftest start a transfer in
> the background and check the status during this transfer.
>
> Once the expected events have been recorded, there is no reason to wait
> for the data transfer to finish. It can be stopped earlier to reduce the
> execution time by more than half.
>
> For these tests, the exchanged data were not verified. Errors, if any,
> were ignored but that's fine, plenty of other tests are looking at that.
> It is then OK to mute stderr now that we are sure errors will be printed
> (and still ignored) because the transfer is stopped before the end.
>
> Fixes: e274f7154008 ("selftests: mptcp: add subflow limits test-cases")
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
> tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 52484a7c286a..42e3bd1a05f5 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -498,6 +498,12 @@ kill_events_pids()
> kill_wait $evts_ns2_pid
> }
>
> +kill_tests_wait()
> +{
> + kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
> + wait
> +}
Can we use the existing function kill_wait() to do this?
Thanks,
-Geliang
> +
> pm_nl_set_limits()
> {
> local ns=$1
> @@ -3089,7 +3095,7 @@ endpoint_tests()
> pm_nl_set_limits $ns1 2 2
> pm_nl_set_limits $ns2 2 2
> pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
> - run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow &
> + run_tests $ns1 $ns2 10.0.1.1 0 0 0 slow 2>/dev/null &
>
> wait_mpj $ns1
> pm_nl_check_endpoint 1 "creation" \
> @@ -3102,14 +3108,14 @@ endpoint_tests()
> pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
> pm_nl_check_endpoint 0 "modif is allowed" \
> $ns2 10.0.2.2 id 1 flags signal
> - wait
> + kill_tests_wait
> fi
>
> if reset "delete and re-add"; then
> pm_nl_set_limits $ns1 1 1
> pm_nl_set_limits $ns2 1 1
> pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
> - run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 &
> + run_tests $ns1 $ns2 10.0.1.1 4 0 0 speed_20 2>/dev/null &
>
> wait_mpj $ns2
> pm_nl_del_endpoint $ns2 2 10.0.2.2
> @@ -3119,7 +3125,7 @@ endpoint_tests()
> pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
> wait_mpj $ns2
> chk_subflow_nr "" "after re-add" 2
> - wait
> + kill_tests_wait
> fi
> }
>
>
> --
> 2.38.1
>
>
Hi Geliang,
On 01/02/2023 06:17, Geliang Tang wrote:
> Matthieu Baerts <matthieu.baerts@tessares.net> 于2023年1月31日周二 19:23写道:
>>
>> These 'endpoint' tests from 'mptcp_join.sh' selftest start a transfer in
>> the background and check the status during this transfer.
>>
>> Once the expected events have been recorded, there is no reason to wait
>> for the data transfer to finish. It can be stopped earlier to reduce the
>> execution time by more than half.
>>
>> For these tests, the exchanged data were not verified. Errors, if any,
>> were ignored but that's fine, plenty of other tests are looking at that.
>> It is then OK to mute stderr now that we are sure errors will be printed
>> (and still ignored) because the transfer is stopped before the end.
>>
>> Fixes: e274f7154008 ("selftests: mptcp: add subflow limits test-cases")
>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
>> ---
>> tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++----
>> 1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> index 52484a7c286a..42e3bd1a05f5 100755
>> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
>> @@ -498,6 +498,12 @@ kill_events_pids()
>> kill_wait $evts_ns2_pid
>> }
>>
>> +kill_tests_wait()
>> +{
>> + kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
>> + wait
>> +}
>
> Can we use the existing function kill_wait() to do this?
Not easily: here, the best is to send SIGUSR1 to mptcp_connect process
to do a graceful stop. We could probably do a SIGTERM but still, in
endpoint_tests(), we don't have the process IDs, we would need to look
for them.
Also, we want to wait for the whole "run_tests" -- launched in the
background -- to finish, not just mptcp_connect but also the validation
part with the different "sleep" before executing the next test.
So I think we should use this new kill_tests_wait() as it is, no?
Cheers,
Matt
--
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
Matthieu Baerts <matthieu.baerts@tessares.net> 于2023年2月1日周三 18:27写道:
>
> Hi Geliang,
>
> On 01/02/2023 06:17, Geliang Tang wrote:
> > Matthieu Baerts <matthieu.baerts@tessares.net> 于2023年1月31日周二 19:23写道:
> >>
> >> These 'endpoint' tests from 'mptcp_join.sh' selftest start a transfer in
> >> the background and check the status during this transfer.
> >>
> >> Once the expected events have been recorded, there is no reason to wait
> >> for the data transfer to finish. It can be stopped earlier to reduce the
> >> execution time by more than half.
> >>
> >> For these tests, the exchanged data were not verified. Errors, if any,
> >> were ignored but that's fine, plenty of other tests are looking at that.
> >> It is then OK to mute stderr now that we are sure errors will be printed
> >> (and still ignored) because the transfer is stopped before the end.
> >>
> >> Fixes: e274f7154008 ("selftests: mptcp: add subflow limits test-cases")
> >> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> >> ---
> >> tools/testing/selftests/net/mptcp/mptcp_join.sh | 14 ++++++++++----
> >> 1 file changed, 10 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> >> index 52484a7c286a..42e3bd1a05f5 100755
> >> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> >> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> >> @@ -498,6 +498,12 @@ kill_events_pids()
> >> kill_wait $evts_ns2_pid
> >> }
> >>
> >> +kill_tests_wait()
> >> +{
> >> + kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
> >> + wait
> >> +}
> >
> > Can we use the existing function kill_wait() to do this?
>
> Not easily: here, the best is to send SIGUSR1 to mptcp_connect process
> to do a graceful stop. We could probably do a SIGTERM but still, in
> endpoint_tests(), we don't have the process IDs, we would need to look
> for them.
>
> Also, we want to wait for the whole "run_tests" -- launched in the
> background -- to finish, not just mptcp_connect but also the validation
> part with the different "sleep" before executing the next test.
>
> So I think we should use this new kill_tests_wait() as it is, no?
I agree.
Thanks,
-Geliang
>
> Cheers,
> Matt
> --
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net
© 2016 - 2025 Red Hat, Inc.