diff mbox series

[PATCHv2,net] selftests: pmtu.sh: fix result checking

Message ID 20231031034732.3531008-1-liuhangbin@gmail.com (mailing list archive)
State Accepted
Commit 63e201916b27260218e528a2f8758be47f99bbf4
Delegated to: Netdev Maintainers
Headers show
Series [PATCHv2,net] selftests: pmtu.sh: fix result checking | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success net selftest script(s) already in Makefile
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Hangbin Liu Oct. 31, 2023, 3:47 a.m. UTC
In the PMTU test, when all previous tests are skipped and the new test
passes, the exit code is set to 0. However, the current check mistakenly
treats this as an assignment, causing the check to pass every time.

Consequently, regardless of how many tests have failed, if the latest test
passes, the PMTU test will report a pass.

Fixes: 2a9d3716b810 ("selftests: pmtu.sh: improve the test result processing")
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
v2: use "-eq" instead of "=" to make less error-prone
---
 tools/testing/selftests/net/pmtu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Po-Hsu Lin Oct. 31, 2023, 4:41 a.m. UTC | #1
On Tue, Oct 31, 2023 at 11:47 AM Hangbin Liu <liuhangbin@gmail.com> wrote:
>
> In the PMTU test, when all previous tests are skipped and the new test
> passes, the exit code is set to 0. However, the current check mistakenly
> treats this as an assignment, causing the check to pass every time.
>
> Consequently, regardless of how many tests have failed, if the latest test
> passes, the PMTU test will report a pass.
>
> Fixes: 2a9d3716b810 ("selftests: pmtu.sh: improve the test result processing")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> v2: use "-eq" instead of "=" to make less error-prone
> ---
>  tools/testing/selftests/net/pmtu.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
> index f838dd370f6a..b3b2dc5a630c 100755
> --- a/tools/testing/selftests/net/pmtu.sh
> +++ b/tools/testing/selftests/net/pmtu.sh
> @@ -2048,7 +2048,7 @@ run_test() {
>         case $ret in
>                 0)
>                         all_skipped=false
> -                       [ $exitcode=$ksft_skip ] && exitcode=0
> +                       [ $exitcode -eq $ksft_skip ] && exitcode=0
>                 ;;
>                 $ksft_skip)
>                         [ $all_skipped = true ] && exitcode=$ksft_skip
> --
> 2.41.0
>
Acked-by: Po-Hsu Lin <po-hsu.lin@canonical.com>

Looking good to me, thanks!
patchwork-bot+netdevbpf@kernel.org Nov. 3, 2023, 9:20 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Tue, 31 Oct 2023 11:47:32 +0800 you wrote:
> In the PMTU test, when all previous tests are skipped and the new test
> passes, the exit code is set to 0. However, the current check mistakenly
> treats this as an assignment, causing the check to pass every time.
> 
> Consequently, regardless of how many tests have failed, if the latest test
> passes, the PMTU test will report a pass.
> 
> [...]

Here is the summary with links:
  - [PATCHv2,net] selftests: pmtu.sh: fix result checking
    https://git.kernel.org/netdev/net/c/63e201916b27

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index f838dd370f6a..b3b2dc5a630c 100755
--- a/tools/testing/selftests/net/pmtu.sh
+++ b/tools/testing/selftests/net/pmtu.sh
@@ -2048,7 +2048,7 @@  run_test() {
 	case $ret in
 		0)
 			all_skipped=false
-			[ $exitcode=$ksft_skip ] && exitcode=0
+			[ $exitcode -eq $ksft_skip ] && exitcode=0
 		;;
 		$ksft_skip)
 			[ $all_skipped = true ] && exitcode=$ksft_skip