# Testing - [Testing](#testing) - [Overview](#overview) - [Prerequisites](#prerequisites) - [The dev\_cli.sh entry point](#the-dev_clish-entry-point) - [Global flags](#global-flags) - [Building](#building) - [Running tests](#running-tests) - [Argument passthrough](#argument-passthrough) - [Custom kernel and firmware](#custom-kernel-and-firmware) - [Unit tests](#unit-tests) - [Integration tests](#integration-tests) - [x86\_64](#x86_64) - [ARM64](#arm64) - [VFIO](#vfio) - [Windows guests](#windows-guests) - [Rate limiter](#rate-limiter) - [Confidential VMs](#confidential-vms) - [Performance metrics](#performance-metrics) - [Code coverage](#code-coverage) ## Overview Cloud Hypervisor's development script runs builds and tests inside a Docker container to provide a reproducible environment. The main entry point is `scripts/dev_cli.sh`, which manages the container lifecycle and forwards arguments to the appropriate test scripts. The container image is published at `ghcr.io/cloud-hypervisor/cloud-hypervisor` and is automatically pulled on first use. A local build of the container can be triggered with `scripts/dev_cli.sh build-container` or by passing the `--local` flag. Test workloads (guest images, kernels, firmware) are stored on the host under `$HOME/workloads` and bind-mounted into the container at `/root/workloads`. Most test scripts download missing workloads automatically on first run. ## Prerequisites A working Docker (or Podman) installation and access to `/dev/kvm` (or `/dev/mshv` for Microsoft Hypervisor tests) are required. The host must be running Linux on x86_64 or aarch64. ```shell # Verify KVM is available ls -l /dev/kvm ``` The container image bundles all build dependencies. No Rust toolchain is needed on the host. ## The dev_cli.sh entry point ``` scripts/dev_cli.sh [flags] [] ``` ### Global flags | Flag | Description | |-----------|--------------------------------------------------| | `--local` | Build and use a local container image instead of pulling from the registry. | ### Building ```shell scripts/dev_cli.sh build [--debug|--release] [--libc musl|gnu] \ [--hypervisor kvm|mshv] [--features ] \ [--volumes /host:/ctr#...] [-- ] ``` | Flag | Default | Description | |----------------|---------|------------------------------------------| | `--debug` | yes | Build debug binaries. | | `--release` | | Build release binaries. | | `--libc` | `gnu` | C library to link against (`musl`/`gnu`).| | `--hypervisor` | auto | Hypervisor backend (`kvm`/`mshv`). Auto-detected from the host device node when omitted. | | `--features` | | Additional cargo features. | | `--volumes` | | Extra host volumes (`/a:/a#/b:/b`). | | `--runtime` | `docker`| Container runtime (`docker`/`podman`). | Arguments after `--` are forwarded directly to `cargo build`. ### Running tests ```shell scripts/dev_cli.sh tests [] [--libc musl|gnu] \ [--hypervisor kvm|mshv] [--volumes /host:/ctr#...] \ [--