diff mbox series

selftests/seccomp: report errno and add hints on failure

Message ID 20250517122740.35043-1-sameekshasankpal@gmail.com
State New
Headers show
Series selftests/seccomp: report errno and add hints on failure | expand

Commit Message

Sameeksha Sankpal May 17, 2025, 12:27 p.m. UTC
Signed-off-by: Sameeksha Sankpal <sameekshasankpal@gmail.com>
---
 tools/testing/selftests/seccomp/seccomp_bpf.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/selftests/seccomp/seccomp_bpf.c
index 14ba51b52095..d6a85d7b26da 100644
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@ -4508,7 +4508,11 @@  static char get_proc_stat(struct __test_metadata *_metadata, pid_t pid)
 
 	snprintf(proc_path, sizeof(proc_path), "/proc/%d/stat", pid);
 	ASSERT_EQ(get_nth(_metadata, proc_path, 3, &line), 1);
-
+	int rc = get_nth(_metadata, proc_path, 3, &line);
+    	if (rc != 1) {
+        	printf("[ERROR] user_notification_fifo: failed to read stat for PID %d (rc=%d)\n", pid, rc);
+    	}
+    	ASSERT_EQ(rc, 1);
 	status = *line;
 	free(line);
 
@@ -4518,6 +4522,7 @@  static char get_proc_stat(struct __test_metadata *_metadata, pid_t pid)
 TEST(user_notification_fifo)
 {
 	struct seccomp_notif_resp resp = {};
+	ksft_print_msg("[INFO] Starting FIFO notification test\n");
 	struct seccomp_notif req = {};
 	int i, status, listener;
 	pid_t pid, pids[3];
@@ -4535,6 +4540,7 @@  TEST(user_notification_fifo)
 	listener = user_notif_syscall(__NR_getppid,
 				      SECCOMP_FILTER_FLAG_NEW_LISTENER);
 	ASSERT_GE(listener, 0);
+	ksft_print_msg("[INFO] user_notification_fifo: listener PID is %d\n", listener);
 
 	pid = fork();
 	ASSERT_GE(pid, 0);