selftests/kexec: fix test_kexec_jump build and ignore generated binary
Subsystems (3)
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
@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +test_kexec_jump
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
Signature · 1 line
2.43.0
Quoted 6 lines · Moon Hee Lee
The
test_kexec_jumpprogram builds correctly when invoked from the top-level selftests/Makefile, which explicitly sets the OUTPUT variable. However, building directly intools/testing/selftests/kexecfails 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
Makefilerule relies on $(OUTPUT), which is undefined in direct builds.Fix this by listing
test_kexec_jumpinTEST_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
Signed-off-by Moon Hee Lee <[email protected]>--- 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/.gitignoretools/testing/selftests/kexec/.gitignore new file +2
-0@@ -0,0 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0-only +test_kexec_jumptools/testing/selftests/kexec/Makefile +0
-0
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
Hi Shuah,
Quoted 3 lines · Shuah Khan
The change looks good to me.
Acked-by Shuah Khan <[email protected]>
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