Re: [PATCH v2 09/11] kunit: uapi: Add example for UAPI tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 27, 2025 at 03:56:17PM +0200, Nicolas Schier wrote:
> On Mon, May 26, 2025 at 04:50:19PM +0200, Thomas Weißschuh wrote:
> > On Mon, May 26, 2025 at 04:22:02PM +0200, Nicolas Schier wrote:
> > > On Mon, Apr 07, 2025 at 09:42:46AM +0200, Thomas Weißschuh wrote:
> > > > Extend the example to show how to run a userspace executable.
> > > > 
> > > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> > > > ---
> > > >  lib/kunit/.kunitconfig         |  2 ++
> > > >  lib/kunit/Makefile             |  9 ++++++++-
> > > >  lib/kunit/kunit-example-test.c | 15 +++++++++++++++
> > > >  lib/kunit/kunit-example-uapi.c | 22 ++++++++++++++++++++++
> > > >  4 files changed, 47 insertions(+), 1 deletion(-)
> > > 
> > > 
> > > Adding this diff allows 'make clean' to clean up the UAPI test binary:
> > > 
> > > 
> > > diff --git a/lib/Makefile b/lib/Makefile
> > > --- a/lib/Makefile
> > > +++ b/lib/Makefile
> > > @@ -112,8 +112,6 @@ CFLAGS_REMOVE_test_fpu_impl.o += $(CC_FLAGS_NO_FPU)
> > >  # Some KUnit files (hooks.o) need to be built-in even when KUnit is a module,
> > >  # so we can't just use obj-$(CONFIG_KUNIT).
> > > -ifdef CONFIG_KUNIT
> > > -obj-y += kunit/
> > > -endif
> > > +obj-$(if $(CONFIG_KUNIT),y) += kunit/
> > 
> > Wouldn't the following be sufficient?
> > 
> > obj-y += kunit/
> > 
> > The the kunit Makefile doesn't do anything if CONFIG_KUNIT=y and AFAIK for
> > directories obj-m and obj-y should do the same.
> 
> that's wrong.  In lib/kunit/Makefile there is
> 
>     obj-y += hooks.o
> 
> thus, lib/kunit/hooks.o would then be built unconditionally (even w/o 
> CONFIG_KUNIT).

Indeed, thanks for the hint.

> Iff we would add 'obj-y += kunit/' in lib/Makefile we'd have to adjust the 
> hooks.o line in lib/kunit/Makefile appropriately.

I'll go with the 'obj-y += kunit/' solution for now.
It keeps the special logic for hook.o in a single place, gets rid of a
duplicate comment and is easier to understand.

<snip>




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux