mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
	Miroslav Benes <mbenes@suse.cz>, Petr Mladek <pmladek@suse.com>,
	Joe Lawrence <joe.lawrence@redhat.com>
Cc: 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: [PATCH v2 0/2] selftests/livepatch: fix building and running outside the host kernel
Date: Tue,  3 Nov 2026 09:02:16 -0500	[thread overview]
Message-ID: <20261103140218.17568-1-sashal@kernel.org> (raw)

The livepatch test modules are built against the running host kernel
even when the selftests are built for a kernel in an output directory,
and the scripts skip every test on a machine without a kernel build
tree, even when the modules were built and installed with the
selftests.

Patch 1 is unchanged from v1. It picks KDIR from O or KBUILD_OUTPUT,
stops passing O and KBUILD_OUTPUT on to the module build, and skips the
modules for kernels without CONFIG_LIVEPATCH.

Patch 2 is new. Sashiko pointed out on v1 that has_kdir() skips the
tests on installed targets. That check predates this series, but it is
the run time half of the same problem, so patch 2 checks for the test
modules instead.

Tested on v7.4-rc1 with an x86_64 kernel with CONFIG_LIVEPATCH built in
an output directory. The modules build against it with

  make -C tools/testing/selftests O=... TARGETS=livepatch install

and the installed tree was run in a VM that has no build directory for
that kernel. Without patch 2 every test skips on the missing KDIR. With
it all 8 livepatch tests pass, and they skip cleanly when test_modules/
is missing.

Changes since v1:
- Add patch 2.
- Rebase on v7.4-rc1, no changes to patch 1.

v1: https://lore.kernel.org/all/20261014200154.1365200-1-sashal@kernel.org/

Sasha Levin (2):
  selftests/livepatch: build test modules against the selected kernel
  selftests/livepatch: skip based on the test modules instead of KDIR

 tools/testing/selftests/livepatch/Makefile    | 27 +++++++++++++++++++
 .../testing/selftests/livepatch/functions.sh  | 17 +++++-------
 .../selftests/livepatch/test_modules/Makefile |  6 +++--
 3 files changed, 37 insertions(+), 13 deletions(-)

-- 
2.53.0


             reply	other threads:[~2026-11-03 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 14:02 Sasha Levin [this message]
2026-11-03 14:02 ` [PATCH v2 1/2] selftests/livepatch: build test modules against the selected kernel Sasha Levin
2026-11-03 14:02 ` [PATCH v2 2/2] selftests/livepatch: skip based on the test modules instead of KDIR Sasha Levin

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=20261103140218.17568-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --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=pmladek@suse.com \
    --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®