^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) TARGETS = android
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) TARGETS += arm64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) TARGETS += bpf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) TARGETS += breakpoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) TARGETS += capabilities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) TARGETS += cgroup
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) TARGETS += clone3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) TARGETS += core
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) TARGETS += cpufreq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) TARGETS += cpu-hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) TARGETS += drivers/dma-buf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) TARGETS += efivarfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) TARGETS += exec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) TARGETS += filesystems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) TARGETS += filesystems/binderfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) TARGETS += filesystems/epoll
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) TARGETS += firmware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) TARGETS += fpu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) TARGETS += ftrace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) TARGETS += futex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) TARGETS += gpio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) TARGETS += intel_pstate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) TARGETS += ipc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) TARGETS += ir
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) TARGETS += kcmp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) TARGETS += kexec
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) TARGETS += kvm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) TARGETS += lib
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) TARGETS += livepatch
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) TARGETS += lkdtm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) TARGETS += membarrier
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) TARGETS += memfd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) TARGETS += memory-hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) TARGETS += mincore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) TARGETS += mount
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) TARGETS += mqueue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) TARGETS += net
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) TARGETS += net/forwarding
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) TARGETS += net/mptcp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) TARGETS += netfilter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) TARGETS += nsfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) TARGETS += pidfd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) TARGETS += pid_namespace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) TARGETS += powerpc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) TARGETS += proc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) TARGETS += pstore
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) TARGETS += ptrace
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) TARGETS += openat2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) TARGETS += rseq
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) TARGETS += rtc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) TARGETS += seccomp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) TARGETS += sigaltstack
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) TARGETS += size
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) TARGETS += sparc64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) TARGETS += splice
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) TARGETS += static_keys
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) TARGETS += sync
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) TARGETS += sysctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) TARGETS += tc-testing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) TARGETS += timens
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) ifneq (1, $(quicktest))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) TARGETS += timers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) TARGETS += tmpfs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) TARGETS += tpm2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) TARGETS += user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) TARGETS += vm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) TARGETS += x86
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) TARGETS += zram
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) #Please keep the TARGETS list alphabetically sorted
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) # Run "make quicktest=1 run_tests" or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) # "make quicktest=1 kselftest" from top level Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) TARGETS_HOTPLUG = cpu-hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) TARGETS_HOTPLUG += memory-hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) # User can optionally provide a TARGETS skiplist.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) SKIP_TARGETS ?=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) ifneq ($(SKIP_TARGETS),)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) override TARGETS := $(TMP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) # User can set FORCE_TARGETS to 1 to require all targets to be successfully
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) # built; make will fail if any of the targets cannot be built. If
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) # FORCE_TARGETS is not set (the default), make will succeed if at least one
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) # of the targets gets built.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) FORCE_TARGETS ?=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) # Clear LDFLAGS and MAKEFLAGS when implicit rules are missing. This provides
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) # implicit rules to sub-test Makefiles which avoids build failures in test
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) # Makefile that don't have explicit build rules.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) ifeq (,$(LINK.c))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) override LDFLAGS =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) override MAKEFLAGS =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) # Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) # KBUILD_OUTPUT with selftest objects and headers installed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) # by selftests Makefile or lib.mk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) ifdef building_out_of_srctree
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) override LDFLAGS =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) ifneq ($(O),)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) BUILD := $(O)/kselftest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) ifneq ($(KBUILD_OUTPUT),)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) BUILD := $(KBUILD_OUTPUT)/kselftest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) BUILD := $(shell pwd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) DEFAULT_INSTALL_HDR_PATH := 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) # Prepare for headers install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) top_srcdir ?= ../../..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) include $(top_srcdir)/scripts/subarch.include
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ARCH ?= $(SUBARCH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) export KSFT_KHDR_INSTALL_DONE := 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) export BUILD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) # build and run gpio when output directory is the src dir.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) # gpio has dependency on tools/gpio and builds tools/gpio
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) # objects in the src directory in all cases making the src
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) # repo dirty even when objects are relocated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) ifneq (1,$(DEFAULT_INSTALL_HDR_PATH))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) TMP := $(filter-out gpio, $(TARGETS))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) TARGETS := $(TMP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) # set default goal to all, so make without a target runs all, even when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) # all isn't the first target in the file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) .DEFAULT_GOAL := all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) # Install headers here once for all tests. KSFT_KHDR_INSTALL_DONE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) # is used to avoid running headers_install from lib.mk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) # Invoke headers install with --no-builtin-rules to avoid circular
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) # dependency in "make kselftest" case. In this case, second level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) # make inherits builtin-rules which will use the rule generate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) # Makefile.o and runs into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) # "Circular Makefile.o <- prepare dependency dropped."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) # and headers_install fails and test compile fails.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) # O= KBUILD_OUTPUT cases don't run into this error, since main Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) # invokes them as sub-makes and --no-builtin-rules is not necessary,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) # but doesn't cause any failures. Keep it simple and use the same
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) # flags in both cases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) # Local build cases: "make kselftest", "make -C" - headers are installed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) # in the default INSTALL_HDR_PATH usr/include.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) khdr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) $(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) $(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) ARCH=$(ARCH) -C $(top_srcdir) headers_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) all: khdr
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) @ret=1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) for TARGET in $(TARGETS); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) mkdir $$BUILD_TARGET -p; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) $(if $(FORCE_TARGETS),|| exit); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) ret=$$((ret * $$?)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) done; exit $$ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) run_tests: all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) @for TARGET in $(TARGETS); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) hotplug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) @for TARGET in $(TARGETS_HOTPLUG); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) run_hotplug: hotplug
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) @for TARGET in $(TARGETS_HOTPLUG); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) clean_hotplug:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) @for TARGET in $(TARGETS_HOTPLUG); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) run_pstore_crash:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) $(MAKE) -C pstore run_crash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) # Use $BUILD as the default install root. $BUILD points to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) # right output location for the following cases:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) # 1. output_dir=kernel_src
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) # 2. a separate output directory is specified using O= KBUILD_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) # 3. a separate output directory is specified using KBUILD_OUTPUT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) # Avoid conflict with INSTALL_PATH set by the main Makefile
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) KSFT_INSTALL_PATH ?= $(BUILD)/kselftest_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) KSFT_INSTALL_PATH := $(abspath $(KSFT_INSTALL_PATH))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) # Avoid changing the rest of the logic here and lib.mk.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) INSTALL_PATH := $(KSFT_INSTALL_PATH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) TEST_LIST := $(INSTALL_PATH)/kselftest-list.txt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) install: all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) ifdef INSTALL_PATH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) @# Ask all targets to install their files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) mkdir -p $(INSTALL_PATH)/kselftest
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) install -m 744 run_kselftest.sh $(INSTALL_PATH)/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) rm -f $(TEST_LIST)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) @ret=1; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) for TARGET in $(TARGETS); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) $(if $(FORCE_TARGETS),|| exit); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) ret=$$((ret * $$?)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) done; exit $$ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) @# Ask all targets to emit their test scripts
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) @# While building kselftest-list.text skip also non-existent TARGET dirs:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) @# they could be the result of a build failure and should NOT be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) @# included in the generated runlist.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) for TARGET in $(TARGETS); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) [ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) echo -n "Emit Tests for $$TARGET\n"; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) $(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) -C $$TARGET emit_tests >> $(TEST_LIST); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) $(error Error: set INSTALL_PATH to use install)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) FORMAT ?= .gz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) TAR_PATH = $(abspath ${INSTALL_PATH}/kselftest-packages/kselftest.tar${FORMAT})
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) gen_tar: install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) @mkdir -p ${INSTALL_PATH}/kselftest-packages/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) @tar caf ${TAR_PATH} --exclude=kselftest-packages -C ${INSTALL_PATH} .
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) @echo "Created ${TAR_PATH}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) clean:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) @for TARGET in $(TARGETS); do \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) BUILD_TARGET=$$BUILD/$$TARGET; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) .PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar