* [LTP] [PATCH] creat08: Fix test to be able to run on NFS
@ 2011-09-15 11:09 Michal Simek
2011-09-26 6:36 ` Michal Simek
0 siblings, 1 reply; 3+ messages in thread
From: Michal Simek @ 2011-09-15 11:09 UTC (permalink / raw)
To: ltp-list; +Cc: Michal Simek
NFS creates temporary .nfsXXX files for every open/created file.
Based on this rmdir syscall failed because directory is not empty.
The solution is to close all open/created files. They are also unlink
in cleanup.
Error log:
creat08 5 TBROK : rmdir testdir.A.167 failed: errno=???(39): Directory not empty
creat08 6 TBROK : Remaining cases broken
Example of created files(listed by readdir):
testdir.A.155
.nfs00000000070201f60000007d
..
.nfs00000000070201f70000007c
.
testdir.B.155
.nfs00000000000dc13c0000007f
.nfs00000000000dc1050000007e
..
.
.nfs00000000000dc0f600000080
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
testcases/kernel/syscalls/creat/creat08.c | 23 +++++++++++++++++------
1 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/creat/creat08.c b/testcases/kernel/syscalls/creat/creat08.c
index ec2fcf1..30b451a 100644
--- a/testcases/kernel/syscalls/creat/creat08.c
+++ b/testcases/kernel/syscalls/creat/creat08.c
@@ -86,6 +86,7 @@ int main(int ac, char **av)
uid_t save_myuid, user1_uid;
pid_t mypid;
+ int fd;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
@@ -240,7 +241,8 @@ int main(int ac, char **av)
/*
* Create the file with setgid not set
*/
- if (open(nosetgid_A, O_CREAT|O_EXCL|O_RDWR, MODE_RWX) == -1) {
+ fd = open(nosetgid_A, O_CREAT|O_EXCL|O_RDWR, MODE_RWX);
+ if (fd == -1) {
tst_resm(TFAIL, "Creation of %s failed", nosetgid_A);
local_flag = FAILED;
}
@@ -262,12 +264,13 @@ int main(int ac, char **av)
tst_resm(TFAIL, "%s: Incorrect group", nosetgid_A);
local_flag = FAILED;
}
+ close(fd);
/*
* Create the file with setgid set
*/
- if (open(setgid_A, O_CREAT | O_EXCL | O_RDWR, MODE_SGID) ==
- -1) {
+ fd = open(setgid_A, O_CREAT | O_EXCL | O_RDWR, MODE_SGID);
+ if (fd == -1) {
tst_resm(TFAIL, "Creation of %s failed", setgid_A);
local_flag = FAILED;
}
@@ -291,6 +294,8 @@ int main(int ac, char **av)
tst_resm(TINFO, "got %u and %u", buf.st_gid, mygid);
local_flag = FAILED;
}
+ close(fd);
+
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block1.");
} else {
@@ -308,7 +313,8 @@ int main(int ac, char **av)
/*
* Create the file with setgid not set
*/
- if (creat(nosetgid_B, MODE_RWX) == -1) {
+ fd = creat(nosetgid_B, MODE_RWX);
+ if (fd == -1) {
tst_resm(TFAIL, "Creation of %s failed", nosetgid_B);
local_flag = FAILED;
}
@@ -331,11 +337,13 @@ int main(int ac, char **av)
tst_resm(TFAIL, "%s: Incorrect group", nosetgid_B);
local_flag = FAILED;
}
+ close(fd);
/*
* Create the file with setgid set
*/
- if (creat(setgid_B, MODE_SGID) == -1) {
+ fd = creat(setgid_B, MODE_SGID);
+ if (fd == -1) {
tst_resm(TFAIL, "Creation of %s failed", setgid_B);
local_flag = FAILED;
}
@@ -360,6 +368,7 @@ int main(int ac, char **av)
setgid_B);
local_flag = FAILED;
}
+ close(fd);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block2.");
@@ -381,7 +390,8 @@ int main(int ac, char **av)
}
/* Create the file with setgid set */
- if (creat(root_setgid_B, MODE_SGID) == -1) {
+ fd = creat(root_setgid_B, MODE_SGID);
+ if (fd == -1) {
tst_resm(TFAIL, "Creation of %s failed", root_setgid_B);
local_flag = FAILED;
}
@@ -406,6 +416,7 @@ int main(int ac, char **av)
group2_gid);
local_flag = FAILED;
}
+ close(fd);
if (local_flag == PASSED) {
tst_resm(TPASS, "Test passed in block3");
--
1.5.5.6
------------------------------------------------------------------------------
Doing More with Less: The Next Generation Virtual Desktop
What are the key obstacles that have prevented many mid-market businesses
from deploying virtual desktops? How do next-generation virtual desktops
provide companies an easier-to-deploy, easier-to-manage and more affordable
virtual desktop model.http://www.accelacomm.com/jaw/sfnl/114/51426474/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] creat08: Fix test to be able to run on NFS
2011-09-15 11:09 [LTP] [PATCH] creat08: Fix test to be able to run on NFS Michal Simek
@ 2011-09-26 6:36 ` Michal Simek
2011-10-05 15:07 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Michal Simek @ 2011-09-26 6:36 UTC (permalink / raw)
Cc: ltp-list
Michal Simek wrote:
> NFS creates temporary .nfsXXX files for every open/created file.
> Based on this rmdir syscall failed because directory is not empty.
> The solution is to close all open/created files. They are also unlink
> in cleanup.
>
> Error log:
> creat08 5 TBROK : rmdir testdir.A.167 failed: errno=???(39): Directory not empty
> creat08 6 TBROK : Remaining cases broken
>
> Example of created files(listed by readdir):
> testdir.A.155
> .nfs00000000070201f60000007d
> ..
> .nfs00000000070201f70000007c
> .
>
> testdir.B.155
> .nfs00000000000dc13c0000007f
> .nfs00000000000dc1050000007e
> ..
> .
> .nfs00000000000dc0f600000080
>
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
> testcases/kernel/syscalls/creat/creat08.c | 23 +++++++++++++++++------
> 1 files changed, 17 insertions(+), 6 deletions(-)
Can someone review it or apply it to git?
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] creat08: Fix test to be able to run on NFS
2011-09-26 6:36 ` Michal Simek
@ 2011-10-05 15:07 ` Cyril Hrubis
0 siblings, 0 replies; 3+ messages in thread
From: Cyril Hrubis @ 2011-10-05 15:07 UTC (permalink / raw)
To: Michal Simek; +Cc: ltp-list
Hi!
>
> Can someone review it or apply it to git?
>
Commited, thanks.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-05 15:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-15 11:09 [LTP] [PATCH] creat08: Fix test to be able to run on NFS Michal Simek
2011-09-26 6:36 ` Michal Simek
2011-10-05 15:07 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.