# Testing signals — torvalds/linux

> Canonical page: https://codevetter.com/unpack/linux/testing-signals

# Testing signals — torvalds/linux

Scanned commit f0100363d8c374bd8e9ea7c9ba02744f0b802ca4 (2026-09-21). Generated by codevetter codevetter 1.12.0 on 2026-09-22.

Testing is built into the tree: KUnit (lib/kunit/) is the in-kernel unit-test framework, run at boot via kunit_run_all_tests() or via the tools/testing/kunit/kunit.py harness under UML/QEMU. kselftest (tools/testing/selftests/, ~135 target dirs) provides userspace-driven syscall/feature tests emitting KTAP. Numerous ad-hoc selftest .c files live next to core code (initramfs_test.c, kallsyms_selftest.c, sysctl-test.c, dmapool_test.c, gup_test.c). There is no in-tree CI config — validation is maintainer/review driven, with checkpatch.pl/get_maintainer.pl as local gates; external systems (syzbot, kernelci, 0-day) do continuous testing.
- KUnit is the kernel unit-test framework: lib/kunit/ contains test.c, executor.c, try-catch.c, string-stream.c, debugfs.c and assertion helpers, with public headers in include/kunit/test.h. — [lib/kunit/test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/lib/kunit/test.c) [lib/kunit/Makefile](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/lib/kunit/Makefile) [include/kunit/test.h](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/include/kunit/test.h)
- KUnit tests execute during boot inside kernel_init_freeable via kunit_run_all_tests(), after do_basic_setup() and before prepare_namespace(), so late-init tests run with the full kernel initialized. — [init/main.c#L1675-1679](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/init/main.c#L1675-L1679) [lib/kunit/executor.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/lib/kunit/executor.c)
- tools/testing/kunit/ provides the Python runner: kunit.py orchestrates builds (kunit_config.py) and runs kernels under QEMU (qemu_config.py, qemu_configs/), parsing KTAP output via kunit_parser.py. — [tools/testing/kunit/kunit.py](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/kunit/kunit.py) [tools/testing/kunit/kunit_config.py](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/kunit/kunit_config.py) [tools/testing/kunit/qemu_config.py](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/kunit/qemu_config.py) [tools/testing/kunit/kunit_parser.py](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/kunit/kunit_parser.py)
- Per-subsystem .kunitconfig fragments select test builds: init/.kunitconfig sets CONFIG_KUNIT=y + CONFIG_INITRAMFS_TEST=y; rust/.kunitconfig sets CONFIG_KUNIT + CONFIG_RUST + CONFIG_RUST_KERNEL_DOCTESTS. — [init/.kunitconfig](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/init/.kunitconfig) [rust/.kunitconfig](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/rust/.kunitconfig)
- kselftest lives in tools/testing/selftests/: the top Makefile aggregates ~135 TARGETS (acct, bpf, cgroup, clone3, exec, futex, memblock-adjacent dirs, net, ...), and runner.sh/run_kselftest.sh plus ksft.py/ktap_helpers.sh provide the KTAP-emitting harness. — [tools/testing/selftests/Makefile#L1-30](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/selftests/Makefile#L1-L30) [tools/testing/selftests/run_kselftest.sh](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/selftests/run_kselftest.sh) [tools/testing/selftests/kselftest/runner.sh](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/selftests/kselftest/runner.sh) [tools/testing/selftests/kselftest/ksft.py](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/selftests/kselftest/ksft.py)
- Ad-hoc selftests sit beside production code: init/initramfs_test.c (CONFIG_INITRAMFS_TEST), kernel/kallsyms_selftest.c, kernel/sysctl-test.c, kernel/crash_core_test.c, kernel/resource_kunit.c, mm/dmapool_test.c and mm/gup_test.c. — [init/initramfs_test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/init/initramfs_test.c) [kernel/kallsyms_selftest.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/kernel/kallsyms_selftest.c) [kernel/sysctl-test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/kernel/sysctl-test.c) [kernel/resource_kunit.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/kernel/resource_kunit.c) [mm/dmapool_test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/mm/dmapool_test.c) [mm/gup_test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/mm/gup_test.c)
- tools/testing/ also hosts standalone harnesses for library code — memblock, radix-tree, rbtree, scatterlist, vma, vsock — that compile kernel sources directly in userspace for fast unit testing. — [tools/testing/memblock](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/memblock) [tools/testing/radix-tree](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/radix-tree) [tools/testing/vma](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/vma) [tools/testing/rbtree](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/rbtree)
- Rust has its own test plumbing: rust/kernel/kunit.rs plus the #[kunit] proc-macro support in rust/macros/kunit.rs, an example test in lib/kunit/kunit-example-test.c style, and CONFIG_RUST_KERNEL_DOCTESTS for doc tests. — [rust/kernel/kunit.rs](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/rust/kernel/kunit.rs) [rust/macros/kunit.rs](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/rust/macros/kunit.rs) [rust/.kunitconfig](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/rust/.kunitconfig) [lib/kunit/kunit-example-test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/lib/kunit/kunit-example-test.c)
- There is no .github/, .gitlab-ci.yml or similar CI config in the tree; contribution gating is the email review flow documented in Documentation/process/submitting-patches.rst with scripts/checkpatch.pl as the pre-submit style checker. — [Documentation/process/submitting-patches.rst](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/Documentation/process/submitting-patches.rst) [scripts/checkpatch.pl](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/scripts/checkpatch.pl) [scripts/get_maintainer.pl](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/scripts/get_maintainer.pl)
- Coverage is uneven by construction: selftests concentrate in tools/testing/selftests and a minority of core files carry paired test modules (e.g. kernel/sysctl-test.c for kernel/sysctl.c), so most of mm/, net/ and drivers/ has no in-tree unit coverage and relies on external fuzzing/CI. (inferred) — [kernel/sysctl-test.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/kernel/sysctl-test.c) [kernel/sysctl.c](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/kernel/sysctl.c) [tools/testing/selftests/Makefile](https://github.com/torvalds/linux/blob/f0100363d8c374bd8e9ea7c9ba02744f0b802ca4/tools/testing/selftests/Makefile)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
