linux/tools/testing/selftests
Axel Rasmussen 8ba6e86408 userfaultfd/selftests: reinitialize test context in each test
Currently, the context (fds, mmap-ed areas, etc.) are global.  Each test
mutates this state in some way, in some cases really "clobbering it"
(e.g., the events test mremap-ing area_dst over the top of area_src, or
the minor faults tests overwriting the count_verify values in the test
areas).  We run the tests in a particular order, each test is careful to
make the right assumptions about its starting state, etc.

But, this is fragile.  It's better for a test's success or failure to not
depend on what some other prior test case did to the global state.

To that end, clear and reinitialize the test context at the start of each
test case, so whatever prior test cases did doesn't affect future tests.

This is particularly relevant to this series because the events test's
mremap of area_dst screws up assumptions the minor fault test was relying
on.  This wasn't a problem for hugetlb, as we don't mremap in that case.

[peterx@redhat.com: fix conflict between this patch and the uffd pagemap series]
  Link: https://lkml.kernel.org/r/YKQqKrl+/cQ1utrb@t490s

Link: https://lkml.kernel.org/r/20210503180737.2487560-10-axelrasmussen@google.com
Signed-off-by: Axel Rasmussen <axelrasmussen@google.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Brian Geffon <bgeffon@google.com>
Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Joe Perches <joe@perches.com>
Cc: Kirill A. Shutemov <kirill@shutemov.name>
Cc: Lokesh Gidra <lokeshgidra@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Mina Almasry <almasrymina@google.com>
Cc: Oliver Upton <oupton@google.com>
Cc: Shaohua Li <shli@fb.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Wang Qing <wangqing@vivo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-06-30 20:47:28 -07:00
..
arm64 kselftest/arm64: Add missing stddef.h include to BTI tests 2021-05-10 10:19:01 +01:00
bpf bpf, selftests: Adjust few selftest outcomes wrt unreachable code 2021-06-14 23:06:38 +02:00
breakpoints selftests: breakpoints: Use correct error messages in breakpoint_test_arm64.c 2021-02-08 17:04:41 -07:00
capabilities
cgroup kselftests: cgroup: update kmem test for new vmstat implementation 2021-04-30 11:20:38 -07:00
clone3
core selftests/core: add regression test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC 2020-12-19 16:23:19 +01:00
cpu-hotplug
cpufreq
dma dma-mapping: benchmark: Add support for multi-pages map/unmap 2021-04-02 16:41:08 +02:00
dmabuf-heaps kselftests: dmabuf-heaps: Add extra checking that allocated buffers are zeroed 2021-02-08 16:25:53 -07:00
drivers selftests: mlxsw: Fix mausezahn invocation in ERSPAN scale test 2021-04-23 14:01:28 -07:00
efivarfs
exec tools/testing/selftests/exec: fix link error 2021-05-22 15:09:07 -10:00
filesystems kselftest: introduce new epoll test case 2021-05-06 19:24:13 -07:00
firmware firmware_loader: Remove unnecessary conversion to bool 2021-03-23 14:51:50 +01:00
fpu
ftrace selftests/ftrace: Add '!event' synthetic event syntax check 2021-02-11 16:22:32 -05:00
futex
gpio selftests: gpio: update .gitignore 2021-03-08 11:59:16 +01:00
ia64
intel_pstate
ipc selftests/ipc: remove unneeded semicolon 2021-02-08 16:32:43 -07:00
ir
kcmp
kexec
kmod
kselftest
kvm KVM: selftests: Fix mapping length truncation in m{,un}map() 2021-06-24 04:04:38 -04:00
landlock landlock: Enable user space to infer supported features 2021-04-22 12:22:11 -07:00
lib
livepatch
lkdtm lkdtm: Add REPORT_STACK for checking stack offsets 2021-04-08 14:05:20 +02:00
locking
media_tests
membarrier
memfd
memory-hotplug
mincore selftests: remove duplicate include 2021-05-07 00:26:33 -07:00
mount
mount_setattr tests: add mount_setattr() selftests 2021-01-24 14:43:45 +01:00
mqueue
nci selftests: Add .gitignore for nci test suite 2021-05-20 12:51:24 -07:00
net selftests/net: Add icmp.sh for testing ICMP dummy address responses 2021-06-18 12:13:24 -07:00
netfilter selftests: netfilter: add fib test case 2021-06-09 21:06:35 +02:00
nsfs
ntb
openat2
perf_events signal: Deliver all of the siginfo perf data in _perf 2021-05-18 16:20:54 -05:00
pid_namespace
pidfd
powerpc Merge branch 'akpm' (patches from Andrew) 2021-05-07 00:34:51 -07:00
prctl
proc proc: add .gitignore for proc-subset-pid selftest 2021-06-05 08:58:11 -07:00
pstore
ptp
ptrace
rcutorture Merge branches 'bitmaprange.2021.03.08a', 'fixes.2021.03.15a', 'kvfree_rcu.2021.03.08a', 'mmdumpobj.2021.03.08a', 'nocb.2021.03.15a', 'poll.2021.03.24a', 'rt.2021.03.08a', 'tasks.2021.03.08a', 'torture.2021.03.08a' and 'torturescript.2021.03.22a' into HEAD 2021-03-24 17:20:18 -07:00
resctrl selftests/resctrl: Change a few printed messages 2021-04-07 16:37:49 -06:00
rseq
rtc
safesetid
seccomp powerpc/64s/syscall: Use pt_regs.trap to distinguish syscall ABI difference between sc and scv syscalls 2021-05-21 00:58:03 +10:00
sgx x86/sgx: Expose SGX architectural definitions to the kernel 2021-04-06 09:43:41 +02:00
sigaltstack
size
sparc64
splice
static_keys
sync
syscall_user_dispatch entry: Use different define for selector variable in SUD 2021-02-06 00:21:42 +01:00
sysctl
tc-testing net/sched: fq_pie: re-factor fix for fq_pie endless loop 2021-05-23 17:16:09 -07:00
timens selftests/timens: Fix gettime_perf to work on powerpc 2021-04-21 22:52:32 +10:00
timers selftests/timers: Fix spelling mistake "clocksourc" -> "clocksource" 2021-03-26 11:37:17 -06:00
tmpfs
tpm2
uevent
user
vDSO selftests/vDSO: fix ABI selftest on riscv 2021-02-08 16:38:34 -07:00
vm userfaultfd/selftests: reinitialize test context in each test 2021-06-30 20:47:28 -07:00
watchdog
wireguard wireguard: selftests: make sure rp_filter is disabled on vethc 2021-06-04 14:25:14 -07:00
x86 selftests/x86: Add a missing .note.GNU-stack section to thunks_32.S 2021-03-18 11:05:14 +01:00
zram
.gitignore
gen_kselftest_tar.sh
kselftest.h
kselftest_deps.sh selftests: remove obsolete gpio references from kselftest_deps.sh 2021-02-15 11:43:28 +01:00
kselftest_harness.h selftests: kselftest_harness.h: partially fix kernel-doc markups 2021-01-21 14:06:00 -07:00
kselftest_install.sh
kselftest_module.h kselftest: add support for skipped tests 2021-02-15 11:07:42 +01:00
lib.mk Networking changes for 5.13. 2021-04-29 11:57:23 -07:00
Makefile selftests/landlock: Add user space tests 2021-04-22 12:22:11 -07:00
run_kselftest.sh