linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/kcmp: Make the test output consistent and clear
@ 2022-06-29 19:28 Gautam Menghani
  2022-07-11  4:22 ` Gautam Menghani
  0 siblings, 1 reply; 4+ messages in thread
From: Gautam Menghani @ 2022-06-29 19:28 UTC (permalink / raw)
  To: shuah
  Cc: linux-kernel-mentees, linux-kernel, linux-kselftest, Gautam Menghani

Make the output format of this test consistent. Currently the output is
as follows:

+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# pid1:  45814 pid2:  45815 FD:  1 FILES:  1 VM:  2 FS:  1 SIGHAND:  2 
+  IO:  0 SYSVSEM:  0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
+ok 1 selftests: kcmp: kcmp_test

With this patch applied the output is as follows:

+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# TAP version 13
+# 1..3
+# pid1:  46330 pid2:  46331 FD:  1 FILES:  2 VM:  2 FS:  2 SIGHAND:  1 
+  IO:  0 SYSVSEM:  0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+ok 1 selftests: kcmp: kcmp_test


Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
 tools/testing/selftests/kcmp/kcmp_test.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
index 6ea7b9f37a41..25110c7c0b3e 100644
--- a/tools/testing/selftests/kcmp/kcmp_test.c
+++ b/tools/testing/selftests/kcmp/kcmp_test.c
@@ -88,6 +88,9 @@ int main(int argc, char **argv)
 		int pid2 = getpid();
 		int ret;
 
+		ksft_print_header();
+		ksft_set_plan(3);
+
 		fd2 = open(kpath, O_RDWR, 0644);
 		if (fd2 < 0) {
 			perror("Can't open file");
@@ -152,7 +155,6 @@ int main(int argc, char **argv)
 			ksft_inc_pass_cnt();
 		}
 
-		ksft_print_cnts();
 
 		if (ret)
 			ksft_exit_fail();
@@ -162,5 +164,5 @@ int main(int argc, char **argv)
 
 	waitpid(pid2, &status, P_ALL);
 
-	return ksft_exit_pass();
+	return 0;
 }
-- 
2.36.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [PATCH] selftests/kcmp: Make the test output consistent and clear
  2022-06-29 19:28 [PATCH] selftests/kcmp: Make the test output consistent and clear Gautam Menghani
@ 2022-07-11  4:22 ` Gautam Menghani
  2022-07-13 23:52   ` Shuah Khan
  0 siblings, 1 reply; 4+ messages in thread
From: Gautam Menghani @ 2022-07-11  4:22 UTC (permalink / raw)
  To: shuah; +Cc: linux-kernel-mentees, linux-kernel, linux-kselftest

Hi Shuah,
Please review this patch and let me know if any changes are required.
On Thu, Jun 30, 2022 at 12:58:22AM +0530, Gautam Menghani wrote:
> Make the output format of this test consistent. Currently the output is
> as follows:
> 
> +TAP version 13
> +1..1
> +# selftests: kcmp: kcmp_test
> +# pid1:  45814 pid2:  45815 FD:  1 FILES:  1 VM:  2 FS:  1 SIGHAND:  2 
> +  IO:  0 SYSVSEM:  0 INV: -1
> +# PASS: 0 returned as expected
> +# PASS: 0 returned as expected
> +# PASS: 0 returned as expected
> +# # Planned tests != run tests (0 != 3)
> +# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> +# # Planned tests != run tests (0 != 3)
> +# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> +# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> +ok 1 selftests: kcmp: kcmp_test
> 
> With this patch applied the output is as follows:
> 
> +TAP version 13
> +1..1
> +# selftests: kcmp: kcmp_test
> +# TAP version 13
> +# 1..3
> +# pid1:  46330 pid2:  46331 FD:  1 FILES:  2 VM:  2 FS:  2 SIGHAND:  1 
> +  IO:  0 SYSVSEM:  0 INV: -1
> +# PASS: 0 returned as expected
> +# PASS: 0 returned as expected
> +# PASS: 0 returned as expected
> +# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
> +ok 1 selftests: kcmp: kcmp_test
> 
> 
> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
> ---
>  tools/testing/selftests/kcmp/kcmp_test.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
> index 6ea7b9f37a41..25110c7c0b3e 100644
> --- a/tools/testing/selftests/kcmp/kcmp_test.c
> +++ b/tools/testing/selftests/kcmp/kcmp_test.c
> @@ -88,6 +88,9 @@ int main(int argc, char **argv)
>  		int pid2 = getpid();
>  		int ret;
>  
> +		ksft_print_header();
> +		ksft_set_plan(3);
> +
>  		fd2 = open(kpath, O_RDWR, 0644);
>  		if (fd2 < 0) {
>  			perror("Can't open file");
> @@ -152,7 +155,6 @@ int main(int argc, char **argv)
>  			ksft_inc_pass_cnt();
>  		}
>  
> -		ksft_print_cnts();
>  
>  		if (ret)
>  			ksft_exit_fail();
> @@ -162,5 +164,5 @@ int main(int argc, char **argv)
>  
>  	waitpid(pid2, &status, P_ALL);
>  
> -	return ksft_exit_pass();
> +	return 0;
>  }
> -- 
> 2.36.1
> 
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* Re: [PATCH] selftests/kcmp: Make the test output consistent and clear
  2022-07-11  4:22 ` Gautam Menghani
