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 |
Roman Gushchin | 84092dbc | 2018-05-11 19:03:49 +0100 | [diff] [blame] | 6 | TARGETS += cgroup |
Viresh Kumar | e66d5b6 | 2017-01-13 12:06:45 +0530 | [diff] [blame] | 7 | TARGETS += cpufreq |
Andrew Morton | 66a01b9 | 2013-02-27 17:05:56 -0800 | [diff] [blame] | 8 | TARGETS += cpu-hotplug |
Andrew Morton | 66a01b9 | 2013-02-27 17:05:56 -0800 | [diff] [blame] | 9 | TARGETS += efivarfs |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 10 | TARGETS += exec |
Christian Brauner | ce290a1 | 2018-03-13 17:55:27 +0100 | [diff] [blame] | 11 | TARGETS += filesystems |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 12 | TARGETS += firmware |
| 13 | TARGETS += ftrace |
Darren Hart | ecac1a7 | 2015-05-12 21:07:55 -0700 | [diff] [blame] | 14 | TARGETS += futex |
Bamvor Jian Zhang | 22f6592 | 2016-11-21 18:16:11 +0800 | [diff] [blame] | 15 | TARGETS += gpio |
Stafford Horne | 6320303 | 2017-01-12 00:16:07 +0900 | [diff] [blame] | 16 | TARGETS += intel_pstate |
Bamvor Jian Zhang | 7e72247 | 2015-11-17 22:35:43 +0800 | [diff] [blame] | 17 | TARGETS += ipc |
Pavel Emelyanov | 58c7be8 | 2013-04-30 15:27:06 -0700 | [diff] [blame] | 18 | TARGETS += kcmp |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 19 | TARGETS += kvm |
Kees Cook | 317dc34 | 2015-11-06 16:30:32 -0800 | [diff] [blame] | 20 | TARGETS += lib |
Pranith Kumar | b6d9734 | 2015-09-11 13:07:42 -0700 | [diff] [blame] | 21 | TARGETS += membarrier |
David Herrmann | 4f5ce5e | 2014-08-08 14:25:32 -0700 | [diff] [blame] | 22 | TARGETS += memfd |
Pavel Emelyanov | 58c7be8 | 2013-04-30 15:27:06 -0700 | [diff] [blame] | 23 | TARGETS += memory-hotplug |
Eric W. Biederman | db181ce | 2014-07-29 15:50:44 -0700 | [diff] [blame] | 24 | TARGETS += mount |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 25 | TARGETS += mqueue |
David S. Miller | a6f6803 | 2013-03-20 15:07:56 -0400 | [diff] [blame] | 26 | TARGETS += net |
Florian Westphal | 25d8bce | 2018-10-31 18:26:21 +0100 | [diff] [blame] | 27 | TARGETS += netfilter |
Willem de Bruijn | cda261f | 2018-12-20 16:22:54 -0500 | [diff] [blame] | 28 | TARGETS += networking/timestamping |
Andrey Vagin | 6ad92bf | 2016-09-06 00:47:16 -0700 | [diff] [blame] | 29 | TARGETS += nsfs |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 30 | TARGETS += powerpc |
Alexey Dobriyan | 9cd6565 | 2018-04-10 16:31:45 -0700 | [diff] [blame] | 31 | TARGETS += proc |
Hiraku Toyooka | cc04a46 | 2015-10-02 20:46:39 +0900 | [diff] [blame] | 32 | TARGETS += pstore |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 33 | TARGETS += ptrace |
Mathieu Desnoyers | ccba8b6 | 2018-06-02 08:44:08 -0400 | [diff] [blame] | 34 | TARGETS += rseq |
Alexandre Belloni | a12ab9e | 2018-04-19 14:50:29 +0200 | [diff] [blame] | 35 | TARGETS += rtc |
Kees Cook | c99ee51 | 2015-06-16 10:54:14 -0700 | [diff] [blame] | 36 | TARGETS += seccomp |
Stas Sergeev | 19fd286 | 2016-04-14 23:20:05 +0300 | [diff] [blame] | 37 | TARGETS += sigaltstack |
Tim Bird | 3ce5105 | 2014-12-03 10:42:21 -0800 | [diff] [blame] | 38 | TARGETS += size |
Tom Hromatka | 3c54508 | 2018-04-26 10:54:09 -0600 | [diff] [blame] | 39 | TARGETS += sparc64 |
Al Viro | b8826e5 | 2017-02-18 22:07:24 -0500 | [diff] [blame] | 40 | TARGETS += splice |
Bamvor Jian Zhang | 1087d01 | 2015-09-09 21:06:25 +0800 | [diff] [blame] | 41 | TARGETS += static_keys |
Emilio López | 82208160 | 2016-10-19 09:49:48 -0300 | [diff] [blame] | 42 | TARGETS += sync |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 43 | TARGETS += sysctl |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 44 | ifneq (1, $(quicktest)) |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 45 | TARGETS += timers |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 46 | endif |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 47 | TARGETS += user |
| 48 | TARGETS += vm |
Andy Lutomirski | 3f705df | 2015-04-06 23:11:06 -0700 | [diff] [blame] | 49 | TARGETS += x86 |
Naresh Kamboju | f21fb79 | 2015-08-18 12:31:59 +0530 | [diff] [blame] | 50 | TARGETS += zram |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 51 | #Please keep the TARGETS list alphabetically sorted |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 52 | # Run "make quicktest=1 run_tests" or |
SeongJae Park | c6a13fa | 2017-04-14 08:43:16 +0900 | [diff] [blame] | 53 | # "make quicktest=1 kselftest" from top level Makefile |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 54 | |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 55 | TARGETS_HOTPLUG = cpu-hotplug |
| 56 | TARGETS_HOTPLUG += memory-hotplug |
| 57 | |
Shuah Khan | 67d8712 | 2015-03-18 11:57:39 -0600 | [diff] [blame] | 58 | # Clear LDFLAGS and MAKEFLAGS if called from main |
| 59 | # Makefile to avoid test build failures when test |
| 60 | # Makefile doesn't have explicit build rules. |
| 61 | ifeq (1,$(MAKELEVEL)) |
Arnaldo Carvalho de Melo | 60df464 | 2015-05-14 16:55:18 -0300 | [diff] [blame] | 62 | override LDFLAGS = |
Shuah Khan | 67d8712 | 2015-03-18 11:57:39 -0600 | [diff] [blame] | 63 | override MAKEFLAGS = |
| 64 | endif |
| 65 | |
Shuah Khan | 52fd1d0 | 2017-09-07 19:57:43 -0600 | [diff] [blame] | 66 | ifneq ($(KBUILD_SRC),) |
| 67 | override LDFLAGS = |
| 68 | endif |
| 69 | |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 70 | BUILD := $(O) |
| 71 | ifndef BUILD |
| 72 | BUILD := $(KBUILD_OUTPUT) |
| 73 | endif |
| 74 | ifndef BUILD |
| 75 | BUILD := $(shell pwd) |
| 76 | endif |
| 77 | |
Shuah Khan | 44f0135 | 2018-02-21 17:25:55 -0700 | [diff] [blame] | 78 | # KSFT_TAP_LEVEL is used from KSFT framework to prevent nested TAP header |
| 79 | # printing from tests. Applicable to run_tests case where run_tests adds |
| 80 | # TAP header prior running tests and when a test program invokes another |
| 81 | # with system() call. Export it here to cover override RUN_TESTS defines. |
| 82 | export KSFT_TAP_LEVEL=`echo 1` |
| 83 | |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 84 | export BUILD |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 85 | all: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 86 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 87 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 88 | mkdir $$BUILD_TARGET -p; \ |
| 89 | make OUTPUT=$$BUILD_TARGET -C $$TARGET;\ |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 90 | done; |
| 91 | |
Andrew Morton | cab6b05 | 2012-03-28 14:42:54 -0700 | [diff] [blame] | 92 | run_tests: all |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 93 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 94 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 95 | make OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ |
Frederic Weisbecker | f467f71 | 2012-03-28 14:42:54 -0700 | [diff] [blame] | 96 | done; |
| 97 | |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 98 | hotplug: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 99 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 100 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 101 | make OUTPUT=$$BUILD_TARGET -C $$TARGET;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 102 | done; |
| 103 | |
| 104 | run_hotplug: hotplug |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 105 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 106 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 107 | make OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 108 | done; |
| 109 | |
| 110 | clean_hotplug: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 111 | @for TARGET in $(TARGETS_HOTPLUG); 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 clean;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 114 | done; |
| 115 | |
Hiraku Toyooka | f615e2b | 2015-10-02 20:46:41 +0900 | [diff] [blame] | 116 | run_pstore_crash: |
| 117 | make -C pstore run_crash |
| 118 | |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 119 | INSTALL_PATH ?= install |
| 120 | INSTALL_PATH := $(abspath $(INSTALL_PATH)) |
| 121 | ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh |
| 122 | |
| 123 | install: |
| 124 | ifdef INSTALL_PATH |
| 125 | @# Ask all targets to install their files |
| 126 | mkdir -p $(INSTALL_PATH) |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 127 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 128 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 129 | make OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install; \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 130 | done; |
| 131 | |
| 132 | @# Ask all targets to emit their test scripts |
Rolf Eike Beer | a2b1e8a | 2016-12-14 11:59:34 +0100 | [diff] [blame] | 133 | echo "#!/bin/sh" > $(ALL_SCRIPT) |
Michael Ellerman | 14f1889 | 2018-01-16 17:10:39 +1100 | [diff] [blame] | 134 | echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT) |
| 135 | echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT) |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 136 | echo "ROOT=\$$PWD" >> $(ALL_SCRIPT) |
Michael Ellerman | 14f1889 | 2018-01-16 17:10:39 +1100 | [diff] [blame] | 137 | echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT) |
| 138 | echo " OUTPUT=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT) |
| 139 | echo " cat /dev/null > \$$OUTPUT" >> $(ALL_SCRIPT) |
| 140 | echo "else" >> $(ALL_SCRIPT) |
| 141 | echo " OUTPUT=/dev/stdout" >> $(ALL_SCRIPT) |
| 142 | echo "fi" >> $(ALL_SCRIPT) |
Shuah Khan (Samsung OSG) | 3df6131 | 2018-05-01 12:15:34 -0600 | [diff] [blame] | 143 | echo "export KSFT_TAP_LEVEL=1" >> $(ALL_SCRIPT) |
| 144 | echo "export skip=4" >> $(ALL_SCRIPT) |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 145 | |
| 146 | for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 147 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Shuah Khan | 44f0135 | 2018-02-21 17:25:55 -0700 | [diff] [blame] | 148 | echo "echo ; echo TAP version 13" >> $(ALL_SCRIPT); \ |
| 149 | echo "echo Running tests in $$TARGET" >> $(ALL_SCRIPT); \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 150 | echo "echo ========================================" >> $(ALL_SCRIPT); \ |
Michael Ellerman | 88893cf | 2018-03-23 20:44:27 +1100 | [diff] [blame] | 151 | echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 152 | echo "cd $$TARGET" >> $(ALL_SCRIPT); \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 153 | 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] | 154 | echo "cd \$$ROOT" >> $(ALL_SCRIPT); \ |
| 155 | done; |
| 156 | |
| 157 | chmod u+x $(ALL_SCRIPT) |
| 158 | else |
| 159 | $(error Error: set INSTALL_PATH to use install) |
| 160 | endif |
| 161 | |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 162 | clean: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 163 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 164 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 165 | make OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 166 | done; |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 167 | |
SeongJae Park | 584f34f | 2017-04-14 08:44:46 +0900 | [diff] [blame] | 168 | .PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean |