Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ name: Tests
# Runs ./test/all on a real Omarchy install: the VM image of the current
# release, booted fresh for each shard, with this checkout's code copied in.
# The package recipes are checked out beside it, because some tests hold this
# repository's scripts against them. Same-repo branches and pushes to quattro
# run on Namespace 16x32 runners (inline, avoiding a separate trust job); fork
# pull requests run the same sharded suite on GitHub's ubuntu-26.04 runners.
# repository's scripts against them. This fork has no Namespace runners, so
# every shard runs on GitHub's ubuntu-26.04 runners. The release image is
# reused from a Namespace cache volume when NSC_CACHE_PATH is set, and
# fetched into /dev/shm otherwise.

on:
pull_request:
Expand All @@ -22,7 +23,7 @@ concurrency:
jobs:
test:
name: test (${{ matrix.shard }})
runs-on: ${{ (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && 'namespace-profile-linux-amd64-16x32' || 'ubuntu-26.04' }}
runs-on: ubuntu-26.04
timeout-minutes: 20
strategy:
fail-fast: false
Expand Down
4 changes: 2 additions & 2 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the end and exits non-zero.
Deliberately excluded from `./test/all`; it runs in a VM, not the
development session.

Every pull request runs `./test/all` on a real Omarchy install (`.github/workflows/test.yml`), sharded across four parallel VMs (`noncomp-1`, `noncomp-2`, `comp` with `test/cli`, and `exclusive`): `test/ci-vm` boots the VM image of the current stable release using a prebuilt Arch QEMU container (`ghcr.io/omacom/omarchy-ci-qemu:latest`, refreshed by `.github/workflows/ci-qemu-image.yml`), copies the checkout and omarchy-pkgs in, and runs its shard in the desktop session with `OMARCHY_PATH` at the checkout and its `bin/` first on `PATH`. Same-repo branches and pushes to `quattro` run on Namespace `16x32` runners with the release VM image cached in `$NSC_CACHE_PATH`; fork pull requests run the same four shards on GitHub's `ubuntu-26.04` runners, fetching the image into `/dev/shm`. When a run fails, the job log shows the output of every test file that failed or did not finish, and the job uploads every file's log as an artifact. `./test/shell` also prints the ten slowest test files in each run (`--group all|noncomp|comp|exclusive` and `--shard K/N` select subsets locally the same way CI does).
Every pull request runs `./test/all` on a real Omarchy install (`.github/workflows/test.yml`), sharded across four parallel VMs (`noncomp-1`, `noncomp-2`, `comp` with `test/cli`, and `exclusive`): `test/ci-vm` boots the VM image of the current stable release using a prebuilt Arch QEMU container (`ghcr.io/omacom/omarchy-ci-qemu:latest`, refreshed by `.github/workflows/ci-qemu-image.yml`), copies the checkout and omarchy-pkgs in, and runs its shard in the desktop session with `OMARCHY_PATH` at the checkout and its `bin/` first on `PATH`. Every shard runs on GitHub's `ubuntu-26.04` runners. The release image is reused from a Namespace cache volume when `$NSC_CACHE_PATH` is set, and fetched into `/dev/shm` otherwise. When a run fails, the job log shows the output of every test file that failed or did not finish, and the job uploads every file's log as an artifact. `./test/shell` also prints the ten slowest test files in each run (`--group all|noncomp|comp|exclusive` and `--shard K/N` select subsets locally the same way CI does).

A new shell test only needs the right name: drop `<area>-test.sh` into
`test/shell.d/` and `./test/shell` picks it up automatically. Shared fixtures
Expand Down Expand Up @@ -108,7 +108,7 @@ A handful of tests fail when a fast path gets slow again. Each prefers a count t
- `test/shell.d/menu-guard-budget-test.sh` runs the shipped menu's guard batch on this machine's real hardware: the batch within 200ms (about 50ms today) and each guard alone within 100ms (the slowest is about 30ms), scaled to the machine, listing the slowest guards when either fails. Skipped without `$XDG_RUNTIME_DIR`, which holds the package snapshot the menu relies on.
- `test/shell.d/theme-set-budget-test.sh` runs the whole `omarchy-theme-set` in a scratch home where every app is a stub given its real cost (a running Hunk, VS Code's Electron boot, three tmux sessions). It fails when either theme's switch takes over 500ms scaled to the machine (about 80ms today), starts more than a handful of tmux clients, starts VS Code to list its extensions, or waits for Hunk's settle nudge.
- `test/shell.d/bar-startup-budget-test.sh` starts a scratch shell through `bin/omarchy-launch-shell`, as uwsm does at login, on an empty home, and times it until the compositor maps the default bar at a real size: the fastest of three cold starts within 750ms scaled to the machine (about 280ms today). Greetd and the compositor's own start are left to acceptance testing. Compositor-gated, and it reads the live session, so a busy desktop can fail it.
- `test/shell.d/lock-appear-budget-test.sh` times the lock preview surface, which renders the real LockView without engaging the session lock: the lock service answering within four times as long as the shell itself takes to answer (2.6 to 3.2 times on GitHub's runners, Intel and AMD alike, where process speed tracks neither), and the first appearance, timed once the shell has gone quiet, within 300ms, each the fastest of three cold starts, and a reappearance within 150ms, the faster of two, both scaled to the machine (about 130ms first and 45ms again today). Compositor-gated, and it reads the live session, so a busy desktop can fail it.
- `test/shell.d/lock-appear-budget-test.sh` times the lock preview surface, which renders the real LockView without engaging the session lock: the lock service answering within four times as long as the shell itself takes to answer, after one untimed start has filled the QML disk cache (shell ping returns before plugin services are compiled, and a cold compile of them on the 4-vCPU GitHub runner ran past four times the ping; with the cache warm the ratio is the same QML work on both sides of it, where process speed tracks neither), and the first appearance, timed once the shell has gone quiet, within 300ms, each the fastest of three cold starts, and a reappearance within 150ms, the faster of two, both scaled to the machine (about 130ms first and 45ms again today). Compositor-gated, and it reads the live session, so a busy desktop can fail it.
- `test/shell.d/menu-open-budget-test.sh` times a warm menu summon until the compositor maps its surface at a real size: the fastest of three within 150ms scaled to the machine (about 40ms today). Compositor-gated, and it reads the live session, so a busy desktop can fail it.
- `test/shell.d/panel-open-budgets-test.sh` times each bar panel (audio, Bluetooth, monitor, network, and power where there is a battery) from its IPC open until the compositor maps it: the first open, which builds the panel's content, within 400ms and the faster of two reopens within 150ms, scaled to the machine (about 30 to 60ms for both today). Compositor-gated, and it reads the live session, so a busy desktop can fail it.

Expand Down
10 changes: 8 additions & 2 deletions test/shell
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ if (( ${#skipped[@]} > 0 )); then
fi

print_slowest() {
local rows=() name ms
local rows=() name ms ranked=() row shown=0
for test in "${tests[@]}"; do
name=$(basename "$test")
[[ -f $workdir/$name.time ]] || continue
Expand All @@ -348,9 +348,15 @@ print_slowest() {
done
(( ${#rows[@]} > 0 )) || return 0
printf '\nSlowest test files:\n'
printf '%s\n' "${rows[@]}" | sort -rn | head -n 10 | while read -r ms rel; do
# sort must finish writing. head would close the pipe after ten lines, and
# pipefail then fails a green suite.
mapfile -t ranked < <(printf '%s\n' "${rows[@]}" | sort -rn)
for row in "${ranked[@]}"; do
(( shown >= 10 )) && break
read -r ms rel <<<"$row"
ms=$(( 10#$ms ))
printf ' %6d.%02ds %s\n' "$(( ms / 1000 ))" "$(( (ms % 1000) / 10 ))" "$rel"
shown=$(( shown + 1 ))
done
}

Expand Down
19 changes: 18 additions & 1 deletion test/shell.d/lock-appear-budget-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
# path is bounded separately by omarchy-system-sleep-lock and its
# sleep-lock test. Fastest of three; the appearances are scaled to machine
# process speed, the view build to how fast the shell itself starts.
# Shell ping exists before plugin services are compiled, and a cold home
# deletes the QML disk cache, so one untimed start fills that cache first.
# The measured starts still get an empty session home.

set -euo pipefail

Expand All @@ -21,6 +24,19 @@ REOPEN_BUDGET_MS=$(( ${OMARCHY_LOCK_REAPPEAR_BUDGET_MS:-150} * SPEED_PERCENT / 1

setup_scratch_shell

# Outside the session home, so reset_scratch_home keeps the compiled services.
export QML_DISK_CACHE_PATH="$SCRATCH_DIR/qmlcache"
mkdir -p "$QML_DISK_CACHE_PATH"
start_scratch_shell
wait_scratch_shell
for _ in {1..80}; do
[[ $(scratch_ipc lock status 2>/dev/null || true) == '{"locked":'* ]] && break
kill -0 "$SCRATCH_PID" 2>/dev/null || fail "lock service becomes available"
sleep 0.1
done
[[ $(scratch_ipc lock status 2>/dev/null || true) == '{"locked":'* ]] || fail "lock service becomes available"
stop_scratch_shell

appear_ms() {
local start end
start=$EPOCHREALTIME
Expand Down Expand Up @@ -69,7 +85,8 @@ answer_best=""
first_best=""
reopen_best=""
for round in 1 2 3; do
(( round == 1 )) || { stop_scratch_shell; reset_scratch_home; }
(( round == 1 )) || stop_scratch_shell
reset_scratch_home
launch_start=$EPOCHREALTIME
start_scratch_shell
wait_scratch_shell
Expand Down
24 changes: 23 additions & 1 deletion test/shell.d/polkit-face-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,29 @@ const pluginQml = fs.readdirSync(pluginDir).filter((name) => name.endsWith('.qml

assert(/property var pluginRegistry/.test(agentQml), 'polkit agent declares pluginRegistry so ensureService injects the real registry')
assert(!/property\s+\S+\s+shell\b/.test(pluginQml), 'nothing in the polkit plugin declares shell')
assert(!/\bsource:/.test(pluginQml) && !/setSource\(/.test(pluginQml) && !/FaceScanRing/.test(pluginQml), 'no QML is loaded from a URL into the polkit windows')
function qmlSourceLoadsComponent(qml) {
const re = /\bsource:/g
let match
while ((match = re.exec(qml))) {
let depth = 0
let open = -1
for (let i = match.index - 1; i >= 0; i--) {
const ch = qml[i]
if (ch === '}') depth++
else if (ch === '{') {
if (depth === 0) {
open = i
break
}
depth--
}
}
const type = open < 0 ? '' : (qml.slice(0, open).match(/([A-Za-z_][A-Za-z0-9_]*)\s*$/) || [])[1]
if (type !== 'Image') return true
}
return false
}
assert(!qmlSourceLoadsComponent(pluginQml) && !/setSource\(/.test(pluginQml) && !/FaceScanRing/.test(pluginQml), 'no QML is loaded from a URL into the polkit windows')
assert(!fs.existsSync(path.join(pluginDir, 'FaceScanRing.qml')), 'first-party FaceScanRing is gone')
assert(!/chromeContext/.test(pluginQml), 'chromeContext is gone: a QtObject parented to the agent root is a walk back to the field')
assert(!/item\.chrome/.test(pluginQml) && !/item\.flow/.test(pluginQml), 'nothing host-owned is handed to a chrome plugin')
Expand Down