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

Zeng Linggang
2015-05-20T09:35:19Z

Hi, Alexey and Jan

On Wed, 2015-05-20 at 11:13 +0300, Alexey Kodanev wrote:
> 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:

OK. I will do as that.

Thank both of you.

Best regards,
Zeng

>
> --- 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