selftest: pidfd: Omit long and repeating outputs
authorZiqi Zhao <astrajoan@yahoo.com>
Tue, 23 May 2023 23:22:07 +0000 (23:22 +0000)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 12 Jun 2023 22:39:11 +0000 (16:39 -0600)
An output message:

> # # waitpid WEXITSTATUS=0

will be printed for 30,000+ times in the `pidfd_test` selftest, which
does not seem ideal. This patch removes the print logic in the
`wait_for_pid` function, so each call to this function does not output
a line by default. Any existing call sites where the extra line might
be beneficial have been modified to include extra print statements
outside of the function calls.

Signed-off-by: Ziqi Zhao <astrajoan@yahoo.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/pidfd/pidfd.h
tools/testing/selftests/pidfd/pidfd_fdinfo_test.c
tools/testing/selftests/pidfd/pidfd_test.c

index 6922d6417e1cf06094c10627e0bd491d292d6fd2..88d6830ee004df3c7a9d3ebcdab89d5775e9ab9b 100644 (file)
@@ -90,7 +90,6 @@ again:
        }
 
        ret = WEXITSTATUS(status);
-       ksft_print_msg("waitpid WEXITSTATUS=%d\n", ret);
        return ret;
 }
 
index 3fd8e903118f532d43a2ac251ec71531f19ca161..4e86f927880c32d3676db629811aaa37beda69de 100644 (file)
@@ -143,6 +143,7 @@ static inline int child_join(struct child *child, struct error *err)
                r = -1;
        }
 
+       ksft_print_msg("waitpid WEXITSTATUS=%d\n", r);
        return r;
 }
 
index e2dd4ed849846216f15c70a996cb2cdc160f210a..00a07e7c571cda1cd6617af6a91f10d94592aaf1 100644 (file)
@@ -115,7 +115,8 @@ static int test_pidfd_send_signal_exited_fail(void)
 
        pidfd = open(buf, O_DIRECTORY | O_CLOEXEC);
 
-       (void)wait_for_pid(pid);
+       ret = wait_for_pid(pid);
+       ksft_print_msg("waitpid WEXITSTATUS=%d\n", ret);
 
        if (pidfd < 0)
                ksft_exit_fail_msg(