mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] selftests: x86: conform test to TAP format output
@ 2024-03-07 18:37 Muhammad Usama Anjum
  2024-03-25  7:07 ` Muhammad Usama Anjum
  2024-04-14 13:21 ` Muhammad Usama Anjum
  0 siblings, 2 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-07 18:37 UTC (permalink / raw)
  To: Shuah Khan, Muhammad Usama Anjum; +Cc: kernel, linux-kselftest, linux-kernel

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>
---
 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();
 }
-- 
2.39.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: x86: conform test to TAP format output
  2024-03-07 18:37 [PATCH] selftests: x86: conform test to TAP format output Muhammad Usama Anjum
@ 2024-03-25  7:07 ` Muhammad Usama Anjum
  2024-04-04 11:49   ` Muhammad Usama Anjum
  2024-04-14 13:21 ` Muhammad Usama Anjum
  1 sibling, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-03-25  7:07 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-kernel

Soft reminder

On 3/7/24 11:37 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>
> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: x86: conform test to TAP format output
  2024-03-25  7:07 ` Muhammad Usama Anjum
@ 2024-04-04 11:49   ` Muhammad Usama Anjum
  0 siblings, 0 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-04 11:49 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-kernel

Soft reminder

On 3/25/24 12:07 PM, Muhammad Usama Anjum wrote:
> Soft reminder
> 
> On 3/7/24 11:37 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>
>> ---
>>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: x86: conform test to TAP format output
  2024-03-07 18:37 [PATCH] selftests: x86: conform test to TAP format output Muhammad Usama Anjum
  2024-03-25  7:07 ` Muhammad Usama Anjum
@ 2024-04-14 13:21 ` Muhammad Usama Anjum
  2024-04-22 12:38   ` Muhammad Usama Anjum
  1 sibling, 1 reply; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-14 13:21 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-kernel

Soft reminder for this patch

On 3/7/24 11:37 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>
> ---
>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] selftests: x86: conform test to TAP format output
  2024-04-14 13:21 ` Muhammad Usama Anjum
@ 2024-04-22 12:38   ` Muhammad Usama Anjum
  0 siblings, 0 replies; 5+ messages in thread
From: Muhammad Usama Anjum @ 2024-04-22 12:38 UTC (permalink / raw)
  To: Shuah Khan; +Cc: Muhammad Usama Anjum, kernel, linux-kselftest, linux-kernel

Reminder

On 4/14/24 6:21 PM, Muhammad Usama Anjum wrote:
> Soft reminder for this patch
> 
> On 3/7/24 11:37 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>
>> ---
>>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-22 12:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07 18:37 [PATCH] selftests: x86: conform test to TAP format output Muhammad Usama Anjum
2024-03-25  7:07 ` Muhammad Usama Anjum
2024-04-04 11:49   ` Muhammad Usama Anjum
2024-04-14 13:21 ` Muhammad Usama Anjum
2024-04-22 12:38   ` Muhammad Usama Anjum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®