blob: 780952c01bf52db80f3b893f1e7ecb2bf149556f [file] [log] [blame]
# KVM Unit Test Driver
This directory contains the driver script for kvm-unit-tests. Tests run
inside QEMU that emulates the native architecture.
## Requirements:
- A Linux kernel image cross-compiled for AArch64. See ANDROID-KVM_DIR/linux
Build using default rules:
$ make linux
Example of custom building:
$ cd ANDROID-KVM_DIR/linux
$ make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" -j`nproc` defconfig
$ make ARCH=arm64 CROSS_COMPILE="aarch64-linux-gnu-" -j`nproc`
$ # image is now in ANDROID-KVM_DIR/linux/arch/arm64/boot/Image.gz
- KVM unit tests built as standalone. See ANDROID-KVM_DIR/kvm-unit-tests
Build using default rules:
$ make kvm-unit-tests
Example of custom building:
$ cd ANDROID-KVM_DIR/kvm-unit-tests
$ ./configure --arch=arm64 --cross-prefix="aarch64-linux-gnu-"
$ make -j`nproc` standalone
$ # test binaries are now in ANDROID-KVM_DIR/kvm-unit-tests/tests
- A root file system image to boot.
A prebuilt image is in ANDROID-KVM_DIR/prebuilts.
Rebuild using default rules:
$ make update-prebuilts
Example of custom building:
$ cd ANDROID-KVM_DIR/buildroot
$ make qemu_aarch64_virt_kvmunittests_defconfig
$ make clean all
$ # image is now in ANDROID-KVM_DIR/buildroot/output/images/rootfs.ext4
- QEMU with aarch64-softmmu, v5.0.0 or later
A prebuilt binary is in ANDROID-KVM_DIR/prebuilts.
Buildroot creates one in the buildprocess. It's available at
ANDROID-KVM_DIR/buildroot/output/host/bin/qemu-system-aarch64
## Running the tests
To run all tests:
$ make test -j`nproc`
To list all test targets:
$ make test-list
To run one test, e.g. PSCI under nVHE:
$ make test-kut-nvhe-psci
To run the same test with GDB server:
$ make test-kut-nvhe-psci-gdb
Alternatively, a test can be invoked using run_test.sh:
$ ./build/kvm-unit-tests/run_test.sh psci
Note that this will not rebuild dependencies but starts quicker.