Re: [PATCH v2 4/4] fstests: add generic test for file handles

Eryu Guan
2017-04-20T07:21:54Z

On Thu, Apr 20, 2017 at 09:34:48AM +0300, Amir Goldstein wrote:
..
> >> +# Check non-stale handles to linked files
> >> +rm -f $testdir/*
> >> +src/open_by_handle -c $testdir $numfiles
> >> +src/open_by_handle $testdir $numfiles
> >> +
> >> +# Check non-stale handles to files that were hardlinked and original deleted
> >> +src/open_by_handle -l $testdir $numfiles
> >> +src/open_by_handle -u $testdir $numfiles
> >
> > This last test still depends on test files created in the second test
> > implicitly. Forgot to update this part?
>
> Intentional.
> It's the intended usage to create a test set with -c
> (imagine this is going to done on lower layer)
> then link the test set with -l (imagine this on either lower or overlay)
> then unlink the test set with -u (imagine this on overlay).

Yeah, that makes more sense in an overlay-specific test & operating on
multiple layers. But I don't see the point in this generic test by doing
so, as all these operations are clearly done on the same layer. So I
think adding "rm -f" and "-c" run in this test won't change test
behavior, but could avoid the implicit dependency.

Anyway, at least this is worth some comments on the implicit dependency.

>
> So as a rule of thumb, rm -f is only added as extra safety
> before a src/open_by_handle -c line
>
> >
> > # Check non-stale handles to files that were hardlinked and original deleted
> > rm -f $testdir/*
> > src/open_by_handle -c $testdir $numfiles
> > src/open_by_handle -l $testdir $numfiles
> > src/open_by_handle -u $testdir $numfiles
> >
> >> +
> >> +echo "Silence is golden"
> >> +status=$?
> >
> > $? is always 0 after echo. And any test failure could break golden
> > image, I think status can be set to 0 unconditionally.
> >
>
> Indeed. a combination of copy&paste from xfs/238 and me moving
> Silence is golden to end. Let me know if you want me to re-post for this

I can fix this status issue, but seems you need to re-post anyway to add
more comments or empty $testdir before each test :)

Thanks,
Eryu