bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: shuah <shuah@kernel.org>
To: Yauheni Kaliuta <yauheni.kaliuta@redhat.com>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-kselftest@vger.kernel.org, bpf@vger.kernel.org,
	shuah <shuah@kernel.org>
Subject: Re: kselftest OOT run_tests
Date: Wed, 27 May 2020 12:22:37 -0600	[thread overview]
Message-ID: <07bb723f-8174-5373-6715-65b61942080c@kernel.org> (raw)
In-Reply-To: <xunytv01omwj.fsf@redhat.com>

On 5/27/20 1:30 AM, Yauheni Kaliuta wrote:
> Hi, shuah!
>>>>>> On Tue, 26 May 2020 11:13:29 -0600, shuah   wrote:
>   > On 5/25/20 7:55 AM, Yauheni Kaliuta wrote:
>   >> Hi!
>   >>
>   >> I'm wondering how out of tree check is supposed to work for make
>   >> O=dir run_tests from selftests (or make -C ...) directory?
>   >>
>   >> (both with 051f278e9d81 ("kbuild: replace KBUILD_SRCTREE with
>   >> boolean building_out_of_srctree") and without)
>   >>
>   >> make M= ... does not work with run_tests.
>   >>
>   > Kselftests run_tests target isn't intended for building and
>   > running tests OOT.
> But there is code there trying to handle it. All that OUTPUT
> related things must be removed if it's broken, right? Can I post
> a patch?
>   > Also make M= doesn't make sense for them.
> Well, M=... at least includes all the makefiles.
>   > There is no support to build OOT at the moment. I would like
>   > to get a better understanding of your use-case. Can you
>   > elaborate?
> I care about make install actually. But fixing it I had to deal
> with OUTPUT. Looking a proper for that I found that it's a bit
> broken.

kselftest supports install of all all tests and a sub-set of tests
both native and cross-builds.

Simple case:
If you want to build all tests and install to $HOME/install/
This has a dependency on kernel being built in the source repo
you are running the following install command from:

In Kernel source root dir run:
make kselftest-install O=$HOME/install

You will find installed tests with run script to run them all
under $HOME/install/kselftest/kselftest_install/

If you run run_kselftest.sh under kselftest_install, it will run
all the tests.

You can use TARGETS var to build a sub-set of tests.

In Kernel source root dir run:
make kselftest-install TARGETS=bpf O=$HOME/install

Native or cross-build case when you are doing relocatable

arm64 cross-build:
# first do a relocatable kernel build in $HOME/arm64_build
make O=$HOME/arm64_build/ ARCH=arm64 HOSTCC=gcc \
             CROSS_COMPILE=aarch64-linux-gnu- defconfig

make O=$HOME/arm64_build/ ARCH=arm64 HOSTCC=gcc \
             CROSS_COMPILE=aarch64-linux-gnu- all

# install selftests (all)
make kselftest-install O=$HOME/arm64_build ARCH=arm64 \
             HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu-

# install selftests (just bpf)
make kselftest-install TARGETS=bpf O=$HOME/arm64_build ARCH=arm64 \
             HOSTCC=gcc CROSS_COMPILE=aarch64-linux-gnu-

You will find kselftest installed under


You can use the same procedure for native builds as well
assuming your native env. is x86_64

# first do a relocatable kernel build in $HOME/x86_64_build

make kselftest-install TARGETS=bpf O=$HOME/x86_64_build

You will find kselftest installed under


It is on todo to update the documentation. :(

-- Shuah

  reply	other threads:[~2020-05-27 18:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25 13:55 Yauheni Kaliuta
2020-05-26 17:13 ` shuah
2020-05-26 20:40   ` Joe Lawrence
2020-05-27  7:34     ` Yauheni Kaliuta
2020-05-27  7:30   ` Yauheni Kaliuta
2020-05-27 18:22     ` shuah [this message]
2020-05-27 18:40       ` Yauheni Kaliuta
2020-05-27 21:46         ` shuah

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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=07bb723f-8174-5373-6715-65b61942080c@kernel.org \
    --to=shuah@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=yamada.masahiro@socionext.com \
    --cc=yauheni.kaliuta@redhat.com \
    --subject='Re: kselftest OOT run_tests' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).