selftests: exec: Use new ksft_exit_fail_perror() helper
authorMuhammad Usama Anjum <usama.anjum@collabora.com>
Thu, 4 Apr 2024 16:14:33 +0000 (21:14 +0500)
committerShuah Khan <skhan@linuxfoundation.org>
Mon, 6 May 2024 19:57:19 +0000 (13:57 -0600)
Use ksft_exit_fail_perror() to print the value of errno and its string
form. This is the first user of the ksft_exit_fail_perror() and proves
the usefulness of this API.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
tools/testing/selftests/exec/recursion-depth.c

index b2f37d86a5f623b1a8e91af7b42bfc6db79af34b..438c8ff2fd2601f607d1dc9594ead6aed00c7649 100644 (file)
@@ -37,25 +37,25 @@ int main(void)
                        ksft_test_result_skip("error: unshare, errno %d\n", errno);
                        ksft_finished();
                }
-               ksft_exit_fail_msg("error: unshare, errno %d\n", errno);
+               ksft_exit_fail_perror("error: unshare");
        }
 
        if (mount(NULL, "/", NULL, MS_PRIVATE | MS_REC, NULL) == -1)
-               ksft_exit_fail_msg("error: mount '/', errno %d\n", errno);
+               ksft_exit_fail_perror("error: mount '/'");
 
        /* Require "exec" filesystem. */
        if (mount(NULL, "/tmp", "ramfs", 0, NULL) == -1)
-               ksft_exit_fail_msg("error: mount ramfs, errno %d\n", errno);
+               ksft_exit_fail_perror("error: mount ramfs");
 
 #define FILENAME "/tmp/1"
 
        fd = creat(FILENAME, 0700);
        if (fd == -1)
-               ksft_exit_fail_msg("error: creat, errno %d\n", errno);
+               ksft_exit_fail_perror("error: creat");
 
 #define S "#!" FILENAME "\n"
        if (write(fd, S, strlen(S)) != strlen(S))
-               ksft_exit_fail_msg("error: write, errno %d\n", errno);
+               ksft_exit_fail_perror("error: write");
 
        close(fd);