diff mbox series

[5/5] getdents02: Enable .all_filesystems

Message ID 20240911163443.95398-6-mdoucha@suse.cz
State Accepted
Headers show
Series Enable .all_filesystems in readdir() and getdents() tests | expand

Commit Message

Martin Doucha Sept. 11, 2024, 4:34 p.m. UTC
Run the getdents() error test on all filesystems.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/getdents/getdents02.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

Comments

Cyril Hrubis Sept. 12, 2024, 12:18 p.m. UTC | #1
Hi!
I did merged the patchset, thanks.

I've also notice that there are failures on -m32 build but that happens
before these patches as well:

$ ./getdents02
tst_tmpdir.c:316: TINFO: Using /tmp/LTP_getxryBmt as tmpdir (ext2/ext3/ext4 filesystem)
tst_test.c:1809: TINFO: LTP version: 20240524-236-g0ae6bcc6f
tst_test.c:1813: TINFO: Tested kernel: 6.9.3 #1 SMP PREEMPT_DYNAMIC Fri Jun  7 11:00:48 CEST 2024 x86_64
tst_test.c:1652: TINFO: Timeout per run is 0h 00m 30s
getdents.h:148: TINFO: Testing the SYS_getdents syscall
tst_buffers.c:57: TINFO: Test is using guarded buffers
getdents02.c:86: TPASS: getdents failed as expected: EBADF (9)
getdents02.c:86: TPASS: getdents failed as expected: EINVAL (22)
getdents02.c:86: TPASS: getdents failed as expected: ENOTDIR (20)
getdents02.c:86: TPASS: getdents failed as expected: ENOENT (2)
getdents02.c:90: TFAIL: getdents failed unexpectedly: EINVAL (22)
getdents.h:151: TINFO: Testing the SYS_getdents64 syscall
tst_buffers.c:57: TINFO: Test is using guarded buffers
getdents02.c:86: TPASS: getdents failed as expected: EBADF (9)
getdents02.c:86: TPASS: getdents failed as expected: EINVAL (22)
getdents02.c:86: TPASS: getdents failed as expected: ENOTDIR (20)
getdents02.c:86: TPASS: getdents failed as expected: ENOENT (2)
getdents02.c:90: TFAIL: getdents failed unexpectedly: EINVAL (22)
getdents.h:157: TCONF: libc getdents() is not implemented
getdents.h:162: TINFO: Testing libc getdents64()
tst_buffers.c:57: TINFO: Test is using guarded buffers
getdents02.c:86: TPASS: getdents failed as expected: EBADF (9)
getdents02.c:86: TPASS: getdents failed as expected: EINVAL (22)
getdents02.c:86: TPASS: getdents failed as expected: ENOTDIR (20)
getdents02.c:86: TPASS: getdents failed as expected: ENOENT (2)
getdents02.c:86: TPASS: getdents failed as expected: EFAULT (14)

