Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Shuah Khan <shuah@kernel.org>,
	Muhammad Usama Anjum <usama.anjum@collabora.com>
Cc: kernel@collabora.com, "Chang S . Bae" <chang.seok.bae@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>,
	Ingo Molnar <mingo@kernel.org>,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] selftests: x86: vdso_restorer: Return correct exit statuses
Date: Fri, 12 Jul 2024 12:30:43 +0500	[thread overview]
Message-ID: <20240712073045.110014-2-usama.anjum@collabora.com> (raw)
In-Reply-To: <20240712073045.110014-1-usama.anjum@collabora.com>

Return correct exit status, KSFT_SKIP if the pre-conditions aren't met.
Return KSFT_FAIL if error occurs. Use ksft_finished() which will
compmare the total planned tests with passed tests to return the exit
value.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
 tools/testing/selftests/x86/vdso_restorer.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/x86/vdso_restorer.c b/tools/testing/selftests/x86/vdso_restorer.c
index 8e173d71291f6..54f33e8cda5cc 100644
--- a/tools/testing/selftests/x86/vdso_restorer.c
+++ b/tools/testing/selftests/x86/vdso_restorer.c
@@ -56,7 +56,7 @@ int main()
 			      RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
 	if (!vdso) {
 		printf("[SKIP]\tFailed to find vDSO.  Tests are not expected to work.\n");
-		return 0;
+		return KSFT_SKIP;
 	}
 
 	ksft_set_plan(2);
@@ -69,7 +69,7 @@ int main()
 	printf("[RUN]\tRaise a signal, SA_SIGINFO, sa.restorer == NULL\n");
 
 	if (syscall(SYS_rt_sigaction, SIGUSR1, &sa, NULL, 8) != 0)
-		err(1, "raw rt_sigaction syscall");
+		err(KSFT_FAIL, "raw rt_sigaction syscall");
 
 	raise(SIGUSR1);
 
@@ -80,10 +80,12 @@ int main()
 	sa.flags = 0;
 	sa.handler = handler_without_siginfo;
 	if (syscall(SYS_sigaction, SIGUSR1, &sa, 0) != 0)
-		err(1, "raw sigaction syscall");
+		err(KSFT_FAIL, "raw sigaction syscall");
 	handler_called = 0;
 
 	raise(SIGUSR1);
 
 	ksft_test_result(handler_called, "SA_SIGINFO handler returned\n");
+
+	ksft_finished();
 }
-- 
2.39.2


  reply	other threads:[~2024-07-12  7:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12  7:30 [PATCH 1/2] selftests: x86: vdso_restorer: remove manual counting of pass/fail tests Muhammad Usama Anjum
2024-07-12  7:30 ` Muhammad Usama Anjum [this message]
2024-07-16 22:01   ` [PATCH 2/2] selftests: x86: vdso_restorer: Return correct exit statuses Shuah Khan
2024-07-18  7:18     ` Muhammad Usama Anjum
2024-07-16 22:00 ` [PATCH 1/2] selftests: x86: vdso_restorer: remove manual counting of pass/fail tests Shuah Khan
2024-07-19 16:40 ` Shuah Khan
2024-07-21 16:24   ` Muhammad Usama Anjum
2024-07-21 16:37     ` Muhammad Usama Anjum
2024-07-22 17:20       ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240712073045.110014-2-usama.anjum@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=chang.seok.bae@intel.com \
    --cc=kernel@collabora.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox