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 |
Cristian Marussi | 313a4db | 2019-10-25 18:57:06 +0100 | [diff] [blame] | 3 | TARGETS += arm64 |
Pintu Agarwal | 47a18c4 | 2017-11-01 13:00:39 -0400 | [diff] [blame] | 4 | TARGETS += bpf |
Daniel Borkmann | 5aa5bd1 | 2016-10-17 14:28:36 +0200 | [diff] [blame] | 5 | TARGETS += breakpoints |
Bamvor Jian Zhang | f4ecb32 | 2015-11-17 22:35:42 +0800 | [diff] [blame] | 6 | TARGETS += capabilities |
Roman Gushchin | 84092dbc | 2018-05-11 19:03:49 +0100 | [diff] [blame] | 7 | TARGETS += cgroup |
Christian Brauner | de52872 | 2019-10-14 12:45:38 +0200 | [diff] [blame] | 8 | TARGETS += clone3 |
Christian Brauner | 2c5db60 | 2019-05-20 16:13:28 +0200 | [diff] [blame] | 9 | TARGETS += core |
Viresh Kumar | e66d5b6 | 2017-01-13 12:06:45 +0530 | [diff] [blame] | 10 | TARGETS += cpufreq |
Andrew Morton | 66a01b9 | 2013-02-27 17:05:56 -0800 | [diff] [blame] | 11 | TARGETS += cpu-hotplug |
Tom Murphy | 6edf2e3 | 2018-11-27 10:33:08 +0000 | [diff] [blame] | 12 | TARGETS += drivers/dma-buf |
Andrew Morton | 66a01b9 | 2013-02-27 17:05:56 -0800 | [diff] [blame] | 13 | TARGETS += efivarfs |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 14 | TARGETS += exec |
Christian Brauner | ce290a1 | 2018-03-13 17:55:27 +0100 | [diff] [blame] | 15 | TARGETS += filesystems |
Christian Brauner | 75abec7 | 2019-01-17 12:48:54 +0100 | [diff] [blame] | 16 | TARGETS += filesystems/binderfs |
Heiher | f2728fe | 2019-12-04 16:52:19 -0800 | [diff] [blame] | 17 | TARGETS += filesystems/epoll |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 18 | TARGETS += firmware |
Petteri Aimonen | 4185b3b | 2020-06-18 16:37:37 +0200 | [diff] [blame] | 19 | TARGETS += fpu |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 20 | TARGETS += ftrace |
Darren Hart | ecac1a7 | 2015-05-12 21:07:55 -0700 | [diff] [blame] | 21 | TARGETS += futex |
Bamvor Jian Zhang | 22f6592 | 2016-11-21 18:16:11 +0800 | [diff] [blame] | 22 | TARGETS += gpio |
Stafford Horne | 6320303 | 2017-01-12 00:16:07 +0900 | [diff] [blame] | 23 | TARGETS += intel_pstate |
Bamvor Jian Zhang | 7e72247 | 2015-11-17 22:35:43 +0800 | [diff] [blame] | 24 | TARGETS += ipc |
Sean Young | e55c884 | 2018-10-16 15:09:31 +0100 | [diff] [blame] | 25 | TARGETS += ir |
Pavel Emelyanov | 58c7be8 | 2013-04-30 15:27:06 -0700 | [diff] [blame] | 26 | TARGETS += kcmp |
Mimi Zohar | c3c0e81 | 2019-03-13 10:09:10 -0400 | [diff] [blame] | 27 | TARGETS += kexec |
Paolo Bonzini | 783e9e5 | 2018-03-27 11:49:19 +0200 | [diff] [blame] | 28 | TARGETS += kvm |
Kees Cook | 317dc34 | 2015-11-06 16:30:32 -0800 | [diff] [blame] | 29 | TARGETS += lib |
Joe Lawrence | a2818ee | 2019-01-09 13:43:29 +0100 | [diff] [blame] | 30 | TARGETS += livepatch |
Kees Cook | 46d1a0f | 2020-01-09 21:02:06 -0800 | [diff] [blame] | 31 | TARGETS += lkdtm |
Pranith Kumar | b6d9734 | 2015-09-11 13:07:42 -0700 | [diff] [blame] | 32 | TARGETS += membarrier |
David Herrmann | 4f5ce5e | 2014-08-08 14:25:32 -0700 | [diff] [blame] | 33 | TARGETS += memfd |
Pavel Emelyanov | 58c7be8 | 2013-04-30 15:27:06 -0700 | [diff] [blame] | 34 | TARGETS += memory-hotplug |
Ricardo Cañuelo | 7a30919 | 2020-08-06 23:23:51 -0700 | [diff] [blame] | 35 | TARGETS += mincore |
Eric W. Biederman | db181ce | 2014-07-29 15:50:44 -0700 | [diff] [blame] | 36 | TARGETS += mount |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 37 | TARGETS += mqueue |
David S. Miller | a6f6803 | 2013-03-20 15:07:56 -0400 | [diff] [blame] | 38 | TARGETS += net |
Vadym Kochan | 81573b1 | 2020-03-23 16:24:04 +0200 | [diff] [blame] | 39 | TARGETS += net/forwarding |
Florian Westphal | 048d19d | 2020-01-21 16:56:29 -0800 | [diff] [blame] | 40 | TARGETS += net/mptcp |
Florian Westphal | 25d8bce | 2018-10-31 18:26:21 +0100 | [diff] [blame] | 41 | TARGETS += netfilter |
Andrey Vagin | 6ad92bf | 2016-09-06 00:47:16 -0700 | [diff] [blame] | 42 | TARGETS += nsfs |
Christian Brauner | 575a0ae | 2018-12-29 22:27:33 +0100 | [diff] [blame] | 43 | TARGETS += pidfd |
Christian Brauner | 6952a4f | 2020-03-08 17:26:32 +0100 | [diff] [blame] | 44 | TARGETS += pid_namespace |
Michael Ellerman | 0e56dac | 2013-08-06 17:42:35 +1000 | [diff] [blame] | 45 | TARGETS += powerpc |
Alexey Dobriyan | 9cd6565 | 2018-04-10 16:31:45 -0700 | [diff] [blame] | 46 | TARGETS += proc |
Hiraku Toyooka | cc04a46 | 2015-10-02 20:46:39 +0900 | [diff] [blame] | 47 | TARGETS += pstore |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 48 | TARGETS += ptrace |
Aleksa Sarai | b28a10a | 2020-01-18 23:08:00 +1100 | [diff] [blame] | 49 | TARGETS += openat2 |
Mathieu Desnoyers | ccba8b6 | 2018-06-02 08:44:08 -0400 | [diff] [blame] | 50 | TARGETS += rseq |
Alexandre Belloni | a12ab9e | 2018-04-19 14:50:29 +0200 | [diff] [blame] | 51 | TARGETS += rtc |
Kees Cook | c99ee51 | 2015-06-16 10:54:14 -0700 | [diff] [blame] | 52 | TARGETS += seccomp |
Stas Sergeev | 19fd286 | 2016-04-14 23:20:05 +0300 | [diff] [blame] | 53 | TARGETS += sigaltstack |
Tim Bird | 3ce5105 | 2014-12-03 10:42:21 -0800 | [diff] [blame] | 54 | TARGETS += size |
Tom Hromatka | 3c54508 | 2018-04-26 10:54:09 -0600 | [diff] [blame] | 55 | TARGETS += sparc64 |
Al Viro | b8826e5 | 2017-02-18 22:07:24 -0500 | [diff] [blame] | 56 | TARGETS += splice |
Bamvor Jian Zhang | 1087d01 | 2015-09-09 21:06:25 +0800 | [diff] [blame] | 57 | TARGETS += static_keys |
Emilio López | 82208160 | 2016-10-19 09:49:48 -0300 | [diff] [blame] | 58 | TARGETS += sync |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 59 | TARGETS += sysctl |
Briana Oursler | 2b9843f | 2020-07-17 14:54:39 -0700 | [diff] [blame] | 60 | TARGETS += tc-testing |
Dmitry Safonov | 61c5767 | 2019-11-12 01:27:17 +0000 | [diff] [blame] | 61 | TARGETS += timens |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 62 | ifneq (1, $(quicktest)) |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 63 | TARGETS += timers |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 64 | endif |
Alexey Dobriyan | a332286 | 2019-03-05 15:49:24 -0800 | [diff] [blame] | 65 | TARGETS += tmpfs |
Jarkko Sakkinen | 6ea3dfe | 2019-02-04 15:16:40 +0200 | [diff] [blame] | 66 | TARGETS += tpm2 |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 67 | TARGETS += user |
| 68 | TARGETS += vm |
Andy Lutomirski | 3f705df | 2015-04-06 23:11:06 -0700 | [diff] [blame] | 69 | TARGETS += x86 |
Naresh Kamboju | f21fb79 | 2015-08-18 12:31:59 +0530 | [diff] [blame] | 70 | TARGETS += zram |
Andrew Morton | 96e869d | 2014-12-18 16:17:43 -0800 | [diff] [blame] | 71 | #Please keep the TARGETS list alphabetically sorted |
Shuah Khan | 2278e5e | 2015-06-19 13:13:43 -0600 | [diff] [blame] | 72 | # Run "make quicktest=1 run_tests" or |
SeongJae Park | c6a13fa | 2017-04-14 08:43:16 +0900 | [diff] [blame] | 73 | # "make quicktest=1 kselftest" from top level Makefile |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 74 | |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 75 | TARGETS_HOTPLUG = cpu-hotplug |
| 76 | TARGETS_HOTPLUG += memory-hotplug |
| 77 | |
Cristian Marussi | 3a24f7f | 2019-09-26 18:52:18 +0100 | [diff] [blame] | 78 | # User can optionally provide a TARGETS skiplist. |
| 79 | SKIP_TARGETS ?= |
| 80 | ifneq ($(SKIP_TARGETS),) |
| 81 | TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS)) |
| 82 | override TARGETS := $(TMP) |
| 83 | endif |
| 84 | |
Jiri Benc | 9d235a5 | 2020-02-06 09:40:00 +0100 | [diff] [blame] | 85 | # User can set FORCE_TARGETS to 1 to require all targets to be successfully |
| 86 | # built; make will fail if any of the targets cannot be built. If |
| 87 | # FORCE_TARGETS is not set (the default), make will succeed if at least one |
| 88 | # of the targets gets built. |
| 89 | FORCE_TARGETS ?= |
| 90 | |
Greg Thelen | f69237e | 2020-07-28 00:32:41 -0700 | [diff] [blame] | 91 | # Clear LDFLAGS and MAKEFLAGS when implicit rules are missing. This provides |
| 92 | # implicit rules to sub-test Makefiles which avoids build failures in test |
| 93 | # Makefile that don't have explicit build rules. |
| 94 | ifeq (,$(LINK.c)) |
Arnaldo Carvalho de Melo | 60df464 | 2015-05-14 16:55:18 -0300 | [diff] [blame] | 95 | override LDFLAGS = |
Shuah Khan | 67d8712 | 2015-03-18 11:57:39 -0600 | [diff] [blame] | 96 | override MAKEFLAGS = |
| 97 | endif |
| 98 | |
Shuah Khan | 29e911e | 2020-02-26 15:54:49 -0700 | [diff] [blame] | 99 | # Append kselftest to KBUILD_OUTPUT and O to avoid cluttering |
Shuah Khan | 61c2018 | 2019-05-14 14:43:44 -0600 | [diff] [blame] | 100 | # KBUILD_OUTPUT with selftest objects and headers installed |
| 101 | # by selftests Makefile or lib.mk. |
Masahiro Yamada | 051f278 | 2019-07-06 12:07:12 +0900 | [diff] [blame] | 102 | ifdef building_out_of_srctree |
Shuah Khan | 52fd1d0 | 2017-09-07 19:57:43 -0600 | [diff] [blame] | 103 | override LDFLAGS = |
| 104 | endif |
| 105 | |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 106 | ifneq ($(O),) |
Shuah Khan | 29e911e | 2020-02-26 15:54:49 -0700 | [diff] [blame] | 107 | BUILD := $(O)/kselftest |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 108 | else |
| 109 | ifneq ($(KBUILD_OUTPUT),) |
Shuah Khan | f60b85e | 2019-11-28 16:03:21 -0700 | [diff] [blame] | 110 | BUILD := $(KBUILD_OUTPUT)/kselftest |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 111 | else |
| 112 | BUILD := $(shell pwd) |
| 113 | DEFAULT_INSTALL_HDR_PATH := 1 |
| 114 | endif |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 115 | endif |
| 116 | |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 117 | # Prepare for headers install |
| 118 | top_srcdir ?= ../../.. |
| 119 | include $(top_srcdir)/scripts/subarch.include |
| 120 | ARCH ?= $(SUBARCH) |
| 121 | export KSFT_KHDR_INSTALL_DONE := 1 |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 122 | export BUILD |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 123 | |
Shuah Khan | d917fb8 | 2019-04-19 16:31:28 -0600 | [diff] [blame] | 124 | # build and run gpio when output directory is the src dir. |
| 125 | # gpio has dependency on tools/gpio and builds tools/gpio |
| 126 | # objects in the src directory in all cases making the src |
| 127 | # repo dirty even when objects are relocated. |
| 128 | ifneq (1,$(DEFAULT_INSTALL_HDR_PATH)) |
| 129 | TMP := $(filter-out gpio, $(TARGETS)) |
| 130 | TARGETS := $(TMP) |
| 131 | endif |
| 132 | |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 133 | # set default goal to all, so make without a target runs all, even when |
| 134 | # all isn't the first target in the file. |
| 135 | .DEFAULT_GOAL := all |
| 136 | |
| 137 | # Install headers here once for all tests. KSFT_KHDR_INSTALL_DONE |
| 138 | # is used to avoid running headers_install from lib.mk. |
| 139 | # Invoke headers install with --no-builtin-rules to avoid circular |
| 140 | # dependency in "make kselftest" case. In this case, second level |
| 141 | # make inherits builtin-rules which will use the rule generate |
| 142 | # Makefile.o and runs into |
| 143 | # "Circular Makefile.o <- prepare dependency dropped." |
| 144 | # and headers_install fails and test compile fails. |
| 145 | # |
| 146 | # O= KBUILD_OUTPUT cases don't run into this error, since main Makefile |
| 147 | # invokes them as sub-makes and --no-builtin-rules is not necessary, |
| 148 | # but doesn't cause any failures. Keep it simple and use the same |
| 149 | # flags in both cases. |
| 150 | # Local build cases: "make kselftest", "make -C" - headers are installed |
| 151 | # in the default INSTALL_HDR_PATH usr/include. |
| 152 | khdr: |
| 153 | ifeq (1,$(DEFAULT_INSTALL_HDR_PATH)) |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 154 | $(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 155 | else |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 156 | $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \ |
Shuah Khan | 8ce72dc | 2019-04-15 15:51:42 -0600 | [diff] [blame] | 157 | ARCH=$(ARCH) -C $(top_srcdir) headers_install |
| 158 | endif |
| 159 | |
| 160 | all: khdr |
Cristian Marussi | 5f70bde | 2019-12-10 11:44:59 +0000 | [diff] [blame] | 161 | @ret=1; \ |
| 162 | for TARGET in $(TARGETS); do \ |
| 163 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
| 164 | mkdir $$BUILD_TARGET -p; \ |
Jiri Benc | 9d235a5 | 2020-02-06 09:40:00 +0100 | [diff] [blame] | 165 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \ |
| 166 | $(if $(FORCE_TARGETS),|| exit); \ |
Cristian Marussi | 5f70bde | 2019-12-10 11:44:59 +0000 | [diff] [blame] | 167 | ret=$$((ret * $$?)); \ |
| 168 | done; exit $$ret; |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 169 | |
Andrew Morton | cab6b05 | 2012-03-28 14:42:54 -0700 | [diff] [blame] | 170 | run_tests: all |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 171 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 172 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 173 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\ |
Frederic Weisbecker | f467f71 | 2012-03-28 14:42:54 -0700 | [diff] [blame] | 174 | done; |
| 175 | |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 176 | hotplug: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 177 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 178 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 179 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 180 | done; |
| 181 | |
| 182 | run_hotplug: hotplug |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 183 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 184 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 185 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 186 | done; |
| 187 | |
| 188 | clean_hotplug: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 189 | @for TARGET in $(TARGETS_HOTPLUG); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 190 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 191 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ |
Shuah Khan | ddddda9 | 2014-07-02 09:51:38 -0600 | [diff] [blame] | 192 | done; |
| 193 | |
Hiraku Toyooka | f615e2b | 2015-10-02 20:46:41 +0900 | [diff] [blame] | 194 | run_pstore_crash: |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 195 | $(MAKE) -C pstore run_crash |
Hiraku Toyooka | f615e2b | 2015-10-02 20:46:41 +0900 | [diff] [blame] | 196 | |
Shuah Khan | c3c5992 | 2019-05-07 17:44:21 -0600 | [diff] [blame] | 197 | # Use $BUILD as the default install root. $BUILD points to the |
| 198 | # right output location for the following cases: |
| 199 | # 1. output_dir=kernel_src |
| 200 | # 2. a separate output directory is specified using O= KBUILD_OUTPUT |
| 201 | # 3. a separate output directory is specified using KBUILD_OUTPUT |
Shuah Khan | 17eac6c | 2019-09-26 16:40:14 -0600 | [diff] [blame] | 202 | # Avoid conflict with INSTALL_PATH set by the main Makefile |
Shuah Khan | c3c5992 | 2019-05-07 17:44:21 -0600 | [diff] [blame] | 203 | # |
Shuah Khan | 17eac6c | 2019-09-26 16:40:14 -0600 | [diff] [blame] | 204 | KSFT_INSTALL_PATH ?= $(BUILD)/kselftest_install |
| 205 | KSFT_INSTALL_PATH := $(abspath $(KSFT_INSTALL_PATH)) |
| 206 | # Avoid changing the rest of the logic here and lib.mk. |
| 207 | INSTALL_PATH := $(KSFT_INSTALL_PATH) |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 208 | ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh |
Kees Cook | f0f0a5d | 2020-09-28 13:26:48 -0700 | [diff] [blame] | 209 | TEST_LIST := $(INSTALL_PATH)/kselftest-list.txt |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 210 | |
Shuah Khan | c3c5992 | 2019-05-07 17:44:21 -0600 | [diff] [blame] | 211 | install: all |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 212 | ifdef INSTALL_PATH |
| 213 | @# Ask all targets to install their files |
Kees Cook | d4e59a5 | 2019-04-24 16:12:31 -0700 | [diff] [blame] | 214 | mkdir -p $(INSTALL_PATH)/kselftest |
Kees Cook | c78fd76 | 2019-10-30 12:45:36 -0700 | [diff] [blame] | 215 | install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/ |
Kees Cook | d4e59a5 | 2019-04-24 16:12:31 -0700 | [diff] [blame] | 216 | install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/ |
Kees Cook | 5c069b6 | 2019-04-24 16:12:35 -0700 | [diff] [blame] | 217 | install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/ |
Kees Cook | f0f0a5d | 2020-09-28 13:26:48 -0700 | [diff] [blame] | 218 | install -m 744 run_kselftest.sh $(INSTALL_PATH)/ |
| 219 | rm -f $(TEST_LIST) |
Cristian Marussi | 5f70bde | 2019-12-10 11:44:59 +0000 | [diff] [blame] | 220 | @ret=1; \ |
| 221 | for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 222 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Jiri Benc | 9d235a5 | 2020-02-06 09:40:00 +0100 | [diff] [blame] | 223 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \ |
| 224 | $(if $(FORCE_TARGETS),|| exit); \ |
Cristian Marussi | 5f70bde | 2019-12-10 11:44:59 +0000 | [diff] [blame] | 225 | ret=$$((ret * $$?)); \ |
| 226 | done; exit $$ret; |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 227 | |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 228 | |
Kees Cook | f0f0a5d | 2020-09-28 13:26:48 -0700 | [diff] [blame] | 229 | @# Ask all targets to emit their test scripts |
| 230 | @# While building kselftest-list.text skip also non-existent TARGET dirs: |
Cristian Marussi | 131b30c | 2019-09-26 18:52:19 +0100 | [diff] [blame] | 231 | @# they could be the result of a build failure and should NOT be |
| 232 | @# included in the generated runlist. |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 233 | for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 234 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Prabhakar Kushwaha | 02bf1f8 | 2019-10-22 13:27:17 +0000 | [diff] [blame] | 235 | [ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \ |
Shuah Khan | 17eac6c | 2019-09-26 16:40:14 -0600 | [diff] [blame] | 236 | echo -n "Emit Tests for $$TARGET\n"; \ |
Kees Cook | f0f0a5d | 2020-09-28 13:26:48 -0700 | [diff] [blame] | 237 | $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \ |
| 238 | -C $$TARGET emit_tests >> $(TEST_LIST); \ |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 239 | done; |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 240 | else |
| 241 | $(error Error: set INSTALL_PATH to use install) |
| 242 | endif |
| 243 | |
Veronika Kabatova | a5f3046 | 2020-05-19 22:00:45 +0200 | [diff] [blame] | 244 | FORMAT ?= .gz |
| 245 | TAR_PATH = $(abspath ${INSTALL_PATH}/kselftest-packages/kselftest.tar${FORMAT}) |
| 246 | gen_tar: install |
| 247 | @mkdir -p ${INSTALL_PATH}/kselftest-packages/ |
| 248 | @tar caf ${TAR_PATH} --exclude=kselftest-packages -C ${INSTALL_PATH} . |
| 249 | @echo "Created ${TAR_PATH}" |
| 250 | |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 251 | clean: |
Shuah Khan | 1ede053 | 2017-09-18 17:30:50 -0600 | [diff] [blame] | 252 | @for TARGET in $(TARGETS); do \ |
bamvor.zhangjian@huawei.com | a8ba798 | 2016-11-29 19:55:52 +0800 | [diff] [blame] | 253 | BUILD_TARGET=$$BUILD/$$TARGET; \ |
Ilya Leoshkevich | 0ac33e4 | 2019-08-16 18:06:04 +0200 | [diff] [blame] | 254 | $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\ |
Frederic Weisbecker | 274343a | 2012-01-12 17:20:44 -0800 | [diff] [blame] | 255 | done; |
Michael Ellerman | 32dcfba | 2015-03-11 15:06:00 +1100 | [diff] [blame] | 256 | |
Veronika Kabatova | a5f3046 | 2020-05-19 22:00:45 +0200 | [diff] [blame] | 257 | .PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar |