Re: [LTP] [PATCH v2] fallocate04: another check if SEEK_HOLE is not supported

Alexey Kodanev
2015-05-20T08:10:31Z

Hi,
On 05/20/2015 04:47 AM, Zeng Linggang wrote:
> Hi!
>
> On Tue, 2015-05-19 at 07:18 -0400, Jan Stancek wrote:
[ ... ]
>> Wouldn't it be enough to turn that warning into TINFO, for kernels < 3.1?
>>
>> diff --git a/testcases/kernel/syscalls/fallocate/fallocate04.c b/testcases/kernel/syscalls/fallocate/fallocate04.c
>> index 911bbe8..45d9827 100644
>> --- a/testcases/kernel/syscalls/fallocate/fallocate04.c
>> +++ b/testcases/kernel/syscalls/fallocate/fallocate04.c
>> @@ -158,9 +158,12 @@ 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)
> How about put them before lseek(SEEK_HOLE) ?
>
> if (tst_kvercmp(3, 1, 0) < 0) {
> fill_tst_buf();
> memset();
> check_file_data();
> } else {
> lseek(SEEK_HOLE);
> ...
> }

Please don't complicate the test-case with this, I agree with Jan, it is
enough to add the kernel version check. It can be as follows:

--- a/testcases/kernel/syscalls/fallocate/fallocate04.c
+++ b/testcases/kernel/syscalls/fallocate/fallocate04.c
@@ -158,7 +158,8 @@ static void test02(void)
tst_brkm(TFAIL | TERRNO, cleanup,
"fallocate() or lseek() failed");
}
- tst_resm(TWARN | TERRNO, "lseek() doesn't support
SEEK_HOLE");
+ tst_resm((tst_kvercmp(3, 1, 0) < 0) ? TINFO : (TWARN |
TERRNO),
+ "lseek() doesn't support SEEK_HOLE");
}
tst_resm(TINFO, "found a hole at '%ld' offset", ret);

Best regards,
Alexey