Re: [PATCH v11 2/2] selftests: add tests for clone3() with *set_tid
From: Christian Brauner
Date: Fri Nov 15 2019 - 17:53:55 EST
On Fri, Nov 15, 2019 at 02:20:18PM -0800, Andrei Vagin wrote:
> On Fri, Nov 15, 2019 at 01:36:21PM +0100, Adrian Reber wrote:
> > This tests clone3() with *set_tid to see if all desired PIDs are working
> > as expected. The tests are trying multiple invalid input parameters as
> > well as creating processes while specifying a certain PID in multiple
> > PID namespaces at the same time.
> >
> > Additionally this moves common clone3() test code into clone3_selftests.h.
> >
> > Signed-off-by: Adrian Reber <areber@xxxxxxxxxx>
> > ---
> > v9:
> > - applied all changes from Christian's review (except using the
> > NSpid: parsing code from selftests/pidfd/pidfd_fdinfo_test.c)
> >
> > v10:
> > - added even more '\n' and include file fixes (Christian)
> >
> > v11:
> > - added more return code checking at multiple places (Andrei)
> > - also add set_tid/set_tid_size to internal struct (Andrei)
>
> I think we can add a test case to trigger the issue what I found in the
> previous version of the kernel patch. You can find my version of this
> test case in the attached patch.
>
> nit: we need to flush stdout and stderr buffers before calling the raw
> clone3 syscall and _exit(). Otherwise, some log messages can be lost and
> some of them can be printed twice.
>
> To trigger this issue, you can run the test and redirect its output to
> file or pipe:
>
> $ ./clone3_set_tid | cat
>
> I have attached the patch to address both these problems. It is a draft
> version and may require some work.
>
> Adrian and Christian, it is up to you to decide whether we want to
> update the current patch or to fix this on top by a separate patch.
If you give me a proper commit with a commit message I'll put it on top
as another patch. :)
Christian