diff options
Diffstat (limited to '.extras/test-logic.sh')
| -rw-r--r-- | .extras/test-logic.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.extras/test-logic.sh b/.extras/test-logic.sh new file mode 100644 index 0000000..20041a9 --- /dev/null +++ b/.extras/test-logic.sh @@ -0,0 +1,36 @@ +#!/bin/bash +# +# Logic self-check for .extras/test-build. Covers the pure, host-side parts: +# dependency resolution, override application, unknown-dep -> UNMET, cache +# decisions, and BLOCKED-BY-DEP propagation. No docker. +# +# Run: bash .extras/test-logic.sh +# +set -uo pipefail + +SCRIPT="$(dirname "$0")/test-build" +T=$(mktemp -d) +BASE_DB=$(mktemp -d); mkdir -p "$BASE_DB" + +cleanup() { rm -rf "$T" "$BASE_DB"; } +trap cleanup EXIT + +# Source the script without running main(). Sourcing re-runs the CONFIG block, +# so set test vars AFTER the source. +LIB=$(mktemp) +sed '/^main "\$@"$/d' "$SCRIPT" > "$LIB" +# shellcheck disable=SC1090 +source "$LIB" 2>/dev/null +rm -f "$LIB" + +pass=0; fail=0 +ok() { echo " ok: $1"; ((pass++)); return 0; } +bad() { echo " FAIL: $1"; ((fail++)); return 0; } + +# Placeholder assertion so this file runs before any logic exists. +ok "script sources without executing main" + +echo +echo "$pass passed, $fail failed" +[[ $fail -eq 0 ]] || exit 1 +echo "ALL LOGIC CHECKS PASS" |
