Merge tag 'linux-kselftest-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel...
[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 TARGETS += zram
27 #Please keep the TARGETS list alphabetically sorted
28 # Run "make quicktest=1 run_tests" or
29 # "make quicktest=1 kselftest from top level Makefile
30
31 TARGETS_HOTPLUG = cpu-hotplug
32 TARGETS_HOTPLUG += memory-hotplug
33
34 # Clear LDFLAGS and MAKEFLAGS if called from main
35 # Makefile to avoid test build failures when test
36 # Makefile doesn't have explicit build rules.
37 ifeq (1,$(MAKELEVEL))
38 override LDFLAGS =
39 override MAKEFLAGS =
40 endif
41
42 all:
43         for TARGET in $(TARGETS); do \
44                 make -C $$TARGET; \
45         done;
46
47 run_tests: all
48         for TARGET in $(TARGETS); do \
49                 make -C $$TARGET run_tests; \
50         done;
51
52 hotplug:
53         for TARGET in $(TARGETS_HOTPLUG); do \
54                 make -C $$TARGET; \
55         done;
56
57 run_hotplug: hotplug
58         for TARGET in $(TARGETS_HOTPLUG); do \
59                 make -C $$TARGET run_full_test; \
60         done;
61
62 clean_hotplug:
63         for TARGET in $(TARGETS_HOTPLUG); do \
64                 make -C $$TARGET clean; \
65         done;
66
67 INSTALL_PATH ?= install
68 INSTALL_PATH := $(abspath $(INSTALL_PATH))
69 ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
70
71 install:
72 ifdef INSTALL_PATH
73         @# Ask all targets to install their files
74         mkdir -p $(INSTALL_PATH)
75         for TARGET in $(TARGETS); do \
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