mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-10 20:27:15 +01:00
Some checks failed
dependency freshness / dependencies on newest stable (push) Waiting to run
file length / file-length (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
crdt_sync_dart tests / test (push) Has been cancelled
crdt_sync_flutter tests / test (push) Has been cancelled
crdt-sync pre-commit / pre-commit (push) Has been cancelled
crdt-sync tests / test (push) Has been cancelled
ts_config tests / test (push) Has been cancelled
ts_core tests / test (push) Has been cancelled
web_ui tests / test (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
31 lines
1.1 KiB
Bash
31 lines
1.1 KiB
Bash
# ============================================================================
|
|
# vmbox: shared bats fixture for the host-side unit tests (load test_helper).
|
|
#
|
|
# VMBOX_HOME is redirected to a per-test temp dir. Nothing here may touch the
|
|
# real ~/.local/share/vmbox: these tests create and delete VM state, and a
|
|
# stray write there would clobber a live sandbox's overlay or pidfile.
|
|
# ============================================================================
|
|
|
|
setup() {
|
|
VMBOX_TEST_HOME="$(mktemp -d)"
|
|
export VMBOX_HOME="$VMBOX_TEST_HOME"
|
|
REPO_ROOT="$(cd "$BATS_TEST_DIRNAME/.." && pwd -P)"
|
|
export REPO_ROOT
|
|
|
|
# common.sh guards against double-sourcing with a readonly flag, and bats
|
|
# runs every test in a fresh subshell, so a plain source is safe here.
|
|
source "$REPO_ROOT/lib/common.sh"
|
|
source "$REPO_ROOT/lib/verdict.sh"
|
|
|
|
install -d "$VMBOX_VMS_DIR"
|
|
}
|
|
|
|
teardown() {
|
|
[[ -n "${VMBOX_TEST_HOME:-}" && -d "$VMBOX_TEST_HOME" ]] && rm -rf "$VMBOX_TEST_HOME"
|
|
}
|
|
|
|
# Create a fake VM directory without booting anything.
|
|
_fake_vm() {
|
|
install -d "$(vm_dir "$1")"
|
|
}
|