Re: [LTP] [PATCH 1/5] Add stat04 test

Li Wang
2024-07-04T12:03:31Z

On Thu, Jul 4, 2024 at 7:56 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> > > And if you are asking if the test will run fine without the sleep, it
> > > will run and it will pass, but the timestamps will be same for the link
> > > and the file, so if kernel picks up wrong timestamp we will not find
> > > out.
> > >
> >
> > I'm confused, do you mean if the kernel sets a wrong timestamp it could
> > report TFAIL?
> >
> > From what I can tell, the stat(sym_path,) also retrieves information of
> > the target file,
> > shouldn't that always equal the stat(file_path,) timestamp? As long as
> the
> > stat()
> > works correctly, with sleep(1) or not won't impact anything.
>
> The test tries to assert that stat() follows the symlink and this test
> is a unit test for this assertion. However if we do not spend some
> effort on making the link and target attributes actually diffferent the
> test would pass even if kernel returned the attributes for the symlink
> instead.
>

Oh yes, I see. That wait a moment is quite necessary, thanks!

Reviewed-by: Li Wang <liwang@redhat.com>

--
Regards,
Li Wang