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