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