Skip to contentSkip to conversation

setxattr: prefer not to run tests in tmpfs

PATCH New [email protected] 2 participants 5 messages Mar 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setxattr: prefer not to run tests in tmpfs

From: "Maxin B. John" <[email protected]>

1. Even though tmpfs supports extended attributes, running these tests on other filesystems will be relatively better for testing xattrs.

2. setxattr01 doesn't need root privileges to run

---
 testcases/kernel/syscalls/setxattr/setxattr01.c |  7 ++-----
 testcases/kernel/syscalls/setxattr/setxattr02.c | 10 +++++++---
 testcases/kernel/syscalls/setxattr/setxattr03.c |  5 ++---
 3 files changed, 11 insertions(+), 11 deletions(-)
testcases/kernel/syscalls/setxattr/setxattr01.c +2 -5
index 478f994..e4f35dd 100644
@@ -179,10 +179,6 @@ static void setup(void)
 {
 	int fd;
 
-	tst_require_root();
-
-	tst_tmpdir();
-
 	/* Test for xattr support */
 	fd = creat("testfile", 0644);
 	if (fd == -1)
@@ -219,7 +215,8 @@ static void setup(void)
 
 static void cleanup(void)
 {
-	tst_rmdir();
+	unlink("testfile");
+	unlink("setxattr01testfile");
 }
 #else /* HAVE_SYS_XATTR_H */
 int main(int argc, char *argv[])
testcases/kernel/syscalls/setxattr/setxattr02.c +7 -3
index 73c464c..286f483 100644
@@ -182,8 +182,6 @@ static void setup(void)
 
 	tst_require_root();
 
-	tst_tmpdir();
-
 	/* Test for xattr support */
 	fd = creat("testfile", 0644);
 	if (fd == -1)
@@ -232,7 +230,13 @@ static void setup(void)
 
 static void cleanup(void)
 {
-	tst_rmdir();
+	unlink(FILENAME);
+	unlink(SYMLINK);
+	unlink(FIFO);
+	unlink(CHR);
+	unlink(BLK);
+	unlink(SOCK);
+	rmdir(DIRNAME);
 }
 #else /* HAVE_SYS_XATTR_H */
 int main(int argc, char *argv[])
testcases/kernel/syscalls/setxattr/setxattr03.c +2 -3
index c09211e..ce71c67 100644
@@ -164,8 +164,6 @@ static void setup(void)
 
 	tst_require_root();
 
-	tst_tmpdir();
-
 	/* Test for xattr support */
 	fd = creat("testfile", 0644);
 	if (fd == -1)
@@ -208,7 +206,8 @@ static void cleanup(void)
 	close(immu_fd);
 	close(append_fd);
 
-	tst_rmdir();
+	unlink(IMMU_FILE);
+	unlink(APPEND_FILE);
 }
 #else
 int main(void)
Signature · 1 line
2.4.0
#1 lore raw

PATCH 1/1 setxattr: prefer not to run tests in tmpfs

Hi!
NACK tests must not create any files outside it's temporary directory.

We can either exit the test with TCONF if /tmp is on tmpfs or format and mount a device and run these testcases on a file created there in that case.

Signature · 2 lines
Cyril Hrubis
[email protected]
#2 lore raw

PATCH 1/1 setxattr: prefer not to run tests in tmpfs

Hi Cyril,

Quoted 2 lines · Cyril Hrubis

Hi!
NACK tests must not create any files outside it's temporary directory.

Ok.

Quoted 3 lines

We can either exit the test with TCONF if /tmp is on tmpfs or format and mount a device and run these testcases on a file created there in that case.

Thanks for sharing your thoughts. It is clear now.

However, what about tests which fails by default on tmpfs like "fcntl" tests? Should we default to the "/tmp" directory rather than mounting another device and run the tests again ?

Quoted 3 lines

--
Cyril Hrubis
[email protected]

Best Regards,
Maxin

#3 lore raw

PATCH 1/1 setxattr: prefer not to run tests in tmpfs

Hi!

Quoted 9 lines
Quoted 3 lines

We can either exit the test with TCONF if /tmp is on tmpfs or format and mount a device and run these testcases on a file created there in that case.

Thanks for sharing your thoughts. It is clear now.

However, what about tests which fails by default on tmpfs like "fcntl" tests? Should we default to the "/tmp" directory rather than mounting another device and run the tests again ?

Have a look at ftruncate04.c testcase, that falls back to mounting a device over the directory the test uses if needed.

Signature · 2 lines
Cyril Hrubis
[email protected]
#4 lore raw

PATCH 1/1 setxattr: prefer not to run tests in tmpfs

Hi,

Quoted 5 lines · Cyril Hrubis

Hi!

Quoted 4 lines
Quoted 3 lines

We can either exit the test with TCONF if /tmp is on tmpfs or format and mount a device and run these testcases on a file created there in that case.

Quoted 8 lines
Quoted 5 lines

Thanks for sharing your thoughts. It is clear now.

However, what about tests which fails by default on tmpfs like "fcntl" tests? Should we default to the "/tmp" directory rather than mounting another device and run the tests again ?

Have a look at ftruncate04.c testcase, that falls back to mounting a device over the directory the test uses if needed.

That helps. Thank you!

Quoted 3 lines

--
Cyril Hrubis
[email protected]

Warm Regards,
Maxin