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