1TARGETS = breakpoints 2TARGETS += capabilities 3TARGETS += cpu-hotplug 4TARGETS += efivarfs 5TARGETS += exec 6TARGETS += firmware 7TARGETS += ftrace 8TARGETS += futex 9TARGETS += ipc 10TARGETS += kcmp 11TARGETS += lib 12TARGETS += membarrier 13TARGETS += memfd 14TARGETS += memory-hotplug 15TARGETS += mount 16TARGETS += mqueue 17TARGETS += net 18TARGETS += powerpc 19TARGETS += pstore 20TARGETS += ptrace 21TARGETS += seccomp 22TARGETS += sigaltstack 23TARGETS += size 24TARGETS += static_keys 25TARGETS += sysctl 26ifneq (1, $(quicktest)) 27TARGETS += timers 28endif 29TARGETS += user 30TARGETS += vm 31TARGETS += x86 32TARGETS += zram 33#Please keep the TARGETS list alphabetically sorted 34# Run "make quicktest=1 run_tests" or 35# "make quicktest=1 kselftest from top level Makefile 36 37TARGETS_HOTPLUG = cpu-hotplug 38TARGETS_HOTPLUG += memory-hotplug 39 40# Clear LDFLAGS and MAKEFLAGS if called from main 41# Makefile to avoid test build failures when test 42# Makefile doesn't have explicit build rules. 43ifeq (1,$(MAKELEVEL)) 44override LDFLAGS = 45override MAKEFLAGS = 46endif 47 48all: 49 for TARGET in $(TARGETS); do \ 50 make -C $$TARGET; \ 51 done; 52 53run_tests: all 54 for TARGET in $(TARGETS); do \ 55 make -C $$TARGET run_tests; \ 56 done; 57 58hotplug: 59 for TARGET in $(TARGETS_HOTPLUG); do \ 60 make -C $$TARGET; \ 61 done; 62 63run_hotplug: hotplug 64 for TARGET in $(TARGETS_HOTPLUG); do \ 65 make -C $$TARGET run_full_test; \ 66 done; 67 68clean_hotplug: 69 for TARGET in $(TARGETS_HOTPLUG); do \ 70 make -C $$TARGET clean; \ 71 done; 72 73run_pstore_crash: 74 make -C pstore run_crash 75 76INSTALL_PATH ?= install 77INSTALL_PATH := $(abspath $(INSTALL_PATH)) 78ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh 79 80install: 81ifdef INSTALL_PATH 82 @# Ask all targets to install their files 83 mkdir -p $(INSTALL_PATH) 84 for TARGET in $(TARGETS); do \ 85 make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ 86 done; 87 88 @# Ask all targets to emit their test scripts 89 echo "#!/bin/bash" > $(ALL_SCRIPT) 90 echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT) 91 echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) 92 93 for TARGET in $(TARGETS); do \ 94 echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ 95 echo "echo ========================================" >> $(ALL_SCRIPT); \ 96 echo "cd $$TARGET" >> $(ALL_SCRIPT); \ 97 make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ 98 echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ 99 done; 100 101 chmod u+x $(ALL_SCRIPT) 102else 103 $(error Error: set INSTALL_PATH to use install) 104endif 105 106clean: 107 for TARGET in $(TARGETS); do \ 108 make -C $$TARGET clean; \ 109 done; 110 111.PHONY: install 112