test: golden status and plan output of the bash backend in a bubblewrap sandbox

This commit is contained in:
theupriser committed 2026-10-05 09:58:23 +02:00
1 parent 2ac2b0d5ca
commit 2659009a49
45 files changed
+146

No files matched your search

+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
# Fake modinfo: modules listed in $FIXTURE/modules exist.
for module in "$@"; do [[ "$module" == -* ]] || grep -qx -- "$module" "$FIXTURE/modules" 2>/dev/null || exit 1; done
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash
# Fake pacman for the golden sandbox: the installed packages are listed in $FIXTURE/packages (one name per line).
# Only the queries the status code makes: -Q/-Qq <pkg>, -T <pkg>..., -Qi <pkg>. Writes (-S, -U, -R) are logged and succeed.
list="$FIXTURE/packages"; touch "$list" 2>/dev/null
case "$1" in
-T) shift; for package in "$@"; do grep -qx -- "$package" "$list" || echo "$package"; done; [[ $# -gt 0 ]] ;;
-Q|-Qq|-Qi|-Qs) shift; status=0; for package in "$@"; do [[ "$package" == -* ]] && continue; grep -qx -- "$package" "$list" || status=1; done; exit $status ;;
-Ss|-Si) exit 1 ;;
*) echo "pacman $*" >> "${GOLDEN_LOG:-/dev/null}"; exit 0 ;;
esac
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
# Fake sudo: logs the command and succeeds; nothing runs.
while [[ "$1" == -* ]]; do shift; done
echo "sudo $*" >> "${GOLDEN_LOG:-/dev/null}"
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# Fake systemctl: enabled units listed in $FIXTURE/enabled-units, active ones in $FIXTURE/active-units.
# Queries answer from those lists; everything else is logged and succeeds.
verb=""; units=()
for argument in "$@"; do
[[ "$argument" == -* ]] && continue
if [[ -z "$verb" ]]; then verb="$argument"; else units+=("$argument"); fi
done
case "$verb" in
is-enabled) for unit in "${units[@]}"; do grep -qx -- "$unit" "$FIXTURE/enabled-units" 2>/dev/null || { echo disabled; exit 1; }; done; echo enabled ;;
is-active) for unit in "${units[@]}"; do grep -qx -- "$unit" "$FIXTURE/active-units" 2>/dev/null || { echo inactive; exit 3; }; done; echo active ;;
*) echo "systemctl $*" >> "${GOLDEN_LOG:-/dev/null}"; exit 0 ;;
esac
+2
View File
@@ -0,0 +1,2 @@
#!/bin/bash
if [[ "$1" == -r ]]; then echo 7.0.0-fixture-cachyos; else command uname "$@"; fi