Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteFrom the root of a Linux kernel source tree, the documented one-command path is make kselftest. For more control, build headers and the selftests separately, then run them with:
make headers
make -C tools/testing/selftests
make -C tools/testing/selftests run_tests
Use TARGETS to limit testing to the subsystem touched by your patch, keep build output separate with O= or KBUILD_OUTPUT, and treat the results as one part of a patch-specific validation plan. Some tests need root, a configured or booted kernel, special hardware, or more time than the default timeout allows.
As an Amazon Associate I earn from qualifying purchases.
What Linux kernel selftests are—and what they can prove
Linux kernel selftests, usually called kselftest, are small tests kept in the kernel source tree under tools/testing/selftests/. Each test targets particular kernel code paths and normally runs as a userspace process. The official documentation is at Linux Kernel Selftests.
Recommended Free Tools
That userspace design matters: many tests can run against an existing kernel and do not require you to boot a newly built kernel. Other tests deliberately exercise interfaces, configurations, devices, namespaces, tracing facilities, or architecture behavior that your running kernel must provide. A test can therefore be skipped or fail because the environment is missing a prerequisite, not because the patch is wrong.
#1 Best Overall
Selftests are not a universal proof of correctness. They cover the paths represented by the selected tests, kernel configuration, architecture, hardware, permissions, and runtime conditions you used. Before submitting, combine kselftest with the builds, configurations, and integration checks appropriate to your change.
Prerequisites before you start
Use a complete kernel source tree
Run the commands from the root of the kernel source tree being tested. The target names and available tests come from that tree’s Makefiles, so do not assume that a name listed for one kernel version exists in another.
Prepare the headers
The documented sequence begins with make headers. This prepares the exported headers needed by userspace selftests. If it fails, fix the kernel-tree or toolchain problem first; a later selftest build cannot reliably compensate for missing headers.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Check privileges and environment
Some tests require root privileges. Others need a particular Kconfig option, a booted kernel with the relevant feature, a device, or a runtime service. Read the target’s local documentation and Makefile when a test reports a skip or permission error. Running as an unprivileged user is still useful: the kselftest contribution rules explicitly say, “Do as much as you can if you’re not root.”
Decide whether you need a newly built kernel
The suite itself is a userspace program, but the documentation generally describes tests as being run after building, installing, and booting a kernel. If your patch changes code that is only present in the kernel you built, boot that kernel before interpreting results. If the patch affects a userspace-visible interface that already exists in the running kernel, the relevant selftest may be runnable without a custom boot.
The standard build-and-run workflow
For a full default run from the source root, use the three-stage form:
-
Prepare userspace headers:
make headers -
Build the in-tree selftests:
make -C tools/testing/selftests -
Run the tests:
make -C tools/testing/selftests run_tests
The run command prints pass/fail results. A failure is a signal to inspect the individual test, its prerequisites, and the environment; it is not automatically proof that the patch introduced a regression.
When you want the shortest documented path, use:
make kselftest
This top-level target builds and runs the suite. It is convenient for a broad smoke test, while the subdirectory form makes it easier to separate preparation, compilation, and execution when diagnosing a problem.
Run only the subsystem relevant to your patch
Full-suite runs can take time and may include tests unrelated to your change. The selftest Makefile accepts TARGETS so you can select one or more collections. For example, to build and run the ptrace tests:
make -C tools/testing/selftests TARGETS=ptrace run_tests
For top-level invocation, quote multiple target names:
make TARGETS="size timers" kselftest
You can exclude a selected collection with SKIP_TARGETS:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
make TARGETS="breakpoints size timers" SKIP_TARGETS=size kselftest
Use the target names supported by the Makefile in the exact kernel tree you are testing. A name that is valid in one release, architecture, or branch may not be present in another.
Make every selected target build successfully
By default, the build can succeed when at least one target builds. That behavior is useful for heterogeneous trees but can hide a broken target in a patch-specific selection. Add FORCE_TARGETS=1 when you want every target you selected to be required to build:
make TARGETS="breakpoints size timers" FORCE_TARGETS=1 kselftest
Use this stricter mode when your patch touches several collections or when a clean build result for each selected target is part of your submission evidence.
Keep selftest build output out of the source tree
To place output in a separate directory, run the target from the kernel source root and set either O= or KBUILD_OUTPUT=:
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →make O=/tmp/kselftest kselftest
or:
make KBUILD_OUTPUT=/tmp/kselftest kselftest
If both variables are set, O= takes precedence. A separate output directory is useful when you need to preserve a clean source tree, compare runs from different configurations, or remove generated files without touching checked-out sources.
Get a concise summary and per-test records
Pass summary=1 to the top-level target:
make summary=1 kselftest
Summary mode produces summarized output and writes individual results to per-test files. Save those files with your patch-testing notes so a reviewer can distinguish a pass, failure, skip, timeout, or environment error for each test.
Install the tests and use the dedicated runner
The install target copies built selftests to tools/testing/selftests/kselftest_install by default. To choose another destination, set INSTALL_PATH:
make -C tools/testing/selftests install
make -C tools/testing/selftests INSTALL_PATH=/tmp/kselftest-install install
The installed directory contains run_kselftest.sh, which is useful when you want to list, select, or repeat tests without rebuilding them.
List available tests
./run_kselftest.sh -l
The list reflects what was installed from your source tree. Use it to verify spelling before selecting a collection or individual test.
Run a collection
./run_kselftest.sh -c <collection>
Replace <collection> with a collection shown by -l. Collection-level execution is useful for rerunning the subsystem that contains your change after you have fixed an environment problem.
Run named tests
./run_kselftest.sh -t <test>
Use the test name reported by the list or by an earlier run. Named execution narrows a failure to the smallest practical reproducer before you rerun the broader collection.
Rank #3
- Used Book in Good Condition
Root requirements still apply when using the installed runner. Installing the files does not grant capabilities or make an unavailable kernel feature appear.
Understand timeouts and hotplug behavior
The documented default timeout is 45 seconds per test. It is an operational default, not a performance benchmark. A slow machine, a heavily loaded system, virtualized hardware, or a test waiting for a resource can exceed it. The installed runner supports --override-timeout when a longer limit is justified. Record the override in your test notes so a reviewer knows the run was not using the default.
A timeout is not necessarily fatal. Inspect the test’s output and whether it was waiting for a resource before treating it as a kernel regression. Avoid simply increasing the limit until a real hang disappears; first establish what the test is waiting for.
Hotplug tests need special care. Some can wait for a CPU or memory unit to become available, so they have dedicated targets. Normal hotplug mode is intentionally limited for safety. Run the dedicated target only when your patch requires that coverage and your test environment can safely perform the requested hotplug operation.
Interpret pass, skip, failure, and missing coverage correctly
Pass
A pass means the selected test completed successfully under the kernel, architecture, configuration, hardware, permissions, and timeout you used. It does not certify untested configurations or code paths.
Skip or “not run”
Skips commonly indicate a missing Kconfig option, unsupported architecture, absent device, insufficient privilege, or a test that deliberately avoids changing the current system. Find the test’s documented prerequisite before changing the code. If the feature is intentionally unconfigured, the top-level suite should remain usable; the kselftest guidance says contributors should “Don’t cause the top-level ‘make run_tests’ to fail if your feature is unconfigured.”
Failure
Reproduce a failure with the smallest target or named test. Capture the command, kernel commit, configuration, architecture, privilege level, runner timeout, and relevant logs. Then determine whether the failure is deterministic, an environmental issue, or a regression introduced by the patch.
No result because a target did not build
Without FORCE_TARGETS=1, the overall build can succeed if at least one target builds. If a relevant target is missing from the run, rebuild with that target selected and require all selected targets to build. A compile failure is coverage information, not a passing test.
A patch-focused validation plan
Kselftest should be matched to the patch rather than treated as an all-or-nothing ritual. Use this sequence to make the evidence proportional to the change:
-
Identify the kernel subsystem, Kconfig symbols, architectures, devices, and userspace interfaces touched by the patch.
-
Build the kernel configuration you intend to test, prepare headers, and build the corresponding selftest targets.
-
Boot or otherwise provide the kernel environment required by the tests. Confirm that the running kernel is the one whose behavior you are evaluating.
-
Run the directly relevant target with
FORCE_TARGETS=1when you need every selected target to compile, then run a broader related collection if interactions are plausible.Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Repeat failures with the installed runner and a named test to reduce noise. Use
summary=1or preserve per-test files for review. -
Record intentional skips and their prerequisites instead of presenting them as passes.
-
Extend the matrix when the patch changes configuration-dependent code, architecture code, locking, memory management, hotplug, or other areas where one environment cannot represent all behavior.
The Linux Kernel patch submission checklist advises testing multiple builds with related Kconfig options disabled and/or set to =m when applicable. It also calls for testing against the most recent linux-next tag when appropriate, so interactions with queued changes are detected. Neither recommendation means every patch needs every configuration or the entire selftest suite; choose a matrix that exercises the code and dependencies your patch changes.
Free tools Windows power users keep installed
One-click scans. No signup required.
Architecture, device, and configuration coverage
Selftests run in the environment you provide. A test that passes on one architecture does not establish behavior on another, and a test that passes with a built-in feature may not cover the module case. For patches involving devices or device-facing APIs, consult the kernel’s Device testing with kselftest documentation for the additional setup and safety considerations.
When a test depends on a device, namespace, privilege, CPU, memory node, or boot parameter, write that dependency next to the result. This prevents a later reader from confusing “not applicable here” with “verified.”
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Requirements for adding or changing a selftest
If your patch adds a test, preserve the properties that let the suite run in automation and in partial environments:
-
“Do as much as you can if you’re not root;” design unprivileged portions to run where possible and report unavoidable privilege requirements clearly.
Recommended Free Tools
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
“Don’t take too long;” avoid unnecessary delays and make waits bounded.
-
“Don’t break the build on any architecture, and” keep architecture-specific assumptions guarded or isolated.
-
“Don’t cause the top-level ‘make run_tests’ to fail if your feature is unconfigured.” A missing optional feature should produce an appropriate skip or non-fatal result rather than breaking unrelated test execution.
Test output should follow TAP (Test Anything Protocol) so continuous-integration systems can parse individual results. Emit clear diagnostics for prerequisites and failures, and ensure cleanup runs after both success and error paths.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsCommon problems and recovery steps
| Symptom | Likely cause | Action |
|---|---|---|
make headers fails |
Incomplete tree, unsupported toolchain, or source/configuration error | Fix the kernel build prerequisite and rerun header preparation before building selftests. |
| A target is skipped | Missing Kconfig option, device, architecture support, or privilege | Read that target’s requirements; enable or provide the prerequisite only when it is appropriate for the test. |
| Overall build succeeds but a selected test is absent | At least one target built and the default did not require all targets | Use FORCE_TARGETS=1 and build the target explicitly. |
| Permission denied | The test requires root or a capability not held by the current user | Rerun with the required privilege in an isolated test environment, or document the limitation. |
| Test exceeds 45 seconds | System load, virtualization, resource wait, or a genuine hang | Inspect logs and resource conditions; use --override-timeout only after establishing that a longer wait is legitimate. |
| Hotplug test waits indefinitely | CPU or memory cannot be made available, or the wrong hotplug mode was chosen | Check the dedicated hotplug target and system safety constraints; do not force normal hotplug mode to perform unsupported operations. |
Failure appears only on linux-next |
Interaction with queued changes | Record the exact tag and configuration, bisect or coordinate with the affected subsystem, and include the interaction in the patch discussion. |
Command reference
| Purpose | Command |
|---|---|
| Prepare headers | make headers |
| Build all in-tree selftests | make -C tools/testing/selftests |
| Run all in-tree selftests | make -C tools/testing/selftests run_tests |
| Build and run through the top level | make kselftest |
| Run one collection | make -C tools/testing/selftests TARGETS=ptrace run_tests |
| Run several collections | make TARGETS="size timers" kselftest |
| Exclude a collection | make TARGETS="breakpoints size timers" SKIP_TARGETS=size kselftest |
| Require every selected target to build | make TARGETS="breakpoints size timers" FORCE_TARGETS=1 kselftest |
| Use a separate output directory | make O=/tmp/kselftest kselftest |
| Write summarized results | make summary=1 kselftest |
| Install tests | make -C tools/testing/selftests install |
| List installed tests | ./run_kselftest.sh -l |
| Run an installed collection | ./run_kselftest.sh -c <collection> |
| Run an installed named test | ./run_kselftest.sh -t <test> |
What to report with your patch
Include enough detail that another contributor can understand exactly what was exercised:
-
Kernel commit or branch, architecture, compiler/toolchain context, and relevant Kconfig choices.
-
Whether the tests ran against a newly built and booted kernel or an existing kernel.
-
The exact
TARGETS,SKIP_TARGETS,FORCE_TARGETS, output-directory, summary, and timeout options used.Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Passes, failures, skips, and timeouts, with logs or per-test result files where useful.
-
Root, device, CPU, memory, namespace, or other environmental requirements that affected coverage.
-
Additional builds with disabled or modularized related options and any
linux-nextrun required by the patch’s risk profile.
This record turns “selftests passed” into reproducible evidence: it tells reviewers which code paths were tested, which were unavailable, and why.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




