diff mbox series

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

Message ID 20231030094555.3333551-1-liuhangbin@gmail.com (mailing list archive)
State New
Headers show
Series [net] selftests: pmtu.sh: fix result checking | expand

Commit Message

Hangbin Liu Oct. 30, 2023, 9:45 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>
---
 tools/testing/selftests/net/pmtu.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Po-Hsu Lin Oct. 30, 2023, 3:34 p.m. UTC | #1
On Mon, Oct 30, 2023 at 5:46 PM 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>
> ---
>  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..b9648da4c371 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 = $ksft_skip ] && exitcode=0
Perhaps replacing "=" with -eq here will be less error-prone?
Thanks for catching this!

>                 ;;
>                 $ksft_skip)
>                         [ $all_skipped = true ] && exitcode=$ksft_skip
> --
> 2.41.0
>
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/pmtu.sh b/tools/testing/selftests/net/pmtu.sh
index f838dd370f6a..b9648da4c371 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 = $ksft_skip ] && exitcode=0
 		;;
 		$ksft_skip)
 			[ $all_skipped = true ] && exitcode=$ksft_skip