public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH v2] syscalls/fstatfs02: Using temporary file description to test the syscall
@ 2014-06-10 14:59 shuang.qiu
  2014-06-10 16:43 ` chrubis
  0 siblings, 1 reply; 2+ messages in thread
From: shuang.qiu @ 2014-06-10 14:59 UTC (permalink / raw)
  To: ltp-list

From: Shuang Qiu <shuang.qiu@oracle.com>

It is not expected to use stdout as the file description to test the
system call fstatfs().Using ltp temporary file instead.

Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
---
 testcases/kernel/syscalls/fstatfs/fstatfs02.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/fstatfs/fstatfs02.c b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
index f851c97..8e011a0 100644
--- a/testcases/kernel/syscalls/fstatfs/fstatfs02.c
+++ b/testcases/kernel/syscalls/fstatfs/fstatfs02.c
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include "test.h"
 #include "usctest.h"
+#include "safe_macros.h"
 
 static void setup(void);
 static void cleanup(void);
@@ -49,7 +50,7 @@ static struct test_case_t {
 	    /* Skip since uClinux does not implement memory protection */
 	    /* EFAULT - address for buf is invalid */
 	{
-	1, (void *)-1, EFAULT}
+	-1, (void *)-1, EFAULT}
 #endif
 };
 
@@ -107,11 +108,19 @@ static void setup(void)
 	TEST_PAUSE;
 
 	tst_tmpdir();
+#ifndef UCLINUX
+	TC[1].fd = SAFE_OPEN(cleanup, "tempfile", O_RDWR | O_CREAT, 0700);
+#endif
 }
 
 static void cleanup(void)
 {
 	TEST_CLEANUP;
 
+#ifndef UCLINUX
+	if (TC[1].fd > 0 && close(TC[1].fd))
+		tst_resm(TWARN | TERRNO, "Failed to close fd");
+#endif
+
 	tst_rmdir();
 }
-- 
1.7.9.5


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [LTP] [PATCH v2] syscalls/fstatfs02: Using temporary file description to test the syscall
  2014-06-10 14:59 [LTP] [PATCH v2] syscalls/fstatfs02: Using temporary file description to test the syscall shuang.qiu
@ 2014-06-10 16:43 ` chrubis
  0 siblings, 0 replies; 2+ messages in thread
From: chrubis @ 2014-06-10 16:43 UTC (permalink / raw)
  To: shuang.qiu; +Cc: ltp-list

Hi!
> It is not expected to use stdout as the file description to test the
> system call fstatfs().Using ltp temporary file instead.

Pushed, thanks.

Note that I've also added a testcase into the fstatfs01 that ensures
that fstatfs() works with pipe() file descriptors.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-10 16:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-10 14:59 [LTP] [PATCH v2] syscalls/fstatfs02: Using temporary file description to test the syscall shuang.qiu
2014-06-10 16:43 ` chrubis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox