test(runner): the cleaner's list file stays inside the test
CI / Shell-Lint (bash -n, source-check, Validierungs-Tests) (pull_request) Successful in 3s

This commit is contained in:
2026-10-11 01:19:02 +02:00
parent d8565939ac
commit e292a5e614
+7 -3
View File
@@ -3,7 +3,8 @@
# Docker and without root: docker and stat are stand-ins on PATH that answer
# from tables, and act-runner's private /tmp is a directory under a temp root.
# stat is stood in because a ctime cannot be set back, and the cleaner goes by
# ctime; find and rm are real, under the temp root only.
# ctime; find and rm are real, under the temp root only. The cleaner's own
# list file (mktemp) goes to a directory of the test too, not to /tmp.
# Aufruf: bash tests/test_runner_cleanup.sh
set -u
@@ -20,7 +21,7 @@ nok() { FAIL=$((FAIL + 1)); echo "NOT OK - $1"; }
die() { echo "setup failed: $1" >&2; exit 1; }
T="$(mktemp -d)" || die mktemp
trap 'rm -rf "$T"' EXIT
mkdir -p "$T/conf" "$T/bin" || die mkdir
mkdir -p "$T/conf" "$T/bin" "$T/own" || die mkdir
# patchmgr's file, as runner-install.sh lays it down.
cat >"$T/conf/patchmgr.conf" <<'CONF_EOF' || die conf
@@ -81,7 +82,7 @@ fresh_tmp() {
rm -f "$T/rm-fails"
}
cleanup() { PATH="$T/bin:$PATH" CONF_DIR="$T/conf" TMP_ROOT="$T/root" bash "$CLEANUP"; }
cleanup() { PATH="$T/bin:$PATH" CONF_DIR="$T/conf" TMP_ROOT="$T/root" TMPDIR="$T/own" bash "$CLEANUP"; }
removed_any() { grep -q '^rm' "$T/calls"; }
untouched() { [ -d "$R/counter-check-old" ] && [ -d "$R/go-build-old" ] && [ -d "$R/patchmgrx-old" ] && [ -d "$R/patchmgr-counter-check-old" ]; }
@@ -195,6 +196,9 @@ done
fresh_tmp
if MAX_AGE_HOURS=4 cleanup >/dev/null 2>&1; then ok "MAX_AGE_HOURS=4 is accepted"; else nok "MAX_AGE_HOURS=4 was refused"; fi
# ── The cleaner's list files stay in the test and are removed ────────────────
if [ -z "$(ls -A "$T/own")" ]; then ok "no list file is left behind"; else nok "list files left behind: $(ls -A "$T/own")"; fi
echo
echo "pass: $PASS, fail: $FAIL"
[ "$FAIL" -eq 0 ]