Running KUnit

From the kernel repository root:

pekit run kunit

pekit run kunit builds the KUnit configuration's kernel with the pinned toolchain, then boots it with the existing PKM runner and the host's QEMU, qemu-system-x86_64. It's a script you run by hand, not a test, because it needs QEMU and wants KVM. It uses KVM when /dev/kvm is available, otherwise TCG. The run requires complete KTAP accounting, passing PKM suites, clean power-down and no kernel warning/oops/lockdep failure signatures. The serial log is kunit-qemu.log beside the image, as the direct runner writes it, or where PKM_KUNIT_LOG says. Native integration and hardware qualification remain additional checks.

The migrated configs, verifier, key generator and KUnit runner come from PKM commit ac4c6eb57ff94821f1eaea2b3bde460777d48f5b. No dependency on the old PKM checkout is needed to run these commands.

Run an existing kernel directly #

The direct runner accepts either a bzImage or a Kbuild output tree containing arch/x86/boot/bzImage. It uses host QEMU and timeout, as pekit run kunit does.

bash peios/test-kunit.sh /path/to/bzImage

The direct runner supports these environment variables:

VariableMeaningDefault
QEMU_BINQEMU executableqemu-system-x86_64
PKM_KUNIT_TIMEOUTBoot timeout in seconds420
PKM_KUNIT_LOGSerial log pathkunit-qemu.log beside the image, or in the supplied tree
PKM_KUNIT_INITRDOptional initramfsNone
PKM_KUNIT_FILTERKUnit filter globFull configured run

Set overrides in the environment of either command.

What a pass means #

The runner requires successful QEMU exit, the clean power-down marker, a top-level KTAP plan, exactly the planned number of results and the final successful result. It rejects failure, warning, oops and lockdep signatures. An unfiltered run additionally requires the PKM smoke marker and a passing PKM suite summary. A filtered run instead requires actual selected case results.

A selected passing suite is evidence for that selection, not a full suite run. Retain the serial log with the kernel revision and configuration used.

The host-side parser and runner regression tests can be run without booting:

pekit test kunit_runner

Edit this page