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