We only skip the O_DIRECT testes when on tmpfs.
Signed-off-by: Zeng Linggang <[email protected]>
---
testcases/kernel/syscalls/read/read02.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/testcases/kernel/syscalls/read/read02.c
b/testcases/kernel/syscalls/read/read02.c
index 0ceff4e..ff12e8f 100644
--- a/testcases/kernel/syscalls/read/read02.c
+++ b/testcases/kernel/syscalls/read/read02.c
@@ -54,7 +54,7 @@
char *TCID = "read02";
static int badfd = -1;
-static int fd2, fd3, fd4;
+static int fd2, fd3, fd4 = -1;
static char buf[BUFSIZ];
static void *outside_buf = (void *)-1;
static void *addr4;
@@ -112,11 +112,6 @@ static void setup(void)
tst_tmpdir();
- if (tst_fs_type(cleanup, ".") == TST_TMPFS_MAGIC) {
- tst_brkm(TCONF, cleanup,
- "Test not supported on tmpfs filesystem");
- }
-
fd2 = SAFE_OPEN(cleanup, ".", O_DIRECTORY);
SAFE_FILE_PRINTF(cleanup, "test_file", "A");
@@ -131,11 +126,20 @@ static void setup(void)
addr4 = SAFE_MEMALIGN(cleanup, getpagesize(), (4096 * 10));
addr5 = addr4 + 1;
- fd4 = SAFE_OPEN(cleanup, "test_file", O_RDWR | O_DIRECT);
+ if (tst_fs_type(cleanup, ".") != TST_TMPFS_MAGIC)
+ fd4 = SAFE_OPEN(cleanup, "test_file", O_RDWR | O_DIRECT);
}
static void read_verify(const struct test_case_t *test)
{
+ if (test->fd == &fd4) {
+ if (*test->fd == -1) {
+ tst_resm(TCONF,
+ "Test not supported on tmpfs filesystem");
+ return;
+ }
+ }
+
TEST(read(*test->fd, *test->buf, test->count));
if (TEST_RETURN != -1) {
--
1.8.4.2
------------------------------------------------------------------------------
The best possible search technologies are now affordable for all companies.
Download your FREE open source Enterprise Search Engine today!
Our experts will assist you in its installation for $59/mo, no commitment.
Test it for FREE on our Cloud platform anytime!
http://pubads.g.doubleclick.net/gampad/clk?id=145328191&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list