[PATCH 03/20] kbuild: kselftest_install - add a new make target to install selftests

From: Shuah Khan
Date: Tue Nov 04 2014 - 12:18:52 EST


Add a new make target to install to install kernel selftests.
This new target will build and install selftests.

Approach:

make kselftest_target:
-- exports kselftest INSTALL_KSFT_PATH
default $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
-- exports path for ksefltest.sh
-- runs selftests make install target:

selftests make install target
-- creates kselftest.sh script in install install dir
-- runs install targets for all INSTALL_TARGETS

Individual test make install targets:
-- install test programs and/or scripts in install dir
-- append to the ksefltest.sh file to add commands to run test

Signed-off-by: Shuah Khan <shuahkh@xxxxxxxxxxxxxxx>
---
Makefile | 17 +++++++++++++++++
1 file changed, 17 insertions(+)

diff --git a/Makefile b/Makefile
index 05d67af..291aff7 100644
--- a/Makefile
+++ b/Makefile
@@ -1078,6 +1078,20 @@ kselftest:
$(Q)$(MAKE) -C tools/testing/selftests run_tests

# ---------------------------------------------------------------------------
+# Kernel selftest install
+INSTALL_KSFT_PATH=$(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)
+export INSTALL_KSFT_PATH
+KSELFTEST=$(INSTALL_KSFT_PATH)/kselftest.sh
+export KSELFTEST
+
+PHONY += kselftest_install
+kselftest_install:
+ @rm -rf $(INSTALL_KSFT_PATH)
+ @mkdir -p $(INSTALL_KSFT_PATH)
+ $(Q)$(MAKE) -C tools/testing/selftests install
+ chmod +x $(KSELFTEST)
+
+# ---------------------------------------------------------------------------
# Modules

ifdef CONFIG_MODULES
@@ -1285,6 +1299,9 @@ help:
@echo ' Build, install, and boot kernel before'
@echo ' running kselftest on it'
@echo ''
+ @echo ' kselftest_install - Install Kselftests to INSTALL_KSFT_PATH'
+ @echo ' default: $(INSTALL_MOD_PATH)/lib/kselftest/$(KERNELRELEASE)'
+ @echo ''
@echo 'Kernel packaging:'
@$(MAKE) $(build)=$(package-dir) help
@echo ''
--
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/