All of lore.kernel.org
 help / color / mirror / Atom feed
From: Atul Kumar Pant <atulpant.linux@gmail.com>
To: shuah@kernel.org
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
	Atul Kumar Pant <atulpant.linux@gmail.com>,
	linux-kselftest@vger.kernel.org
Subject: [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework
Date: Sun, 23 Jul 2023 12:11:54 +0530	[thread overview]
Message-ID: <20230723064154.89443-1-atulpant.linux@gmail.com> (raw)

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

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

WARNING: multiple messages have this Message-ID (diff)
From: Atul Kumar Pant <atulpant.linux@gmail.com>
To: shuah@kernel.org
Cc: Atul Kumar Pant <atulpant.linux@gmail.com>,
	linux-kselftest@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH v1] selftests: ipc: Updates the msgque test to use kselftest framework
Date: Sun, 23 Jul 2023 12:11:54 +0530	[thread overview]
Message-ID: <20230723064154.89443-1-atulpant.linux@gmail.com> (raw)

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


             reply	other threads:[~2023-07-23  6:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-23  6:41 Atul Kumar Pant [this message]
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-16 15:45   ` Shuah Khan
2023-08-17  9:21   ` Atul Kumar Pant
2023-08-17  9:21     ` Atul Kumar Pant

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=20230723064154.89443-1-atulpant.linux@gmail.com \
    --to=atulpant.linux@gmail.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kselftest@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.