Skip to contentSkip to conversation

selftests/kexec: fix test_kexec_jump build and ignore generated binary

PATCH In review Moon Hee Lee 2 participants 3 messages Jun 24, 2025 – Jul 2, 2025

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

PATCH 1/1 selftests/kexec: fix test_kexec_jump build and ignore generated binary

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.

Also add the binary to .gitignore to avoid tracking it in version control.

---
 tools/testing/selftests/kexec/.gitignore | 2 ++
 tools/testing/selftests/kexec/Makefile   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/kexec/.gitignore
tools/testing/selftests/kexec/.gitignore new file +2 -0
new file mode 100644
index 000000000000..5f3d9e089ae8
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+test_kexec_jump
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
maintainer Acked-by on v1 1/1
#1 lore raw
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:

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

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

The change looks good to me.

Quoted 2 lines

Also add the binary to .gitignore to avoid tracking it in version control.

There is another patch that adds the executable to .gitignore
https://lore.kernel.org/r/[email protected]

I think you are missing [email protected] - added it

Quoted 21 lines
---
  tools/testing/selftests/kexec/.gitignore | 2 ++
  tools/testing/selftests/kexec/Makefile   | 2 +-
  2 files changed, 3 insertions(+), 1 deletion(-)

create mode 100644 tools/testing/selftests/kexec/.gitignore

tools/testing/selftests/kexec/.gitignore new file +2 -0
new file mode 100644
index 000000000000..5f3d9e089ae8
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+test_kexec_jump
tools/testing/selftests/kexec/Makefile +0 -0
index e3000ccb9a5d..874cfdd3b75b 100644

tools/testing/selftests/kexec/Makefile include ../../../scripts/Makefile.arch · line 18

Quoted 8 lines
tools/testing/selftests/kexec/Makefile +1 -1
@@ -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

thanks,
-- Shuah

#2 lore raw

Hi Shuah,

Quoted 3 lines · Shuah Khan

The change looks good to me.

Thank you, Shuah. I'll carry your Acked-by tag in v2.

Quoted 3 lines

There is another patch that adds the executable to .gitignore
https://lore.kernel.org/r/[email protected]

I missed that patch. Thank you for pointing it out. I'll drop this change in v2.

Quoted 1 line

I think you are missing [email protected] - added it

Thanks, I’ll add [email protected] manually in future patches since get_maintainer.pl didn’t include it.

$ ./scripts/get_maintainer.pl --scm tools/testing/selftests/kexec
Shuah Khan <[email protected]> (maintainer:KERNEL SELFTEST FRAMEWORK)
David Woodhouse <[email protected]> (commit_signer:1/1=100%,authored:1/1=100%)
Ingo Molnar <[email protected]> (commit_signer:1/1=100%)
[email protected] (open list:KERNEL SELFTEST FRAMEWORK)
[email protected] (open list)
git git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git
git git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

Regards,
Moonhee