Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework
@ 2023-07-23  6:41 Atul Kumar Pant
  2023-08-16 15:45 ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Atul Kumar Pant @ 2023-07-23  6:41 UTC (permalink / raw)
  To: shuah; +Cc: Atul Kumar Pant, linux-kselftest, linux-kernel-mentees

Updates the msgque test to print the pass or fail status after the
completion of the test.

Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
---
 tools/testing/selftests/ipc/msgque.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
index 656c43c24044..513b1265bb75 100644
--- a/tools/testing/selftests/ipc/msgque.c
+++ b/tools/testing/selftests/ipc/msgque.c
@@ -9,6 +9,7 @@
 
 #include "../kselftest.h"
 
+#define NUM_TEST_CASES		1
 #define MAX_MSG_SIZE		32
 
 struct msg1 {
@@ -197,6 +198,7 @@ int main(int argc, char **argv)
 	int msg, pid, err;
 	struct msgque_data msgque;
 
+	ksft_set_plan(NUM_TEST_CASES);
 	if (getuid() != 0)
 		return ksft_exit_skip(
 				"Please run the test as root - Exiting.\n");
@@ -243,13 +245,16 @@ int main(int argc, char **argv)
 		printf("Failed to test queue: %d\n", err);
 		goto err_out;
 	}
+	ksft_test_result_pass("# Test Passed\n");
 	return ksft_exit_pass();
 
 err_destroy:
 	if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
 		printf("Failed to destroy queue: %d\n", -errno);
+		ksft_test_result_fail("# Test Failed\n");
 		return ksft_exit_fail();
 	}
 err_out:
+	ksft_test_result_fail("# Test Failed\n");
 	return ksft_exit_fail();
 }
-- 
2.25.1


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

* Re: [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework
  2023-07-23  6:41 [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework Atul Kumar Pant
@ 2023-08-16 15:45 ` Shuah Khan
  2023-08-17  9:21   ` Atul Kumar Pant
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2023-08-16 15:45 UTC (permalink / raw)
  To: Atul Kumar Pant, shuah; +Cc: linux-kselftest, linux-kernel-mentees, Shuah Khan

On 7/23/23 00:41, Atul Kumar Pant wrote:
> Updates the msgque test to print the pass or fail status after the
> completion of the test.
> 
> Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
> ---
>   tools/testing/selftests/ipc/msgque.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
> index 656c43c24044..513b1265bb75 100644
> --- a/tools/testing/selftests/ipc/msgque.c
> +++ b/tools/testing/selftests/ipc/msgque.c
> @@ -9,6 +9,7 @@
>   
>   #include "../kselftest.h"
>   
> +#define NUM_TEST_CASES		1
>   #define MAX_MSG_SIZE		32
>   
>   struct msg1 {
> @@ -197,6 +198,7 @@ int main(int argc, char **argv)
>   	int msg, pid, err;
>   	struct msgque_data msgque;
>   
> +	ksft_set_plan(NUM_TEST_CASES);
>   	if (getuid() != 0)
>   		return ksft_exit_skip(
>   				"Please run the test as root - Exiting.\n");
> @@ -243,13 +245,16 @@ int main(int argc, char **argv)
>   		printf("Failed to test queue: %d\n", err);
>   		goto err_out;
>   	}
> +	ksft_test_result_pass("# Test Passed\n");
>   	return ksft_exit_pass();
>   
>   err_destroy:
>   	if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
>   		printf("Failed to destroy queue: %d\n", -errno);
> +		ksft_test_result_fail("# Test Failed\n");
>   		return ksft_exit_fail();
>   	}
>   err_out:
> +	ksft_test_result_fail("# Test Failed\n");
>   	return ksft_exit_fail();
>   }

I am not seeing any value in adding these. It already has messages
in error legs and it prints totals at the end:

# Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0

thanks,
-- Shuah

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

* Re: [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework
  2023-08-16 15:45 ` Shuah Khan
@ 2023-08-17  9:21   ` Atul Kumar Pant
  0 siblings, 0 replies; 3+ messages in thread
From: Atul Kumar Pant @ 2023-08-17  9:21 UTC (permalink / raw)
  To: Shuah Khan; +Cc: shuah, linux-kselftest, linux-kernel-mentees

On Wed, Aug 16, 2023 at 09:45:10AM -0600, Shuah Khan wrote:
> On 7/23/23 00:41, Atul Kumar Pant wrote:
> > Updates the msgque test to print the pass or fail status after the
> > completion of the test.
> > 
> > Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
> > ---
> >   tools/testing/selftests/ipc/msgque.c | 5 +++++
> >   1 file changed, 5 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/ipc/msgque.c b/tools/testing/selftests/ipc/msgque.c
> > index 656c43c24044..513b1265bb75 100644
> > --- a/tools/testing/selftests/ipc/msgque.c
> > +++ b/tools/testing/selftests/ipc/msgque.c
> > @@ -9,6 +9,7 @@
> >   #include "../kselftest.h"
> > +#define NUM_TEST_CASES		1
> >   #define MAX_MSG_SIZE		32
> >   struct msg1 {
> > @@ -197,6 +198,7 @@ int main(int argc, char **argv)
> >   	int msg, pid, err;
> >   	struct msgque_data msgque;
> > +	ksft_set_plan(NUM_TEST_CASES);
> >   	if (getuid() != 0)
> >   		return ksft_exit_skip(
> >   				"Please run the test as root - Exiting.\n");
> > @@ -243,13 +245,16 @@ int main(int argc, char **argv)
> >   		printf("Failed to test queue: %d\n", err);
> >   		goto err_out;
> >   	}
> > +	ksft_test_result_pass("# Test Passed\n");
> >   	return ksft_exit_pass();
> >   err_destroy:
> >   	if (msgctl(msgque.msq_id, IPC_RMID, NULL)) {
> >   		printf("Failed to destroy queue: %d\n", -errno);
> > +		ksft_test_result_fail("# Test Failed\n");
> >   		return ksft_exit_fail();
> >   	}
> >   err_out:
> > +	ksft_test_result_fail("# Test Failed\n");
> >   	return ksft_exit_fail();
> >   }
> 
> I am not seeing any value in adding these. It already has messages
> in error legs and it prints totals at the end:
> 
> # Totals: pass:0 fail:0 xfail:0 xpass:0 skip:0 error:0
> 
> thanks,
> -- Shuah

	The stats printed at the end have no account of whether the test passed
	or failed. As seen in the totals message at the end, all the values for
	various test results (pass, fail,xfail, xpass,skip and error) is 0.
	With this patch we'll get the totals at the end of test like:
	# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0

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

end of thread, other threads:[~2023-08-17  9:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-23  6:41 [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework Atul Kumar Pant
2023-08-16 15:45 ` Shuah Khan
2023-08-17  9:21   ` Atul Kumar Pant

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