[LTP] [PATCH v3] syscalls/faccessat202: Add new testcase

Cyril Hrubis chrubis@suse.cz
Wed Aug 23 11:34:43 CEST 2023


Hi!
I've added short descriptions to the testcase structure and pushed,
thanks.

Full diff:

diff --git a/testcases/kernel/syscalls/faccessat2/faccessat202.c b/testcases/kernel/syscalls/faccessat2/faccessat202.c
index e6cd1ec5e..a60db2bf8 100644
--- a/testcases/kernel/syscalls/faccessat2/faccessat202.c
+++ b/testcases/kernel/syscalls/faccessat2/faccessat202.c
@@ -46,13 +46,15 @@ static struct tcase {
        int mode;
        int flags;
        int exp_errno;
+       const char *desc;
 } tcases[] = {
-       {&atcwd_fd, &bad_path, R_OK, 0, EFAULT},
-       {&atcwd_fd, &rel_path, R_OK, -1, EINVAL},
-       {&atcwd_fd, &rel_path, -1, 0, EINVAL},
-       {&bad_fd, &rel_path, R_OK, 0, EBADF},
-       {&fd, &rel_path, R_OK, 0, ENOTDIR},
-       {&atcwd_fd, &rel_path, R_OK, AT_EACCESS, EACCES},
+       {&atcwd_fd, &bad_path, R_OK, 0, EFAULT, "invalid address"},
+       {&atcwd_fd, &rel_path, R_OK, -1, EINVAL, "invalid flags"},
+       {&atcwd_fd, &rel_path, -1, 0, EINVAL, "invalid mode"},
+       {&bad_fd, &rel_path, R_OK, 0, EBADF, "invalid fd"},
+       {&fd, &rel_path, R_OK, 0, ENOTDIR, "fd pointing to file"},
+       {&atcwd_fd, &rel_path, R_OK, AT_EACCESS, EACCES,
+         "AT_EACCESS and unprivileged EUID"},
 };

 static void verify_faccessat2(unsigned int i)
@@ -63,7 +65,7 @@ static void verify_faccessat2(unsigned int i)
                SAFE_SETEUID(ltpuser->pw_uid);

        TST_EXP_FAIL(faccessat2(*tc->fd, *tc->filename, tc->mode, tc->flags),
-                    tc->exp_errno, "faccessat2()");
+                    tc->exp_errno, "faccessat2() with %s", tc->desc);

        if (tc->exp_errno == EACCES)
                SAFE_SETEUID(0);

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list