Running KUnit using the wrapper script

David Gow davidgow at google.com
Wed Mar 22 18:31:10 PDT 2023


On Thu, 23 Mar 2023 at 09:08, Mark Brown <broonie at kernel.org> wrote:
>
> I've been trying to do some stuff with KUnit but I can't seem to
> find a current tree where KUnit builds.  Running on Debian stable
> starting from a clean -next tree and running:
>
>    ./tools/testing/kunit/kunit.py config
>    ./tools/testing/kunit/kunit.py build
>
> based on Documentation/dev-tools/kunit/start.rst.  However I get:
>
> [00:42:59] Configuring KUnit Kernel ...
> [00:42:59] Building KUnit Kernel ...
> Populating config with:
> $ make ARCH=um O=.kunit olddefconfig
> Building with:
> $ make ARCH=um O=.kunit --jobs=8
> ERROR:root:In file included from /usr/include/stdlib.h:1013,
>                  from ../arch/x86/um/os-Linux/registers.c:8:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
>    26 | {
>       | ^
> make[4]: *** [../scripts/Makefile.build:252: arch/x86/um/os-Linux/registers.o] Error 1
> make[3]: *** [../scripts/Makefile.build:494: arch/x86/um/os-Linux] Error 2
> make[3]: *** Waiting for unfinished jobs....
> In file included from /usr/include/stdlib.h:1013,
>                  from ../arch/um/drivers/fd.c:7:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
>    26 | {
>       | ^
> make[3]: *** [../scripts/Makefile.build:252: arch/um/drivers/fd.o] Error 1
> make[3]: *** Waiting for unfinished jobs....
> In file included from /usr/include/stdlib.h:1013,
>                  from ../arch/um/os-Linux/skas/process.c:7:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
>    26 | {
>       | ^
> make[4]: *** [../scripts/Makefile.build:252: arch/um/os-Linux/skas/process.o] Error 1
> make[3]: *** [../scripts/Makefile.build:494: arch/um/os-Linux/skas] Error 2
> make[2]: *** [../scripts/Makefile.build:494: arch/um/os-Linux] Error 2
> make[2]: *** Waiting for unfinished jobs....
> make[2]: *** [../scripts/Makefile.build:494: arch/x86/um] Error 2
> make[2]: *** [../scripts/Makefile.build:494: arch/um/drivers] Error 2
> In file included from /usr/include/stdlib.h:1013,
>                  from arch/um/kernel/config.c:7:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h: In function ‘atof’:
> /usr/include/x86_64-linux-gnu/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
>    26 | {
>       | ^
> make[3]: *** [../scripts/Makefile.build:252: arch/um/kernel/config.o] Error 1
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [../scripts/Makefile.build:494: arch/um/kernel] Error 2
> make[1]: *** [/home/broonie/git/bisect/Makefile:2028: .] Error 2
> make: *** [Makefile:226: __sub-make] Error 2
>
> [00:43:20] Elapsed time: 20.233s

Hi Mark,

This one is my fault, I'm afraid. We're triggering a bug in older gcc
versions (<11) at the moment.

Patch to work around it is here, or it should be fine with gcc >= 11 or clang:
https://lore.kernel.org/linux-um/20230318041555.4192172-1-davidgow@google.com/

(The gcc bug is described here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99652 )

>
> which isn't ideal.  v6.2 is also broken, albeit differently:
>
> ERROR:root:`.exit.text' referenced in section `.uml.exitcall.exit' of arch/um/drivers/virtio_uml.o: defined in discarded section `.exit.text' of arch/um/drivers/virtio_uml.o
> collect2: error: ld returned 1 exit status
> make[2]: *** [../scripts/Makefile.vmlinux:35: vmlinux] Error 1
> make[1]: *** [/home/broonie/git/linux/Makefile:1264: vmlinux] Error 2
> make: *** [Makefile:242: __sub-make] Error 2
>

Hmm... I haven't seen this one here: v6.2 builds and runs fine with
gcc 10, 11, and clang 14.

Looks like maybe it's an issue with older binutils. Maybe this patch
will fix it:
https://lore.kernel.org/all/20230207164156.537378-1-masahiroy@kernel.org/

> which makes bisecting a bit of an issue.  The kunit-fixes, kunit
> and kunit-next trees in -next have the former error.  Can anyone
> point me at a tree/config/commands that's suitable for working on
> KUnit at the minute?

The most convenient workarounds (other than having newer gcc /
binutils) are probably to either run against a different architecture
(e.g. --arch x86_64) or to build with clang (--make_options LLVM=1).
Those should be a bit more stable for bisections than UML on the older
gcc versions.

Sorry for the mess!
-- David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4003 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.infradead.org/pipermail/linux-um/attachments/20230323/e6d63dd2/attachment.p7s>


More information about the linux-um mailing list