summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorShuah Khan <skhan@linuxfoundation.org>2019-09-26 18:40:14 -0400
committerShuah Khan <skhan@linuxfoundation.org>2019-10-01 12:11:08 -0400
commit17eac6c2db8b2cdfe33d40229bdda2acd86b304a (patch)
tree7553fd772a8077cfe83dc51d974699df88e2d3ea /tools/testing/selftests
parent54ecb8f7028c5eb3d740bb82b0f1d90f2df63c5c (diff)
selftests: Add kselftest-all and kselftest-install targets
Add kselftest-all target to build tests from the top level Makefile. This is to simplify kselftest use-cases for CI and distributions where build and test systems are different. Current kselftest target builds and runs tests on a development system which is a developer use-case. Add kselftest-install target to install tests from the top level Makefile. This is to simplify kselftest use-cases for CI and distributions where build and test systems are different. This change addresses requests from developers and testers to add support for installing kselftest from the main Makefile. In addition, make the install directory the same when install is run using "make kselftest-install" or by running kselftest_install.sh. Also fix the INSTALL_PATH variable conflict between main Makefile and selftests Makefile. Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests')
-rw-r--r--tools/testing/selftests/Makefile8
-rwxr-xr-xtools/testing/selftests/kselftest_install.sh4
2 files changed, 8 insertions, 4 deletions
diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index c3feccb99ff5..bad18145ed1a 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -171,9 +171,12 @@ run_pstore_crash:
171# 1. output_dir=kernel_src 171# 1. output_dir=kernel_src
172# 2. a separate output directory is specified using O= KBUILD_OUTPUT 172# 2. a separate output directory is specified using O= KBUILD_OUTPUT
173# 3. a separate output directory is specified using KBUILD_OUTPUT 173# 3. a separate output directory is specified using KBUILD_OUTPUT
174# Avoid conflict with INSTALL_PATH set by the main Makefile
174# 175#
175INSTALL_PATH ?= $(BUILD)/install 176KSFT_INSTALL_PATH ?= $(BUILD)/kselftest_install
176INSTALL_PATH := $(abspath $(INSTALL_PATH)) 177KSFT_INSTALL_PATH := $(abspath $(KSFT_INSTALL_PATH))
178# Avoid changing the rest of the logic here and lib.mk.
179INSTALL_PATH := $(KSFT_INSTALL_PATH)
177ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh 180ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
178 181
179install: all 182install: all
@@ -203,6 +206,7 @@ ifdef INSTALL_PATH
203 echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \ 206 echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
204 echo "cd $$TARGET" >> $(ALL_SCRIPT); \ 207 echo "cd $$TARGET" >> $(ALL_SCRIPT); \
205 echo -n "run_many" >> $(ALL_SCRIPT); \ 208 echo -n "run_many" >> $(ALL_SCRIPT); \
209 echo -n "Emit Tests for $$TARGET\n"; \
206 $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ 210 $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
207 echo "" >> $(ALL_SCRIPT); \ 211 echo "" >> $(ALL_SCRIPT); \
208 echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ 212 echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
diff --git a/tools/testing/selftests/kselftest_install.sh b/tools/testing/selftests/kselftest_install.sh
index ec304463883c..e2e1911d62d5 100755
--- a/tools/testing/selftests/kselftest_install.sh
+++ b/tools/testing/selftests/kselftest_install.sh
@@ -24,12 +24,12 @@ main()
24 echo "$0: Installing in specified location - $install_loc ..." 24 echo "$0: Installing in specified location - $install_loc ..."
25 fi 25 fi
26 26
27 install_dir=$install_loc/kselftest 27 install_dir=$install_loc/kselftest_install
28 28
29# Create install directory 29# Create install directory
30 mkdir -p $install_dir 30 mkdir -p $install_dir
31# Build tests 31# Build tests
32 INSTALL_PATH=$install_dir make install 32 KSFT_INSTALL_PATH=$install_dir make install
33} 33}
34 34
35main "$@" 35main "$@"