Skip to content

Commit

Permalink
selftests: mptcp: join: stop transfer when check is done
Browse files Browse the repository at this point in the history
Since the mentioned commit, the "userspace pm" tests of mptcp_join
selftests are launching the whole transfer in the background, do the
required checks, then wait for the end of transfer.

There is no need to wait longer, especially because the checks at the
end of the transfer are ignored (which is fine). This saves quite a few
seconds on slow environments.

While at it, use 'mptcp_lib_kill_wait()' helper everywhere, instead of
on a specific one with 'kill_tests_wait()'. Note that old versions will
need commit bdbef0a ("selftests: mptcp: add mptcp_lib_kill_wait")
as well.

Fixes: 4369c19 ("selftests: mptcp: test userspace pm out of transfer")
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
  • Loading branch information
matttbe authored and intel-lab-lkp committed Jan 18, 2024
1 parent de314d2 commit 03a19fa
Showing 1 changed file with 11 additions and 16 deletions.
27 changes: 11 additions & 16 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -643,13 +643,6 @@ kill_events_pids()
mptcp_lib_kill_wait $evts_ns2_pid
}

kill_tests_wait()
{
#shellcheck disable=SC2046
kill -SIGUSR1 $(ip netns pids $ns2) $(ip netns pids $ns1)
wait
}

pm_nl_set_limits()
{
local ns=$1
Expand Down Expand Up @@ -3453,7 +3446,7 @@ userspace_tests()
chk_mptcp_info subflows 0 subflows 0
chk_subflows_total 1 1
kill_events_pids
wait $tests_pid
mptcp_lib_kill_wait $tests_pid
fi

# userspace pm create destroy subflow
Expand All @@ -3475,7 +3468,7 @@ userspace_tests()
chk_mptcp_info subflows 0 subflows 0
chk_subflows_total 1 1
kill_events_pids
wait $tests_pid
mptcp_lib_kill_wait $tests_pid
fi

# userspace pm create id 0 subflow
Expand All @@ -3494,7 +3487,7 @@ userspace_tests()
chk_mptcp_info subflows 1 subflows 1
chk_subflows_total 2 2
kill_events_pids
wait $tests_pid
mptcp_lib_kill_wait $tests_pid
fi

# userspace pm remove initial subflow
Expand All @@ -3518,7 +3511,7 @@ userspace_tests()
chk_mptcp_info subflows 1 subflows 1
chk_subflows_total 1 1
kill_events_pids
wait $tests_pid
mptcp_lib_kill_wait $tests_pid
fi

# userspace pm send RM_ADDR for ID 0
Expand All @@ -3544,7 +3537,7 @@ userspace_tests()
chk_mptcp_info subflows 1 subflows 1
chk_subflows_total 1 1
kill_events_pids
wait $tests_pid
mptcp_lib_kill_wait $tests_pid
fi
}

Expand All @@ -3558,7 +3551,8 @@ endpoint_tests()
pm_nl_set_limits $ns2 2 2
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal
speed=slow \
run_tests $ns1 $ns2 10.0.1.1 2>/dev/null &
run_tests $ns1 $ns2 10.0.1.1 &
local tests_pid=$!

wait_mpj $ns1
pm_nl_check_endpoint "creation" \
Expand All @@ -3573,7 +3567,7 @@ endpoint_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 flags signal
pm_nl_check_endpoint "modif is allowed" \
$ns2 10.0.2.2 id 1 flags signal
kill_tests_wait
mptcp_lib_kill_wait $tests_pid
fi

if reset "delete and re-add" &&
Expand All @@ -3582,7 +3576,8 @@ endpoint_tests()
pm_nl_set_limits $ns2 1 1
pm_nl_add_endpoint $ns2 10.0.2.2 id 2 dev ns2eth2 flags subflow
test_linkfail=4 speed=20 \
run_tests $ns1 $ns2 10.0.1.1 2>/dev/null &
run_tests $ns1 $ns2 10.0.1.1 &
local tests_pid=$!

wait_mpj $ns2
chk_subflow_nr "before delete" 2
Expand All @@ -3597,7 +3592,7 @@ endpoint_tests()
wait_mpj $ns2
chk_subflow_nr "after re-add" 2
chk_mptcp_info subflows 1 subflows 1
kill_tests_wait
mptcp_lib_kill_wait $tests_pid
fi
}

Expand Down

0 comments on commit 03a19fa

Please sign in to comment.