Skip to contentSkip to conversation

selftests/kexec: fix test_kexec_jump build

PATCH In review Moon Hee Lee 3 participants 4 messages Jul 2, 2025 – Jul 8, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 selftests/kexec: fix test_kexec_jump build

The test_kexec_jump program builds correctly when invoked from the top-level selftests/Makefile, which explicitly sets the OUTPUT variable. However, building directly in tools/testing/selftests/kexec fails with:

make: *** No rule to make target '/test_kexec_jump', needed by 'test_kexec_jump.sh'. Stop.

This failure occurs because the Makefile rule relies on $(OUTPUT), which is undefined in direct builds.

Fix this by listing test_kexec_jump in TEST_GEN_PROGS, the standard way to declare generated test binaries in the kselftest framework. This ensures the binary is built regardless of invocation context and properly removed by make clean.

---
Changes in v2:
- Dropped the .gitignore addition, as it is already handled in [1]

[1] https://lore.kernel.org/r/[email protected]

 tools/testing/selftests/kexec/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kexec/Makefile +1 -1
index e3000ccb9a5d..874cfdd3b75b 100644
@@ -12,7 +12,7 @@ include ../../../scripts/Makefile.arch
 
 ifeq ($(IS_64_BIT)$(ARCH_PROCESSED),1x86)
 TEST_PROGS += test_kexec_jump.sh
-test_kexec_jump.sh: $(OUTPUT)/test_kexec_jump
+TEST_GEN_PROGS := test_kexec_jump
 endif
 
 include ../lib.mk
Signature · 1 line
2.43.0
Acked-by on v2 1/1
#2 lore raw
In reply to Moon Hee Lee
Quoted 5 lines · Moon Hee Lee

The test_kexec_jump program builds correctly when invoked from the top-level selftests/Makefile, which explicitly sets the OUTPUT variable. However, building directly in tools/testing/selftests/kexec fails with:

make: *** No rule to make target '/test_kexec_jump', needed by 'test_kexec_jump.sh'. Stop.

I can reproduce this, and this patch fixes it. Thanks.

Quoted 38 lines

This failure occurs because the Makefile rule relies on $(OUTPUT), which is undefined in direct builds.

Fix this by listing test_kexec_jump in TEST_GEN_PROGS, the standard way to declare generated test binaries in the kselftest framework. This ensures the binary is built regardless of invocation context and properly removed by make clean.

---
Changes in v2:
- Dropped the .gitignore addition, as it is already handled in [1]

[1] https://lore.kernel.org/r/[email protected]

 tools/testing/selftests/kexec/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/kexec/Makefile +1 -1
index e3000ccb9a5d..874cfdd3b75b 100644
@@ -12,7 +12,7 @@ include ../../../scripts/Makefile.arch
 
 ifeq ($(IS_64_BIT)$(ARCH_PROCESSED),1x86)
 TEST_PROGS += test_kexec_jump.sh
-test_kexec_jump.sh: $(OUTPUT)/test_kexec_jump
+TEST_GEN_PROGS := test_kexec_jump
 endif
 
 include ../lib.mk
Signature · 1 line
2.43.0
#3 lore raw
Quoted 7 lines · Baoquan He
Quoted 6 lines · Moon Hee Lee

The test_kexec_jump program builds correctly when invoked from the top-level
selftests/Makefile, which explicitly sets the OUTPUT variable. However,
building directly in tools/testing/selftests/kexec fails with:

Quoted 6 lines
Quoted 2 lines

  make: *** No rule to make target '/test_kexec_jump', needed by 'test_kexec_jump.sh'.  Stop.

I can reproduce this, and this patch fixes it. Thanks.

Thanks.

Amazon Development Centre (London) Ltd. Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.