It looks like the tst_dirp_size() function does not work properly when
the code is compiled with -m32. Do we see these failures anywhere in
openQA?
Martin Doucha Sept. 12, 2024, 1:19 p.m. UTC | #2
On 12. 09. 24 14:18, Cyril Hrubis wrote:
> Hi!
> I did merged the patchset, thanks.
> 
> I've also notice that there are failures on -m32 build but that happens
> before these patches as well:
> 
> $ ./getdents02
> tst_tmpdir.c:316: TINFO: Using /tmp/LTP_getxryBmt as tmpdir (ext2/ext3/ext4 filesystem)
> tst_test.c:1809: TINFO: LTP version: 20240524-236-g0ae6bcc6f
> tst_test.c:1813: TINFO: Tested kernel: 6.9.3 #1 SMP PREEMPT_DYNAMIC Fri Jun  7 11:00:48 CEST 2024 x86_64
> tst_test.c:1652: TINFO: Timeout per run is 0h 00m 30s
> getdents.h:148: TINFO: Testing the SYS_getdents syscall
> tst_buffers.c:57: TINFO: Test is using guarded buffers
> getdents02.c:86: TPASS: getdents failed as expected: EBADF (9)
> getdents02.c:86: TPASS: getdents failed as expected: EINVAL (22)
> getdents02.c:86: TPASS: getdents failed as expected: ENOTDIR (20)
> getdents02.c:86: TPASS: getdents failed as expected: ENOENT (2)
> getdents02.c:90: TFAIL: getdents failed unexpectedly: EINVAL (22)
> getdents.h:151: TINFO: Testing the SYS_getdents64 syscall
> tst_buffers.c:57: TINFO: Test is using guarded buffers
> getdents02.c:86: TPASS: getdents failed as expected: EBADF (9)
> getdents02.c:86: TPASS: getdents failed as expected: EINVAL (22)
> getdents02.c:86: TPASS: getdents failed as expected: ENOTDIR (20)
> getdents02.c:86: TPASS: getdents failed as expected: ENOENT (2)
> getdents02.c:90: TFAIL: getdents failed unexpectedly: EINVAL (22)
> getdents.h:157: TCONF: libc getdents() is not implemented
> getdents.h:162: TINFO: Testing libc getdents64()
> tst_buffers.c:57: TINFO: Test is using guarded buffers
> getdents02.c:86: TPASS: getdents failed as expected: EBADF (9)
> getdents02.c:86: TPASS: getdents failed as expected: EINVAL (22)
> getdents02.c:86: TPASS: getdents failed as expected: ENOTDIR (20)
> getdents02.c:86: TPASS: getdents failed as expected: ENOENT (2)
> getdents02.c:86: TPASS: getdents failed as expected: EFAULT (14)
> 
> It looks like the tst_dirp_size() function does not work properly when
> the code is compiled with -m32. Do we see these failures anywhere in
> openQA?

Yes, 32bit getdents02 has been failing on Tumbleweed since the subtest 
was added:
https://openqa.opensuse.org/tests/4458950#step/getdents02/8
diff mbox series

Patch

diff --git a/testcases/kernel/syscalls/getdents/getdents02.c b/testcases/kernel/syscalls/getdents/getdents02.c
index 25aa30d9d..805a8bc48 100644
--- a/testcases/kernel/syscalls/getdents/getdents02.c
+++ b/testcases/kernel/syscalls/getdents/getdents02.c
@@ -26,7 +26,9 @@ 
 
 #define DIR_MODE	(S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP| \
 			 S_IXGRP|S_IROTH|S_IXOTH)
-#define TEST_DIR	"test_dir"
+#define MNTPOINT	"mntpoint"
+#define TEST_DIR	MNTPOINT "/test_dir"
+#define TEST_FILE	MNTPOINT "/test"
 
 static char *dirp;
 static size_t size;
@@ -61,8 +63,8 @@  static void setup(void)
 	size = tst_dirp_size();
 	dirp = tst_alloc(size);
 
-	fd = SAFE_OPEN(".", O_RDONLY);
-	fd_file = SAFE_OPEN("test", O_CREAT | O_RDWR, 0644);
+	fd = SAFE_OPEN(MNTPOINT, O_RDONLY);
+	fd_file = SAFE_OPEN(TEST_FILE, O_CREAT | O_RDWR, 0644);
 
 	dirp_bad = tst_get_bad_addr(NULL);
 
@@ -92,9 +94,12 @@  static void run(unsigned int i)
 }
 
 static struct tst_test test = {
-	.needs_tmpdir = 1,
 	.test = run,
 	.setup = setup,
 	.tcnt = ARRAY_SIZE(tcases),
 	.test_variants = TEST_VARIANTS,
+	.needs_root = 1,
+	.all_filesystems = 1,
+	.mount_device = 1,
+	.mntpoint = MNTPOINT
 };