[PATCH v10] tests/fcntl.c: add test for print_f_owner_ex
Dmitry V. Levin
ldv at altlinux.org
Fri Jun 1 12:48:09 UTC 2018
On Thu, May 03, 2018 at 08:18:41PM +0300, Dmitry V. Levin wrote:
> On Thu, May 03, 2018 at 02:18:32PM +0300, Dmitry V. Levin wrote:
> > On Wed, May 02, 2018 at 11:16:57PM +0800, Zhibin Li wrote:
> > > *tests/fcntl.c (test_f_owner_ex_type_pid,
> > > test_f_owner_ex_umove_or_printaddr, test_f_owner_ex): New functions.
> > > (main): Use test_f_owner_ex.
> > > ---
> > > tests/fcntl.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 53 insertions(+)
> > >
> > > diff --git a/tests/fcntl.c b/tests/fcntl.c
> > > index 4f62ca2a..504464e0 100644
> > > --- a/tests/fcntl.c
> > > +++ b/tests/fcntl.c
> > > @@ -69,12 +69,65 @@ test_flock64(void)
> > > #endif
> > > }
> > >
> > > +static long
> > > +test_f_owner_ex_type_pid(const int cmd, const char *const cmd_name,
> > > + const int type, const char *const type_name,
> > > + pid_t pid)
> > > +{
> > > + TAIL_ALLOC_OBJECT_CONST_PTR(struct f_owner_ex, fo);
> >
> > Another issue I found with this test is it assumes that struct f_owner_ex,
> > F_SETOWN_EX, and F_GETOWN_EX are always defined, which is not the case on
> > older systems.
> >
> > I had to add the following guard to make it more portable:
> >
> > /*
> > * F_[GS]ETOWN_EX had conflicting values with F_[SG]ETLK64
> > * in kernel revisions v2.6.32-rc1~96..v2.6.32-rc7~23.
> > */
> > #undef TEST_F_OWNER_EX
> > #if defined F_GETOWN_EX && defined F_SETOWN_EX \
> > && (F_GETOWN_EX != F_SETLK64) && (F_SETOWN_EX != F_GETLK64)
> > # define TEST_F_OWNER_EX
> > #endif
> >
> > #ifdef TEST_F_OWNER_EX
> > ...
> > #endif /* TEST_F_OWNER_EX */
>
> Also, struct f_owner_ex appeared to be not portable enough,
> so I had to add a workaround for that. too.
>
> I've merged this test now, thanks.
It's only yesterday that I found out that this new test is applicable
to tests/fcntl64.c as well, so I renamed tests/struct_flock.c
to tests/fcntl-common.c and moved the code there.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180601/2ba74544/attachment.bin>
More information about the Strace-devel
mailing list