Skip to contentSkip to conversation

selftests: pmtu.sh: fix result checking

PATCH Applied Hangbin Liu 3 participants 3 messages Oct 31, 2023 – Nov 3, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests: pmtu.sh: fix result checking

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")

---
v2: use "-eq" instead of "=" to make less error-prone

---
 tools/testing/selftests/net/pmtu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/pmtu.sh +1 -1
index f838dd370f6a..b3b2dc5a630c 100755
@@ -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
Signature · 1 line
2.41.0
Acked-by on v2 1/1
#1 lore raw
Quoted 30 lines · Hangbin Liu

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")

---
v2: use "-eq" instead of "=" to make less error-prone

---
 tools/testing/selftests/net/pmtu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/pmtu.sh +1 -2
index f838dd370f6a..b3b2dc5a630c 100755
@@ -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
--
Quoted 2 lines

2.41.0

Looking good to me, thanks!

#2 lore raw
In reply to Hangbin Liu
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 8 lines · 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html