Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Share one lock-file helper between the caches
Diffstat (limited to '')
| -rwxr-xr-x | tests/t0003-cache.sh | 25 |
1 file changed, 25 insertions, 0 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index f4fa3cb..17816c3 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -365,4 +365,29 @@ test_expect_success PERL 'a scan finding its lock held runs uncached' ' test_must_be_empty held.err ' +# A run that died before its rename leaves a lock file behind, here longer +# than anything the next run writes and ending in a repository and a marker. +# Emptying the file before reuse keeps that tail out of both caches. +test_expect_success 'a stale lock file reaches neither the scan nor a slot' ' + { + printf "%01024d\n" 0 0 0 0 && + echo "repo.url=ghost" && + echo "repo.path=$PWD/scanned/one/.git" + } >stale.lock && + rm -f "cache5/$scanned_rc" && + cp stale.lock "cache5/$scanned_rc.lock" && + CGIT_CONFIG="$PWD/scanrc" QUERY_STRING="url=" cgit >scan.out && + grep ">one</a>" scan.out && + ! grep ">ghost</a>" scan.out && + rm -rf cache3 && mkdir cache3 && + CGIT_CONFIG="$PWD/bigkeyrc" QUERY_STRING="url=bigpage/" cgit >page.out && + slot=$(ls cache3) && + rm "cache3/$slot" && + { cat page.out page.out && echo "STALE-TAIL"; } >"cache3/$slot.lock" && + CGIT_CONFIG="$PWD/bigkeyrc" QUERY_STRING="url=bigpage/" cgit >/dev/null && + CGIT_CONFIG="$PWD/bigkeyrc" QUERY_STRING="url=bigpage/" cgit >replay.out && + grep "</html>" replay.out && + ! grep "STALE-TAIL" replay.out +' + test_done |
