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