[LTP] [PATCH v2 1/2] syscalls/faccessat201: Add new testcase

Cyril Hrubis chrubis@suse.cz
Tue Aug 22 16:22:01 CEST 2023


Hi!
Pushed with minor changes, thanks.

- we have to include config.h in the lapi/faccessat.h so that we get
  eventually get the macro HAVE_FACCESSAT2 definition (if defined)

- the directory in the test temporary directory must be 0777 otherwise
  the test will fail with EACCESS when executed as non-root

- the abs_path is initialized in the test setup dynamically, it
  shouldn't be initialized in the .bufs structure

Full diff:

diff --git a/include/lapi/faccessat.h b/include/lapi/faccessat.h
index 5b42014d2..05997d975 100644
--- a/include/lapi/faccessat.h
+++ b/include/lapi/faccessat.h
@@ -9,6 +9,7 @@
 #define FACCESSAT2_H

 #include "tst_test.h"
+#include "config.h"
 #include "lapi/syscalls.h"

 #ifndef HAVE_FACCESSAT2
diff --git a/testcases/kernel/syscalls/faccessat2/faccessat201.c b/testcases/kernel/syscalls/faccessat2/faccessat201.c
index 88ee21522..012091752 100644
--- a/testcases/kernel/syscalls/faccessat2/faccessat201.c
+++ b/testcases/kernel/syscalls/faccessat2/faccessat201.c
@@ -61,7 +61,7 @@ static void setup(void)
        abs_path = tst_aprintf("%s/%s", tmpdir_path, RELPATH);
        free(tmpdir_path);

-       SAFE_MKDIR(TESTDIR, 0666);
+       SAFE_MKDIR(TESTDIR, 0777);
        dir_fd = SAFE_OPEN(TESTDIR, O_DIRECTORY);
        SAFE_TOUCH(abs_path, 0444, NULL);
        SAFE_SYMLINK(abs_path, TESTSYMLINK);
@@ -80,7 +80,6 @@ static struct tst_test test = {
        .cleanup = cleanup,
        .bufs = (struct tst_buffers []) {
                {&testfile, .str = TESTFILE},
-               {&abs_path, .size = sizeof(char)},
                {&rel_path, .str = RELPATH},
                {&sym_path, .str = TESTSYMLINK},
                {},


-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list