2017-11-01 15:07:57 +01:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2020-08-27 14:36:27 +02:00
|
|
|
TARGETS = arm64
|
2017-11-01 13:00:39 -04:00
|
|
|
TARGETS += bpf
|
2016-10-17 14:28:36 +02:00
|
|
|
TARGETS += breakpoints
|
2015-11-17 22:35:42 +08:00
|
|
|
TARGETS += capabilities
|
2018-05-11 19:03:49 +01:00
|
|
|
TARGETS += cgroup
|
2019-10-14 12:45:38 +02:00
|
|
|
TARGETS += clone3
|
2019-05-20 16:13:28 +02:00
|
|
|
TARGETS += core
|
2017-01-13 12:06:45 +05:30
|
|
|
TARGETS += cpufreq
|
2013-02-27 17:05:56 -08:00
|
|
|
TARGETS += cpu-hotplug
|
2018-11-27 10:33:08 +00:00
|
|
|
TARGETS += drivers/dma-buf
|
2013-02-27 17:05:56 -08:00
|
|
|
TARGETS += efivarfs
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += exec
|
2018-03-13 17:55:27 +01:00
|
|
|
TARGETS += filesystems
|
2019-01-17 12:48:54 +01:00
|
|
|
TARGETS += filesystems/binderfs
|
2019-12-04 16:52:19 -08:00
|
|
|
TARGETS += filesystems/epoll
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += firmware
|
2020-06-18 16:37:37 +02:00
|
|
|
TARGETS += fpu
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += ftrace
|
2015-05-12 21:07:55 -07:00
|
|
|
TARGETS += futex
|
2016-11-21 18:16:11 +08:00
|
|
|
TARGETS += gpio
|
2017-01-12 00:16:07 +09:00
|
|
|
TARGETS += intel_pstate
|
2015-11-17 22:35:43 +08:00
|
|
|
TARGETS += ipc
|
2018-10-16 15:09:31 +01:00
|
|
|
TARGETS += ir
|
2013-04-30 15:27:06 -07:00
|
|
|
TARGETS += kcmp
|
2019-03-13 10:09:10 -04:00
|
|
|
TARGETS += kexec
|
2018-03-27 11:49:19 +02:00
|
|
|
TARGETS += kvm
|
2021-04-22 17:41:20 +02:00
|
|
|
TARGETS += landlock
|
2015-11-06 16:30:32 -08:00
|
|
|
TARGETS += lib
|
2019-01-09 13:43:29 +01:00
|
|
|
TARGETS += livepatch
|
2020-01-09 21:02:06 -08:00
|
|
|
TARGETS += lkdtm
|
2015-09-11 13:07:42 -07:00
|
|
|
TARGETS += membarrier
|
2014-08-08 14:25:32 -07:00
|
|
|
TARGETS += memfd
|
2013-04-30 15:27:06 -07:00
|
|
|
TARGETS += memory-hotplug
|
2020-08-06 23:23:51 -07:00
|
|
|
TARGETS += mincore
|
2014-07-29 15:50:44 -07:00
|
|
|
TARGETS += mount
|
2021-01-21 14:19:55 +01:00
|
|
|
TARGETS += mount_setattr
|
2021-07-15 13:07:14 +03:00
|
|
|
TARGETS += move_mount_set_group
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += mqueue
|
2021-01-27 22:08:29 +09:00
|
|
|
TARGETS += nci
|
2013-03-20 15:07:56 -04:00
|
|
|
TARGETS += net
|
2021-08-01 00:57:07 -07:00
|
|
|
TARGETS += net/af_unix
|
2020-03-23 16:24:04 +02:00
|
|
|
TARGETS += net/forwarding
|
2020-01-21 16:56:29 -08:00
|
|
|
TARGETS += net/mptcp
|
2018-10-31 18:26:21 +01:00
|
|
|
TARGETS += netfilter
|
2016-09-06 00:47:16 -07:00
|
|
|
TARGETS += nsfs
|
2018-12-29 22:27:33 +01:00
|
|
|
TARGETS += pidfd
|
2020-03-08 17:26:32 +01:00
|
|
|
TARGETS += pid_namespace
|
2013-08-06 17:42:35 +10:00
|
|
|
TARGETS += powerpc
|
2018-04-10 16:31:45 -07:00
|
|
|
TARGETS += proc
|
2015-10-02 20:46:39 +09:00
|
|
|
TARGETS += pstore
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += ptrace
|
2020-01-18 23:08:00 +11:00
|
|
|
TARGETS += openat2
|
2021-04-22 14:27:15 +02:00
|
|
|
TARGETS += rlimits
|
2018-06-02 08:44:08 -04:00
|
|
|
TARGETS += rseq
|
2018-04-19 14:50:29 +02:00
|
|
|
TARGETS += rtc
|
2015-06-16 10:54:14 -07:00
|
|
|
TARGETS += seccomp
|
2020-11-13 00:01:31 +02:00
|
|
|
TARGETS += sgx
|
2016-04-14 23:20:05 +03:00
|
|
|
TARGETS += sigaltstack
|
2014-12-03 10:42:21 -08:00
|
|
|
TARGETS += size
|
2018-04-26 10:54:09 -06:00
|
|
|
TARGETS += sparc64
|
2017-02-18 22:07:24 -05:00
|
|
|
TARGETS += splice
|
2015-09-09 21:06:25 +08:00
|
|
|
TARGETS += static_keys
|
2016-10-19 09:49:48 -03:00
|
|
|
TARGETS += sync
|
2020-11-27 14:32:36 -05:00
|
|
|
TARGETS += syscall_user_dispatch
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += sysctl
|
2020-07-17 14:54:39 -07:00
|
|
|
TARGETS += tc-testing
|
2019-11-12 01:27:17 +00:00
|
|
|
TARGETS += timens
|
2015-06-19 13:13:43 -06:00
|
|
|
ifneq (1, $(quicktest))
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += timers
|
2015-06-19 13:13:43 -06:00
|
|
|
endif
|
2019-03-05 15:49:24 -08:00
|
|
|
TARGETS += tmpfs
|
2019-02-04 15:16:40 +02:00
|
|
|
TARGETS += tpm2
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += user
|
2020-10-26 11:49:41 +00:00
|
|
|
TARGETS += vDSO
|
2014-12-18 16:17:43 -08:00
|
|
|
TARGETS += vm
|
2015-04-06 23:11:06 -07:00
|
|
|
TARGETS += x86
|
2015-08-18 12:31:59 +05:30
|
|
|
TARGETS += zram
|
2014-12-18 16:17:43 -08:00
|
|
|
#Please keep the TARGETS list alphabetically sorted
|
2015-06-19 13:13:43 -06:00
|
|
|
# Run "make quicktest=1 run_tests" or
|
2017-04-14 08:43:16 +09:00
|
|
|
# "make quicktest=1 kselftest" from top level Makefile
|
2012-01-12 17:20:44 -08:00
|
|
|
|
2014-07-02 09:51:38 -06:00
|
|
|
TARGETS_HOTPLUG = cpu-hotplug
|
|
|
|
|
TARGETS_HOTPLUG += memory-hotplug
|
|
|
|
|
|
2020-12-10 18:52:33 +00:00
|
|
|
# User can optionally provide a TARGETS skiplist. By default we skip
|
|
|
|
|
# BPF since it has cutting edge build time dependencies which require
|
|
|
|
|
# more effort to install.
|
|
|
|
|
SKIP_TARGETS ?= bpf
|
2019-09-26 18:52:18 +01:00
|
|
|
ifneq ($(SKIP_TARGETS),)
|
|
|
|
|
TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS))
|
|
|
|
|
override TARGETS := $(TMP)
|
|
|
|
|
endif
|
|
|
|
|
|
2020-02-06 09:40:00 +01:00
|
|
|
# User can set FORCE_TARGETS to 1 to require all targets to be successfully
|
|
|
|
|
# built; make will fail if any of the targets cannot be built. If
|
|
|
|
|
# FORCE_TARGETS is not set (the default), make will succeed if at least one
|
|
|
|
|
# of the targets gets built.
|
|
|
|
|
FORCE_TARGETS ?=
|
|
|
|
|
|
2020-07-28 00:32:41 -07:00
|
|
|
# Clear LDFLAGS and MAKEFLAGS when implicit rules are missing. This provides
|
|
|
|
|
# implicit rules to sub-test Makefiles which avoids build failures in test
|
|
|
|
|
# Makefile that don't have explicit build rules.
|
|
|
|
|
ifeq (,$(LINK.c))
|
2015-05-14 16:55:18 -03:00
|
|
|
override LDFLAGS =
|
2015-03-18 11:57:39 -06:00
|
|
|
override MAKEFLAGS =
|
|
|
|
|
endif
|
|
|
|
|
|
2020-02-26 15:54:49 -07:00
|
|
|
# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
|
2019-05-14 14:43:44 -06:00
|
|
|
# KBUILD_OUTPUT with selftest objects and headers installed
|
|
|
|
|
# by selftests Makefile or lib.mk.
|
2019-07-06 12:07:12 +09:00
|
|
|
ifdef building_out_of_srctree
|
2017-09-07 19:57:43 -06:00
|
|
|
override LDFLAGS =
|
|
|
|
|
endif
|
|
|
|
|
|
2019-04-15 15:51:42 -06:00
|
|
|
ifneq ($(O),)
|
2020-02-26 15:54:49 -07:00
|
|
|
BUILD := $(O)/kselftest
|
2019-04-15 15:51:42 -06:00
|
|
|
else
|
|
|
|
|
ifneq ($(KBUILD_OUTPUT),)
|
2019-11-28 16:03:21 -07:00
|
|
|
BUILD := $(KBUILD_OUTPUT)/kselftest
|
2019-04-15 15:51:42 -06:00
|
|
|
else
|
|
|
|
|
BUILD := $(shell pwd)
|
|
|
|
|
DEFAULT_INSTALL_HDR_PATH := 1
|
|
|
|
|
endif
|
2016-11-29 19:55:52 +08:00
|
|
|
endif
|
|
|
|
|
|
2019-04-15 15:51:42 -06:00
|
|
|
# Prepare for headers install
|
|
|
|
|
top_srcdir ?= ../../..
|
|
|
|
|
include $(top_srcdir)/scripts/subarch.include
|
|
|
|
|
ARCH ?= $(SUBARCH)
|
|
|
|
|
export KSFT_KHDR_INSTALL_DONE := 1
|
2016-11-29 19:55:52 +08:00
|
|
|
export BUILD
|
2019-04-15 15:51:42 -06:00
|
|
|
|
|
|
|
|
# set default goal to all, so make without a target runs all, even when
|
|
|
|
|
# all isn't the first target in the file.
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
|
|
|
|
|
# Install headers here once for all tests. KSFT_KHDR_INSTALL_DONE
|
|
|
|
|
# is used to avoid running headers_install from lib.mk.
|
|
|
|
|
# Invoke headers install with --no-builtin-rules to avoid circular
|
|
|
|
|
# dependency in "make kselftest" case. In this case, second level
|
|
|
|
|
# make inherits builtin-rules which will use the rule generate
|
|
|
|
|
# Makefile.o and runs into
|
|
|
|
|
# "Circular Makefile.o <- prepare dependency dropped."
|
|
|
|
|
# and headers_install fails and test compile fails.
|
|
|
|
|
#
|
|
|
|
|
# O= KBUILD_OUTPUT cases don't run into this error, since main Makefile
|
|
|
|
|
# invokes them as sub-makes and --no-builtin-rules is not necessary,
|
|
|
|
|
# but doesn't cause any failures. Keep it simple and use the same
|
|
|
|
|
# flags in both cases.
|
|
|
|
|
# Local build cases: "make kselftest", "make -C" - headers are installed
|
|
|
|
|
# in the default INSTALL_HDR_PATH usr/include.
|
|
|
|
|
khdr:
|
|
|
|
|
ifeq (1,$(DEFAULT_INSTALL_HDR_PATH))
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
|
2019-04-15 15:51:42 -06:00
|
|
|
else
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
|
2019-04-15 15:51:42 -06:00
|
|
|
ARCH=$(ARCH) -C $(top_srcdir) headers_install
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
all: khdr
|
2019-12-10 11:44:59 +00:00
|
|
|
@ret=1; \
|
|
|
|
|
for TARGET in $(TARGETS); do \
|
|
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
|
|
|
|
mkdir $$BUILD_TARGET -p; \
|
2020-02-06 09:40:00 +01:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \
|
|
|
|
|
$(if $(FORCE_TARGETS),|| exit); \
|
2019-12-10 11:44:59 +00:00
|
|
|
ret=$$((ret * $$?)); \
|
|
|
|
|
done; exit $$ret;
|
2012-01-12 17:20:44 -08:00
|
|
|
|
2012-03-28 14:42:54 -07:00
|
|
|
run_tests: all
|
2017-09-18 17:30:50 -06:00
|
|
|
@for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
|
2012-03-28 14:42:54 -07:00
|
|
|
done;
|
|
|
|
|
|
2014-07-02 09:51:38 -06:00
|
|
|
hotplug:
|
2017-09-18 17:30:50 -06:00
|
|
|
@for TARGET in $(TARGETS_HOTPLUG); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
|
2014-07-02 09:51:38 -06:00
|
|
|
done;
|
|
|
|
|
|
|
|
|
|
run_hotplug: hotplug
|
2017-09-18 17:30:50 -06:00
|
|
|
@for TARGET in $(TARGETS_HOTPLUG); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
|
2014-07-02 09:51:38 -06:00
|
|
|
done;
|
|
|
|
|
|
|
|
|
|
clean_hotplug:
|
2017-09-18 17:30:50 -06:00
|
|
|
@for TARGET in $(TARGETS_HOTPLUG); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
|
2014-07-02 09:51:38 -06:00
|
|
|
done;
|
|
|
|
|
|
2015-10-02 20:46:41 +09:00
|
|
|
run_pstore_crash:
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) -C pstore run_crash
|
2015-10-02 20:46:41 +09:00
|
|
|
|
2019-05-07 17:44:21 -06:00
|
|
|
# Use $BUILD as the default install root. $BUILD points to the
|
|
|
|
|
# right output location for the following cases:
|
|
|
|
|
# 1. output_dir=kernel_src
|
|
|
|
|
# 2. a separate output directory is specified using O= KBUILD_OUTPUT
|
|
|
|
|
# 3. a separate output directory is specified using KBUILD_OUTPUT
|
2019-09-26 16:40:14 -06:00
|
|
|
# Avoid conflict with INSTALL_PATH set by the main Makefile
|
2019-05-07 17:44:21 -06:00
|
|
|
#
|
2019-09-26 16:40:14 -06:00
|
|
|
KSFT_INSTALL_PATH ?= $(BUILD)/kselftest_install
|
|
|
|
|
KSFT_INSTALL_PATH := $(abspath $(KSFT_INSTALL_PATH))
|
|
|
|
|
# Avoid changing the rest of the logic here and lib.mk.
|
|
|
|
|
INSTALL_PATH := $(KSFT_INSTALL_PATH)
|
2015-03-11 15:06:00 +11:00
|
|
|
ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
|
2020-09-28 13:26:48 -07:00
|
|
|
TEST_LIST := $(INSTALL_PATH)/kselftest-list.txt
|
2015-03-11 15:06:00 +11:00
|
|
|
|
2019-05-07 17:44:21 -06:00
|
|
|
install: all
|
2015-03-11 15:06:00 +11:00
|
|
|
ifdef INSTALL_PATH
|
|
|
|
|
@# Ask all targets to install their files
|
2019-04-24 16:12:31 -07:00
|
|
|
mkdir -p $(INSTALL_PATH)/kselftest
|
2019-10-30 12:45:36 -07:00
|
|
|
install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/
|
2019-04-24 16:12:31 -07:00
|
|
|
install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
|
2019-04-24 16:12:35 -07:00
|
|
|
install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
|
2020-09-28 13:26:48 -07:00
|
|
|
install -m 744 run_kselftest.sh $(INSTALL_PATH)/
|
|
|
|
|
rm -f $(TEST_LIST)
|
2019-12-10 11:44:59 +00:00
|
|
|
@ret=1; \
|
|
|
|
|
for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2020-02-06 09:40:00 +01:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
|
|
|
|
|
$(if $(FORCE_TARGETS),|| exit); \
|
2019-12-10 11:44:59 +00:00
|
|
|
ret=$$((ret * $$?)); \
|
|
|
|
|
done; exit $$ret;
|
2015-03-11 15:06:00 +11:00
|
|
|
|
|
|
|
|
|
2020-09-28 13:26:48 -07:00
|
|
|
@# Ask all targets to emit their test scripts
|
|
|
|
|
@# While building kselftest-list.text skip also non-existent TARGET dirs:
|
2019-09-26 18:52:19 +01:00
|
|
|
@# they could be the result of a build failure and should NOT be
|
|
|
|
|
@# included in the generated runlist.
|
2015-03-11 15:06:00 +11:00
|
|
|
for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-10-22 13:27:17 +00:00
|
|
|
[ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \
|
2019-09-26 16:40:14 -06:00
|
|
|
echo -n "Emit Tests for $$TARGET\n"; \
|
2020-09-28 13:26:48 -07:00
|
|
|
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
|
|
|
|
|
-C $$TARGET emit_tests >> $(TEST_LIST); \
|
2015-03-11 15:06:00 +11:00
|
|
|
done;
|
|
|
|
|
else
|
|
|
|
|
$(error Error: set INSTALL_PATH to use install)
|
|
|
|
|
endif
|
|
|
|
|
|
2020-05-19 22:00:45 +02:00
|
|
|
FORMAT ?= .gz
|
|
|
|
|
TAR_PATH = $(abspath ${INSTALL_PATH}/kselftest-packages/kselftest.tar${FORMAT})
|
|
|
|
|
gen_tar: install
|
|
|
|
|
@mkdir -p ${INSTALL_PATH}/kselftest-packages/
|
|
|
|
|
@tar caf ${TAR_PATH} --exclude=kselftest-packages -C ${INSTALL_PATH} .
|
|
|
|
|
@echo "Created ${TAR_PATH}"
|
|
|
|
|
|
2012-01-12 17:20:44 -08:00
|
|
|
clean:
|
2017-09-18 17:30:50 -06:00
|
|
|
@for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-16 18:06:04 +02:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
|
2012-01-12 17:20:44 -08:00
|
|
|
done;
|
2015-03-11 15:06:00 +11:00
|
|
|
|
2020-05-19 22:00:45 +02:00
|
|
|
.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar
|