Diff options
Diffstat (limited to 'tests/t0003-cache.sh')
| -rwxr-xr-x | tests/t0003-cache.sh | 27 |
1 file changed, 13 insertions, 14 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index ad6017c..4df6b83 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -93,26 +93,25 @@ test_expect_success 'set up a repo with a page larger than the output buffer' ' rm -rf cache2 && mkdir cache2 ' -test_expect_success 'the first request fills the slot and the second replays it' ' - cgit_rc bigrc "url=bigpage/tree/big.txt" >big.first && +# The slot holds the key, a NUL and then the page, so the page it keeps is +# what follows the first line once the NUL is a newline. The replay has to +# match that and a render with the cache off. +test_expect_success 'a page larger than the buffer is kept and replayed whole' ' + cgit_ok bigrc "url=bigpage/tree/big.txt" >big.first && test $(wc -c <big.first) -gt 65536 && - cgit_rc bigrc "url=bigpage/tree/big.txt" >big.second && - strip_headers <big.first >big.first.body && - strip_headers <big.second >big.second.body && - test_cmp big.first.body big.second.body -' - -test_expect_success 'the cached body matches one generated with the cache off' ' + ls cache2 >big.slots && + test_line_count = 1 big.slots && + tr "\000" "\n" <"cache2/$(cat big.slots)" | sed 1d >slot.page && + test_cmp big.first slot.page && + cgit_ok bigrc "url=bigpage/tree/big.txt" >big.second && + test_cmp big.first big.second && sed -e "s/^cache-size=64$/cache-size=0/" bigrc >bignocache && - cgit_rc bignocache "url=bigpage/tree/big.txt" >big.nocache && + cgit_ok bignocache "url=bigpage/tree/big.txt" >big.nocache && strip_headers <big.nocache >big.nocache.body && + strip_headers <big.second >big.second.body && test_cmp big.nocache.body big.second.body ' -test_expect_success 'the page ends where it should, so nothing was dropped' ' - tail -c 200 big.second.body | grep "</html>" -' - # A slot stores its key ahead of the content and only the first few kilobytes of # it are read back, so a key longer than that could never match. A request # carrying one used to leave a slot behind on every visit that nothing could |
