Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Test a scan whose list cannot be written
After the write fails the scan runs a second time, and that run adds
nothing only because scan-tree.c never resets the directories it has
visited. Nothing showed it, so a reset would have listed every
repository twice and passed.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0003-cache.sh | 19 |
1 file changed, 19 insertions, 0 deletions
diff --git a/tests/t0003-cache.sh b/tests/t0003-cache.sh index c7e8369..365e257 100755 --- a/tests/t0003-cache.sh +++ b/tests/t0003-cache.sh @@ -564,6 +564,25 @@ test_expect_success 'set up a cached scan of two repositories' ' test_path_is_file "cache5/$scanned_rc" ' +# A list that cannot be written leaves the request with the scan it made +# before the write failed, so each repository is listed once and nothing is +# left in the cache-root. The limit is on files, so the log and the exit +# status go through the pipe with the page. +test_expect_success 'a scan whose list cannot be written lists each repository once' ' + rm -rf cache9 && mkdir cache9 && + sed "s|^cache-root=.*|cache-root=$PWD/cache9|" scanrc >unwritablerc && + ( + trap "" XFSZ && + ulimit -f 0 && + { cgit_rc unwritablerc "url=" 2>&1; echo "exit status $?"; } + ) | cat >unwritable.out && + test_grep "^exit status 0$" unwritable.out && + test_grep "Unable to write .*/cache9/rc-[0-9a-f]*\.lock" unwritable.out && + test $(grep -c ">one</a>" unwritable.out) = 1 && + test $(grep -c ">two</a>" unwritable.out) = 1 && + test_dir_is_empty cache9 +' + # A request that finds the scan's lock held and has no list to go on scans # in its own process, leaving the file to the holder. That is only another # request at work and no cause for a line in the log. |
