1 # SPDX-License-Identifier: GPL-2.0
5 TARGETS
+= capabilities
11 TARGETS
+= filesystems
16 TARGETS
+= intel_pstate
23 TARGETS
+= memory-hotplug
36 TARGETS
+= sigaltstack
40 TARGETS
+= static_keys
43 ifneq (1, $(quicktest
))
50 #Please keep the TARGETS list alphabetically sorted
51 # Run "make quicktest=1 run_tests" or
52 # "make quicktest=1 kselftest" from top level Makefile
54 TARGETS_HOTPLUG
= cpu-hotplug
55 TARGETS_HOTPLUG
+= memory-hotplug
57 # Clear LDFLAGS and MAKEFLAGS if called from main
58 # Makefile to avoid test build failures when test
59 # Makefile doesn't have explicit build rules.
65 ifneq ($(KBUILD_SRC
),)
71 BUILD
:= $(KBUILD_OUTPUT
)
77 # KSFT_TAP_LEVEL is used from KSFT framework to prevent nested TAP header
78 # printing from tests. Applicable to run_tests case where run_tests adds
79 # TAP header prior running tests and when a test program invokes another
80 # with system() call. Export it here to cover override RUN_TESTS defines.
81 export KSFT_TAP_LEVEL
=`echo 1`
85 @for TARGET in
$(TARGETS
); do \
86 BUILD_TARGET
=$$BUILD/$$TARGET; \
87 mkdir
$$BUILD_TARGET -p
; \
88 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET;\
92 @for TARGET in
$(TARGETS
); do \
93 BUILD_TARGET
=$$BUILD/$$TARGET; \
94 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET run_tests
;\
98 @for TARGET in
$(TARGETS_HOTPLUG
); do \
99 BUILD_TARGET
=$$BUILD/$$TARGET; \
100 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET;\
104 @for TARGET in
$(TARGETS_HOTPLUG
); do \
105 BUILD_TARGET
=$$BUILD/$$TARGET; \
106 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET run_full_test
;\
110 @for TARGET in
$(TARGETS_HOTPLUG
); do \
111 BUILD_TARGET
=$$BUILD/$$TARGET; \
112 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET clean;\
116 make
-C pstore run_crash
118 INSTALL_PATH ?
= install
119 INSTALL_PATH
:= $(abspath
$(INSTALL_PATH
))
120 ALL_SCRIPT
:= $(INSTALL_PATH
)/run_kselftest.sh
124 @
# Ask all targets to install their files
125 mkdir
-p
$(INSTALL_PATH
)
126 @for TARGET in
$(TARGETS
); do \
127 BUILD_TARGET
=$$BUILD/$$TARGET; \
128 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET INSTALL_PATH
=$(INSTALL_PATH
)/$$TARGET install; \
131 @
# Ask all targets to emit their test scripts
132 echo
"#!/bin/sh" > $(ALL_SCRIPT
)
133 echo
"BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT
)
134 echo
"cd \$$BASE_DIR" >> $(ALL_SCRIPT
)
135 echo
"ROOT=\$$PWD" >> $(ALL_SCRIPT
)
136 echo
"if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT
)
137 echo
" OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT
)
138 echo
" cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT
)
139 echo
"else" >> $(ALL_SCRIPT
)
140 echo
" OUTPUT=/dev/stdout" >> $(ALL_SCRIPT
)
141 echo
"fi" >> $(ALL_SCRIPT
)
142 echo
"export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT
)
143 echo
"export skip=4" >> $(ALL_SCRIPT
)
145 for TARGET in
$(TARGETS
); do \
146 BUILD_TARGET
=$$BUILD/$$TARGET; \
147 echo
"echo ; echo TAP version 13" >> $(ALL_SCRIPT
); \
148 echo
"echo Running tests in $$TARGET" >> $(ALL_SCRIPT
); \
149 echo
"echo ========================================" >> $(ALL_SCRIPT
); \
150 echo
"[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT
); \
151 echo
"cd $$TARGET" >> $(ALL_SCRIPT
); \
152 make
-s
--no-print-directory OUTPUT
=$$BUILD_TARGET -C
$$TARGET emit_tests
>> $(ALL_SCRIPT
); \
153 echo
"cd \$$ROOT" >> $(ALL_SCRIPT
); \
156 chmod u
+x
$(ALL_SCRIPT
)
158 $(error Error
: set INSTALL_PATH to use
install)
162 @for TARGET in
$(TARGETS
); do \
163 BUILD_TARGET
=$$BUILD/$$TARGET; \
164 make OUTPUT
=$$BUILD_TARGET -C
$$TARGET clean;\
167 .PHONY
: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash
install clean