update
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@
|
||||
#
|
||||
# Or simply use the Makefile targets:
|
||||
# make test-lint-docker # build dev stage, run shellcheck+lint
|
||||
# make test-smoke # dry probes; add RUN_SMOKE=1 for real installs
|
||||
# make test-smoke # dry probes; add RUN_SMOKE=1 for real pacman+npm installs
|
||||
#
|
||||
# See README.md ("Testing") and test/entrypoint-test.sh for details.
|
||||
|
||||
|
||||
+64
-15
@@ -9,13 +9,15 @@
|
||||
# - `make -n` dry-runs to catch Makefile typos / missing scripts
|
||||
# - `stow --simulate` to prove every stow target resolves
|
||||
# 2. REAL SMOKE (guarded by RUN_SMOKE=1)
|
||||
# - exercises term/setup.sh package parsing and (optionally) installs
|
||||
# - resolves every @pacman entry against the repo DB
|
||||
# - exercises term/setup.sh (pacman + npm) and re-runs it to prove
|
||||
# idempotency
|
||||
# - verifies stow actually creates symlinks into $HOME
|
||||
# Full AUR/npm + kreation/buntes-monster only run with RUN_FULL=1.
|
||||
# AUR + kreation/buntes-monster only run with RUN_FULL=1.
|
||||
#
|
||||
# Env flags (set via `docker run -e`):
|
||||
# RUN_SMOKE=1 run the real pacman-install smoke
|
||||
# RUN_FULL=1 also attempt AUR/npm + hypr/kreation/buntes-monster
|
||||
# RUN_SMOKE=1 run the real pacman+npm install smoke
|
||||
# RUN_FULL=1 also attempt AUR + hypr/kreation/buntes-monster
|
||||
# SKIP_NET=1 pretend no network; skip anything that needs the mirror
|
||||
|
||||
set -uo pipefail
|
||||
@@ -137,8 +139,8 @@ NOOP
|
||||
echo "[stub] chsh $*"
|
||||
exit 0
|
||||
NOOP
|
||||
# The AUR section is stripped for the pacman-only smoke, so term/setup.sh
|
||||
# only ever passes repo packages here; route yay through pacman directly.
|
||||
# The AUR section is stripped for the smoke, so term/setup.sh only ever
|
||||
# passes repo packages (+ npm) here; route yay through pacman directly.
|
||||
# --noconfirm is needed because the container isn't interactive.
|
||||
cat > "$HOME/bin/yay" <<'NOOP'
|
||||
#!/bin/bash
|
||||
@@ -157,9 +159,9 @@ NOOP
|
||||
say_fail "$d/setup.sh syntax error"
|
||||
fi
|
||||
pacman_count=$(awk '
|
||||
/^@pacman/{s="pacman"}
|
||||
/^@aur/{s="aur"}
|
||||
/^@npm/{s="npm"}
|
||||
/^@pacman/{s="pacman"; next}
|
||||
/^@aur/{s="aur"; next}
|
||||
/^@npm/{s="npm"; next}
|
||||
/^[[:space:]]*#/{next}
|
||||
/^[[:space:]]*$/{next}
|
||||
s=="pacman"{pc++} s=="aur"{ac++} s=="npm"{nc++}
|
||||
@@ -169,12 +171,46 @@ NOOP
|
||||
say_ok "$d/packages.txt -> ${PC} pacman, ${AC} aur, ${NC} npm entries"
|
||||
done
|
||||
|
||||
# 2c2. Every @pacman entry in every packages.txt must resolve in the
|
||||
# repo DB, using the same resolution as the installer (`pacman -S
|
||||
# --print-format`). Aliases/provides count as resolved (locate ->
|
||||
# plocate, ttf-font-awesome -> woff2-font-awesome), while a typo'd or
|
||||
# AUR-only name (e.g. `rd`) fails here before any install happens.
|
||||
header "package resolvability (@pacman entries)"
|
||||
resolv_fail=0
|
||||
for d in basic term utils; do
|
||||
while IFS= read -r pkg; do
|
||||
[[ -z "$pkg" ]] && continue
|
||||
if pacman -S --print-format '%n' "$pkg" >/dev/null 2>&1; then
|
||||
say_ok "pacman resolves $pkg ($d)"
|
||||
else
|
||||
say_fail "pacman cannot resolve $pkg ($d) - target not found"
|
||||
resolv_fail=1
|
||||
fi
|
||||
done < <(awk '
|
||||
BEGIN{s="pacman"}
|
||||
/^@pacman/{s="pacman"; next}
|
||||
/^@aur/{s="skip"; next}
|
||||
/^@npm/{s="skip"; next}
|
||||
/^[[:space:]]*#/{next} /^[[:space:]]*$/{next}
|
||||
s=="pacman"{ sub(/^[^\/]*\//,""); print }
|
||||
' "$REPO/$d/packages.txt")
|
||||
done
|
||||
|
||||
# 2d. If network allowed and not skipped, actually install the pacman
|
||||
# section of term/setup.sh (mirrors `make term` without AUR/npm).
|
||||
# and npm sections of term/setup.sh (mirrors `make term` without AUR;
|
||||
# the @aur section stays RUN_FULL-gated since it needs yay/AUR builds).
|
||||
if [[ "${SKIP_NET:-0}" != "1" ]]; then
|
||||
header "make term (pacman packages, AUR/npm skipped)"
|
||||
# Patch packages.txt to drop @aur/@npm so we don't hit AUR/npm.
|
||||
header "make term (pacman + npm packages, AUR skipped)"
|
||||
# Patch packages.txt: keep @pacman and @npm (@npm runs via sudo npm
|
||||
# in the container), drop @aur so we don't hit AUR builds.
|
||||
cp "$REPO/term/packages.txt" "$HOME/packages.txt.full"
|
||||
awk '
|
||||
/^@aur$/{s="skip"}; /^@npm$/{s="npm"}; /^@pacman$/{s="pacman"}
|
||||
{ if (s!="skip" && NF>0 && $1 !~ /^#/) print }
|
||||
' "$REPO/term/packages.txt" > "$HOME/packages.txt.term-smoke"
|
||||
# pacman-only list for verify_packages.sh (npm packages are not in
|
||||
# the pacman DB).
|
||||
awk '
|
||||
/^@aur$/{s="skip"}; /^@npm$/{s="skip"}; /^@pacman$/{s="pacman"}
|
||||
{ if (s!="skip" && NF>0 && $1 !~ /^#/) print }
|
||||
@@ -182,14 +218,27 @@ NOOP
|
||||
# set a scratch HOME for setup.sh so it doesn't touch the real one.
|
||||
mkdir -p "$HOME/term"
|
||||
cp "$REPO/term/setup.sh" "$HOME/term/setup.sh"
|
||||
cp "$HOME/packages.txt.term-only" "$HOME/term/packages.txt"
|
||||
cp "$HOME/packages.txt.term-smoke" "$HOME/term/packages.txt"
|
||||
# chsh is stubbed via $HOME/bin so even `chsh` works without a pty.
|
||||
setup_ok=0
|
||||
if ( cd "$HOME/term" && bash setup.sh ) ; then
|
||||
say_ok "term/setup.sh (term-only) completed"
|
||||
say_ok "term/setup.sh (pacman+npm) completed"
|
||||
setup_ok=1
|
||||
else
|
||||
say_fail "term/setup.sh (term-only) failed (exit $?)"
|
||||
say_fail "term/setup.sh (pacman+npm) failed (exit $?)"
|
||||
fi
|
||||
|
||||
# 2d1. Idempotency probe: a second run must also succeed. Catches
|
||||
# steps that break on re-runs over an already-populated state (e.g.
|
||||
# `ya pkg add` failing with "already exists").
|
||||
if [[ "$setup_ok" == "1" ]]; then
|
||||
if ( cd "$HOME/term" && bash setup.sh ) ; then
|
||||
say_ok "term/setup.sh re-run: idempotent"
|
||||
else
|
||||
say_fail "term/setup.sh re-run failed (exit $?) - not idempotent"
|
||||
fi
|
||||
else
|
||||
echo " skipping idempotency probe (first run did not complete)"
|
||||
fi
|
||||
|
||||
# 2d2. Verify that every package is really installed and its binary
|
||||
|
||||
Reference in New Issue
Block a user