Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Shuah Khan <skhan@linuxfoundation.org>
To: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	Shuah Khan <shuah@kernel.org>
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,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: Re: [PATCH 1/2] selftests: x86: vdso_restorer: remove manual counting of pass/fail tests
Date: Fri, 19 Jul 2024 10:40:45 -0600	[thread overview]
Message-ID: <9cf7f693-bc6a-415b-99c3-f6c59b871c4f@linuxfoundation.org> (raw)
In-Reply-To: <20240712073045.110014-1-usama.anjum@collabora.com>

On 7/12/24 01:30, Muhammad Usama Anjum wrote:
> Use kselftest wrapper to mark tests pass/fail instead of manually
> counting.

You care combining two changes in the patch.

This is needed to return correct exit status. This also
> improves readability and mainability.

Spelling - "mainability" - checkpatch would have helped you
catch this.

The change to return the correct error fine and but not the
change thaT ADDS DUPLICATE tap header.

> 


> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
>   tools/testing/selftests/x86/vdso_restorer.c | 20 +++++++-------------
>   1 file changed, 7 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/testing/selftests/x86/vdso_restorer.c b/tools/testing/selftests/x86/vdso_restorer.c
> index fe99f24341554..8e173d71291f6 100644
> --- a/tools/testing/selftests/x86/vdso_restorer.c
> +++ b/tools/testing/selftests/x86/vdso_restorer.c
> @@ -21,6 +21,7 @@
>   #include <unistd.h>
>   #include <syscall.h>
>   #include <sys/syscall.h>
> +#include "../kselftest.h"
>   
>   /* Open-code this -- the headers are too messy to easily use them. */
>   struct real_sigaction {
> @@ -44,9 +45,10 @@ static void handler_without_siginfo(int sig)
>   
>   int main()
>   {
> -	int nerrs = 0;
>   	struct real_sigaction sa;
>   
> +	ksft_print_header();

The problem with adding this header here is when
make kselftest TARGETS=vDSO is run there will be
duplicate TAP 13 headers.


> +
>   	void *vdso = dlopen("linux-vdso.so.1",
>   			    RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
>   	if (!vdso)
> @@ -57,6 +59,8 @@ int main()
>   		return 0;
>   	}
>   
> +	ksft_set_plan(2);
> +
>   	memset(&sa, 0, sizeof(sa));
>   	sa.handler = handler_with_siginfo;
>   	sa.flags = SA_SIGINFO;
> @@ -69,12 +73,7 @@ int main()
>   
>   	raise(SIGUSR1);
>   
> -	if (handler_called) {
> -		printf("[OK]\tSA_SIGINFO handler returned successfully\n");
> -	} else {
> -		printf("[FAIL]\tSA_SIGINFO handler was not called\n");
> -		nerrs++;
> -	}
> +	ksft_test_result(handler_called, "SA_SIGINFO handler returned\n");
>   
>   	printf("[RUN]\tRaise a signal, !SA_SIGINFO, sa.restorer == NULL\n");
>   
> @@ -86,10 +85,5 @@ int main()
>   
>   	raise(SIGUSR1);
>   
> -	if (handler_called) {
> -		printf("[OK]\t!SA_SIGINFO handler returned successfully\n");
> -	} else {
> -		printf("[FAIL]\t!SA_SIGINFO handler was not called\n");
> -		nerrs++;
> -	}
> +	ksft_test_result(handler_called, "SA_SIGINFO handler returned\n");
>   }

thanks,
-- Shuah

  parent reply	other threads:[~2024-07-19 16:40 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 ` [PATCH 2/2] selftests: x86: vdso_restorer: Return correct exit statuses Muhammad Usama Anjum
2024-07-16 22:01   ` 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 [this message]
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=9cf7f693-bc6a-415b-99c3-f6c59b871c4f@linuxfoundation.org \
    --to=skhan@linuxfoundation.org \
    --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 \
    --cc=usama.anjum@collabora.com \
    /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