Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0 |
Pintu Agarwal | 47a18c4 | 2017-11-01 13:00:39 -0400 | [diff] [blame] | 2 | TARGETS = android |
| 3 | TARGETS += bpf |
Daniel Borkmann | 5aa5bd1 | 2016-10-17 14:28:36 +0200 | [diff] [blame] | 4 | TARGETS += breakpoints |
Bamvor Jian Zhang | f4ecb32 | 2015-11-17 22:35:42 +0800 | [diff] [blame] | 5 | TARGETS += capabilities |
Viresh Kumar | e66d5b6 | 2017-01-13 12:06:45 +0530 | [diff] [blame] | 6 | TARGETS += cpufreq |
Andrew Morton | 66a01b9 | 2013-02-27 17:05:56 -0800 | [diff] [blame] | 7 | TARGETS += cpu-hotplug |
Andrew Morton | 66a01b9 | 2013-02-27 17:05:56 -0800 | [diff] [blame] | 8 | TARGETS += efivarfs |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 9 | TARGETS += exec |
| 10 | TARGETS += firmware |
| 11 | TARGETS += ftrace |
Darren Hart | ecac1a7 | 2015-05-12 21:07:55 -0700 | [diff] [blame] | 12 | TARGETS += futex |
Bamvor Jian Zhang | 22f6592 | 2016-11-21 18:16:11 +0800 | [diff] [blame] | 13 | TARGETS += gpio |
Stafford Horne | 6320303 | 2017-01-12 00:16:07 +0900 | [diff] [blame] | 14 | TARGETS += intel_pstate |
Bamvor Jian Zhang | 7e72247 | 2015-11-17 22:35:43 +0800 | [diff] [blame] | 15 | TARGETS += ipc |
Pavel Emelyanov | 58c7be8 | 2013-04-30 15:27:06 -0700 | [diff] [blame] | 16 | TARGETS += kcmp |
Kees Cook | 317dc34 | 2015-11-06 16:30:32 -0800 | [diff] [blame] | 17 | TARGETS += lib |
Pranith Kumar | b6d9734 | 2015-09-11 13:07:42 -0700 | [diff] [blame] | 18 | TARGETS += membarrier |
David Herrmann | 4f5ce5e | 2014-08-08 14:25:32 -0700 | [diff] [blame] | 19 | TARGETS += memfd |
Pavel Emelyanov | 58c7be8 | 2013-04-30 15:27:06 -0700 | [diff] [blame] | 20 | TARGETS += memory-hotplug |
Eric W. Biederman | db181ce | 2014-07-29 15:50:44 -0700 | [diff] [blame] | 21 | TARGETS += mount |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 22 | TARGETS += mqueue |
David S. Miller | a6f6803 | 2013-03-20 15:07:56 -0400 | [diff] [blame] | 23 | TARGETS += net |
Andrey Vagin | 6ad92bf | 2016-09-06 00:47:16 -0700 | [diff] [blame] | 24 | TARGETS += nsfs |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 25 | TARGETS += powerpc |
Hiraku Toyooka | cc04a46 | 2015-10-02 20:46:39 +0900 | [diff] [blame] | 26 | TARGETS += pstore |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 27 | TARGETS += ptrace |
Kees Cook | c99ee51 | 2015-06-16 10:54:14 -0700 | [diff] [blame] | 28 | TARGETS += seccomp |
Stas Sergeev | 19fd286 | 2016-04-14 23:20:05 +0300 | [diff] [blame] | 29 | TARGETS += sigaltstack |
Tim Bird | 3ce5105 | 2014-12-03 10:42:21 -0800 | [diff] [blame] | 30 | TARGETS += size |
Al Viro | b8826e5 | 2017-02-18 22:07:24 -0500 | [diff] [blame] | 31 | TARGETS += splice |
Bamvor Jian Zhang | 1087d01 | 2015-09-09 21:06:25 +0800 | [diff] [blame] | 32 | TARGETS += static_keys |
Emilio López | 82208160 | 2016-10-19 09:49:48 -0300 | [diff] [blame] | 33 | TARGETS += sync |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 34 | TARGETS += sysctl |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 35 | ifneq (1, $(quicktest)) |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 36 | TARGETS += timers |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 37 | endif |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 38 | TARGETS += user |
| 39 | TARGETS += vm |
Andy Lutomirski | 3f705df | 2015-04-06 23:11:06 -0700 | [diff] [blame] | 40 | TARGETS += x86 |
Naresh Kamboju | f21fb79 | 2015-08-18 12:31:59 +0530 | [diff] [blame] | 41 | TARGETS += zram |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 42 | #Please keep the TARGETS list alphabetically sorted |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 43 | # Run "make quicktest=1 run_tests" or |
SeongJae Park | c6a13fa | 2017-04-14 08:43:16 +0900 | [diff] [blame] | 44 | # "make quicktest=1 kselftest" from top level Makefile |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 45 | |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 46 | TARGETS_HOTPLUG = cpu-hotplug |
| 47 | TARGETS_HOTPLUG += memory-hotplug |
| 48 | |
Shuah Khan | 67d8712 | 2015-03-18 11:57:39 -0600 | [diff] [blame] | 49 | # Clear LDFLAGS and MAKEFLAGS if called from main |
| 50 | # Makefile to avoid test build failures when test |
| 51 | # Makefile doesn't have explicit build rules. |
| 52 | ifeq (1,$(MAKELEVEL)) |
Arnaldo Carvalho de Melo | 60df464 | 2015-05-14 16:55:18 -0300 | [diff] [blame] | 53 | override LDFLAGS = |
Shuah Khan | 67d8712 | 2015-03-18 11:57:39 -0600 | [diff] [blame] | 54 | override MAKEFLAGS = |
| 55 | endif |
| 56 | |
Shuah Khan | 52fd1d0 | 2017-09-07 19:57:43 -0600 | [diff] [blame] | 57 | ifneq ($(KBUILD_SRC),) |
| 58 | override LDFLAGS = |
| 59 | endif |
| 60 | |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 61 | BUILD := $(O) |
| 62 | ifndef BUILD |
| 63 | BUILD := $(KBUILD_OUTPUT) |
| 64 | endif |
| 65 | ifndef BUILD |
| 66 | BUILD := $(shell pwd) |
| 67 | endif |
| 68 | |
| 69 | export BUILD |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 70 | all: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 71 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 72 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 73 | mkdir $$BUILD_TARGET -p; \ |
| 74 | make OUTPUT=$$BUILD_TARGET -C $$TARGET;\ |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 75 | done; |
| 76 | |
Andrew Morton | cab6b05 | 2012-03-28 14:42:54 -0700 | [diff] [blame] | 77 | run_tests: all |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 78 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 79 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 80 | make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ |
Frederic Weisbecker | f467f71 | 2012-03-28 14:42:54 -0700 | [diff] [blame] | 81 | done; |
| 82 | |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 83 | hotplug: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 84 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 85 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 86 | make OUTPUT=$$BUILD_TARGET -C $$TARGET;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 87 | done; |
| 88 | |
| 89 | run_hotplug: hotplug |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 90 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 91 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 92 | make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 93 | done; |
| 94 | |
| 95 | clean_hotplug: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 96 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 97 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 98 | make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 99 | done; |
| 100 | |
Hiraku Toyooka | f615e2b | 2015-10-02 20:46:41 +0900 | [diff] [blame] | 101 | run_pstore_crash: |
| 102 | make -C pstore run_crash |
| 103 | |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 104 | INSTALL_PATH ?= install |
| 105 | INSTALL_PATH := $(abspath $(INSTALL_PATH)) |
| 106 | ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh |
| 107 | |
| 108 | install: |
| 109 | ifdef INSTALL_PATH |
| 110 | @# Ask all targets to install their files |
| 111 | mkdir -p $(INSTALL_PATH) |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 112 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 113 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 114 | make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 115 | done; |
| 116 | |
| 117 | @# Ask all targets to emit their test scripts |
Rolf Eike Beer | a2b1e8a | 2016-12-14 11:59:34 +0100 | [diff] [blame] | 118 | echo "#!/bin/sh" > $(ALL_SCRIPT) |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 119 | echo "cd \$$(dirname \$$0)" >> $(ALL_SCRIPT) |
| 120 | echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) |
| 121 | |
| 122 | for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 123 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 124 | echo "echo ; echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ |
| 125 | echo "echo ========================================" >> $(ALL_SCRIPT); \ |
| 126 | echo "cd $$TARGET" >> $(ALL_SCRIPT); \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 127 | make -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 128 | echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ |
| 129 | done; |
| 130 | |
| 131 | chmod u+x $(ALL_SCRIPT) |
| 132 | else |
| 133 | $(error Error: set INSTALL_PATH to use install) |
| 134 | endif |
| 135 | |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 136 | clean: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 137 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 138 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 139 | make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 140 | done; |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 141 | |
SeongJae Park | 584f34f | 2017-04-14 08:44:46 +0900 | [diff] [blame] | 142 | .PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean |