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