blob: 24ae9e829e9aa2e22db0e035b4c1d53d5424cf61 [file] [log] [blame]
Andrew Morton66a01b92013-02-27 17:05:56 -08001TARGETS = breakpoints
Andrew Morton66a01b92013-02-27 17:05:56 -08002TARGETS += cpu-hotplug
Andrew Morton66a01b92013-02-27 17:05:56 -08003TARGETS += efivarfs
Andrew Morton96e869d2014-12-18 16:17:43 -08004TARGETS += exec
5TARGETS += firmware
6TARGETS += ftrace
Darren Hartecac1a72015-05-12 21:07:55 -07007TARGETS += futex
Pavel Emelyanov58c7be82013-04-30 15:27:06 -07008TARGETS += kcmp
David Herrmann4f5ce5e2014-08-08 14:25:32 -07009TARGETS += memfd
Pavel Emelyanov58c7be82013-04-30 15:27:06 -070010TARGETS += memory-hotplug
Eric W. Biedermandb181ce2014-07-29 15:50:44 -070011TARGETS += mount
Andrew Morton96e869d2014-12-18 16:17:43 -080012TARGETS += mqueue
David S. Millera6f68032013-03-20 15:07:56 -040013TARGETS += net
Michael Ellerman0e56dac2013-08-06 17:42:35 +100014TARGETS += powerpc
Andrew Morton96e869d2014-12-18 16:17:43 -080015TARGETS += ptrace
Kees Cookc99ee512015-06-16 10:54:14 -070016TARGETS += seccomp
Tim Bird3ce51052014-12-03 10:42:21 -080017TARGETS += size
Andrew Morton96e869d2014-12-18 16:17:43 -080018TARGETS += sysctl
Shuah Khan2278e5e2015-06-19 13:13:43 -060019ifneq (1, $(quicktest))
Andrew Morton96e869d2014-12-18 16:17:43 -080020TARGETS += timers
Shuah Khan2278e5e2015-06-19 13:13:43 -060021endif
Andrew Morton96e869d2014-12-18 16:17:43 -080022TARGETS += user
23TARGETS += vm
Andy Lutomirski3f705df2015-04-06 23:11:06 -070024TARGETS += x86
Andrew Morton96e869d2014-12-18 16:17:43 -080025#Please keep the TARGETS list alphabetically sorted
Shuah Khan2278e5e2015-06-19 13:13:43 -060026# Run "make quicktest=1 run_tests" or
27# "make quicktest=1 kselftest from top level Makefile
Frederic Weisbecker274343a2012-01-12 17:20:44 -080028
Shuah Khanddddda92014-07-02 09:51:38 -060029TARGETS_HOTPLUG = cpu-hotplug
30TARGETS_HOTPLUG += memory-hotplug
31
Shuah Khan67d87122015-03-18 11:57:39 -060032# 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))
Arnaldo Carvalho de Melo60df4642015-05-14 16:55:18 -030036override LDFLAGS =
Shuah Khan67d87122015-03-18 11:57:39 -060037override MAKEFLAGS =
38endif
39
Frederic Weisbecker274343a2012-01-12 17:20:44 -080040all:
41 for TARGET in $(TARGETS); do \
42 make -C $$TARGET; \
43 done;
44
Andrew Mortoncab6b052012-03-28 14:42:54 -070045run_tests: all
Frederic Weisbeckerf467f712012-03-28 14:42:54 -070046 for TARGET in $(TARGETS); do \
47 make -C $$TARGET run_tests; \
48 done;
49
Shuah Khanddddda92014-07-02 09:51:38 -060050hotplug:
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
Michael Ellerman32dcfba2015-03-11 15:06:00 +110065INSTALL_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
Frederic Weisbecker274343a2012-01-12 17:20:44 -080096clean:
97 for TARGET in $(TARGETS); do \
98 make -C $$TARGET clean; \
99 done;
Michael Ellerman32dcfba2015-03-11 15:06:00 +1100100
101.PHONY: install