]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests: mptcp: check output: catch cmd errors
authorMatthieu Baerts (NGI0) <matttbe@kernel.org>
Tue, 5 May 2026 15:00:58 +0000 (17:00 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 7 May 2026 01:16:45 +0000 (18:16 -0700)
commit65db7b27b90e2ea8d4966935aa9a50b6a60c31ac
treea8dd2ff2e188abbecb8a2dffaa0709da5b511a08
parent166b78344031bf7ac9f55cb5282776cfd85f220e
selftests: mptcp: check output: catch cmd errors

Using '${?}' inside the if-statement to check the returned value from
the command that was evaluated as part of the if-statement is not
correct: here, '${?}' will be linked to the previous instruction, not
the one that is expected here (${cmd}).

Instead, simply mark the error, except if an error is expected. If
that's the case, 1 can be passed as the 4th argument of this helper.
Three checks from pm_netlink.sh expect an error.

While at it, improve the error message when the command unexpectedly
fails or succeeds.

Note that we could expect a specific returned value, but the checks
currently expecting an error can be used with 'ip mptcp' or 'pm_nl_ctl',
and these two tools don't return the same error code.

Fixes: 2d0c1d27ea4e ("selftests: mptcp: add mptcp_lib_check_output helper")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260505-net-mptcp-pm-fixes-7-1-rc3-v1-10-fca8091060a4@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/mptcp/mptcp_lib.sh
tools/testing/selftests/net/mptcp/pm_netlink.sh