blob: 4b4957b8df4e879a0d19098fdacce49658fce24a [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
Kees Cook317dc342015-11-06 16:30:32 -08009TARGETS += lib
Pranith Kumarb6d97342015-09-11 13:07:42 -070010TARGETS += membarrier
David Herrmann4f5ce5e2014-08-08 14:25:32 -070011TARGETS += memfd
Pavel Emelyanov58c7be82013-04-30 15:27:06 -070012TARGETS += memory-hotplug
Eric W. Biedermandb181ce2014-07-29 15:50:44 -070013TARGETS += mount
Andrew Morton96e869d2014-12-18 16:17:43 -080014TARGETS += mqueue
David S. Millera6f68032013-03-20 15:07:56 -040015TARGETS += net
Michael Ellerman0e56dac2013-08-06 17:42:35 +100016TARGETS += powerpc
Andrew Morton96e869d2014-12-18 16:17:43 -080017TARGETS += ptrace
Kees Cookc99ee512015-06-16 10:54:14 -070018TARGETS += seccomp
Tim Bird3ce51052014-12-03 10:42:21 -080019TARGETS += size
Bamvor Jian Zhang1087d012015-09-09 21:06:25 +080020TARGETS += static_keys
Andrew Morton96e869d2014-12-18 16:17:43 -080021TARGETS += sysctl
Shuah Khan2278e5e2015-06-19 13:13:43 -060022ifneq (1, $(quicktest))
Andrew Morton96e869d2014-12-18 16:17:43 -080023TARGETS += timers
Shuah Khan2278e5e2015-06-19 13:13:43 -060024endif
Andrew Morton96e869d2014-12-18 16:17:43 -080025TARGETS += user
26TARGETS += vm
Andy Lutomirski3f705df2015-04-06 23:11:06 -070027TARGETS += x86
Naresh Kambojuf21fb792015-08-18 12:31:59 +053028TARGETS += zram
Andrew Morton96e869d2014-12-18 16:17:43 -080029#Please keep the TARGETS list alphabetically sorted
Shuah Khan2278e5e2015-06-19 13:13:43 -060030# Run "make quicktest=1 run_tests" or
31# "make quicktest=1 kselftest from top level Makefile
Frederic Weisbecker274343a2012-01-12 17:20:44 -080032
Shuah Khanddddda92014-07-02 09:51:38 -060033TARGETS_HOTPLUG = cpu-hotplug
34TARGETS_HOTPLUG += memory-hotplug
35
Shuah Khan67d87122015-03-18 11:57:39 -060036# Clear LDFLAGS and MAKEFLAGS if called from main
37# Makefile to avoid test build failures when test
38# Makefile doesn't have explicit build rules.
39ifeq (1,$(MAKELEVEL))
Arnaldo Carvalho de Melo60df4642015-05-14 16:55:18 -030040override LDFLAGS =
Shuah Khan67d87122015-03-18 11:57:39 -060041override MAKEFLAGS =
42endif
43
Frederic Weisbecker274343a2012-01-12 17:20:44 -080044all:
45 for TARGET in $(TARGETS); do \
46 make -C $$TARGET; \
47 done;
48
Andrew Mortoncab6b052012-03-28 14:42:54 -070049run_tests: all
Frederic Weisbeckerf467f712012-03-28 14:42:54 -070050 for TARGET in $(TARGETS); do \
51 make -C $$TARGET run_tests; \
52 done;
53
Shuah Khanddddda92014-07-02 09:51:38 -060054hotplug:
55 for TARGET in $(TARGETS_HOTPLUG); do \
56 make -C $$TARGET; \
57 done;
58
59run_hotplug: hotplug
60 for TARGET in $(TARGETS_HOTPLUG); do \
61 make -C $$TARGET run_full_test; \
62 done;
63
64clean_hotplug:
65 for TARGET in $(TARGETS_HOTPLUG); do \
66 make -C $$TARGET clean; \
67 done;
68
Michael Ellerman32dcfba2015-03-11 15:06:00 +110069INSTALL_PATH ?= install
70INSTALL_PATH := $(abspath $(INSTALL_PATH))
71ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
72
73install:
74ifdef INSTALL_PATH
75 @# Ask all targets to install their files
76 mkdir -p $(INSTALL_PATH)
77 for TARGET in $(TARGETS); do \
Michael Ellerman32dcfba2015-03-11 15:06:00 +110078 make -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \
79 done;
80
81 @# Ask all targets to emit their test scripts
82 echo "#!/bin/bash" > $(ALL_SCRIPT)
83 echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT)
84 echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
85
86 for TARGET in $(TARGETS); do \
87 echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \
88 echo "echo ========================================" >> $(ALL_SCRIPT); \
89 echo "cd $$TARGET" >> $(ALL_SCRIPT); \
90 make -s --no-print-directory -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
91 echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
92 done;
93
94 chmod u+x $(ALL_SCRIPT)
95else
96 $(error Error: set INSTALL_PATH to use install)
97endif
98
Frederic Weisbecker274343a2012-01-12 17:20:44 -080099clean:
100 for TARGET in $(TARGETS); do \
101 make -C $$TARGET clean; \
102 done;
Michael Ellerman32dcfba2015-03-11 15:06:00 +1100103
104.PHONY: install