This is a note to let you know that I've just added the patch titled selftests: mptcp: diag: skip listen tests if not supported to the 6.3-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: selftests-mptcp-diag-skip-listen-tests-if-not-supported.patch and it can be found in the queue-6.3 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From dc97251bf0b70549c76ba261516c01b8096771c5 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx> Date: Thu, 8 Jun 2023 18:38:47 +0200 Subject: selftests: mptcp: diag: skip listen tests if not supported From: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx> commit dc97251bf0b70549c76ba261516c01b8096771c5 upstream. Selftests are supposed to run on any kernels, including the old ones not supporting all MPTCP features. One of them is the listen diag dump support introduced by commit 4fa39b701ce9 ("mptcp: listen diag dump support"). It looks like there is no good pre-check to do here, i.e. dedicated function available in kallsyms. Instead, we try to get info if nothing is returned, the test is marked as skipped. That's not ideal because something could be wrong with the feature and instead of reporting an error, the test could be marked as skipped. If we know in advanced that the feature is supposed to be supported, the tester can set SELFTESTS_MPTCP_LIB_EXPECT_ALL_FEATURES env var to 1: in this case the test will report an error instead of marking the test as skipped if nothing is returned. Link: https://github.com/multipath-tcp/mptcp_net-next/issues/368 Fixes: f2ae0fa68e28 ("selftests/mptcp: add diag listen tests") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Matthieu Baerts <matthieu.baerts@xxxxxxxxxxxx> Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- tools/testing/selftests/net/mptcp/diag.sh | 42 ++++++++++++------------------ 1 file changed, 17 insertions(+), 25 deletions(-) --- a/tools/testing/selftests/net/mptcp/diag.sh +++ b/tools/testing/selftests/net/mptcp/diag.sh @@ -55,16 +55,20 @@ __chk_nr() { local command="$1" local expected=$2 - local msg nr + local msg="$3" + local skip="${4:-SKIP}" + local nr - shift 2 - msg=$* nr=$(eval $command) printf "%-50s" "$msg" if [ $nr != $expected ]; then - echo "[ fail ] expected $expected found $nr" - ret=$test_cnt + if [ $nr = "$skip" ] && ! mptcp_lib_expect_all_features; then + echo "[ skip ] Feature probably not supported" + else + echo "[ fail ] expected $expected found $nr" + ret=$test_cnt + fi else echo "[ ok ]" fi @@ -76,12 +80,12 @@ __chk_msk_nr() local condition=$1 shift 1 - __chk_nr "ss -inmHMN $ns | $condition" $* + __chk_nr "ss -inmHMN $ns | $condition" "$@" } chk_msk_nr() { - __chk_msk_nr "grep -c token:" $* + __chk_msk_nr "grep -c token:" "$@" } wait_msk_nr() @@ -119,37 +123,26 @@ wait_msk_nr() chk_msk_fallback_nr() { - __chk_msk_nr "grep -c fallback" $* + __chk_msk_nr "grep -c fallback" "$@" } chk_msk_remote_key_nr() { - __chk_msk_nr "grep -c remote_key" $* + __chk_msk_nr "grep -c remote_key" "$@" } __chk_listen() { local filter="$1" local expected=$2 + local msg="$3" - shift 2 - msg=$* - - nr=$(ss -N $ns -Ml "$filter" | grep -c LISTEN) - printf "%-50s" "$msg" - - if [ $nr != $expected ]; then - echo "[ fail ] expected $expected found $nr" - ret=$test_cnt - else - echo "[ ok ]" - fi + __chk_nr "ss -N $ns -Ml '$filter' | grep -c LISTEN" "$expected" "$msg" 0 } chk_msk_listen() { lport=$1 - local msg="check for listen socket" # destination port search should always return empty list __chk_listen "dport $lport" 0 "listen match for dport $lport" @@ -167,10 +160,9 @@ chk_msk_listen() chk_msk_inuse() { local expected=$1 + local msg="$2" local listen_nr - shift 1 - listen_nr=$(ss -N "${ns}" -Ml | grep -c LISTEN) expected=$((expected + listen_nr)) @@ -181,7 +173,7 @@ chk_msk_inuse() sleep 0.1 done - __chk_nr get_msk_inuse $expected $* + __chk_nr get_msk_inuse $expected "$msg" } # $1: ns, $2: port Patches currently in stable-queue which might be from matthieu.baerts@xxxxxxxxxxxx are queue-6.3/selftests-mptcp-join-fix-shellcheck-warnings.patch queue-6.3/selftests-mptcp-join-support-rm_addr-for-used-endpoints-or-not.patch queue-6.3/selftests-mptcp-pm-nl-skip-fullmesh-flag-checks-if-not-supported.patch queue-6.3/selftests-mptcp-lib-skip-if-missing-symbol.patch queue-6.3/selftests-mptcp-join-skip-fullmesh-flag-tests-if-not-supported.patch queue-6.3/selftests-mptcp-connect-skip-tfo-tests-if-not-supported.patch queue-6.3/selftests-mptcp-join-skip-fastclose-tests-if-not-supported.patch queue-6.3/selftests-mptcp-remove-duplicated-entries-in-usage.patch queue-6.3/selftests-mptcp-sockopt-skip-getsockopt-checks-if-not-supported.patch queue-6.3/selftests-mptcp-join-skip-backup-if-set-flag-on-id-not-supported.patch queue-6.3/selftests-mptcp-join-skip-mixed-tests-if-not-supported.patch queue-6.3/selftests-mptcp-userspace-pm-skip-if-ip-tool-is-unavailable.patch queue-6.3/selftests-mptcp-join-helpers-to-skip-tests.patch queue-6.3/selftests-mptcp-lib-skip-if-not-below-kernel-version.patch queue-6.3/selftests-mptcp-userspace-pm-skip-if-not-supported.patch queue-6.3/selftests-mptcp-join-uniform-listener-tests.patch queue-6.3/selftests-mptcp-diag-skip-listen-tests-if-not-supported.patch queue-6.3/selftests-mptcp-sockopt-skip-tcp_inq-checks-if-not-supported.patch queue-6.3/selftests-mptcp-join-skip-test-if-iptables-tc-cmds-fail.patch queue-6.3/selftests-mptcp-join-skip-implicit-tests-if-not-supported.patch queue-6.3/selftests-mptcp-userspace-pm-skip-pm-listener-events-tests-if-unavailable.patch queue-6.3/selftests-mptcp-join-skip-fail-tests-if-not-supported.patch queue-6.3/selftests-mptcp-sockopt-relax-expected-returned-size.patch queue-6.3/selftests-mptcp-pm-nl-remove-hardcoded-default-limits.patch queue-6.3/selftests-mptcp-join-skip-check-if-mib-counter-not-supported.patch queue-6.3/selftests-mptcp-diag-skip-inuse-tests-if-not-supported.patch queue-6.3/selftests-mptcp-join-use-iptables-legacy-if-available.patch queue-6.3/selftests-mptcp-join-support-local-endpoint-being-tracked-or-not.patch queue-6.3/selftests-mptcp-join-skip-userspace-pm-tests-if-not-supported.patch queue-6.3/selftests-mptcp-connect-skip-transp-tests-if-not-supported.patch queue-6.3/selftests-mptcp-join-skip-mpc-backups-tests-if-not-supported.patch queue-6.3/selftests-mptcp-join-skip-pm-listener-tests-if-not-supported.patch queue-6.3/selftests-mptcp-connect-skip-disconnect-tests-if-not-supported.patch