License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
2017-11-02 01:00:39 +08:00
|
|
|
TARGETS = android
|
2019-10-26 01:57:06 +08:00
|
|
|
TARGETS += arm64
|
2017-11-02 01:00:39 +08:00
|
|
|
TARGETS += bpf
|
2016-10-17 20:28:36 +08:00
|
|
|
TARGETS += breakpoints
|
2015-11-17 22:35:42 +08:00
|
|
|
TARGETS += capabilities
|
selftests: cgroup: add memory controller self-tests
Cgroups are used for controlling the physical resource distribution
(memory, CPU, io, etc) and often are used as basic building blocks
for large distributed computing systems. Even small differences
in the actual behavior may lead to significant incidents.
The codebase is under the active development, which will unlikely
stop at any time soon. Also it's scattered over different kernel
subsystems, which makes regressions more probable.
Given that, the lack of any tests is crying.
This patch implements some basic tests for the memory controller,
as well as a minimal required framework. It doesn't pretend for a
very good coverage, but pretends to be a starting point.
Hopefully, any following significant changes will include corresponding
tests.
Tests for CPU and io controllers, as well as cgroup core
are next in the todo list.
Signed-off-by: Roman Gushchin <guro@fb.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: kernel-team@fb.com
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-05-12 02:03:49 +08:00
|
|
|
TARGETS += cgroup
|
2019-10-14 18:45:38 +08:00
|
|
|
TARGETS += clone3
|
2017-01-13 14:36:45 +08:00
|
|
|
TARGETS += cpufreq
|
2013-05-01 06:27:06 +08:00
|
|
|
TARGETS += cpu-hotplug
|
2018-11-27 18:33:08 +08:00
|
|
|
TARGETS += drivers/dma-buf
|
2013-05-01 06:27:06 +08:00
|
|
|
TARGETS += efivarfs
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += exec
|
2018-03-14 00:55:27 +08:00
|
|
|
TARGETS += filesystems
|
2019-01-17 19:48:54 +08:00
|
|
|
TARGETS += filesystems/binderfs
|
2019-12-05 08:52:19 +08:00
|
|
|
TARGETS += filesystems/epoll
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += firmware
|
|
|
|
TARGETS += ftrace
|
2015-05-13 12:07:55 +08:00
|
|
|
TARGETS += futex
|
2016-11-21 18:16:11 +08:00
|
|
|
TARGETS += gpio
|
2017-01-11 23:16:07 +08:00
|
|
|
TARGETS += intel_pstate
|
2015-11-17 22:35:43 +08:00
|
|
|
TARGETS += ipc
|
2018-10-16 22:09:31 +08:00
|
|
|
TARGETS += ir
|
2013-02-28 09:05:56 +08:00
|
|
|
TARGETS += kcmp
|
2019-03-13 22:09:10 +08:00
|
|
|
TARGETS += kexec
|
2018-03-27 17:49:19 +08:00
|
|
|
TARGETS += kvm
|
2015-11-07 08:30:32 +08:00
|
|
|
TARGETS += lib
|
2019-01-09 20:43:29 +08:00
|
|
|
TARGETS += livepatch
|
2020-01-10 13:02:06 +08:00
|
|
|
TARGETS += lkdtm
|
2015-09-12 04:07:42 +08:00
|
|
|
TARGETS += membarrier
|
2014-08-09 05:25:32 +08:00
|
|
|
TARGETS += memfd
|
2013-05-01 06:27:06 +08:00
|
|
|
TARGETS += memory-hotplug
|
2014-07-30 06:50:44 +08:00
|
|
|
TARGETS += mount
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += mqueue
|
2013-03-21 03:07:56 +08:00
|
|
|
TARGETS += net
|
2020-03-23 22:24:04 +08:00
|
|
|
TARGETS += net/forwarding
|
2020-01-22 08:56:29 +08:00
|
|
|
TARGETS += net/mptcp
|
2018-11-01 01:26:21 +08:00
|
|
|
TARGETS += netfilter
|
2016-09-06 15:47:16 +08:00
|
|
|
TARGETS += nsfs
|
2018-12-30 05:27:33 +08:00
|
|
|
TARGETS += pidfd
|
2020-03-09 00:26:32 +08:00
|
|
|
TARGETS += pid_namespace
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += powerpc
|
2018-04-11 07:31:45 +08:00
|
|
|
TARGETS += proc
|
2015-10-02 19:46:39 +08:00
|
|
|
TARGETS += pstore
|
2013-05-01 06:28:00 +08:00
|
|
|
TARGETS += ptrace
|
2020-01-18 20:08:00 +08:00
|
|
|
TARGETS += openat2
|
2018-06-02 20:44:08 +08:00
|
|
|
TARGETS += rseq
|
2018-04-19 20:50:29 +08:00
|
|
|
TARGETS += rtc
|
2015-06-17 01:54:14 +08:00
|
|
|
TARGETS += seccomp
|
2016-04-15 04:20:05 +08:00
|
|
|
TARGETS += sigaltstack
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += size
|
2018-04-27 00:54:09 +08:00
|
|
|
TARGETS += sparc64
|
2017-02-19 11:07:24 +08:00
|
|
|
TARGETS += splice
|
2015-09-09 21:06:25 +08:00
|
|
|
TARGETS += static_keys
|
2016-10-19 20:49:48 +08:00
|
|
|
TARGETS += sync
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += sysctl
|
2019-11-12 09:27:17 +08:00
|
|
|
TARGETS += timens
|
2015-06-20 03:13:43 +08:00
|
|
|
ifneq (1, $(quicktest))
|
2013-06-28 08:06:43 +08:00
|
|
|
TARGETS += timers
|
2015-06-20 03:13:43 +08:00
|
|
|
endif
|
2019-03-06 07:49:24 +08:00
|
|
|
TARGETS += tmpfs
|
2019-02-04 21:16:40 +08:00
|
|
|
TARGETS += tpm2
|
2014-01-24 07:54:38 +08:00
|
|
|
TARGETS += user
|
2014-12-19 08:17:43 +08:00
|
|
|
TARGETS += vm
|
2015-04-07 14:11:06 +08:00
|
|
|
TARGETS += x86
|
2015-08-18 15:01:59 +08:00
|
|
|
TARGETS += zram
|
2014-12-19 08:17:43 +08:00
|
|
|
#Please keep the TARGETS list alphabetically sorted
|
2015-06-20 03:13:43 +08:00
|
|
|
# Run "make quicktest=1 run_tests" or
|
2017-04-14 07:43:16 +08:00
|
|
|
# "make quicktest=1 kselftest" from top level Makefile
|
2012-01-13 09:20:44 +08:00
|
|
|
|
2014-07-02 23:51:38 +08:00
|
|
|
TARGETS_HOTPLUG = cpu-hotplug
|
|
|
|
TARGETS_HOTPLUG += memory-hotplug
|
|
|
|
|
2019-09-27 01:52:18 +08:00
|
|
|
# User can optionally provide a TARGETS skiplist.
|
|
|
|
SKIP_TARGETS ?=
|
|
|
|
ifneq ($(SKIP_TARGETS),)
|
|
|
|
TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS))
|
|
|
|
override TARGETS := $(TMP)
|
|
|
|
endif
|
|
|
|
|
2020-02-06 16:40:00 +08: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 ?=
|
|
|
|
|
2015-03-19 01:57:39 +08:00
|
|
|
# Clear LDFLAGS and MAKEFLAGS if called from main
|
|
|
|
# Makefile to avoid test build failures when test
|
|
|
|
# Makefile doesn't have explicit build rules.
|
|
|
|
ifeq (1,$(MAKELEVEL))
|
2015-05-15 03:55:18 +08:00
|
|
|
override LDFLAGS =
|
2015-03-19 01:57:39 +08:00
|
|
|
override MAKEFLAGS =
|
|
|
|
endif
|
|
|
|
|
2020-02-27 06:54:49 +08:00
|
|
|
# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
|
2019-05-15 04:43:44 +08:00
|
|
|
# KBUILD_OUTPUT with selftest objects and headers installed
|
|
|
|
# by selftests Makefile or lib.mk.
|
2019-07-06 11:07:12 +08:00
|
|
|
ifdef building_out_of_srctree
|
2017-09-08 09:57:43 +08:00
|
|
|
override LDFLAGS =
|
|
|
|
endif
|
|
|
|
|
2019-04-16 05:51:42 +08:00
|
|
|
ifneq ($(O),)
|
2020-02-27 06:54:49 +08:00
|
|
|
BUILD := $(O)/kselftest
|
2019-04-16 05:51:42 +08:00
|
|
|
else
|
|
|
|
ifneq ($(KBUILD_OUTPUT),)
|
2019-11-29 07:03:21 +08:00
|
|
|
BUILD := $(KBUILD_OUTPUT)/kselftest
|
2019-04-16 05:51:42 +08:00
|
|
|
else
|
|
|
|
BUILD := $(shell pwd)
|
|
|
|
DEFAULT_INSTALL_HDR_PATH := 1
|
|
|
|
endif
|
2016-11-29 19:55:52 +08:00
|
|
|
endif
|
|
|
|
|
2019-04-16 05:51:42 +08: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-16 05:51:42 +08:00
|
|
|
|
2019-04-20 06:31:28 +08:00
|
|
|
# build and run gpio when output directory is the src dir.
|
|
|
|
# gpio has dependency on tools/gpio and builds tools/gpio
|
|
|
|
# objects in the src directory in all cases making the src
|
|
|
|
# repo dirty even when objects are relocated.
|
|
|
|
ifneq (1,$(DEFAULT_INSTALL_HDR_PATH))
|
|
|
|
TMP := $(filter-out gpio, $(TARGETS))
|
|
|
|
TARGETS := $(TMP)
|
|
|
|
endif
|
|
|
|
|
2019-04-16 05:51:42 +08: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-17 00:06:04 +08:00
|
|
|
$(MAKE) --no-builtin-rules ARCH=$(ARCH) -C $(top_srcdir) headers_install
|
2019-04-16 05:51:42 +08:00
|
|
|
else
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) --no-builtin-rules INSTALL_HDR_PATH=$$BUILD/usr \
|
2019-04-16 05:51:42 +08:00
|
|
|
ARCH=$(ARCH) -C $(top_srcdir) headers_install
|
|
|
|
endif
|
|
|
|
|
|
|
|
all: khdr
|
2019-12-10 19:44:59 +08:00
|
|
|
@ret=1; \
|
|
|
|
for TARGET in $(TARGETS); do \
|
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
|
|
|
mkdir $$BUILD_TARGET -p; \
|
2020-02-06 16:40:00 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \
|
|
|
|
$(if $(FORCE_TARGETS),|| exit); \
|
2019-12-10 19:44:59 +08:00
|
|
|
ret=$$((ret * $$?)); \
|
|
|
|
done; exit $$ret;
|
2012-01-13 09:20:44 +08:00
|
|
|
|
2012-03-29 05:42:54 +08:00
|
|
|
run_tests: all
|
2017-09-19 07:30:50 +08:00
|
|
|
@for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests;\
|
2012-03-29 05:42:54 +08:00
|
|
|
done;
|
|
|
|
|
2014-07-02 23:51:38 +08:00
|
|
|
hotplug:
|
2017-09-19 07:30:50 +08:00
|
|
|
@for TARGET in $(TARGETS_HOTPLUG); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
|
2014-07-02 23:51:38 +08:00
|
|
|
done;
|
|
|
|
|
|
|
|
run_hotplug: hotplug
|
2017-09-19 07:30:50 +08:00
|
|
|
@for TARGET in $(TARGETS_HOTPLUG); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
|
2014-07-02 23:51:38 +08:00
|
|
|
done;
|
|
|
|
|
|
|
|
clean_hotplug:
|
2017-09-19 07:30:50 +08:00
|
|
|
@for TARGET in $(TARGETS_HOTPLUG); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
|
2014-07-02 23:51:38 +08:00
|
|
|
done;
|
|
|
|
|
2015-10-02 19:46:41 +08:00
|
|
|
run_pstore_crash:
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) -C pstore run_crash
|
2015-10-02 19:46:41 +08:00
|
|
|
|
2019-05-08 07:44:21 +08: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-27 06:40:14 +08:00
|
|
|
# Avoid conflict with INSTALL_PATH set by the main Makefile
|
2019-05-08 07:44:21 +08:00
|
|
|
#
|
2019-09-27 06:40:14 +08: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 12:06:00 +08:00
|
|
|
ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
|
|
|
|
|
2019-05-08 07:44:21 +08:00
|
|
|
install: all
|
2015-03-11 12:06:00 +08:00
|
|
|
ifdef INSTALL_PATH
|
|
|
|
@# Ask all targets to install their files
|
2019-04-25 07:12:31 +08:00
|
|
|
mkdir -p $(INSTALL_PATH)/kselftest
|
2019-10-31 03:45:36 +08:00
|
|
|
install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/
|
2019-04-25 07:12:31 +08:00
|
|
|
install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
|
2019-04-25 07:12:35 +08:00
|
|
|
install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
|
2019-12-10 19:44:59 +08:00
|
|
|
@ret=1; \
|
|
|
|
for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2020-02-06 16:40:00 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
|
|
|
|
$(if $(FORCE_TARGETS),|| exit); \
|
2019-12-10 19:44:59 +08:00
|
|
|
ret=$$((ret * $$?)); \
|
|
|
|
done; exit $$ret;
|
2015-03-11 12:06:00 +08:00
|
|
|
|
|
|
|
@# Ask all targets to emit their test scripts
|
2016-12-14 18:59:34 +08:00
|
|
|
echo "#!/bin/sh" > $(ALL_SCRIPT)
|
2018-01-16 14:10:39 +08:00
|
|
|
echo "BASE_DIR=\$$(realpath \$$(dirname \$$0))" >> $(ALL_SCRIPT)
|
|
|
|
echo "cd \$$BASE_DIR" >> $(ALL_SCRIPT)
|
2019-04-25 07:12:31 +08:00
|
|
|
echo ". ./kselftest/runner.sh" >> $(ALL_SCRIPT)
|
2015-03-11 12:06:00 +08:00
|
|
|
echo "ROOT=\$$PWD" >> $(ALL_SCRIPT)
|
2018-01-16 14:10:39 +08:00
|
|
|
echo "if [ \"\$$1\" = \"--summary\" ]; then" >> $(ALL_SCRIPT)
|
2019-04-25 07:12:31 +08:00
|
|
|
echo " logfile=\$$BASE_DIR/output.log" >> $(ALL_SCRIPT)
|
|
|
|
echo " cat /dev/null > \$$logfile" >> $(ALL_SCRIPT)
|
2018-01-16 14:10:39 +08:00
|
|
|
echo "fi" >> $(ALL_SCRIPT)
|
2015-03-11 12:06:00 +08:00
|
|
|
|
2019-09-27 01:52:19 +08:00
|
|
|
@# While building run_kselftest.sh skip also non-existent TARGET dirs:
|
|
|
|
@# they could be the result of a build failure and should NOT be
|
|
|
|
@# included in the generated runlist.
|
2015-03-11 12:06:00 +08:00
|
|
|
for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-10-22 21:27:17 +08:00
|
|
|
[ ! -d $(INSTALL_PATH)/$$TARGET ] && echo "Skipping non-existent dir: $$TARGET" && continue; \
|
2018-03-23 17:44:27 +08:00
|
|
|
echo "[ -w /dev/kmsg ] && echo \"kselftest: Running tests in $$TARGET\" >> /dev/kmsg" >> $(ALL_SCRIPT); \
|
2015-03-11 12:06:00 +08:00
|
|
|
echo "cd $$TARGET" >> $(ALL_SCRIPT); \
|
2019-04-25 07:12:32 +08:00
|
|
|
echo -n "run_many" >> $(ALL_SCRIPT); \
|
2019-09-27 06:40:14 +08:00
|
|
|
echo -n "Emit Tests for $$TARGET\n"; \
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET -C $$TARGET emit_tests >> $(ALL_SCRIPT); \
|
2019-04-25 07:12:32 +08:00
|
|
|
echo "" >> $(ALL_SCRIPT); \
|
2015-03-11 12:06:00 +08:00
|
|
|
echo "cd \$$ROOT" >> $(ALL_SCRIPT); \
|
|
|
|
done;
|
|
|
|
|
|
|
|
chmod u+x $(ALL_SCRIPT)
|
|
|
|
else
|
|
|
|
$(error Error: set INSTALL_PATH to use install)
|
|
|
|
endif
|
|
|
|
|
2020-05-20 04:00:45 +08: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-13 09:20:44 +08:00
|
|
|
clean:
|
2017-09-19 07:30:50 +08:00
|
|
|
@for TARGET in $(TARGETS); do \
|
2016-11-29 19:55:52 +08:00
|
|
|
BUILD_TARGET=$$BUILD/$$TARGET; \
|
2019-08-17 00:06:04 +08:00
|
|
|
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
|
2012-01-13 09:20:44 +08:00
|
|
|
done;
|
2015-03-11 12:06:00 +08:00
|
|
|
|
2020-05-20 04:00:45 +08:00
|
|
|
.PHONY: khdr all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar
|