[Linux-kernel-mentees] [Bug Report] tools/testing/kunit/kunit.py run --build_dir='<foo>' fails on "unclean" trees

Vitor Massaru Iha vitor at massaru.org
Fri May 1 18:01:24 UTC 2020


1. https://bugzilla.kernel.org/show_bug.cgi?id=205219

At first I thought this bug was in KUnit, I changed the KUnit code to
change the ARCH environment variable inside python, as I had tried to
reproduce the bug using another architecture, in my case “arm64”,
instead of “um”, and the way I reproduced the bug, my patch fixed the

After Brendan reviewed my patch and reported that the bug still exists
and explained the step by step to reproduce the bug, I was able to
reproduce the bug even with my patch:

$ make ARCH=um defconfig && make ARCH=um -j8
$ make ARCH=um mrproper
$ make ARCH=um defconfig O=./build_um && make ARCH=um -j8 O=./build_um
  CC      scripts/mod/empty.o
In file included from ../include/linux/types.h:6,
                 from ../include/linux/mod_devicetable.h:12,
                 from ../scripts/mod/devicetable-offsets.c:3:
../include/uapi/linux/types.h:5:10: fatal error: asm/types.h: No such
file or directory
    5 | #include <asm/types.h>
      |          ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [../scripts/Makefile.build:100: scripts/mod/devicetable-
offsets.s] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/iha/sdb/opensource/lkmp/linux-
kselftest.git/Makefile:1140: prepare0] Error 2
make[1]: Leaving directory '/home/iha/sdb/opensource/lkmp/linux-
make: *** [Makefile:180: sub-make] Error 2
The cause of the error was because arch/$(SUBARCH)/include/generated
files weren't properly cleaned by `make ARCH=um mrproper`.
Then, analyzing the Makefile, and reproducing the bug, I noticed that a
directory was not cleaned by mrproper. I had a hunch that this bug
didn't exist before and I commented to Brendan about running git
bisect. And in fact the bug was introduced in the kernel, as verified
through git bisect. And through the commit I saw where I should fix the

In the process, I realized that I could have more quickly identified
files not deleted by mrproper just using git clean -idx.

The first solution was to remove the directory not cleaned by mrproper
in the main Makefile. But Masahiro Yamada, in the code review noted
that the problem should be fixed only in architecture “um”, it should
be solved within the Makefile of “um” and suggested another solution
using MRPROPER_DIRS += arch/$(SUBARCH)/include/generated in the
Makefile of “um”.

And with that my patch was accepted:


More information about the Linux-kernel-mentees mailing list