brintos

brintos / linux-shallow public Read only

0
0
Text · 8.5 KiB · 363d031 Raw
304 lines · plain
1# SPDX-License-Identifier: GPL-2.02TARGETS += acct3TARGETS += alsa4TARGETS += amd-pstate5TARGETS += arm646TARGETS += bpf7TARGETS += breakpoints8TARGETS += cachestat9TARGETS += capabilities10TARGETS += cgroup11TARGETS += clone312TARGETS += connector13TARGETS += core14TARGETS += cpufreq15TARGETS += cpu-hotplug16TARGETS += damon17TARGETS += devices/error_logs18TARGETS += devices/probe19TARGETS += dmabuf-heaps20TARGETS += drivers/dma-buf21TARGETS += drivers/s390x/uvdevice22TARGETS += drivers/net23TARGETS += drivers/net/bonding24TARGETS += drivers/net/team25TARGETS += drivers/net/virtio_net26TARGETS += drivers/platform/x86/intel/ifs27TARGETS += dt28TARGETS += efivarfs29TARGETS += exec30TARGETS += fchmodat231TARGETS += filesystems32TARGETS += filesystems/binderfs33TARGETS += filesystems/epoll34TARGETS += filesystems/fat35TARGETS += filesystems/overlayfs36TARGETS += filesystems/statmount37TARGETS += firmware38TARGETS += fpu39TARGETS += ftrace40TARGETS += futex41TARGETS += gpio42TARGETS += hid43TARGETS += intel_pstate44TARGETS += iommu45TARGETS += ipc46TARGETS += ir47TARGETS += kcmp48TARGETS += kexec49TARGETS += kvm50TARGETS += landlock51TARGETS += lib52TARGETS += livepatch53TARGETS += lkdtm54TARGETS += lsm55TARGETS += membarrier56TARGETS += memfd57TARGETS += memory-hotplug58TARGETS += mincore59TARGETS += mount60TARGETS += mount_setattr61TARGETS += move_mount_set_group62TARGETS += mqueue63TARGETS += nci64TARGETS += net65TARGETS += net/af_unix66TARGETS += net/forwarding67TARGETS += net/hsr68TARGETS += net/mptcp69TARGETS += net/netfilter70TARGETS += net/openvswitch71TARGETS += net/packetdrill72TARGETS += net/rds73TARGETS += net/tcp_ao74TARGETS += nsfs75TARGETS += perf_events76TARGETS += pidfd77TARGETS += pid_namespace78TARGETS += power_supply79TARGETS += powerpc80TARGETS += prctl81TARGETS += proc82TARGETS += pstore83TARGETS += ptrace84TARGETS += openat285TARGETS += resctrl86TARGETS += riscv87TARGETS += rlimits88TARGETS += rseq89TARGETS += rtc90TARGETS += rust91TARGETS += sched_ext92TARGETS += seccomp93TARGETS += sgx94TARGETS += sigaltstack95TARGETS += size96TARGETS += sparc6497TARGETS += splice98TARGETS += static_keys99TARGETS += sync100TARGETS += syscall_user_dispatch101TARGETS += sysctl102TARGETS += tc-testing103TARGETS += tdx104TARGETS += thermal/intel/power_floor105TARGETS += thermal/intel/workload_hint106TARGETS += timens107ifneq (1, $(quicktest))108TARGETS += timers109endif110TARGETS += tmpfs111TARGETS += tpm2112TARGETS += tty113TARGETS += uevent114TARGETS += user_events115TARGETS += vDSO116TARGETS += mm117TARGETS += x86118TARGETS += zram119#Please keep the TARGETS list alphabetically sorted120# Run "make quicktest=1 run_tests" or121# "make quicktest=1 kselftest" from top level Makefile122 123TARGETS_HOTPLUG = cpu-hotplug124TARGETS_HOTPLUG += memory-hotplug125 126# Networking tests want the net/lib target, include it automatically127ifneq ($(filter net drivers/net drivers/net/hw,$(TARGETS)),)128ifeq ($(filter net/lib,$(TARGETS)),)129	INSTALL_DEP_TARGETS := net/lib130endif131endif132 133# User can optionally provide a TARGETS skiplist. By default we skip134# targets using BPF since it has cutting edge build time dependencies135# which require more effort to install.136SKIP_TARGETS ?= bpf sched_ext137ifneq ($(SKIP_TARGETS),)138	TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS))139	override TARGETS := $(TMP)140endif141 142# User can set FORCE_TARGETS to 1 to require all targets to be successfully143# built; make will fail if any of the targets cannot be built. If144# FORCE_TARGETS is not set (the default), make will succeed if at least one145# of the targets gets built.146FORCE_TARGETS ?=147 148# Clear LDFLAGS and MAKEFLAGS when implicit rules are missing.  This provides149# implicit rules to sub-test Makefiles which avoids build failures in test150# Makefile that don't have explicit build rules.151ifeq (,$(LINK.c))152override LDFLAGS =153override MAKEFLAGS =154endif155 156# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering157# KBUILD_OUTPUT with selftest objects and headers installed158# by selftests Makefile or lib.mk.159ifdef building_out_of_srctree160override LDFLAGS =161endif162 163top_srcdir ?= ../../..164 165ifeq ("$(origin O)", "command line")166  KBUILD_OUTPUT := $(O)167endif168 169ifneq ($(KBUILD_OUTPUT),)170  # Make's built-in functions such as $(abspath ...), $(realpath ...) cannot171  # expand a shell special character '~'. We use a somewhat tedious way here.172  abs_objtree := $(shell cd $(top_srcdir) && mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)173  $(if $(abs_objtree),, \174    $(error failed to create output directory "$(KBUILD_OUTPUT)"))175  # $(realpath ...) resolves symlinks176  abs_objtree := $(realpath $(abs_objtree))177  BUILD := $(abs_objtree)/kselftest178  KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include179else180  BUILD := $(CURDIR)181  abs_srctree := $(shell cd $(top_srcdir) && pwd)182  KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include183  DEFAULT_INSTALL_HDR_PATH := 1184endif185 186# Prepare for headers install187include $(top_srcdir)/scripts/subarch.include188ARCH           ?= $(SUBARCH)189export BUILD190export KHDR_INCLUDES191 192# set default goal to all, so make without a target runs all, even when193# all isn't the first target in the file.194.DEFAULT_GOAL := all195 196all:197	@ret=1;							\198	for TARGET in $(TARGETS); do				\199		BUILD_TARGET=$$BUILD/$$TARGET;			\200		mkdir $$BUILD_TARGET  -p;			\201		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET	\202				O=$(abs_objtree)		\203				$(if $(FORCE_TARGETS),|| exit);	\204		ret=$$((ret * $$?));				\205	done; exit $$ret;206 207run_tests: all208	@for TARGET in $(TARGETS); do \209		BUILD_TARGET=$$BUILD/$$TARGET;	\210		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests \211				SRC_PATH=$(shell readlink -e $$(pwd)) \212				OBJ_PATH=$(BUILD)                   \213				O=$(abs_objtree);		    \214	done;215 216hotplug:217	@for TARGET in $(TARGETS_HOTPLUG); do \218		BUILD_TARGET=$$BUILD/$$TARGET;	\219		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\220	done;221 222run_hotplug: hotplug223	@for TARGET in $(TARGETS_HOTPLUG); do \224		BUILD_TARGET=$$BUILD/$$TARGET;	\225		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\226	done;227 228clean_hotplug:229	@for TARGET in $(TARGETS_HOTPLUG); do \230		BUILD_TARGET=$$BUILD/$$TARGET;	\231		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\232	done;233 234run_pstore_crash:235	$(MAKE) -C pstore run_crash236 237# Use $BUILD as the default install root. $BUILD points to the238# right output location for the following cases:239# 1. output_dir=kernel_src240# 2. a separate output directory is specified using O= KBUILD_OUTPUT241# 3. a separate output directory is specified using KBUILD_OUTPUT242# Avoid conflict with INSTALL_PATH set by the main Makefile243#244KSFT_INSTALL_PATH ?= $(BUILD)/kselftest_install245KSFT_INSTALL_PATH := $(abspath $(KSFT_INSTALL_PATH))246# Avoid changing the rest of the logic here and lib.mk.247INSTALL_PATH := $(KSFT_INSTALL_PATH)248ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh249TEST_LIST := $(INSTALL_PATH)/kselftest-list.txt250 251install: all252ifdef INSTALL_PATH253	@# Ask all targets to install their files254	mkdir -p $(INSTALL_PATH)/kselftest255	install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/256	install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/257	install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/258	install -m 744 kselftest/ktap_helpers.sh $(INSTALL_PATH)/kselftest/259	install -m 744 kselftest/ksft.py $(INSTALL_PATH)/kselftest/260	install -m 744 run_kselftest.sh $(INSTALL_PATH)/261	rm -f $(TEST_LIST)262	@ret=1;	\263	for TARGET in $(TARGETS) $(INSTALL_DEP_TARGETS); do \264		BUILD_TARGET=$$BUILD/$$TARGET;	\265		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install \266				INSTALL_PATH=$(INSTALL_PATH)/$$TARGET \267				SRC_PATH=$(shell readlink -e $$(pwd)) \268				OBJ_PATH=$(INSTALL_PATH) \269				O=$(abs_objtree)		\270				$(if $(FORCE_TARGETS),|| exit);	\271		ret=$$((ret * $$?));		\272	done; exit $$ret;273 274 275	@# Ask all targets to emit their test scripts276	@# While building kselftest-list.text skip also non-existent TARGET dirs:277	@# they could be the result of a build failure and should NOT be278	@# included in the generated runlist.279	for TARGET in $(TARGETS); do \280		BUILD_TARGET=$$BUILD/$$TARGET;	\281		[ ! -d $(INSTALL_PATH)/$$TARGET ] && printf "Skipping non-existent dir: $$TARGET\n" && continue; \282		printf "Emit Tests for $$TARGET\n"; \283		$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \284			-C $$TARGET emit_tests >> $(TEST_LIST); \285	done;286else287	$(error Error: set INSTALL_PATH to use install)288endif289 290FORMAT ?= .gz291TAR_PATH = $(abspath ${INSTALL_PATH}/kselftest-packages/kselftest.tar${FORMAT})292gen_tar: install293	@mkdir -p ${INSTALL_PATH}/kselftest-packages/294	@tar caf ${TAR_PATH} --exclude=kselftest-packages -C ${INSTALL_PATH} .295	@echo "Created ${TAR_PATH}"296 297clean:298	@for TARGET in $(TARGETS); do \299		BUILD_TARGET=$$BUILD/$$TARGET;	\300		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\301	done;302 303.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar304