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