Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: "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>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	kernel@collabora.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, Shuah Khan <shuah@kernel.org>
Subject: Re: [PATCH v2] selftests: x86: conform test to TAP format output
Date: Wed, 10 Jul 2024 14:37:26 +0500	[thread overview]
Message-ID: <f929b8c4-fb66-4724-b2ee-d012a5c20324@collabora.com> (raw)
In-Reply-To: <890460a3-fd09-4f59-ab21-4f5b16256175@collabora.com>

This patch brings just readability implements by using kselftests wrappers
instead of manual pass/fail test cases counting. It has been on mailing
list from several months now. Please can someone ack or nack?

On 7/1/24 1:38 PM, Muhammad Usama Anjum wrote:
> Adding more reviewers. Please review.
> 
> On 5/28/24 10:05 AM, Muhammad Usama Anjum wrote:
>> Kind reminder
>>
>> On 4/26/24 3:18 PM, Muhammad Usama Anjum wrote:
>>> Conform the layout, informational and status messages to TAP. No
>>> functional change is intended other than the layout of output messages.
>>>
>>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>>> ---
>>> Changes since v1:
>>> - No changes, sending it again as got no response on v1 even after weeks
>>> ---
>>>  tools/testing/selftests/x86/vdso_restorer.c | 29 +++++++++------------
>>>  1 file changed, 12 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/tools/testing/selftests/x86/vdso_restorer.c b/tools/testing/selftests/x86/vdso_restorer.c
>>> index fe99f24341554..f621167424a9c 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,17 +45,19 @@ static void handler_without_siginfo(int sig)
>>>  
>>>  int main()
>>>  {
>>> -	int nerrs = 0;
>>>  	struct real_sigaction sa;
>>>  
>>> +	ksft_print_header();
>>> +	ksft_set_plan(2);
>>> +
>>>  	void *vdso = dlopen("linux-vdso.so.1",
>>>  			    RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
>>>  	if (!vdso)
>>>  		vdso = dlopen("linux-gate.so.1",
>>>  			      RTLD_LAZY | RTLD_LOCAL | RTLD_NOLOAD);
>>>  	if (!vdso) {
>>> -		printf("[SKIP]\tFailed to find vDSO.  Tests are not expected to work.\n");
>>> -		return 0;
>>> +		ksft_print_msg("[SKIP]\tFailed to find vDSO. Tests are not expected to work.\n");
>>> +		return KSFT_SKIP;
>>>  	}
>>>  
>>>  	memset(&sa, 0, sizeof(sa));
>>> @@ -62,21 +65,16 @@ int main()
>>>  	sa.flags = SA_SIGINFO;
>>>  	sa.restorer = NULL;	/* request kernel-provided restorer */
>>>  
>>> -	printf("[RUN]\tRaise a signal, SA_SIGINFO, sa.restorer == NULL\n");
>>> +	ksft_print_msg("Raise a signal, SA_SIGINFO, sa.restorer == NULL\n");
>>>  
>>>  	if (syscall(SYS_rt_sigaction, SIGUSR1, &sa, NULL, 8) != 0)
>>>  		err(1, "raw rt_sigaction syscall");
>>>  
>>>  	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");
>>> +	ksft_print_msg("Raise a signal, !SA_SIGINFO, sa.restorer == NULL\n");
>>>  
>>>  	sa.flags = 0;
>>>  	sa.handler = handler_without_siginfo;
>>> @@ -86,10 +84,7 @@ 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");
>>> +
>>> +	ksft_finished();
>>>  }
>>
> 

-- 
BR,
Muhammad Usama Anjum

  reply	other threads:[~2024-07-10  9:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 10:18 [PATCH v2] selftests: x86: conform test to TAP format output Muhammad Usama Anjum
2024-05-28  5:05 ` Muhammad Usama Anjum
2024-07-01  8:38   ` Muhammad Usama Anjum
2024-07-10  9:37     ` Muhammad Usama Anjum [this message]
2024-07-10 16:16       ` Shuah Khan
2024-07-11  6:52         ` Muhammad Usama Anjum
2024-07-11 16:39           ` Shuah Khan
2024-07-12  7:28             ` Muhammad Usama Anjum

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=f929b8c4-fb66-4724-b2ee-d012a5c20324@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