@ 2022-07-13 23:52   ` Shuah Khan
  2022-07-14 16:16     ` [PATCH v2] " Gautam Menghani
  0 siblings, 1 reply; 4+ messages in thread
From: Shuah Khan @ 2022-07-13 23:52 UTC (permalink / raw)
  To: Gautam Menghani, shuah
  Cc: linux-kernel-mentees, linux-kernel, linux-kselftest

On 7/10/22 10:22 PM, Gautam Menghani wrote:
> Hi Shuah,
> Please review this patch and let me know if any changes are required.

Remember to bottom post.

> On Thu, Jun 30, 2022 at 12:58:22AM +0530, Gautam Menghani wrote:
>> Make the output format of this test consistent. Currently the output is
>> as follows:
>>

Now what is inconsistent. It is not very clean from the output. Please
add more information on how the current information is inconsistent and
how you patch makes it consistent.

>> +TAP version 13
>> +1..1
>> +# selftests: kcmp: kcmp_test
>> +# pid1:  45814 pid2:  45815 FD:  1 FILES:  1 VM:  2 FS:  1 SIGHAND:  2
>> +  IO:  0 SYSVSEM:  0 INV: -1
>> +# PASS: 0 returned as expected
>> +# PASS: 0 returned as expected
>> +# PASS: 0 returned as expected
>> +# # Planned tests != run tests (0 != 3)
>> +# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
>> +# # Planned tests != run tests (0 != 3)
>> +# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
>> +# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
>> +ok 1 selftests: kcmp: kcmp_test
>>
>> With this patch applied the output is as follows:
>>
>> +TAP version 13
>> +1..1
>> +# selftests: kcmp: kcmp_test
>> +# TAP version 13
>> +# 1..3
>> +# pid1:  46330 pid2:  46331 FD:  1 FILES:  2 VM:  2 FS:  2 SIGHAND:  1
>> +  IO:  0 SYSVSEM:  0 INV: -1
>> +# PASS: 0 returned as expected
>> +# PASS: 0 returned as expected
>> +# PASS: 0 returned as expected
>> +# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
>> +ok 1 selftests: kcmp: kcmp_test
>>
>>
>> Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
>> ---

thanks,
-- Shuah
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

* [PATCH v2] selftests/kcmp: Make the test output consistent and clear
  2022-07-13 23:52   ` Shuah Khan
@ 2022-07-14 16:16     ` Gautam Menghani
  0 siblings, 0 replies; 4+ messages in thread
From: Gautam Menghani @ 2022-07-14 16:16 UTC (permalink / raw)
  To: shuah
  Cc: linux-kernel-mentees, linux-kernel, linux-kselftest, Gautam Menghani

In the KCMP test, currently the functions ksft_print_header() and
ksft_set_plan() are not used due to which an error appears in the
output. Also, the result of the tests is being printed multiple times
because the output is printed by both ksft_print_cnts() and
ksft_exit_fail()/ksft_exit_pass(). 
This patch makes the output format of this test consistent. Currently the
output is as follows:

+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# pid1:  45814 pid2:  45815 FD:  1 FILES:  1 VM:  2 FS:  1 SIGHAND:  2 
+  IO:  0 SYSVSEM:  0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Planned tests != run tests (0 != 3)
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+# # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
+ok 1 selftests: kcmp: kcmp_test

With this patch applied the output is as follows:

+TAP version 13
+1..1
+# selftests: kcmp: kcmp_test
+# TAP version 13
+# 1..3
+# pid1:  46330 pid2:  46331 FD:  1 FILES:  2 VM:  2 FS:  2 SIGHAND:  1 
+  IO:  0 SYSVSEM:  0 INV: -1
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# PASS: 0 returned as expected
+# # Totals: pass:3 fail:0 xfail:0 xpass:0 skip:0 error:0
+ok 1 selftests: kcmp: kcmp_test


Signed-off-by: Gautam Menghani <gautammenghani201@gmail.com>
---
Changes in v2:
1. Describe the changes in detail.

 tools/testing/selftests/kcmp/kcmp_test.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/kcmp/kcmp_test.c b/tools/testing/selftests/kcmp/kcmp_test.c
index 6ea7b9f37a41..25110c7c0b3e 100644
--- a/tools/testing/selftests/kcmp/kcmp_test.c
+++ b/tools/testing/selftests/kcmp/kcmp_test.c
@@ -88,6 +88,9 @@ int main(int argc, char **argv)
 		int pid2 = getpid();
 		int ret;
 
+		ksft_print_header();
+		ksft_set_plan(3);
+
 		fd2 = open(kpath, O_RDWR, 0644);
 		if (fd2 < 0) {
 			perror("Can't open file");
@@ -152,7 +155,6 @@ int main(int argc, char **argv)
 			ksft_inc_pass_cnt();
 		}
 
-		ksft_print_cnts();
 
 		if (ret)
 			ksft_exit_fail();
@@ -162,5 +164,5 @@ int main(int argc, char **argv)
 
 	waitpid(pid2, &status, P_ALL);
 
-	return ksft_exit_pass();
+	return 0;
 }
-- 
2.36.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2022-07-14 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-29 19:28 [PATCH] selftests/kcmp: Make the test output consistent and clear Gautam Menghani
2022-07-11  4:22 ` Gautam Menghani
2022-07-13 23:52   ` Shuah Khan
2022-07-14 16:16     ` [PATCH v2] " Gautam Menghani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).