add helpers and vars in mptcp_lib.sh, part 2
Subsystems (3)
Geliang Tang
reviewerv4 cover add helpers and vars in mptcp_lib.sh, part 2
From: Geliang Tang <[email protected]>
v4:
- address Matt's comments in v3 except
- keep #1, #3 as separate patches, not squash them into #2, to keep #2 clean.
v3:
- patch #2, drop this line in mptcp_lib_ns_exit():
rm -f /tmp/"$netns".{nstat,out}Geliang Tang (4):
selftests: mptcp: add local variables rndh
selftests: mptcp: add mptcp_lib_ns_init/exit helpers
selftests: mptcp: more operations in ns_init/exit
selftests: mptcp: add mptcp_lib_events helper
tools/testing/selftests/net/mptcp/diag.sh | 9 ++--- .../selftests/net/mptcp/mptcp_connect.sh | 28 +++++-------- .../testing/selftests/net/mptcp/mptcp_join.sh | 26 ++---------- .../testing/selftests/net/mptcp/mptcp_lib.sh | 40 +++++++++++++++++++ .../selftests/net/mptcp/mptcp_sockopt.sh | 22 +++------- .../testing/selftests/net/mptcp/pm_netlink.sh | 10 ++--- .../selftests/net/mptcp/simult_flows.sh | 21 +++------- .../selftests/net/mptcp/userspace_pm.sh | 29 +++----------- 8 files changed, 77 insertions(+), 108 deletions(-)
Signature · 1 line
2.40.1
Geliang Tang
reviewerPATCH v4 1/4 selftests: mptcp: add local variables rndh
From: Geliang Tang <[email protected]>
This patch adds local variables rndh in do_transfer() functions both in mptcp_connect.sh and simult_flows.sh, setting it with ${ns1:4}, not the global variable rndh. The global one is hidden in the next commit.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 1 + tools/testing/selftests/net/mptcp/simult_flows.sh | 1 + 2 files changed, 2 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +1 -0
@@ -348,6 +348,7 @@ do_transfer() if $capture; then local capuser + local rndh="${connector_ns:4}" if [ -z $SUDO_USER ] ; then capuser="" else
tools/testing/selftests/net/mptcp/simult_flows.sh +1 -0
@@ -139,6 +139,7 @@ do_transfer() if $capture; then local capuser + local rndh="${ns1:4}" if [ -z $SUDO_USER ] ; then capuser="" else
Signature · 1 line
2.40.1
Geliang Tang
reviewerPATCH v4 2/4 selftests: mptcp: add mptcp_lib_ns_init/exit helpers
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Add helpers mptcp_lib_ns_init() and mptcp_lib_ns_exit() in mptcp_lib.sh to initialize and delete the given namespaces. Then every test script can invoke these helpers and use all namespaces.
--- tools/testing/selftests/net/mptcp/diag.sh | 9 +++----- .../selftests/net/mptcp/mptcp_connect.sh | 23 ++++++++----------- .../testing/selftests/net/mptcp/mptcp_join.sh | 11 ++------- .../testing/selftests/net/mptcp/mptcp_lib.sh | 22 ++++++++++++++++++ .../selftests/net/mptcp/mptcp_sockopt.sh | 17 +++++--------- .../testing/selftests/net/mptcp/pm_netlink.sh | 9 +++----- .../selftests/net/mptcp/simult_flows.sh | 16 ++++--------- .../selftests/net/mptcp/userspace_pm.sh | 14 ++++------- 8 files changed, 54 insertions(+), 67 deletions(-)
tools/testing/selftests/net/mptcp/diag.sh +3 -6
@@ -3,9 +3,7 @@ . "$(dirname "${0}")/mptcp_lib.sh" -sec=$(date +%s) -rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) -ns="ns1-$rndh" +ns="" ksft_skip=4 test_cnt=1 timeout_poll=30
@@ -30,7 +28,7 @@ cleanup() { ip netns pids "${ns}" | xargs --no-run-if-empty kill -SIGKILL &>/dev/null - ip netns del $ns + mptcp_lib_ns_exit "${ns}" } mptcp_lib_check_mptcp
@@ -205,8 +203,7 @@ wait_connected() } trap cleanup EXIT -ip netns add $ns -ip -n $ns link set dev lo up +mptcp_lib_ns_init ns echo "a" | \ timeout ${timeout_test} \
tools/testing/selftests/net/mptcp/mptcp_connect.sh +9 -14
@@ -121,12 +121,10 @@ while getopts "$optstring" option;do esac done -sec=$(date +%s) -rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) -ns1="ns1-$rndh" -ns2="ns2-$rndh" -ns3="ns3-$rndh" -ns4="ns4-$rndh" +ns1="" +ns2="" +ns3="" +ns4="" TEST_COUNT=0 TEST_GROUP=""
@@ -140,9 +138,9 @@ cleanup() local netns for netns in "$ns1" "$ns2" "$ns3" "$ns4";do - ip netns del $netns rm -f /tmp/$netns.{nstat,out} done + mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" "${ns4}" } mptcp_lib_check_mptcp
@@ -158,10 +156,7 @@ cin_disconnect="$cin".disconnect cout_disconnect="$cout".disconnect trap cleanup EXIT -for i in "$ns1" "$ns2" "$ns3" "$ns4";do - ip netns add $i || exit $ksft_skip - ip -net $i link set lo up -done +mptcp_lib_ns_init ns1 ns2 ns3 ns4 # "$ns1" ns2 ns3 ns4 # ns1eth2 ns2eth1 ns2eth3 ns3eth2 ns3eth4 ns4eth3
@@ -251,8 +246,8 @@ fi check_mptcp_disabled() { - local disabled_ns="ns_disabled-$rndh" - ip netns add ${disabled_ns} || exit $ksft_skip + local disabled_ns + mptcp_lib_ns_init disabled_ns # net.mptcp.enabled should be enabled by default if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
@@ -266,7 +261,7 @@ check_mptcp_disabled() local err=0 LC_ALL=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \ grep -q "^socket: Protocol not available$" && err=1 - ip netns delete ${disabled_ns} + mptcp_lib_ns_exit "${disabled_ns}" if [ ${err} -eq 0 ]; then echo -e "New MPTCP socket cannot be blocked via sysctl\t\t[ FAIL ]"
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -9
@@ -86,17 +86,10 @@ init_partial() { capout=$(mktemp) - local sec rndh - sec=$(date +%s) - rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) - - ns1="ns1-$rndh" - ns2="ns2-$rndh" + mptcp_lib_ns_init ns1 ns2 local netns for netns in "$ns1" "$ns2"; do - ip netns add $netns || exit $ksft_skip - ip -net $netns link set lo up ip netns exec $netns sysctl -q net.mptcp.enabled=1 ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0
@@ -147,9 +140,9 @@ cleanup_partial() local netns for netns in "$ns1" "$ns2"; do - ip netns del $netns rm -f /tmp/$netns.{nstat,out} done + mptcp_lib_ns_exit "${ns1}" "${ns2}" } init() {
tools/testing/selftests/net/mptcp/mptcp_lib.sh +22 -0
@@ -373,3 +373,25 @@ mptcp_lib_check_output() { return 1 fi } + +mptcp_lib_ns_init() { + local sec rndh + + sec=$(date +%s) + rndh=$(printf %x "$sec")-$(mktemp -u XXXXXX) + + local netns + for netns in "${@}"; do + eval "${netns}=${netns}-${rndh}" + + ip netns add "${!netns}" || exit ${KSFT_SKIP} + ip -net "${!netns}" link set lo up + done +} + +mptcp_lib_ns_exit() { + local netns + for netns in "${@}"; do + ip netns del "$netns" + done +}
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +6 -11
@@ -14,11 +14,9 @@ timeout_test=$((timeout_poll * 2 + 1)) iptables="iptables" ip6tables="ip6tables" -sec=$(date +%s) -rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) -ns1="ns1-$rndh" -ns2="ns2-$rndh" -ns_sbox="ns_sbox-$rndh" +ns1="" +ns2="" +ns_sbox="" add_mark_rules() {
@@ -40,10 +38,10 @@ add_mark_rules() init() { + mptcp_lib_ns_init ns1 ns2 ns_sbox + local netns for netns in "$ns1" "$ns2" "$ns_sbox";do - ip netns add $netns || exit $ksft_skip - ip -net $netns link set lo up ip netns exec $netns sysctl -q net.mptcp.enabled=1 ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0
@@ -79,10 +77,7 @@ init() cleanup() { - local netns - for netns in "$ns1" "$ns2" "$ns_sbox"; do - ip netns del $netns - done + mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns_sbox}" rm -f "$cin" "$cout" rm -f "$sin" "$sout" }
tools/testing/selftests/net/mptcp/pm_netlink.sh +3 -6
@@ -24,15 +24,13 @@ while getopts "$optstring" option;do esac done -sec=$(date +%s) -rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) -ns1="ns1-$rndh" +ns1="" err=$(mktemp) cleanup() { rm -f $err - ip netns del $ns1 + mptcp_lib_ns_exit "${ns1}" } mptcp_lib_check_mptcp
@@ -40,8 +38,7 @@ mptcp_lib_check_tools ip trap cleanup EXIT -ip netns add $ns1 || exit $ksft_skip -ip -net $ns1 link set lo up +mptcp_lib_ns_init ns1 ip netns exec $ns1 sysctl -q net.mptcp.enabled=1 check()
tools/testing/selftests/net/mptcp/simult_flows.sh +5 -11
@@ -3,11 +3,9 @@ . "$(dirname "${0}")/mptcp_lib.sh" -sec=$(date +%s) -rndh=$(printf %x $sec)-$(mktemp -u XXXXXX) -ns1="ns1-$rndh" -ns2="ns2-$rndh" -ns3="ns3-$rndh" +ns1="" +ns2="" +ns3="" capture=false ksft_skip=4 timeout_poll=30
@@ -36,10 +34,7 @@ cleanup() rm -f "$large" "$small" rm -f "$capout" - local netns - for netns in "$ns1" "$ns2" "$ns3";do - ip netns del $netns - done + mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" } mptcp_lib_check_mptcp
@@ -65,9 +60,8 @@ setup() trap cleanup EXIT + mptcp_lib_ns_init ns1 ns2 ns3 for i in "$ns1" "$ns2" "$ns3";do - ip netns add $i || exit $ksft_skip - ip -net $i link set lo up ip netns exec $i sysctl -q net.ipv4.conf.all.rp_filter=0 ip netns exec $i sysctl -q net.ipv4.conf.default.rp_filter=0 done
tools/testing/selftests/net/mptcp/userspace_pm.sh +4 -10
@@ -50,10 +50,8 @@ app6_port=50004 client_addr_id=${RANDOM:0:2} server_addr_id=${RANDOM:0:2} -sec=$(date +%s) -rndh=$(printf %x "$sec")-$(mktemp -u XXXXXX) -ns1="ns1-$rndh" -ns2="ns2-$rndh" +ns1="" +ns2="" ret=0 test_name=""
@@ -118,10 +116,7 @@ cleanup() mptcp_lib_kill_wait $pid done - local netns - for netns in "$ns1" "$ns2" ;do - ip netns del "$netns" - done + mptcp_lib_ns_exit "${ns1}" "${ns2}" rm -rf $file $client_evts $server_evts
@@ -131,9 +126,8 @@ cleanup() trap cleanup EXIT # Create and configure network namespaces for testing +mptcp_lib_ns_init ns1 ns2 for i in "$ns1" "$ns2" ;do - ip netns add "$i" || exit 1 - ip -net "$i" link set lo up ip netns exec "$i" sysctl -q net.mptcp.enabled=1 ip netns exec "$i" sysctl -q net.mptcp.pm_type=1 done
Signature · 1 line
2.40.1
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v4 2/4] selftests: mptcp: add mptcp_lib_ns_init/exit helpers
Hi Geliang,
Quoted 5 lines · Geliang Tang
From: Geliang Tang <[email protected]>
Add helpers
mptcp_lib_ns_init()andmptcp_lib_ns_exit()inmptcp_lib.shto initialize and delete the given namespaces. Then every test script can invoke these helpers and use all namespaces.
(...)
Quoted 4 lines
tools/testing/selftests/net/mptcp/mptcp_connect.sh +0
-0
(...)
tools/testing/selftests/net/mptcp/mptcp_connect.sh fi · line 253
Quoted 9 lines
check_mptcp_disabled()
{tools/testing/selftests/net/mptcp/mptcp_connect.sh +2
-2- local disabled_ns="ns_disabled-$rndh" - ip netns add ${disabled_ns} || exit $ksft_skip + local disabled_ns + mptcp_lib_ns_init disabled_ns # net.mptcp.enabled should be enabled by default if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
After patch 3/4, this check will have less value: the other patch will always force it to the 'enabled' value. But I guess that's fine: this check was mainly to make sure we would not forget to adapt the test if we wanted to set it to disable by default. So fine like that.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Geliang Tang
reviewerPATCH v4 3/4 selftests: mptcp: more operations in ns_init/exit
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
Set more the default sysctl values in mptcp_lib_ns_init(). It is fine to do that everywhere, because they could be overridden latter if needed.
mptcp_lib_ns_exit() now also try to remove temp netns files used for the stats even for selftests not using them. That's fine to do that because these files have a unique name.
--- tools/testing/selftests/net/mptcp/mptcp_connect.sh | 4 ---- tools/testing/selftests/net/mptcp/mptcp_join.sh | 7 ------- tools/testing/selftests/net/mptcp/mptcp_lib.sh | 4 ++++ tools/testing/selftests/net/mptcp/mptcp_sockopt.sh | 7 ------- tools/testing/selftests/net/mptcp/pm_netlink.sh | 1 - tools/testing/selftests/net/mptcp/simult_flows.sh | 4 ---- tools/testing/selftests/net/mptcp/userspace_pm.sh | 1 - 7 files changed, 4 insertions(+), 24 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +0 -4
@@ -136,10 +136,6 @@ cleanup() rm -f "$sin" "$sout" rm -f "$capout" - local netns - for netns in "$ns1" "$ns2" "$ns3" "$ns4";do - rm -f /tmp/$netns.{nstat,out} - done mptcp_lib_ns_exit "${ns1}" "${ns2}" "${ns3}" "${ns4}" }
tools/testing/selftests/net/mptcp/mptcp_join.sh +0 -7
@@ -90,10 +90,7 @@ init_partial() local netns for netns in "$ns1" "$ns2"; do - ip netns exec $netns sysctl -q net.mptcp.enabled=1 ip netns exec $netns sysctl -q net.mptcp.pm_type=0 2>/dev/null || true - ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 - ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0 if $checksum; then ip netns exec $netns sysctl -q net.mptcp.checksum_enabled=1 fi
@@ -138,10 +135,6 @@ cleanup_partial() { rm -f "$capout" - local netns - for netns in "$ns1" "$ns2"; do - rm -f /tmp/$netns.{nstat,out} - done mptcp_lib_ns_exit "${ns1}" "${ns2}" }
tools/testing/selftests/net/mptcp/mptcp_lib.sh +4 -0
@@ -386,6 +386,9 @@ mptcp_lib_ns_init() { ip netns add "${!netns}" || exit ${KSFT_SKIP} ip -net "${!netns}" link set lo up + ip netns exec "${!netns}" sysctl -q net.mptcp.enabled=1 + ip netns exec "${!netns}" sysctl -q net.ipv4.conf.all.rp_filter=0 + ip netns exec "${!netns}" sysctl -q net.ipv4.conf.default.rp_filter=0 done }
@@ -393,5 +396,6 @@ mptcp_lib_ns_exit() { local netns for netns in "${@}"; do ip netns del "$netns" + rm -f /tmp/"$netns".{nstat,out} done }
tools/testing/selftests/net/mptcp/mptcp_sockopt.sh +0 -7
@@ -40,13 +40,6 @@ init() { mptcp_lib_ns_init ns1 ns2 ns_sbox - local netns - for netns in "$ns1" "$ns2" "$ns_sbox";do - ip netns exec $netns sysctl -q net.mptcp.enabled=1 - ip netns exec $netns sysctl -q net.ipv4.conf.all.rp_filter=0 - ip netns exec $netns sysctl -q net.ipv4.conf.default.rp_filter=0 - done - local i for i in `seq 1 4`; do ip link add ns1eth$i netns "$ns1" type veth peer name ns2eth$i netns "$ns2"
tools/testing/selftests/net/mptcp/pm_netlink.sh +0 -1
@@ -39,7 +39,6 @@ mptcp_lib_check_tools ip trap cleanup EXIT mptcp_lib_ns_init ns1 -ip netns exec $ns1 sysctl -q net.mptcp.enabled=1 check() {
tools/testing/selftests/net/mptcp/simult_flows.sh +0 -4
@@ -61,10 +61,6 @@ setup() trap cleanup EXIT mptcp_lib_ns_init ns1 ns2 ns3 - for i in "$ns1" "$ns2" "$ns3";do - ip netns exec $i sysctl -q net.ipv4.conf.all.rp_filter=0 - ip netns exec $i sysctl -q net.ipv4.conf.default.rp_filter=0 - done ip link add ns1eth1 netns "$ns1" type veth peer name ns2eth1 netns "$ns2" ip link add ns1eth2 netns "$ns1" type veth peer name ns2eth2 netns "$ns2"
tools/testing/selftests/net/mptcp/userspace_pm.sh +0 -1
@@ -128,7 +128,6 @@ trap cleanup EXIT # Create and configure network namespaces for testing mptcp_lib_ns_init ns1 ns2 for i in "$ns1" "$ns2" ;do - ip netns exec "$i" sysctl -q net.mptcp.enabled=1 ip netns exec "$i" sysctl -q net.mptcp.pm_type=1 done
Signature · 1 line
2.40.1
Geliang Tang
reviewerPATCH v4 4/4 selftests: mptcp: add mptcp_lib_events helper
In reply to Geliang TangFrom: Geliang Tang <[email protected]>
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.
--- tools/testing/selftests/net/mptcp/mptcp_join.sh | 8 ++------ tools/testing/selftests/net/mptcp/mptcp_lib.sh | 14 ++++++++++++++ tools/testing/selftests/net/mptcp/userspace_pm.sh | 14 ++------------ 3 files changed, 18 insertions(+), 18 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +2 -6
@@ -430,12 +430,8 @@ reset_with_events() { reset "${1}" || return 1 - :> "$evts_ns1" - :> "$evts_ns2" - ip netns exec $ns1 ./pm_nl_ctl events >> "$evts_ns1" 2>&1 & - evts_ns1_pid=$! - ip netns exec $ns2 ./pm_nl_ctl events >> "$evts_ns2" 2>&1 & - evts_ns2_pid=$! + mptcp_lib_events "${ns1}" "${evts_ns1}" evts_ns1_pid + mptcp_lib_events "${ns2}" "${evts_ns2}" evts_ns2_pid } reset_with_tcp_filter()
tools/testing/selftests/net/mptcp/mptcp_lib.sh +14 -0
@@ -399,3 +399,17 @@ mptcp_lib_ns_exit() { rm -f /tmp/"$netns".{nstat,out} done } + +mptcp_lib_events() { + local ns="${1}" + local evts="${2}" + declare -n pid="${3}" + + :>"${evts}" + + if [ ${pid} -ne 0 ]; then + mptcp_lib_kill_wait "${pid}" + fi + ip netns exec "${ns}" ./pm_nl_ctl events >> "${evts}" 2>&1 & + pid=$! +}
tools/testing/selftests/net/mptcp/userspace_pm.sh +2 -12
@@ -178,21 +178,11 @@ make_connection() if [ -z "$client_evts" ]; then client_evts=$(mktemp) fi - :>"$client_evts" - if [ $client_evts_pid -ne 0 ]; then - mptcp_lib_kill_wait $client_evts_pid - fi - ip netns exec "$ns2" ./pm_nl_ctl events >> "$client_evts" 2>&1 & - client_evts_pid=$! + mptcp_lib_events "${ns2}" "${client_evts}" client_evts_pid if [ -z "$server_evts" ]; then server_evts=$(mktemp) fi - :>"$server_evts" - if [ $server_evts_pid -ne 0 ]; then - mptcp_lib_kill_wait $server_evts_pid - fi - ip netns exec "$ns1" ./pm_nl_ctl events >> "$server_evts" 2>&1 & - server_evts_pid=$! + mptcp_lib_events "${ns1}" "${server_evts}" server_evts_pid sleep 0.5 # Run the server
Signature · 1 line
2.40.1
Re: selftests: mptcp: add mptcp_lib_events helper: Tests Results
Hi Geliang,
Thank you for your modifications, that's great!
Our CI (GitHub Action) did some validations and here is its report:
- KVM Validation: normal:
- Unstable: 1 failed test(s): packetdrill_regressions 🔴:
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/7999199133
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/965ac86521bd
If there are some issues, you can reproduce them using the same environment as the one used by the CI thanks to a docker image, e.g.:
$ cd [kernel source code]
$ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
--pull always mptcp/mptcp-upstream-virtme-docker:latest \
auto-normalFor more details:
https://github.com/multipath-tcp/mptcp-upstream-virtme-docker
Please note that despite all the efforts that have been already done to have a stable tests suite when executed on a public CI like here, it is possible some reported issues are not due to your modifications. Still, do not hesitate to help us improve that ;-)
Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v4 4/4] selftests: mptcp: add mptcp_lib_events helper
In reply to Geliang TangHi Geliang,
Quoted 8 lines · Geliang Tang
From: Geliang Tang <[email protected]>
To avoid duplicated code in different MPTCP selftests, we can add and use helpers defined in
mptcp_lib.sh.This patch unifies "
pm_nl_ctlevents" related code inuserspace_pm.shandmptcp_join.shinto a helpermptcp_lib_events(). Define it inmptcp_lib.shand use it in both scripts.
(...)
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_lib.sh +0
-0@@ -399,3 +399,17 @@ mptcp_lib_ns_exit() { rm -f /tmp/"$netns".{nstat,out} done
tools/testing/selftests/net/mptcp/mptcp_lib.sh mptcp_lib_ns_exit() { · line 410
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_lib.sh +9
-0} + +mptcp_lib_events() { + local ns="${1}" + local evts="${2}" + declare -n pid="${3}" + + :>"${evts}" + + if [ ${pid} -ne 0 ]; then
Yet another new shellcheck warning introduced here:
Quoted 7 lines
In
mptcp_lib.shline 410:
if [ ${pid} -ne 0 ]; then
^----^ SC2086 (info): Double quote to prevent globbing and word splitting.Did you mean:
if [ "${pid}" -ne 0 ]; then
I guess the CI should check that and report it, so I would not have to fix that just before applying patches.
I just added the suggested double-quotes when applying the patch.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerRe: [PATCH mptcp-next v4 4/4] selftests: mptcp: add mptcp_lib_events helper
Quoted 39 lines · Matthieu Baerts
Hi Geliang,
Quoted 8 lines · Geliang Tang
From: Geliang Tang <[email protected]>
To avoid duplicated code in different MPTCP selftests, we can add and use helpers defined in
mptcp_lib.sh.This patch unifies "
pm_nl_ctlevents" related code inuserspace_pm.shandmptcp_join.shinto a helpermptcp_lib_events(). Define it inmptcp_lib.shand use it in both scripts.(...)
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_lib.sh +0
-0@@ -399,3 +399,17 @@ mptcp_lib_ns_exit() { rm -f /tmp/"$netns".{nstat,out} donetools/testing/selftests/net/mptcp/mptcp_lib.sh mptcp_lib_ns_exit() { · line 410
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_lib.sh +9
-0} + +mptcp_lib_events() { + local ns="${1}" + local evts="${2}" + declare -n pid="${3}" + + :>"${evts}" + + if [ ${pid} -ne 0 ]; thenYet another new shellcheck warning introduced here:
Quoted 5 lines
In
mptcp_lib.shline 410:
if [ ${pid} -ne 0 ]; then
^----^ SC2086 (info): Double quote to prevent globbing and word splitting.
Quoted 5 lines
Quoted 2 lines
Did you mean:
if [ "${pid}" -ne 0 ]; thenI guess the CI should check that and report it, so I would not have to fix that just before applying patches.
In fact, we don't need this check because mptcp_lib_kill_wait() does nothing if the pid is set to 0. So I simplified the fix by removing the condition.
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
v4:
- address Matt's comments in v3 except
- keep #1, #3 as separate patches, not squash them into #2, to keep #2 clean.
Thank you for the v4, it looks better to me!
I have just one comment for patch 2/4, but it is fine, I think. (I will also add {} around the new 'netns' variable in mptcp_lib.sh when applying the patch.)
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.
Matthieu Baerts
maintainerHi Geliang,
Quoted 10 lines · Matthieu Baerts
Hi Geliang,
Quoted 6 lines · Geliang Tang
From: Geliang Tang <[email protected]>
v4:
- address Matt's comments in v3 except
- keep #1, #3 as separate patches, not squash them into #2, to keep #2 clean.
Quoted 7 lines
Thank you for the v4, it looks better to me!
Reviewed-by Matthieu Baerts (NGI0) <[email protected]>I have just one comment for patch 2/4, but it is fine, I think. (I will also add {} around the new 'netns' variable in
mptcp_lib.shwhen applying the patch.)
I just applied the new patches with the suggested modifications.
New patches for t/upstream:
- b19e35a9c85b: selftests: mptcp: add local variables rndh
- 1e458efc9900: selftests: mptcp: add mptcp_lib_ns_init/exit helpers
- dcb564917e5b: selftests: mptcp: more operations in ns_init/exit
- d734b17e00dd: selftests: mptcp: add mptcp_lib_events helper
- Results: a542d2d60003..80a8f9458231 (export)
Cheers,
Matt
Signature · 1 line
Sponsored by the NGI0 Core fund.