linux-stable/tools/testing/selftests/Makefile

279 lines
7.7 KiB
Makefile
Raw Normal View History

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 14:07:57 +00:00
# SPDX-License-Identifier: GPL-2.0
TARGETS += alsa
TARGETS += amd-pstate
TARGETS += arm64
TARGETS += bpf
TARGETS += breakpoints
TARGETS += cachestat
TARGETS += capabilities
TARGETS += cgroup
TARGETS += clone3
TARGETS += connector
TARGETS += core
TARGETS += cpufreq
TARGETS += cpu-hotplug
TARGETS += damon
TARGETS += dmabuf-heaps
TARGETS += drivers/dma-buf
selftests: drivers/s390x: Add uvdevice tests Adds some selftests to test ioctl error paths of the uv-uapi. The Kconfig S390_UV_UAPI must be selected and the Ultravisor facility must be available. The test can be executed by non-root, however, the uvdevice special file /dev/uv must be accessible for reading and writing which may imply root privileges. ./test-uv-device TAP version 13 1..6 # Starting 6 tests from 3 test cases. # RUN uvio_fixture.att.fault_ioctl_arg ... # OK uvio_fixture.att.fault_ioctl_arg ok 1 uvio_fixture.att.fault_ioctl_arg # RUN uvio_fixture.att.fault_uvio_arg ... # OK uvio_fixture.att.fault_uvio_arg ok 2 uvio_fixture.att.fault_uvio_arg # RUN uvio_fixture.att.inval_ioctl_cb ... # OK uvio_fixture.att.inval_ioctl_cb ok 3 uvio_fixture.att.inval_ioctl_cb # RUN uvio_fixture.att.inval_ioctl_cmd ... # OK uvio_fixture.att.inval_ioctl_cmd ok 4 uvio_fixture.att.inval_ioctl_cmd # RUN attest_fixture.att_inval_request ... # OK attest_fixture.att_inval_request ok 5 attest_fixture.att_inval_request # RUN attest_fixture.att_inval_addr ... # OK attest_fixture.att_inval_addr ok 6 attest_fixture.att_inval_addr # PASSED: 6 / 6 tests passed. # Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0 Signed-off-by: Steffen Eiden <seiden@linux.ibm.com> Acked-by: Janosch Frank <frankja@linux.ibm.com> Message-Id: <20220510144724.3321985-3-seiden@linux.ibm.com> Link: https://lore.kernel.org/kvm/20220510144724.3321985-3-seiden@linux.ibm.com/ Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
2022-05-10 14:47:24 +00:00
TARGETS += drivers/s390x/uvdevice
TARGETS += drivers/net/bonding
TARGETS += drivers/net/team
TARGETS += dt
TARGETS += efivarfs
TARGETS += exec
TARGETS += fchmodat2
TARGETS += filesystems
TARGETS += filesystems/binderfs
TARGETS += filesystems/epoll
TARGETS += filesystems/fat
TARGETS += filesystems/overlayfs
TARGETS += filesystems/statmount
TARGETS += firmware
TARGETS += fpu
TARGETS += ftrace
TARGETS += futex
TARGETS += gpio
TARGETS += hid
TARGETS += intel_pstate
TARGETS += iommu
TARGETS += ipc
TARGETS += ir
TARGETS += kcmp
TARGETS += kexec
TARGETS += kvm
TARGETS += landlock
TARGETS += lib
TARGETS += livepatch
TARGETS += lkdtm
TARGETS += lsm
TARGETS += membarrier
TARGETS += memfd
TARGETS += memory-hotplug
TARGETS += mincore
TARGETS += mount
tests: add mount_setattr() selftests Add a range of selftests for the new mount_setattr() syscall to verify that it works as expected. This tests that: - no invalid flags can be specified - changing properties of a single mount works and leaves other mounts in the mount tree unchanged - changing a mount tre to read-only when one of the mounts has writers fails and leaves the whole mount tree unchanged - changing mount properties from multiple threads works - changing atime settings works - changing mount propagation works - changing the mount options of a mount tree where the individual mounts in the tree have different mount options only changes the flags that were requested to change - changing mount options from another mount namespace fails - changing mount options from another user namespace fails - idmapped mounts Note, the main test-suite for idmapped mounts is part of xfstests and is pretty huge. These tests here just make sure that the syscalls bits work correctly. TAP version 13 1..20 # Starting 20 tests from 3 test cases. # RUN mount_setattr.invalid_attributes ... # OK mount_setattr.invalid_attributes ok 1 mount_setattr.invalid_attributes # RUN mount_setattr.extensibility ... # OK mount_setattr.extensibility ok 2 mount_setattr.extensibility # RUN mount_setattr.basic ... # OK mount_setattr.basic ok 3 mount_setattr.basic # RUN mount_setattr.basic_recursive ... # OK mount_setattr.basic_recursive ok 4 mount_setattr.basic_recursive # RUN mount_setattr.mount_has_writers ... # OK mount_setattr.mount_has_writers ok 5 mount_setattr.mount_has_writers # RUN mount_setattr.mixed_mount_options ... # OK mount_setattr.mixed_mount_options ok 6 mount_setattr.mixed_mount_options # RUN mount_setattr.time_changes ... # OK mount_setattr.time_changes ok 7 mount_setattr.time_changes # RUN mount_setattr.multi_threaded ... # OK mount_setattr.multi_threaded ok 8 mount_setattr.multi_threaded # RUN mount_setattr.wrong_user_namespace ... # OK mount_setattr.wrong_user_namespace ok 9 mount_setattr.wrong_user_namespace # RUN mount_setattr.wrong_mount_namespace ... # OK mount_setattr.wrong_mount_namespace ok 10 mount_setattr.wrong_mount_namespace # RUN mount_setattr_idmapped.invalid_fd_negative ... # OK mount_setattr_idmapped.invalid_fd_negative ok 11 mount_setattr_idmapped.invalid_fd_negative # RUN mount_setattr_idmapped.invalid_fd_large ... # OK mount_setattr_idmapped.invalid_fd_large ok 12 mount_setattr_idmapped.invalid_fd_large # RUN mount_setattr_idmapped.invalid_fd_closed ... # OK mount_setattr_idmapped.invalid_fd_closed ok 13 mount_setattr_idmapped.invalid_fd_closed # RUN mount_setattr_idmapped.invalid_fd_initial_userns ... # OK mount_setattr_idmapped.invalid_fd_initial_userns ok 14 mount_setattr_idmapped.invalid_fd_initial_userns # RUN mount_setattr_idmapped.attached_mount_inside_current_mount_namespace ... # OK mount_setattr_idmapped.attached_mount_inside_current_mount_namespace ok 15 mount_setattr_idmapped.attached_mount_inside_current_mount_namespace # RUN mount_setattr_idmapped.attached_mount_outside_current_mount_namespace ... # OK mount_setattr_idmapped.attached_mount_outside_current_mount_namespace ok 16 mount_setattr_idmapped.attached_mount_outside_current_mount_namespace # RUN mount_setattr_idmapped.detached_mount_inside_current_mount_namespace ... # OK mount_setattr_idmapped.detached_mount_inside_current_mount_namespace ok 17 mount_setattr_idmapped.detached_mount_inside_current_mount_namespace # RUN mount_setattr_idmapped.detached_mount_outside_current_mount_namespace ... # OK mount_setattr_idmapped.detached_mount_outside_current_mount_namespace ok 18 mount_setattr_idmapped.detached_mount_outside_current_mount_namespace # RUN mount_setattr_idmapped.change_idmapping ... # OK mount_setattr_idmapped.change_idmapping ok 19 mount_setattr_idmapped.change_idmapping # RUN mount_setattr_idmapped.idmap_mount_tree_invalid ... # OK mount_setattr_idmapped.idmap_mount_tree_invalid ok 20 mount_setattr_idmapped.idmap_mount_tree_invalid # PASSED: 20 / 20 tests passed. # Totals: pass:20 fail:0 xfail:0 xpass:0 skip:0 error:0 Link: https://lore.kernel.org/r/20210121131959.646623-37-christian.brauner@ubuntu.com Cc: Christoph Hellwig <hch@lst.de> Cc: David Howells <dhowells@redhat.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
2021-01-21 13:19:55 +00:00
TARGETS += mount_setattr
TARGETS += move_mount_set_group
TARGETS += mqueue
TARGETS += nci
TARGETS += net
TARGETS += net/af_unix
TARGETS += net/forwarding
TARGETS += net/hsr
mptcp: add basic kselftest for mptcp Add mptcp_connect tool: xmit two files back and forth between two processes, several net namespaces including some adding delays, losses and reordering. Wrapper script tests that data was transmitted without corruption. The "-c" command line option for mptcp_connect.sh is there for debugging: The script will use tcpdump to create one .pcap file per test case, named according to the namespaces, protocols, and connect address in use. For example, the first test case writes the capture to ns1-ns1-MPTCP-MPTCP-10.0.1.1.pcap. The stderr output from tcpdump is printed after the test completes to show tcpdump's "packets dropped by kernel" information. Also check that userspace can't create MPTCP sockets when mptcp.enabled sysctl is off. The "-b" option allows to tune/lower send buffer size. "-m mmap" can be used to test blocking io. Default is non-blocking io using read/write/poll. Will run automatically on "make kselftest". Note that the default timeout of 45 seconds is used even if there is a "settings" changing it to 450. 45 seconds should be enough in most cases but this depends on the machine running the tests. A fix to correctly read the "settings" file has been proposed upstream but not applied yet. It is not blocking the execution of these new tests but it would be nice to have it: https://patchwork.kernel.org/patch/11204935/ Co-developed-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Co-developed-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com> Co-developed-by: Matthieu Baerts <matthieu.baerts@tessares.net> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net> Co-developed-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: Davide Caratti <dcaratti@redhat.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Christoph Paasch <cpaasch@apple.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-22 00:56:29 +00:00
TARGETS += net/mptcp
TARGETS += net/openvswitch
TARGETS += netfilter
TARGETS += nsfs
TARGETS += perf_events
TARGETS += pidfd
TARGETS += pid_namespace
TARGETS += powerpc
TARGETS += prctl
TARGETS += proc
selftests/pstore: add pstore test script for pre-reboot The pstore_tests script includes test cases which check pstore's behavior before crash (and reboot). The test cases are currently following. - Check pstore backend is registered - Check pstore console is registered - Check /dev/pmsg0 exists - Write unique string to /dev/pmsg0 The unique string written to /dev/pmsg includes UUID. The UUID is also left in 'uuid' file in order to enable us to check if the pmsg keeps the string correctly after reboot. Example usage is following. # cd /path/to/selftests # make run_tests -C pstore (or just .pstore/pstore_tests) make: Entering directory '/path/to/selftests/pstore' === Pstore unit tests (pstore_tests) === UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 Checking pstore console is registered ... ok Checking /dev/pmsg0 exists ... ok Writing unique string to /dev/pmsg0 ... ok selftests: pstore_tests [PASS] make: Leaving directory '/path/to/selftests/pstore' We can also see test logs later. # cat pstore/logs/20151001-072718_b49b02cf-b0c2-4309-be43-b08c3971e37f/pstore_tests.log Thu Oct 1 07:27:18 UTC 2015 === Pstore unit tests (pstore_tests) === UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 Checking pstore console is registered ... ok Checking /dev/pmsg0 exists ... ok Writing unique string to /dev/pmsg0 ... ok Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Colin Cross <ccross@android.com> Cc: Kees Cook <keescook@chromium.org> Cc: Mark Salyzyn <salyzyn@android.com> Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com> Cc: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-10-02 11:46:39 +00:00
TARGETS += pstore
TARGETS += ptrace
TARGETS += openat2
TARGETS += resctrl
TARGETS += riscv
TARGETS += rlimits
TARGETS += rseq
TARGETS += rtc
TARGETS += seccomp
TARGETS += sgx
TARGETS += sigaltstack
TARGETS += size
TARGETS += sparc64
TARGETS += splice
TARGETS += static_keys
TARGETS += sync
TARGETS += syscall_user_dispatch
TARGETS += sysctl
TARGETS += tc-testing
selftests/tdx: Test TDX attestation GetReport support Attestation is used to verify the trustworthiness of a TDX guest. During the guest bring-up, the Intel TDX module measures and records the initial contents and configuration of the guest, and at runtime, guest software uses runtime measurement registers (RMTRs) to measure and record details related to kernel image, command line params, ACPI tables, initrd, etc. At guest runtime, the attestation process is used to attest to these measurements. The first step in the TDX attestation process is to get the TDREPORT data. It is a fixed size data structure generated by the TDX module which includes the above mentioned measurements data, a MAC ID to protect the integrity of the TDREPORT, and a 64-Byte of user specified data passed during TDREPORT request which can uniquely identify the TDREPORT. Intel's TDX guest driver exposes TDX_CMD_GET_REPORT0 IOCTL interface to enable guest userspace to get the TDREPORT subtype 0. Add a kernel self test module to test this ABI and verify the validity of the generated TDREPORT. Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Kai Huang <kai.huang@intel.com> Acked-by: Wander Lairson Costa <wander@redhat.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Link: https://lore.kernel.org/all/20221116223820.819090-4-sathyanarayanan.kuppuswamy%40linux.intel.com
2022-11-16 22:38:20 +00:00
TARGETS += tdx
TARGETS += thermal/intel/power_floor
TARGETS += thermal/intel/workload_hint
TARGETS += timens
ifneq (1, $(quicktest))
TARGETS += timers
endif
TARGETS += tmpfs
TARGETS += tpm2
TARGETS += tty
TARGETS += uevent
TARGETS += user
TARGETS += user_events
TARGETS += vDSO
TARGETS += mm
x86, selftests: Add sigreturn selftest This is my sigreturn test, added mostly unchanged from its old home. It exercises the sigreturn(2) syscall, specifically focusing on its interactions with various IRET corner cases. It tests for correct behavior in several areas that were historically dangerously buggy. For example, it exercises espfix on kernels of both bitnesses under various conditions, and it contains testcases for several now-fixed bugs in IRET error handling. If you run it on older kernels without the fixes, your system will crash. It probably won't eat your data in the process. There is no released kernel on which the sigreturn_64 test will pass, but it passes on tip:x86/asm. I plan to switch to lib.mk for Linux 4.2. I'm not using the ksft_ helpers at all yet. I can do that later. Signed-off-by: Andy Lutomirski <luto@kernel.org> Acked-by: Shuah Khan <shuahkh@osg.samsung.com> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: Denys Vlasenko <vda.linux@googlemail.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Shuah Khan <shuah.kh@samsung.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/89d10b76b92c7202d8123654dc8d36701c017b3d.1428386971.git.luto@kernel.org [ Fixed empty format string GCC build warning in trivial_32bit_program.c ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
2015-04-07 06:11:06 +00:00
TARGETS += x86
selftests/zram: Adding zram tests zram: Compressed RAM based block devices ---------------------------------------- The zram module creates RAM based block devices named /dev/zram<id> (<id> = 0, 1, ...). Pages written to these disks are compressed and stored in memory itself. These disks allow very fast I/O and compression provides good amounts of memory savings. Some of the usecases include /tmp storage, use as swap disks, various caches under /var and maybe many more :) Statistics for individual zram devices are exported through sysfs nodes at /sys/block/zram<id>/ This patch is to validate the zram functionality. Test interacts with block device /dev/zram<id> and sysfs nodes /sys/block/zram<id>/ zram.sh: sanity check of CONFIG_ZRAM and to run zram01 and zram02 tests zram01.sh: creates general purpose ram disks with different filesystems zram02.sh: creates block device for swap zram_lib.sh: create library with initialization/cleanup functions README: ZRAM introduction and Kconfig required. Makefile: To run zram tests zram test output ----------------- ./zram.sh -------------------- running zram tests -------------------- /dev/zram0 device file found: OK set max_comp_streams to zram device(s) /sys/block/zram0/max_comp_streams = '2' (1/1) zram max streams: OK test that we can set compression algorithm supported algs: [lzo] lz4 /sys/block/zram0/comp_algorithm = 'lzo' (1/1) zram set compression algorithm: OK set disk size to zram device(s) /sys/block/zram0/disksize = '2097152' (1/1) zram set disksizes: OK set memory limit to zram device(s) /sys/block/zram0/mem_limit = '2M' (1/1) zram set memory limit: OK make ext4 filesystem on /dev/zram0 zram mkfs.ext4: OK mount /dev/zram0 zram mount of zram device(s): OK fill zram0... zram0 can be filled with '1932' KB zram used 3M, zram disk sizes 2097152M zram compression ratio: 699050.66:1: OK zram cleanup zram01 : [PASS] /dev/zram0 device file found: OK set max_comp_streams to zram device(s) /sys/block/zram0/max_comp_streams = '2' (1/1) zram max streams: OK set disk size to zram device(s) /sys/block/zram0/disksize = '1048576' (1/1) zram set disksizes: OK set memory limit to zram device(s) /sys/block/zram0/mem_limit = '1M' (1/1) zram set memory limit: OK make swap with zram device(s) done with /dev/zram0 zram making zram mkswap and swapon: OK zram swapoff: OK zram cleanup zram02 : [PASS] CC: Shuah Khan <shuahkh@osg.samsung.com> CC: Tyler Baker <tyler.baker@linaro.org> CC: Milosz Wasilewski <milosz.wasilewski@linaro.org> CC: Alexey Kodanev <alexey.kodanev@oracle.com> Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> Reviewed-By: Tyler Baker <tyler.baker@linaro.org> Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-08-18 07:01:59 +00:00
TARGETS += zram
#Please keep the TARGETS list alphabetically sorted
# Run "make quicktest=1 run_tests" or
# "make quicktest=1 kselftest" from top level Makefile
TARGETS_HOTPLUG = cpu-hotplug
TARGETS_HOTPLUG += memory-hotplug
selftests: Skip BPF seftests by default The BPF selftests have build time dependencies on cutting edge versions of tools in the BPF ecosystem including LLVM which are more involved to satisfy than more typical requirements like installing a package from your distribution. This causes issues for users looking at kselftest in as a whole who find that a default build of kselftest fails and that resolving this is time consuming and adds administrative overhead. The fast pace of BPF development and the need for a full BPF stack to do substantial development or validation work on the code mean that people working directly on it don't see a reasonable way to keep supporting older environments without causing problems with the usability of the BPF tests in BPF development so these requirements are unlikely to be relaxed in the immediate future. There is already support for skipping targets so in order to reduce the barrier to entry for people interested in kselftest as a whole let's use that to skip the BPF tests by default when people work with the top level kselftest build system. Users can still build the BPF selftests as part of the wider kselftest build by specifying SKIP_TARGETS, including setting an empty SKIP_TARGETS to build everything. They can also continue to build the BPF selftests individually in cases where they are specifically focused on BPF. This isn't ideal since it means people will need to take special steps to build the BPF tests but the dependencies mean that realistically this is already the case to some extent and it makes it easier for people to pick up and work with the other selftests which is hopefully a net win. Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
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
ifneq ($(SKIP_TARGETS),)
TMP := $(filter-out $(SKIP_TARGETS), $(TARGETS))
override TARGETS := $(TMP)
endif
# 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 ?=
# 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))
override LDFLAGS =
override MAKEFLAGS =
endif
# Append kselftest to KBUILD_OUTPUT and O to avoid cluttering
# KBUILD_OUTPUT with selftest objects and headers installed
# by selftests Makefile or lib.mk.
ifdef building_out_of_srctree
override LDFLAGS =
endif
top_srcdir ?= ../../..
ifeq ("$(origin O)", "command line")
KBUILD_OUTPUT := $(O)
endif
ifneq ($(KBUILD_OUTPUT),)
# Make's built-in functions such as $(abspath ...), $(realpath ...) cannot
# expand a shell special character '~'. We use a somewhat tedious way here.
abs_objtree := $(shell cd $(top_srcdir) && mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) && pwd)
$(if $(abs_objtree),, \
$(error failed to create output directory "$(KBUILD_OUTPUT)"))
# $(realpath ...) resolves symlinks
abs_objtree := $(realpath $(abs_objtree))
BUILD := $(abs_objtree)/kselftest
KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
else
BUILD := $(CURDIR)
abs_srctree := $(shell cd $(top_srcdir) && pwd)
KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
DEFAULT_INSTALL_HDR_PATH := 1
endif
# Prepare for headers install
include $(top_srcdir)/scripts/subarch.include
ARCH ?= $(SUBARCH)
export BUILD
export KHDR_INCLUDES
# 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
Revert "selftests: error out if kernel header files are not yet built" This reverts commit 9fc96c7c19df ("selftests: error out if kernel header files are not yet built"). It turns out that requiring the kernel headers to be built as a prerequisite to building selftests, does not work in many cases. For example, Peter Zijlstra writes: "My biggest beef with the whole thing is that I simply do not want to use 'make headers', it doesn't work for me. I have a ton of output directories and I don't care to build tools into the output dirs, in fact some of them flat out refuse to work that way (bpf comes to mind)." [1] Therefore, stop erroring out on the selftests build. Additional patches will be required in order to change over to not requiring the kernel headers. [1] https://lore.kernel.org/20231208221007.GO28727@noisy.programming.kicks-ass.net Link: https://lkml.kernel.org/r/20231209020144.244759-1-jhubbard@nvidia.com Fixes: 9fc96c7c19df ("selftests: error out if kernel header files are not yet built") Signed-off-by: John Hubbard <jhubbard@nvidia.com> Cc: Anders Roxell <anders.roxell@linaro.org> Cc: Muhammad Usama Anjum <usama.anjum@collabora.com> Cc: David Hildenbrand <david@redhat.com> Cc: Peter Xu <peterx@redhat.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Marcos Paulo de Souza <mpdesouza@suse.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2023-12-09 02:01:44 +00:00
all:
@ret=1; \
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
mkdir $$BUILD_TARGET -p; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET \
O=$(abs_objtree) \
$(if $(FORCE_TARGETS),|| exit); \
ret=$$((ret * $$?)); \
done; exit $$ret;
run_tests: all
@for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests \
O=$(abs_objtree); \
done;
hotplug:
@for TARGET in $(TARGETS_HOTPLUG); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET;\
done;
run_hotplug: hotplug
@for TARGET in $(TARGETS_HOTPLUG); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_full_test;\
done;
clean_hotplug:
@for TARGET in $(TARGETS_HOTPLUG); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;
selftests/pstore: add pstore test scripts going with reboot To test pstore in earnest, we have to cause kernel crash and check pstore filesystem after reboot. We add two scripts: - pstore_crash_test This script causes kernel crash and reboot. It is executed by 'make run_pstore_crash' in selftests. It can also be used with kdump. - pstore_post_reboot_tests This script includes test cases which check pstore's behavior after crash and reboot. It is executed together with pstore_tests by 'make run_tests [-C pstore]' in selftests. The test cases in pstore_post_reboot_tests are currently following. - Check pstore backend is registered - Mount pstore filesystem - Check dmesg/console/pmsg files exist in pstore filesystem - Check dmesg/console files contain oops end marker - Check pmsg file properly keeps the content written before crash - Remove all files in pstore filesystem Example usage is following. (before reboot) # cd /path/to/selftests # make run_tests -C pstore === Pstore unit tests (pstore_tests) === UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f ... selftests: pstore_tests [PASS] === Pstore unit tests (pstore_post_reboot_tests) === UUID=953eb1bc-8e03-48d7-b27a-6552b24c5b7e Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 pstore_crash_test has not been executed yet. we skip further tests. selftests: pstore_post_reboot_tests [PASS] # make run_pstore_crash === Pstore unit tests (pstore_crash_test) === UUID=93c8972d-1466-430b-8c4a-28d8681e74c6 Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 Causing kernel crash ... (kernel crash and reboot) ... (after reboot) # make run_tests -C pstore === Pstore unit tests (pstore_tests) === UUID=8e511e77-2285-499f-8bc0-900d9af1fbcc ... selftests: pstore_tests [PASS] === Pstore unit tests (pstore_post_reboot_tests) === UUID=2dcc2132-4f3c-45aa-a38f-3b54bff8cef1 Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 Mounting pstore filesystem ... ok Checking dmesg files exist in pstore filesystem ... ok dmesg-ramoops-0 dmesg-ramoops-1 Checking console files exist in pstore filesystem ... ok console-ramoops-0 Checking pmsg files exist in pstore filesystem ... ok pmsg-ramoops-0 Checking dmesg files contain oops end marker dmesg-ramoops-0 ... ok dmesg-ramoops-1 ... ok Checking console file contains oops end marker ... ok Checking pmsg file properly keeps the content written before crash ... ok Removing all files in pstore filesystem console-ramoops-0 ... ok dmesg-ramoops-0 ... ok dmesg-ramoops-1 ... ok pmsg-ramoops-0 ... ok selftests: pstore_post_reboot_tests [PASS] Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Colin Cross <ccross@android.com> Cc: Kees Cook <keescook@chromium.org> Cc: Mark Salyzyn <salyzyn@android.com> Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com> Cc: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-10-02 11:46:41 +00:00
run_pstore_crash:
$(MAKE) -C pstore run_crash
selftests/pstore: add pstore test scripts going with reboot To test pstore in earnest, we have to cause kernel crash and check pstore filesystem after reboot. We add two scripts: - pstore_crash_test This script causes kernel crash and reboot. It is executed by 'make run_pstore_crash' in selftests. It can also be used with kdump. - pstore_post_reboot_tests This script includes test cases which check pstore's behavior after crash and reboot. It is executed together with pstore_tests by 'make run_tests [-C pstore]' in selftests. The test cases in pstore_post_reboot_tests are currently following. - Check pstore backend is registered - Mount pstore filesystem - Check dmesg/console/pmsg files exist in pstore filesystem - Check dmesg/console files contain oops end marker - Check pmsg file properly keeps the content written before crash - Remove all files in pstore filesystem Example usage is following. (before reboot) # cd /path/to/selftests # make run_tests -C pstore === Pstore unit tests (pstore_tests) === UUID=b49b02cf-b0c2-4309-be43-b08c3971e37f ... selftests: pstore_tests [PASS] === Pstore unit tests (pstore_post_reboot_tests) === UUID=953eb1bc-8e03-48d7-b27a-6552b24c5b7e Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 pstore_crash_test has not been executed yet. we skip further tests. selftests: pstore_post_reboot_tests [PASS] # make run_pstore_crash === Pstore unit tests (pstore_crash_test) === UUID=93c8972d-1466-430b-8c4a-28d8681e74c6 Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 Causing kernel crash ... (kernel crash and reboot) ... (after reboot) # make run_tests -C pstore === Pstore unit tests (pstore_tests) === UUID=8e511e77-2285-499f-8bc0-900d9af1fbcc ... selftests: pstore_tests [PASS] === Pstore unit tests (pstore_post_reboot_tests) === UUID=2dcc2132-4f3c-45aa-a38f-3b54bff8cef1 Checking pstore backend is registered ... ok backend=ramoops cmdline=console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=768M ramoops.mem_address=0x30000000 ramoops.mem_size=0x10000 Mounting pstore filesystem ... ok Checking dmesg files exist in pstore filesystem ... ok dmesg-ramoops-0 dmesg-ramoops-1 Checking console files exist in pstore filesystem ... ok console-ramoops-0 Checking pmsg files exist in pstore filesystem ... ok pmsg-ramoops-0 Checking dmesg files contain oops end marker dmesg-ramoops-0 ... ok dmesg-ramoops-1 ... ok Checking console file contains oops end marker ... ok Checking pmsg file properly keeps the content written before crash ... ok Removing all files in pstore filesystem console-ramoops-0 ... ok dmesg-ramoops-0 ... ok dmesg-ramoops-1 ... ok pmsg-ramoops-0 ... ok selftests: pstore_post_reboot_tests [PASS] Signed-off-by: Hiraku Toyooka <hiraku.toyooka.gu@hitachi.com> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Tony Luck <tony.luck@intel.com> Cc: Anton Vorontsov <anton@enomsg.org> Cc: Colin Cross <ccross@android.com> Cc: Kees Cook <keescook@chromium.org> Cc: Mark Salyzyn <salyzyn@android.com> Cc: Seiji Aguchi <seiji.aguchi.tr@hitachi.com> Cc: linux-kernel@vger.kernel.org Cc: linux-api@vger.kernel.org Signed-off-by: Shuah Khan <shuahkh@osg.samsung.com>
2015-10-02 11:46:41 +00: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
# Avoid conflict with INSTALL_PATH set by the main Makefile
#
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)
ALL_SCRIPT := $(INSTALL_PATH)/run_kselftest.sh
TEST_LIST := $(INSTALL_PATH)/kselftest-list.txt
install: all
ifdef INSTALL_PATH
@# Ask all targets to install their files
mkdir -p $(INSTALL_PATH)/kselftest
install -m 744 kselftest/module.sh $(INSTALL_PATH)/kselftest/
install -m 744 kselftest/runner.sh $(INSTALL_PATH)/kselftest/
install -m 744 kselftest/prefix.pl $(INSTALL_PATH)/kselftest/
install -m 744 run_kselftest.sh $(INSTALL_PATH)/
rm -f $(TEST_LIST)
@ret=1; \
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET INSTALL_PATH=$(INSTALL_PATH)/$$TARGET install \
O=$(abs_objtree) \
$(if $(FORCE_TARGETS),|| exit); \
ret=$$((ret * $$?)); \
done; exit $$ret;
@# Ask all targets to emit their test scripts
@# While building kselftest-list.text skip also non-existent TARGET dirs:
@# they could be the result of a build failure and should NOT be
@# included in the generated runlist.
for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
[ ! -d $(INSTALL_PATH)/$$TARGET ] && printf "Skipping non-existent dir: $$TARGET\n" && continue; \
printf "Emit Tests for $$TARGET\n"; \
$(MAKE) -s --no-print-directory OUTPUT=$$BUILD_TARGET COLLECTION=$$TARGET \
-C $$TARGET emit_tests >> $(TEST_LIST); \
done;
else
$(error Error: set INSTALL_PATH to use install)
endif
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}"
clean:
@for TARGET in $(TARGETS); do \
BUILD_TARGET=$$BUILD/$$TARGET; \
$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean;\
done;
.PHONY: all run_tests hotplug run_hotplug clean_hotplug run_pstore_crash install clean gen_tar