mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Sasha Levin <sashal@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>,
	Joe Lawrence <joe.lawrence@redhat.com>,
	Song Liu <song@kernel.org>,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	Eva Kurchatova <eva.kurchatova@virtuozzo.com>,
	Yafang Shao <laoar.shao@gmail.com>, Shuah Khan <shuah@kernel.org>,
	live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] selftests/livepatch: skip based on the test modules instead of KDIR
Date: Tue, 10 Nov 2026 11:50:12 +0100	[thread overview]
Message-ID: <avL25NFPU_pJ2tXJ@pathway.suse.cz> (raw)
In-Reply-To: <20261103222706.1642224-3-sashal@kernel.org>

On Tue 2026-11-03 17:27:06, Sasha Levin wrote:
> setup_config() skips every test when there is no kernel build directory
> at $KDIR or /lib/modules/$(uname -r)/build. The test modules are built
> together with the selftests and the scripts load them from
> test_modules/, so nothing needs a build directory at run time. A
> machine running an installed kselftest tree usually has none, and the
> tests are skipped there although the modules were built and installed.
> 
> Check for the modules that __load_mod() loads instead, and remove
> has_kdir(), which has no other users.

This is another a bit cryptic LLM generated commit message.
IMHO, it will be much more strightforard to say that this patch
allows to run livepatch selftests with pre-built test modules
without a need to install kernel devel files.

> Fixes: 54ee3526796f ("selftests: livepatch: Avoid running the tests if kernel-devel is missing")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  tools/testing/selftests/livepatch/functions.sh | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/tools/testing/selftests/livepatch/functions.sh b/tools/testing/selftests/livepatch/functions.sh
> index 8b26b70f92d8c..14fc9cade4de3 100644
> --- a/tools/testing/selftests/livepatch/functions.sh
> +++ b/tools/testing/selftests/livepatch/functions.sh
> @@ -44,16 +44,10 @@ function is_root() {
>  	fi
>  }
>  
> -# Check if we can compile the modules before loading them
> -function has_kdir() {
> -	if [ -z "$KDIR" ]; then
> -		KDIR="/lib/modules/$(uname -r)/build"
> -	fi
> -
> -	if [ ! -d "$KDIR" ]; then
> -		echo "skip all tests: KDIR ($KDIR) not available to compile modules."
> -		exit $ksft_skip
> -	fi
> +# Check that the test modules were built before loading them
> +function has_test_modules() {
> +	compgen -G "test_modules/*.ko" > /dev/null ||
> +		skip "test modules are not available"

I would prefer to keep also the original tests as a fallback
and report:

		echo "skip all tests: test modules are not available and KDIR ($KDIR) is not available to compile them."

Best Regards,
Petr

      reply	other threads:[~2026-11-10 10:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 22:27 [PATCH v3 0/2] selftests/livepatch: fix building and running outside the host kernel Sasha Levin
2026-11-03 22:27 ` [PATCH v3 1/2] selftests/livepatch: build test modules against the selected kernel Sasha Levin
2026-11-10 10:37   ` Petr Mladek
2026-11-03 22:27 ` [PATCH v3 2/2] selftests/livepatch: skip based on the test modules instead of KDIR Sasha Levin
2026-11-10 10:50   ` Petr Mladek [this message]

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=avL25NFPU_pJ2tXJ@pathway.suse.cz \
    --to=pmladek@suse.com \
    --cc=eva.kurchatova@virtuozzo.com \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mpdesouza@suse.com \
    --cc=sashal@kernel.org \
    --cc=shuah@kernel.org \
    --cc=song@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

all inboxes | Powered by JetHome®