Re: Running kunit_tool on unclean trees

From: David Gow
Date: Mon Apr 26 2021 - 17:31:41 EST


On Mon, Apr 26, 2021 at 3:06 PM Masahiro Yamada <masahiroy@xxxxxxxxxx> wrote:
>
> On Sun, Apr 25, 2021 at 4:05 AM Marcelo Schmitt
> <marcelo.schmitt1@xxxxxxxxx> wrote:
> >
> > Hi, a friend and I were chasing bug 205219 [1] listed in Bugzilla.
> > We step into something a little bit different when trying to reproduce
> > the buggy behavior. In our try, compilation failed with a message form
> > make asking us to clean the source tree. We couldn't run kunit_tool
> > after compiling the kernel for x86, as described by Ted in the
> > discussion pointed out by the bug report.
> >
> > Steps to reproduce:
> >
> > 0) Run kunit_tool
> > $ ./tools/testing/kunit/kunit.py run
> > Works fine with a clean tree.
> >
> > 1) Compile the kernel for some architecture (we did it for x86_64).
> >
> > 2) Run kunit_tool again
> > $ ./tools/testing/kunit/kunit.py run
> > Fails with a message form make asking us to clean the source tree.
>
> This is probably because
> tools/testing/kunit/kunit_kernel.py
> runs make with O= option.
>
>
>

Yes: KUnit's tooling has started setting O=.kunit by default[1]. If
you'd rather build KUnit in-tree, you can use the "kunit.py run
--build_dir=." option, which should work.

-- David

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/tools/testing/kunit?id=ddbd60c779b4ddaa87173a160ce90146933fb8f9