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