[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526164038-12259c68-586f-4a24-a814-8ffed5778742@linutronix.de>
Date: Mon, 26 May 2025 16:50:19 +0200
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Nicolas Schier <nicolas.schier@...ux.dev>
Cc: Masahiro Yamada <masahiroy@...nel.org>,
Nathan Chancellor <nathan@...nel.org>, Andrew Morton <akpm@...ux-foundation.org>,
Willy Tarreau <w@....eu>, Thomas Weißschuh <linux@...ssschuh.net>,
Brendan Higgins <brendan.higgins@...ux.dev>, David Gow <davidgow@...gle.com>, Rae Moar <rmoar@...gle.com>,
Shuah Khan <shuah@...nel.org>, Jonathan Corbet <corbet@....net>,
Christophe Leroy <christophe.leroy@...roup.eu>, linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com, linux-doc@...r.kernel.org
Subject: Re: [PATCH v2 09/11] kunit: uapi: Add example for UAPI tests
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@...utronix.de>
> > ---
> > 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.
>
> ifeq ($(CONFIG_DEBUG_KOBJECT),y)
> CFLAGS_kobject.o += -DDEBUG
>
>
>
> plus the 'clean-files' addition below.
<snip>
> > diff --git a/lib/kunit/Makefile b/lib/kunit/Makefile
> > index 989933dab9ad2267f376db470b876ce2a88711b4..1b6be12676f89cafa34f0093d8136b36f4cf5532 100644
> > --- a/lib/kunit/Makefile
> > +++ b/lib/kunit/Makefile
> > @@ -30,4 +30,11 @@ obj-$(CONFIG_KUNIT_TEST) += string-stream-test.o
> > obj-$(CONFIG_KUNIT_TEST) += assert_test.o
> > endif
> >
> > -obj-$(CONFIG_KUNIT_EXAMPLE_TEST) += kunit-example-test.o
> > +userprogs += kunit-example-uapi
>
> clean-files += kunit-example-uapi
This shouldn't be necessary as $(userprogs) is automatically added to
__clean-files in scripts/Makefile.clean.
> > +kunit-example-uapi-userccflags := -static
> > +kunit-example-uapi-nolibc := $(CONFIG_ARCH_HAS_NOLIBC)
> > +blobs += kunit-example-uapi.blob.o
> > +
> > +obj-$(CONFIG_KUNIT_EXAMPLE_TEST) += kunit-example-mod.o
> > +kunit-example-mod-y += kunit-example-test.o
> > +kunit-example-mod-$(CONFIG_KUNIT_UAPI) += kunit-example-uapi.blob.o
>
> --
> Nicolas Schier
Powered by blists - more mailing lists