diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-14 16:13:04 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-14 16:13:04 +0200 |
| commit | b50ad8786a116bf4d30324b1bdfa65db71699e83 (patch) | |
| tree | 59943e672f3c36db85cd2990317171f36b82bfe5 /.extras/test-logic.sh | |
| parent | 2b75214a975be9b9bef4824b78304a23fbe5f078 (diff) | |
| download | sbo-slackbuilds-b50ad8786a116bf4d30324b1bdfa65db71699e83.tar.gz sbo-slackbuilds-b50ad8786a116bf4d30324b1bdfa65db71699e83.zip | |
test-build: variant-namespace the dep cache and prune stale digests
The dep cache was keyed on image digest alone, so a nightly image rebuild
orphaned the old digest's cache dir forever (disk creep). Namespace it as
<variant>-<digest> and, on each run, prune superseded digests of the SAME
variant. Scoping to the variant means a --current run does not wipe the 15.0
cache, so testing both trees back-to-back still reuses built deps (e.g.
google-go-lang). Correctness was already fine (digest self-invalidates); this
just stops the accumulation, matching sbo-batch-test's invalidate-on-base-update.
Add three prune self-checks.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Diffstat (limited to '.extras/test-logic.sh')
| -rw-r--r-- | .extras/test-logic.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/.extras/test-logic.sh b/.extras/test-logic.sh index 469ac1d..7dc7387 100644 --- a/.extras/test-logic.sh +++ b/.extras/test-logic.sh @@ -181,6 +181,19 @@ CACHE_ROOT_SAVE="$CACHE_ROOT"; USE_CACHE=0 [[ "$(cache_decision net libfoo 1.2)" == "new" ]] && ok "--no-cache disables (new)" || bad "disabled cache got [$(cache_decision net libfoo 1.2)]" USE_CACHE=1; CACHE_ROOT="$CACHE_ROOT_SAVE" +# resolve_cache_root prunes stale digests of the SAME variant, keeps the other. +# No docker here, so the digest falls back to the tag-derived name; seed sibling +# dirs and confirm only the active-variant orphan is removed. +PRUNE_CACHE=$(mktemp -d) +PKG_CACHE="$PRUNE_CACHE"; ACTIVE_IMAGE="sbo-testbuild:current"; VERSION_ID="current" +mkdir -p "$PRUNE_CACHE/current-oldstale" "$PRUNE_CACHE/15.0-keepme" +resolve_cache_root +[[ -d "$CACHE_ROOT" ]] && ok "cache root created" || bad "cache root missing" +[[ ! -e "$PRUNE_CACHE/current-oldstale" ]] && ok "prune drops stale same-variant digest" || bad "stale current digest survived" +[[ -d "$PRUNE_CACHE/15.0-keepme" ]] && ok "prune keeps other-variant cache" || bad "15.0 cache wrongly pruned" +rm -rf "$PRUNE_CACHE" +VERSION_ID="current"; CACHE_ROOT="$CACHE_ROOT_SAVE" + # --- BLOCKED-BY-DEP (depends_on_failed) ------------------------------------- dead=(b) if depends_on_failed "$T/cat/g" dead; then ok "g blocked when b dead"; else bad "g should block on b"; fi |
