[LTP] [PATCH] fallocate04: Use tst_kvercmp after lseek(SEEK_HOLE) return EINVAL

Zeng Linggang
2015-05-21T05:38:58Z

SEEK_HOLE is only supported since version 3.1. Just print some
information to remind users if kernel is before 3.1, if not print
'TBROK' and quit, instead of 'TWARN'.

Signed-off-by: Zeng Linggang <zenglg.jy@cn.fujitsu.com>
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
testcases/kernel/syscalls/fallocate/fallocate04.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/fallocate/fallocate04.c b/testcases/kernel/syscalls/fallocate/fallocate04.c
index 911bbe8..0c904a0 100644
--- a/testcases/kernel/syscalls/fallocate/fallocate04.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate04.c
@@ -158,9 +158,15 @@ static void test02(void)
tst_brkm(TFAIL | TERRNO, cleanup,
"fallocate() or lseek() failed");
}
- tst_resm(TWARN | TERRNO, "lseek() doesn't support SEEK_HOLE");
+ if (tst_kvercmp(3, 1, 0) < 0)
+ tst_resm(TINFO, "lseek() doesn't support SEEK_HOLE, "
+ "this is expected for < 3.1 kernels");
+ else
+ tst_brkm(TBROK | TERRNO, cleanup,
+ "lseek() doesn't support SEEK_HOLE");
+ } else {
+ tst_resm(TINFO, "found a hole at '%ld' offset", ret);
}
- tst_resm(TINFO, "found a hole at '%ld' offset", ret);

size_t alloc_size1 = get_allocsize();

--
1.9.3