Diff options
Diffstat (limited to '')
| -rwxr-xr-x | tests/t0003-cache.sh | 22 |
1 file changed, 20 insertions, 2 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index 8b3f2f9..39f11a9 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -247,7 +247,8 @@ overlap_requests() { # The fill writes the page into the lock file through stdout, and an exec # filter puts its own pipe on stdout while it runs. The slot lock has to # outlast that, or a second request on the slot rebuilds it under the first -# and the first visitor gets the two pages spliced together. +# and the first visitor gets the two pages spliced together. The second one +# finding the lock held is ordinary contention, which logs nothing. test_expect_success 'a slot stays locked while an exec filter runs' ' rm -rf cache3 && mkdir cache3 && write_script slow-filter.sh <<-EOF && @@ -264,7 +265,8 @@ test_expect_success 'a slot stays locked while an exec filter runs' ' overlap_requests && test $(grep -c "^Status:" first.out) = 1 && grep "id=.about." first.out && - ! grep "Unable to publish" first.err + ! grep "Unable to publish" first.err && + ! grep "Unable to lock" second.err ' # An flock lasts until the last copy of its descriptor closes, so a filter @@ -294,6 +296,22 @@ test_expect_success PERL 'a filter holds the lock file only as its stdout' ' grep -F "lock file on fd 1." fd.out ' +# A refresh that cannot take the lock serves the expired copy, and says why +# unless the reason is another request doing the refresh. A line appended +# to the copy shows that it is what was served. +test_expect_success SANITY 'a refresh that cannot lock serves the expired slot and says why' ' + rm -rf cache3 && mkdir cache3 && + CGIT_CONFIG="$PWD/bigkeyrc" QUERY_STRING="url=bigpage/" cgit >/dev/null && + slot=$(ls cache3) && + echo "the expired copy" >>"cache3/$slot" && + touch -t 200001010000 "cache3/$slot" && + test_when_finished "chmod u+w cache3" && + chmod a-w cache3 && + CGIT_CONFIG="$PWD/bigkeyrc" QUERY_STRING="url=bigpage/" cgit >stale.out 2>stale.err && + grep "the expired copy" stale.out && + grep "Unable to open .*\.lock: Permission denied" stale.err +' + # A scan is cached in a file named after the hash of its path, so a first # scan finds out what that name is. The index page is left uncached, which # makes each request read the list afresh. |
