selftests: mptcp: add mptcp_lib_events helper
authorGeliang Tang <tanggeliang@kylinos.cn>
Wed, 6 Mar 2024 09:42:55 +0000 (10:42 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 8 Mar 2024 05:06:52 +0000 (21:06 -0800)
commit35bc143a8514ee72b2e9d6b8b385468608b93a53
tree4670958ffefea3e6c3a7b11a8983ec6804bd6eb5
parentdf8d3ba55b4fa1d6aed8449971ee50757cb0732f
selftests: mptcp: add mptcp_lib_events helper

To avoid duplicated code in different MPTCP selftests, we can add and
use helpers defined in mptcp_lib.sh.

This patch unifies "pm_nl_ctl events" related code in userspace_pm.sh
and mptcp_join.sh into a helper mptcp_lib_events(). Define it in
mptcp_lib.sh and use it in both scripts.

Note that mptcp_lib_kill_wait is now call before starting 'events' for
mptcp_join.sh as well, but that's fine: each test is started from a new
netns, so there will not be any existing pid there, and nothing is done
when mptcp_lib_kill_wait is called with 0.

Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://lore.kernel.org/r/20240306-upstream-net-next-20240304-selftests-mptcp-shared-code-shellcheck-v2-6-bc79e6e5e6a0@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/mptcp/mptcp_join.sh
tools/testing/selftests/net/mptcp/mptcp_lib.sh
tools/testing/selftests/net/mptcp/userspace_pm.sh