Fix wallpaper scan cap exit status

This commit is contained in:
Gabriel Brown
2026-08-20 22:00:26 -04:00
parent c4642919f7
commit a90f6eb357
2 changed files with 21 additions and 2 deletions
@@ -11,4 +11,4 @@ find "$@" -maxdepth 2 -type f \
-printf '%T@ %p\n' 2>/dev/null \ -printf '%T@ %p\n' 2>/dev/null \
| sort -rn \ | sort -rn \
| cut -d' ' -f2- \ | cut -d' ' -f2- \
| head -60 | awk 'NR <= 60'
+20 -1
View File
@@ -4,6 +4,7 @@ set -euo pipefail
repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" repo_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
service="$repo_dir/config/dot/quickshell/services/Wallpaper.qml" service="$repo_dir/config/dot/quickshell/services/Wallpaper.qml"
scanner="$repo_dir/config/dot/quickshell/scripts/panama-wallpaper-scan"
fixture="$(mktemp -d /tmp/panama-wallpaper-service.XXXXXX)" fixture="$(mktemp -d /tmp/panama-wallpaper-service.XXXXXX)"
config_home="$fixture/config" config_home="$fixture/config"
state_home="$fixture/state" state_home="$fixture/state"
@@ -17,6 +18,8 @@ shell_log="$fixture/quickshell.log"
harness_pid="" harness_pid=""
quoted_home="$fixture/home's" quoted_home="$fixture/home's"
quoted_wallpaper="$quoted_home/Pictures/Wallpapers/quoted.jpg" quoted_wallpaper="$quoted_home/Pictures/Wallpapers/quoted.jpg"
bulk_wallpapers="$fixture/bulk-wallpapers"
bulk_segment="wallpaper-root-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
fail() { fail() {
printf 'wallpaper service contract: %s\n' "$1" >&2 printf 'wallpaper service contract: %s\n' "$1" >&2
@@ -48,10 +51,26 @@ cleanup() {
} }
trap cleanup EXIT trap cleanup EXIT
for _ in $(seq 1 15); do
bulk_wallpapers="$bulk_wallpapers/$bulk_segment"
done
mkdir -p "$config_home/panama" "$state_home" "$test_bin" \ mkdir -p "$config_home/panama" "$state_home" "$test_bin" \
"$quoted_home/Pictures/Wallpapers" "$quoted_home/Pictures/Wallpapers" "$bulk_wallpapers"
cp -a "$repo_dir/config/dot/quickshell" "$config_path" cp -a "$repo_dir/config/dot/quickshell" "$config_path"
printf 'quoted wallpaper\n' >"$quoted_wallpaper" printf 'quoted wallpaper\n' >"$quoted_wallpaper"
for index in $(seq 1 401); do
wallpaper="$bulk_wallpapers/wallpaper-$index.jpg"
printf 'bulk wallpaper %s\n' "$index" >"$wallpaper"
touch -d "@$((1700000000 + index))" "$wallpaper"
done
if ! bulk_scan="$("$scanner" "$bulk_wallpapers")"; then
fail 'a normal scan with more than 60 images exited non-zero'
fi
expected_bulk_scan="$(for index in $(seq 401 -1 342); do
printf '%s\n' "$bulk_wallpapers/wallpaper-$index.jpg"
done)"
[[ "$bulk_scan" == "$expected_bulk_scan" ]] \
|| fail "over-cap scan did not emit exactly the newest 60 images: $bulk_scan"
cat >"$config_home/panama/settings.json" <<'JSON' cat >"$config_home/panama/settings.json" <<'JSON'
{ {
"displays": { "displays": {