The scenario helpers now take a chain of projects from the driver (SMOKETEST_CHAIN_FILE): CoreDesktop, then sibling projects such as HamPack. Each gets a fake upstream in the VM; upstream_set and upstream_commit take an optional project name; smoketest_prepare updates every project in the installed image; and the new smoketest_build_layer, sibling_add and install_chain install them. health also runs each installed sibling's smoketest/health, and a sibling's smoketest/setup runs before each scenario. Without a chain file, everything works as before, so older drivers and CoreDesktop's own scenarios are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Smoketest
End-to-end tests of install.sh and update on a real Arch + GNOME virtual
machine. The bats tests in tests/ check the logic with fake commands; these
check what fakes can't: pacman, yay, Flatpak, systemd, ufw, Snapper on btrfs,
GNOME settings, and a reboot.
This folder holds what to test: the scenarios, and the scripts that describe a
CoreDesktop machine. The VM itself (QEMU, images, the package cache) comes from
the coredesktop-dev sibling project, which only contributors install:
sibling add <coredesktop-dev url>
coredesktop-dev smoketest list # scenarios and their tier
coredesktop-dev smoketest run # the quick (pr) scenarios
coredesktop-dev smoketest run --tier all # everything, including a fresh install
coredesktop-dev smoketest run 40-failing-migration
It tests the working copy's HEAD commit, so commit first.
How it works
Each scenario runs on a throwaway copy of one of two VM images:
- base: Arch with GNOME, as archinstall's desktop/GNOME profile leaves it,
with a user
testerwho logs in to GNOME automatically. - installed: base after
install.sh, at an older commit of CoreDesktop. Before the scenario starts,updatebrings it to the commit under test.
Inside the VM, a bare repo (/srv/smoketest/coredesktop.git) stands in for
Gitea. git's insteadOf sends CoreDesktop's real URLs there, so install.sh
and update run unchanged. The harness pushes the commit under test to it, and
scenarios push further commits to simulate a new release: a new migration, a
broken hook, a change to update itself.
After a scenario, fingerprint describes the machine as text (packages,
Flatpaks, services, firewall, CoreDesktop's files in /etc, GNOME settings...).
10-fresh-install saves the fingerprint of a fresh install, and
30-upgrade-from-baseline checks that installing an older commit from
baselines and then running update gives the same machine. If they differ,
an install.sh change is probably missing its migration.
Files
| File | What it is |
|---|---|
scenarios/NN-name.sh |
One scenario each (see below) |
lib/scenario.sh |
Helpers and assertions the scenarios use |
fingerprint |
Runs in the VM; prints the machine's fingerprint |
health |
Runs in the VM; checks the machine works, exits 1 if not |
baselines |
Older commits that 30-upgrade-from-baseline installs first |
Writing a scenario
A scenario is a bash file that sets a few variables and defines scenario:
DESCRIPTION="update runs a new migration once"
IMAGE=installed # base or installed
TIER=pr # pr (quick, uses the installed image) or nightly
scenario() {
upstream_commit "Add a migration" 'echo "touch ~/migrated" > migrations/9999999999.sh'
cd_update
assert_status 0
assert_vm "the migration ran" 'test -f ~/migrated'
}
VARIANTS=(a b c) runs the scenario once per value, each in its own VM, with
$VARIANT set. scenario runs with set -e, so any failing command or
assertion fails it. skip "reason" skips it.
Helpers, from lib/scenario.sh:
| Helper | |
|---|---|
cd_install |
Run install.sh as wget ... | bash would, from the fake upstream's main |
cd_update [VAR=value...] |
Run update |
run_in_vm NAME SCRIPT |
Run SCRIPT in the VM; sets $OUTPUT and $STATUS, logs to NAME.log |
upstream_set [PROJECT] REF |
Point the fake upstream's main at REF, a commit in the project's working copy (default: CoreDesktop) |
upstream_commit [PROJECT] MESSAGE SCRIPT |
Run SCRIPT in a clone of the project's upstream (in the VM), commit, push |
sibling_add PROJECT |
Run sibling add with the sibling project's URL |
install_chain |
Install CoreDesktop and every sibling in the run, rebooting as the READMEs say |
fingerprint FILE |
Save the fingerprint |
health [PROJECT...] |
Run the health checks: by default CoreDesktop's, and those of each sibling in the run that's installed |
in_run PROJECT |
True if the sibling project is in this run |
assert_status N, assert_output TEXT, refute_output TEXT |
Check the last run_in_vm |
assert_vm DESCRIPTION SCRIPT |
SCRIPT must succeed in the VM |
assert_same_fingerprint EXPECTED ACTUAL |
The two must match; saves the diff |
The contract with the driver
coredesktop-dev boots the VM, defines these, sources lib/scenario.sh, calls
smoketest_prepare, then the scenario's scenario function:
| Name | |
|---|---|
vm_exec SCRIPT |
Run bash SCRIPT in the VM as tester, inside the GNOME session's environment, stdin from /dev/null. Returns its exit status. |
vm_put LOCAL REMOTE |
Copy a file into the VM |
vm_reboot |
Reboot and wait until tester is logged in to GNOME again |
VM_GIT_SSH, VM_GIT_URL |
GIT_SSH_COMMAND and the ssh:// prefix to push to a path in the VM |
SMOKETEST_REF |
The commit under test |
SMOKETEST_RESULTS |
This scenario's folder for logs and fingerprints |
SMOKETEST_SHARED |
A folder shared by all scenarios in the run |
IMAGE_REF |
For the installed image, the commit it was installed at |
SMOKETEST_CHAIN_FILE |
Optional: the projects in the run (below). Without it, the run is CoreDesktop alone, at SMOKETEST_REF, in an image at IMAGE_REF |
To build the installed image, the driver calls smoketest_build_layer CoreDesktop SHA on the base image instead of smoketest_prepare; and for a sibling's
image layer, smoketest_build_layer NAME SHA on the image below it.
Anything that boots a VM can drive these scenarios, e.g. a CI runner with KVM.
Sibling projects
A sibling project (HamPack, say) can have scenarios of its own, run on top of
CoreDesktop's: coredesktop-dev smoketest run --with HamPack. Its working copy,
beside CoreDesktop's, has a smoketest/project.conf:
NAME=HamPack
PARENT=CoreDesktop # or a sibling it's built on
URLS=(https://gitea.young.computer/david/HamPack.git)
and its scenarios in smoketest/scenarios/, written like CoreDesktop's with
these helpers. Optionally, it has smoketest/health, run by health, and
smoketest/setup, run in the VM before every scenario and image build of a
run it's in, for what it needs on any machine it's tested on.
The run includes CoreDesktop's scenarios too, so it also checks the sibling
doesn't break CoreDesktop. Each sibling gets a fake upstream in the VM like
CoreDesktop's, and the installed image is layered: installed+HamPack is
installed after sibling add HamPack. Scenarios on it start by updating every
project to its commit under test.
The driver describes the run in SMOKETEST_CHAIN_FILE, one line per project,
CoreDesktop first, tab-separated: name, working copy, commit under test, commit
in the image (empty if none), and its URLs, separated by spaces (none for
CoreDesktop, whose are COREDESKTOP_URLS).
Not covered
NVIDIA drivers, firmware updates (updates.d/90-firmware.sh), and anything that
needs a real Core, a Tailscale login or a Claude login (configure). Check
those by hand.