[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66deaafe1974c989e949975bafe3ab0b2ae3f5ff.camel@sipsolutions.net>
Date: Thu, 26 Jun 2025 20:11:17 +0200
From: Benjamin Berg <benjamin@...solutions.net>
To: Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
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>, Nicolas Schier
<nicolas.schier@...ux.dev>
Cc: 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, workflows@...r.kernel.org, Kees Cook
<kees@...nel.org>, Alexander Viro <viro@...iv.linux.org.uk>, Christian
Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH v4 12/15] kunit: Introduce UAPI testing framework
Hi Thomas,
I ran into two minor issues trying out the patches, see inline.
On Thu, 2025-06-26 at 08:10 +0200, Thomas Weißschuh wrote:
> Enable running UAPI tests as part of kunit.
> The selftests are embedded into the kernel image and their output is
> forwarded to kunit for unified reporting.
>
> The implementation reuses parts of usermode drivers and usermode
> helpers. However these frameworks are not used directly as they make it
> impossible to retrieve a thread's exit code.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
>
> [SNIP]
> +/**
> + * KUNIT_UAPI_EMBED_BLOB() - Embed another build artifact into the kernel
> + * @_name: The name of symbol under which the artifact is embedded.
> + * @_path: Path to the artifact on disk.
> + *
> + * Embeds a build artifact like a userspace executable into the kernel or current module.
> + * The build artifact is read from disk and needs to be already built.
> + */
> +#define KUNIT_UAPI_EMBED_BLOB(_name, _path) \
> + asm ( \
> + " .pushsection .rodata, \"a\" \n" \
> + " .global " __stringify(CONCATENATE(_name, _data)) " \n" \
> + __stringify(CONCATENATE(_name, _data)) ": \n" \
> + " .incbin " __stringify(_path) " \n" \
> + " .size " __stringify(CONCATENATE(_name, _data)) ", " \
> + ". - " __stringify(CONCATENATE(_name, _data)) " \n" \
> + " .global " __stringify(CONCATENATE(_name, _end)) " \n" \
> + __stringify(CONCATENATE(_name, _end)) ": \n" \
> + " .popsection \n" \
> + ); \
> + \
> + extern const char CONCATENATE(_name, _data)[]; \
> + extern const char CONCATENATE(_name, _end)[]; \
> + \
> + static const struct kunit_uapi_blob _name = { \
> + .path = _path, \
> + .data = CONCATENATE(_name, _data), \
> + .end = CONCATENATE(_name, _end), \
> + } \
For me, the compiler could not find the files for the ".incbin" unless
I added an include path. i.e. adding
ccflags-y := -I$(obj)
to lib/kunit/Makefile fixed the problem for me.
> [SNIP]
> +static int kunit_uapi_run_executable_in_mount(struct kunit *test, const char *executable,
> + struct vfsmount *mnt)
> +{
> + struct kunit_uapi_user_mode_thread_ctx ctx = {
> + .setup_done = COMPLETION_INITIALIZER_ONSTACK(ctx.setup_done),
> + .executable = executable,
> + .pwd = {
> + .mnt = mnt,
> + .dentry = mnt->mnt_root,
> + },
> + };
> + int forward_err, wait_err, ret;
ret needs to be initialized to zero here as the kernel_wait function
will only set "ret" if wo.wo_stat is non-zero.
Benjamin
> [SNIP]
Powered by blists - more mailing lists