Re: [PATCH v3 3/3] selftests: pidfd: add tests for PIDFD_SELF_*

Lorenzo Stoakes
2024-10-17T07:54:58Z

On Wed, Oct 16, 2024 at 07:14:34PM -0700, John Hubbard wrote:
> On 10/16/24 3:06 PM, Lorenzo Stoakes wrote:
> > On Wed, Oct 16, 2024 at 02:00:27PM -0600, Shuah Khan wrote:
> > > On 10/16/24 04:20, Lorenzo Stoakes wrote:
> ...
> > > > diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h
> > > > index 88d6830ee004..1640b711889b 100644
> > > > --- a/tools/testing/selftests/pidfd/pidfd.h
> > > > +++ b/tools/testing/selftests/pidfd/pidfd.h
> > > > @@ -50,6 +50,14 @@
> > > > #define PIDFD_NONBLOCK O_NONBLOCK
> > > > #endif
> > > > +/* System header file may not have this available. */
> > > > +#ifndef PIDFD_SELF_THREAD
> > > > +#define PIDFD_SELF_THREAD -100
> > > > +#endif
> > > > +#ifndef PIDFD_SELF_THREAD_GROUP
> > > > +#define PIDFD_SELF_THREAD_GROUP -200
> > > > +#endif
> > > > +
> > >
> > > As mentioned in my response to v1 patch:
> > >
> > > kselftest has dependency on "make headers" and tests include
> > > headers from linux/ directory
> >
> > Right but that assumes you install the kernel headers on the build system,
> > which is quite a painful thing to have to do when you are quickly iterating
> > on a qemu setup.
> >
> > This is a use case I use all the time so not at all theoretical.
> >
>
> This is turning out to be a fairly typical reaction from kernel
> developers, when presented with the "you must first run make headers"
> requirement for kselftests.

It's a typical response for good reason... :)

>
> Peter Zijlstra's "NAK NAK NAK" response [1] last year was the most
> colorful, so I'll helpfully cite it here. :)
>
> But seriously...user feedback is rare and valuable. We have some, to the
> effect of, "lose that requirement". And we also have an agreement, and
> an initial implementation in selftests/mm, on *how* to avoid it [2].
>
> So...let's do it that way? Please?

I'd be happy to but we can't because the uapi header is just broken with
this test due to the linux/fcntl.h vs. system header fcntl.h issue.

We could work around it by copying the header without the linux/fcntl.h
include however...

>
>
> [1] https://lore.kernel.org/lkml/20231103121652.GA6217@noisy.programming.kicks-ass.net/
> [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e076eaca5906
>
> thanks,
> --
> John Hubbard
>