Skip to contentSkip to conversation

selftests: pmtu.sh: fix result checking

PATCH Superseded Hangbin Liu 2 participants 2 messages Oct 30, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 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")
---
 tools/testing/selftests/net/pmtu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/pmtu.sh +1 -1
index f838dd370f6a..b9648da4c371 100755
@@ -2048,7 +2048,7 @@ run_test() {
 	case $ret in
 		0)
 			all_skipped=false
-			[ $exitcode=$ksft_skip ] && exitcode=0
+			[ $exitcode = $ksft_skip ] && exitcode=0
 		;;
 		$ksft_skip)
 			[ $all_skipped = true ] && exitcode=$ksft_skip
Signature · 1 line
2.41.0
#1 lore raw
Quoted 19 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")
---
 tools/testing/selftests/net/pmtu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/pmtu.sh +0 -0
index f838dd370f6a..b9648da4c371 100755

tools/testing/selftests/net/pmtu.sh run_test() { · line 2051

Quoted 5 lines
tools/testing/selftests/net/pmtu.sh +1 -1
@@ -2048,7 +2048,7 @@ run_test() {
        case $ret in
                0)
                        all_skipped=false
-                       [ $exitcode=$ksft_skip ] && exitcode=0
+                       [ $exitcode = $ksft_skip ] && exitcode=0

Perhaps replacing "=" with -eq here will be less error-prone? Thanks for catching this!

Quoted 6 lines
tools/testing/selftests/net/pmtu.sh +0 -1
                ;;
                $ksft_skip)
                        [ $all_skipped = true ] && exitcode=$ksft_skip
--

2.41.0