* [LTP] ftruncate04.c: cleanup mandatory locking check
@ 2010-05-12 13:14 Nicolas Joly
2010-05-12 17:23 ` Subrata Modak
2010-05-17 20:06 ` Subrata Modak
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Joly @ 2010-05-12 13:14 UTC (permalink / raw)
To: LTP list
[-- Attachment #1: Type: text/plain, Size: 561 bytes --]
Hi,
The attached patch tries to cleanup the `mandatory locking' check in
the ftruncate04.c testcase.
The currently test is made with system(2) and involve calling some
external tools ... to determine if the underlying filesystem has
`mand' option set. The same result can be easily retrieved with a
simple statvfs(2) call and examining the mount flags value.
This has been successfully tested on a RHEL5 x86_64 machine.
Signed-off-by: Nicolas Joly <njoly@pasteur.fr>
Regards.
--
Nicolas Joly
Biological Software and Databanks.
Institut Pasteur, Paris.
[-- Attachment #2: ltp-ftruncate04.diff --]
[-- Type: text/plain, Size: 1156 bytes --]
diff --git a/testcases/kernel/syscalls/ftruncate/ftruncate04.c b/testcases/kernel/syscalls/ftruncate/ftruncate04.c
index 324a654..fa1daea 100644
--- a/testcases/kernel/syscalls/ftruncate/ftruncate04.c
+++ b/testcases/kernel/syscalls/ftruncate/ftruncate04.c
@@ -66,6 +66,8 @@
#include <inttypes.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/mount.h>
+#include <sys/statvfs.h>
#include "test.h"
#include "usctest.h"
#include "libtestsuite.h"
@@ -285,6 +287,7 @@ int main(int ac, char **av)
struct sigaction act;
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
+ struct statvfs fs;
/*
* parse standard options
@@ -300,9 +303,12 @@ int main(int ac, char **av)
local_flag = PASSED;
tst_tmpdir();
- if (system
- ("mount | grep `df . | grep ^/ | awk {'print $1'}` | grep mand >/dev/null")
- != 0) {
+ if (statvfs(".", &fs) == -1) {
+ tst_resm(TFAIL|TERRNO, "statvfs failed");
+ tst_rmdir();
+ tst_exit();
+ }
+ if ((fs.f_flag & MS_MANDLOCK) == 0) {
tst_resm(TCONF,
"The filesystem where /tmp is mounted does"
" not support mandatory locks. Cannot run this test.");
[-- Attachment #3: Type: text/plain, Size: 80 bytes --]
------------------------------------------------------------------------------
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
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] ftruncate04.c: cleanup mandatory locking check
2010-05-12 13:14 [LTP] ftruncate04.c: cleanup mandatory locking check Nicolas Joly
@ 2010-05-12 17:23 ` Subrata Modak
2010-05-17 20:06 ` Subrata Modak
1 sibling, 0 replies; 3+ messages in thread
From: Subrata Modak @ 2010-05-12 17:23 UTC (permalink / raw)
To: Nicolas Joly; +Cc: LTP list
On Wed, 2010-05-12 at 15:14 +0200, Nicolas Joly wrote:
> Hi,
>
> The attached patch tries to cleanup the `mandatory locking' check in
> the ftruncate04.c testcase.
>
> The currently test is made with system(2) and involve calling some
> external tools ... to determine if the underlying filesystem has
> `mand' option set. The same result can be easily retrieved with a
> simple statvfs(2) call and examining the mount flags value.
>
> This has been successfully tested on a RHEL5 x86_64 machine.
>
> Signed-off-by: Nicolas Joly <njoly@pasteur.fr>
Thanks. This does not introduce any regression. Will wait for others
comments as well.
Regards--
Subrata
>
> Regards.
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
_______________________________________________
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] ftruncate04.c: cleanup mandatory locking check
2010-05-12 13:14 [LTP] ftruncate04.c: cleanup mandatory locking check Nicolas Joly
2010-05-12 17:23 ` Subrata Modak
@ 2010-05-17 20:06 ` Subrata Modak
1 sibling, 0 replies; 3+ messages in thread
From: Subrata Modak @ 2010-05-17 20:06 UTC (permalink / raw)
To: Nicolas Joly; +Cc: LTP list
On Wed, 2010-05-12 at 15:14 +0200, Nicolas Joly wrote:
> Hi,
>
> The attached patch tries to cleanup the `mandatory locking' check in
> the ftruncate04.c testcase.
>
> The currently test is made with system(2) and involve calling some
> external tools ... to determine if the underlying filesystem has
> `mand' option set. The same result can be easily retrieved with a
> simple statvfs(2) call and examining the mount flags value.
>
> This has been successfully tested on a RHEL5 x86_64 machine.
>
> Signed-off-by: Nicolas Joly <njoly@pasteur.fr>
Thanks.
Regards--
Subrata
>
> Regards.
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Ltp-list mailing list
> Ltp-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
_______________________________________________
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:[~2010-05-17 20:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-12 13:14 [LTP] ftruncate04.c: cleanup mandatory locking check Nicolas Joly
2010-05-12 17:23 ` Subrata Modak
2010-05-17 20:06 ` Subrata Modak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox