]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
selftests/harness: Actually report SKIP for signal tests
authorKees Cook <keescook@chromium.org>
Mon, 7 Aug 2023 17:43:58 +0000 (10:43 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:22:30 +0000 (12:22 +0200)
[ Upstream commit b3d46e11fec0c5a8972e5061bb1462119ae5736d ]

Tests that were expecting a signal were not correctly checking for a
SKIP condition. Move the check before the signal checking when
processing test result.

Cc: Shuah Khan <shuah@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Will Drewry <wad@chromium.org>
Cc: linux-kselftest@vger.kernel.org
Fixes: 9847d24af95c ("selftests/harness: Refactor XFAIL into SKIP")
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/kselftest_harness.h

index 11779405dc804d34ef8ac767ec5e22b6d2b5c0ba..a6ea2bd63a8316aee06891a53a82362fda872bda 100644 (file)
@@ -916,7 +916,11 @@ void __wait_for_test(struct __test_metadata *t)
                fprintf(TH_LOG_STREAM,
                        "# %s: Test terminated by timeout\n", t->name);
        } else if (WIFEXITED(status)) {
-               if (t->termsig != -1) {
+               if (WEXITSTATUS(status) == 255) {
+                       /* SKIP */
+                       t->passed = 1;
+                       t->skip = 1;
+               } else if (t->termsig != -1) {
                        t->passed = 0;
                        fprintf(TH_LOG_STREAM,
                                "# %s: Test exited normally instead of by signal (code: %d)\n",
@@ -928,11 +932,6 @@ void __wait_for_test(struct __test_metadata *t)
                        case 0:
                                t->passed = 1;
                                break;
-                       /* SKIP */
-                       case 255:
-                               t->passed = 1;
-                               t->skip = 1;
-                               break;
                        /* Other failure, assume step report. */
                        default:
                                t->passed = 0;