Getting Started
Single-page view · as markdown
What Is Provium
Provium / Getting Started
Provium runs tests that need an operating system of their own. You write Lua tests, choose a guest profile, and ask Provium to start virtual machines (VMs). A guest agent carries out commands and file operations inside them.
Use Provium when a test needs to observe a boot, coordinate several guests, or change a guest's disks, network, or clock. Keep tests of isolated program logic in the component's ordinary unit-test suite.
How a run works #
flowchart LR
cli[Command line] --> scheduler[Resource scheduler]
scheduler --> runner[Lua state for each test file]
runner --> host[Host VM and network controls]
host --> qemu[QEMU guest]
host --> agent[Guest agent]
agent --> system[Guest operating system]
The command provium tests/ discovers files ending in .test.lua. Each file
gets a Lua state and a resource scope called a lab. The scheduler limits how
many files run together according to their resource claims.
Within a file, test(...) calls run in order. Each test has a child scope for
resources created inside its body. A VM created at file scope can be shared by
that file's tests. A VM created inside a test belongs to that test. See
labs and scope.
The QEMU backend boots an explicitly selected kernel and initrd. Host and
guest communicate through a virtual socket, or vsock. The guest kernel must
support that transport and the image must support the agent's startup path.
Provium 0.1.0 accepts the peios guest profile type; an arbitrary
operating-system image is not a supported substitute.
Test resources #
A VM exposes guest commands, files, processes, console output, and clock controls. Separate worker processes allow a test to use different guest credentials. These operations affect the test guest.
Bridges connect guests at the Ethernet layer. Tests configure addresses inside the guests and can apply latency, packet loss, or bandwidth limits on the host. These features require host network access. Disk tests can attach images and inject selected I/O faults.
Fixtures store snapshots for reuse. A fixture's source, dependencies, and profile inputs contribute to its cache identity. Reusing a snapshot avoids repeating its setup; it does not replace checking that the fixture models the state the test needs.
Results and limits #
Provium reports passed, failed, and skipped tests. It can also write a
structured event stream for tools such as provium-coverage. The event stream
describes harness activity; it is not compiler line coverage.
The local backend is for developing the runner without starting QEMU. Its operations run on the host. Do not use a local run as evidence that a kernel, boot path, or guest integration works.
Provium drives guest operations and console streams. It does not provide a graphical application test framework or a system image builder.
Running a First Test
Provium / Getting Started
Run a small guest test to check that your profile, agent, and host setup work
together. This procedure uses installed Provium tools. Contributor build
instructions belong in the repository's docs/building.md.
Before you start #
- Install
proviumwith its matchingagent-overlay.cpio.gz. - Prepare a compatible Peios kernel and initrd with a working
/init. The guest kernel needs vsock support. - Provide QEMU and access to
/dev/kvmand/dev/vhost-vsockon the host. - Provide
ip,tc, andnft, and the host network privileges required by Provium's preflight check. - Use disposable guest state. The commands in a test operate on its guest.
Provium looks for the overlay beside an installed binary at
../share/provium/agent-overlay.cpio.gz. Set PROVIUM_OVERLAY or a profile's
agent_overlay_path when the file is elsewhere. Keep the host runner and
agent from the same build.
Configure a profile #
-
Create a project directory and a
testssubdirectory. -
Add
provium.tomlwith the following content. Replace the kernel and initrd paths with the artifacts prepared for your test system.[] = ["tests"] [] = "/path/to/bzImage" = "/path/to/initrd.cpio.gz" = "console=ttyS0 quiet" = "peios" -
From the project directory, check discovery and preflight:
The roots setting supplies Lua helper and fixture search paths. The
command's positional paths choose which tests to discover. With no paths, the
command searches the current directory.
By default, Provium adds its agent overlay to the profile's initrd and chains
to the image's /init. A profile that already contains the matching agent can
set inject_agent = false. See
profile configuration.
Write and run the test #
-
Create
tests/smoke.test.lua:test -
Run the file from the project directory:
Check the result #
The run should report one passed test and exit with status 0. The VM belongs to the test's scope and is closed when that scope ends.
A failed assertion or file timeout produces status 1. A configuration, preflight, or infrastructure error produces status 2. Resolve a preflight failure before relying on a VM result; skipping the check does not provide missing host capabilities.
To confirm assertion failures are visible, change the expected string to
"different" and run the file again. It should fail with status 1. Restore
"hello" before keeping the test.
For repeated runs, use provium tests/ --watch. Use --json when another
tool needs structured file results. provium(1) and the
command reference describe the remaining options.
Project Structure
Provium / Getting Started
A Provium project groups configuration and Lua tests. Keep its source files in version control and provide the kernel and initrd named by its profiles. Generated fixture snapshots belong in the cache, outside the source tree.
Source layout #
A project can use this layout:
project/
provium.toml
tests/
smoke.test.lua
networking/
connection.test.lua
helpers/
assertions.lua
booted-base.fixture.lua
provium.toml defines profiles and runner settings. The command reads it from
the current directory unless --config selects another file. Profiles name
the kernel, initrd, and boot parameters used by provium:vm(...).
A .test.lua file registers tests. Run provium tests/ to discover those
files under tests. Without a positional path, discovery starts in the
current directory. [provium].roots is a separate setting: it determines
where helpers and fixture files are found.
Tests and shared helpers #
Each test file gets a fresh Lua state. Tests within that file run in order; they do not run conwith each other. The dispatcher can run several files at once when its resource budget allows.
With roots = ["tests"], load tests/helpers/assertions.lua using:
local assertions = require
A helper has an ordinary .lua filename. It is not a test or fixture. Changes
to a helper used by a fixture contribute to that fixture's cache identity.
Fixtures and caches #
A .fixture.lua file builds and returns a VM or lab snapshot. A test asks for
it by name using provium:vm_fixture(...) or provium:lab_fixture(...). The
runner searches the configured roots, computes the fixture's identity, and
either restores a cached snapshot or builds it.
The default fixture cache is ~/.cache/provium/fixtures. Set cache_dir and
cache_max_size under [provium] to choose another location or size budget.
Cache entries are generated state; keep the source fixture and its inputs as
the authority. See
fixtures and dependencies
for invalidation and cache-management commands.
The rerun list is separate from the fixture cache. --rerun-failed selects
the previously failing files from those discovered by the current command.
PROVIUM_RERUN_STATE overrides the rerun-state path.
Files outside the project #
Profiles can refer to kernels and initrds outside the source tree. Record which artifacts a test run used when the result is evidence for a change. A passing result against one image does not qualify another image.
The host needs qemu-system-x86_64 for VM execution and ip, tc, and nft
for network setup. Packet capture also needs tcpdump. These host tools are
separate from commands installed inside a guest.
Saved event streams and fixture caches can be large. Choose explicit output paths for retained evidence and keep disposable output out of source control.