From: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
To: Benjamin Berg <benjamin@sipsolutions.net>
Cc: "Masahiro Yamada" <masahiroy@kernel.org>,
"Nathan Chancellor" <nathan@kernel.org>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Willy Tarreau" <w@1wt.eu>,
"Thomas Weißschuh" <linux@weissschuh.net>,
"Brendan Higgins" <brendan.higgins@linux.dev>,
"David Gow" <davidgow@google.com>, "Rae Moar" <rmoar@google.com>,
"Shuah Khan" <shuah@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Nicolas Schier" <nicolas.schier@linux.dev>,
"Christophe Leroy" <christophe.leroy@csgroup.eu>,
linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
linux-doc@vger.kernel.org, workflows@vger.kernel.org,
"Kees Cook" <kees@kernel.org>,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
"Christian Brauner" <brauner@kernel.org>,
"Jan Kara" <jack@suse.cz>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v4 12/15] kunit: Introduce UAPI testing framework
Date: Fri, 27 Jun 2025 06:20:05 +0200 [thread overview]
Message-ID: <20250627060129-4fe09191-4714-4856-9de5-c8e5cf5ed0d6@linutronix.de> (raw)
In-Reply-To: <66deaafe1974c989e949975bafe3ab0b2ae3f5ff.camel@sipsolutions.net>
Hi Benjamin,
On Thu, Jun 26, 2025 at 08:11:17PM +0200, Benjamin Berg wrote:
> I ran into two minor issues trying out the patches, see inline.
Thanks for testing the series.
> 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@linutronix.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.
Can you share some more details on your build setup?
This worked for me as-is and also passed 0day build testing.
> > [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.
Ack.
> > [SNIP]
Thomas
next prev parent reply other threads:[~2025-06-27 4:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-26 6:10 [PATCH v4 00/15] kunit: Introduce UAPI testing framework Thomas Weißschuh
2025-06-26 6:10 ` [PATCH v4 06/15] fs,fork,exit: export symbols necessary for KUnit UAPI support Thomas Weißschuh
2025-07-11 10:35 ` Thomas Weißschuh
2025-07-11 15:44 ` Al Viro
2025-07-14 5:52 ` Thomas Weißschuh
2025-07-14 8:12 ` Christian Brauner
2025-07-16 5:30 ` Thomas Weißschuh
2025-07-16 6:21 ` Christoph Hellwig
2025-07-16 8:39 ` Thomas Weißschuh
2025-07-16 11:11 ` Christoph Hellwig
2025-07-16 11:33 ` Thomas Weißschuh
2025-07-16 11:36 ` Christoph Hellwig
2025-07-16 12:47 ` Thomas Weißschuh
2025-07-16 12:57 ` Christoph Hellwig
2025-06-26 6:10 ` [PATCH v4 12/15] kunit: Introduce UAPI testing framework Thomas Weißschuh
2025-06-26 18:11 ` Benjamin Berg
2025-06-27 4:20 ` Thomas Weißschuh [this message]
2025-06-27 6:58 ` Benjamin Berg
2025-06-27 8:27 ` Thomas Weißschuh
2025-07-07 18:18 ` [PATCH v4 00/15] " Jonathan Corbet
2025-07-08 5:51 ` Thomas Weißschuh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250627060129-4fe09191-4714-4856-9de5-c8e5cf5ed0d6@linutronix.de \
--to=thomas.weissschuh@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=benjamin@sipsolutions.net \
--cc=brauner@kernel.org \
--cc=brendan.higgins@linux.dev \
--cc=christophe.leroy@csgroup.eu \
--cc=corbet@lwn.net \
--cc=davidgow@google.com \
--cc=jack@suse.cz \
--cc=kees@kernel.org \
--cc=kunit-dev@googlegroups.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@weissschuh.net \
--cc=masahiroy@kernel.org \
--cc=nathan@kernel.org \
--cc=nicolas.schier@linux.dev \
--cc=rmoar@google.com \
--cc=shuah@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=w@1wt.eu \
--cc=workflows@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).