All of lore.kernel.org
 help / color / mirror / Atom feed
From: Siddharth Menon <simeddon@gmail.com>
To: shuah@kernel.org, jpoimboe@kernel.org, jikos@kernel.org,
	mbenes@suse.cz, pmladek@suse.com
Cc: Siddharth Menon <simeddon@gmail.com>,
	Shuah Khan <skhan@linuxfoundation.org>,
	live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: [PATCH] selftests/livepatch: Check if CONFIG_LIVEPATCH is enabled
Date: Wed,  6 Nov 2024 23:11:20 +0530	[thread overview]
Message-ID: <20241106174120.5602-1-simeddon@gmail.com> (raw)

When CONFIG_LIVEPATCH is disabled, compilation fails due to the
required structs from the livepatch header file being undefined.
This checks for CONFIG_LIVEPATCH in order to verify that
it is enabled before compiling livepatch self-tests.

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>
Signed-off-by: Siddharth Menon <simeddon@gmail.com>
---
 tools/testing/selftests/livepatch/test_modules/Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/livepatch/test_modules/Makefile b/tools/testing/selftests/livepatch/test_modules/Makefile
index e6e638c4bcba..b34b80544709 100644
--- a/tools/testing/selftests/livepatch/test_modules/Makefile
+++ b/tools/testing/selftests/livepatch/test_modules/Makefile
@@ -1,5 +1,6 @@
 TESTMODS_DIR := $(realpath $(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
 KDIR ?= /lib/modules/$(shell uname -r)/build
+CONFIG_LIVEPATCH := $(shell cd $(KDIR) && scripts/config --state CONFIG_LIVEPATCH)
 
 obj-m += test_klp_atomic_replace.o \
 	test_klp_callbacks_busy.o \
@@ -13,10 +14,15 @@ obj-m += test_klp_atomic_replace.o \
 	test_klp_shadow_vars.o \
 	test_klp_syscall.o
 
-# Ensure that KDIR exists, otherwise skip the compilation
+
+# Ensure that KDIR exists and CONFIG_LIVEPATCH is enabled, else skip compilation
 modules:
 ifneq ("$(wildcard $(KDIR))", "")
+ifneq ($(filter y m,$(CONFIG_LIVEPATCH)),)
 	$(Q)$(MAKE) -C $(KDIR) modules KBUILD_EXTMOD=$(TESTMODS_DIR)
+else
+    $(warning CONFIG_LIVEPATCH is not enabled in the kernel config file.)
+endif
 endif
 
 # Ensure that KDIR exists, otherwise skip the clean target
-- 
2.39.5


             reply	other threads:[~2024-11-06 17:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-06 17:41 Siddharth Menon [this message]
2024-11-15 10:13 ` [PATCH] selftests/livepatch: Check if CONFIG_LIVEPATCH is enabled Miroslav Benes
2024-11-15 17:14 ` Petr Mladek
2024-11-17 16:18   ` Sid

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=20241106174120.5602-1-simeddon@gmail.com \
    --to=simeddon@gmail.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.