AgeCommit message (Collapse)AuthorLines
Run the file size limit tests without ValgrindBryce Kwon-2/+6
Under --valgrind both tests failed with an exit status of 1 and no page, because Valgrind gave up as it started when the write of its gdbserver file was refused, so cgit never ran.
Test that a background rescan lets the request goBryce Kwon-0/+75
The child that rebuilds an expired list drops the request's stdin, stdout and stderr, and nothing showed it, so a child that kept them would hold the visitor's connection open for the whole scan.
Give the cgit hold-lock runs a time limitBryce Kwon-3/+12
hold-lock has to start cgit inside its hold, so it could not use cgit_rc, and a cgit that blocked on the held lock stalled the run for good instead of failing. The strace helper cannot use cgit_rc either, and now says so.
Check a filter never gets the client's stdoutBryce Kwon-12/+17
The copy of the client's stdout kept during a fill is marked close-on-exec, but nothing checked it, so a filter left holding the connection after the request ended passed.
Let the fd filter find the lock file itselfBryce Kwon-4/+9
The test named the lock file through a variable set for cgit alone, which kept it from going through cgit_rc, as a variable set ahead of a shell function call does not portably reach the commands it runs. The slot names fixed at 00000000 were never explained either.
Test a cache-max-slot-size of 0 and belowBryce Kwon-0/+19
No test set either value, so a size check that took 0 as a limit of no bytes, or a parser that ignored such a value, passed. Under the 64 MB default an ignored value still keeps the big page, so each one follows a limit the page is past.
Test that each page ttl of 0 leaves its page outBryce Kwon-0/+31
cache-about-ttl and cache-snapshot-ttl were never set, cache-index-ttl only by the way and cache-summary-ttl only elsewhere at 0, so a page that took the wrong ttl, or a setting that was never read, passed.
Check the broken commit page from start to endBryce Kwon-2/+11
The test looked only for the error and a single status line, so a page that stopped at the error passed. The empty cache-root proved nothing either without a page that brokenrc does cache.
Test the cache key length a slot can takeBryce Kwon-11/+15
The over-long key was 6000 bytes and the ordinary one about 30, so the limit could move by kilobytes either way and pass, and the warning went to /dev/null.
Write bigkeyrc and slotsizerc in the setup testBryce Kwon-7/+7
About ten tests use bigkeyrc and one more uses slotsizerc, and each was written inside an earlier test, so a --run that left that test out failed the ones after it.
Ask for a missing commit of the hash under testBryce Kwon-3/+2
The id was written as 40 hex digits, which failed the test in a run with GIT_TEST_DEFAULT_HASH=sha256.
Skip the perl helper tests where perl will not runBryce Kwon-3/+9
The PERL prerequisite comes from NO_PERL in the build options, not from an interpreter being there, so a host without perl and with the chain linter off failed these tests instead of skipping them.
Describe what the cache tests coverBryce Kwon-2/+5
Test a scan whose list cannot be writtenBryce Kwon-0/+19
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.
Test that the cache listing is off by defaultBryce Kwon-0/+20
The listing exposes the urls other visitors asked for, and every request for it used the shared config, which turns it on.
Test how an expired page slot is refreshedBryce Kwon-3/+39
No test showed a refresh serving and storing the page as it is now, and the too-large refill could not tell a fresh render from the expired copy, since nothing changed in between. A negative page ttl was proven never to expire only for the scan list.
Test a refresh that finds the slot lock heldBryce Kwon-6/+28
MANUAL says such a request serves the expired copy and logs nothing, and only the case where the lock file cannot be opened was tested.
Look for the placeholder in a list that existsBryce Kwon-6/+9
With no list the glob stayed unmatched, grep failed on it and the negated check passed. The meta check had no proof that the summary had rendered either.
Keep cgit's status where the cache tests pipe itBryce Kwon-10/+21
Piping cgit into cat threw away its exit status, so a crash or valgrind's 126 could not fail the no-key and negative ttl tests. Under ulimit -f 0 not even a status file can be written, so that status goes down the pipe with the page. The negative ttl test also leaned on the list an earlier test left, and its last check passed on a missing file.
Prove a failed final write abandoned the fillBryce Kwon-4/+11
Nothing showed that the limited write failed at all, so a limit that did not bite passed, as did a lock file left behind, a doubled prefix or a page resumed from the wrong offset. The pipe to cat also threw away cgit's exit status.
Check the slot holds the whole large pageBryce Kwon-14/+13
Two identical fresh renders passed the replay test, and the two tests after it read its output, so a slot cut short was caught only because tree pages happen to be cached.
Hold the first request until the second is doneBryce Kwon-26/+84
The lock tests leaned on a three second sleep in the filter and gave up the wait for its marker in silence, so on a slow run the requests need not overlap at all and every check held trivially. A bare wait also hid any crash of the first request, and the second request's page was never looked at. The filter now holds the first request until the test lets it go. The strace test gets the same hold, released once the trace shows the second request has opened the lock file. It checks that the delayed flock then succeeded, since a refusal would mean the inode check was never reached.
Test every setting in the scan cache keyBryce Kwon-0/+94
Only strict-export and the global filters were ever varied against one cache-root, so dropping any of the other inputs passed. Leaving out trust-scan-config is the one that matters most. A list scanned under it carries the filters pushers set, the list is read back with no trust check, and a site that does not trust its scans would run them.
Read back the list a stale lock file could spoilBryce Kwon-9/+14
The scan half grepped the page of the request that rebuilt the list, and that page is drawn from the scan in memory, so the ghost could never show there. Had the truncate moved out of cache_lock_file, every later read of the list would have taken in the stale tail and the test would still have passed.
Test that only full ids take the static ttlBryce Kwon-0/+25
Nothing requested a page pinned to an id with the static ttl in force, so dropping the full id check would cache a page pinned to master or an abbreviation for ever and the suite would pass.
Prove one cache slot keeps its pages apartBryce Kwon-21/+38
The one-slot test threw every response away, so a slot that stopped comparing keys and served whatever page it held still left one file and passed. The collision MANUAL promises to log was never checked either. The size tests also rewrote the shared cgitrc in place, and the listing replay held only while the dynamic ttl did.
Keep a repository's own settings in a cached scanBryce Kwon-0/+47
A scanned repository is read back from the cached list under the global settings, so a setting that only differed from them by being off, or by naming the default value, came back as the global one. branch-sort was written only for age, per-path module links not at all, and a filter a repository turned off left no line behind. Writing an empty value for a filter turned off makes the list depend on whether each global filter is set, so the scan key names that too.
Keep the placeholder out of a cached scanBryce Kwon-0/+12
The cached list wrote "[no description]" like any other description, so once read back it no longer counted as the placeholder and became the meta description of every repository without one. Repositories read back from the list are also marked as having had their description file read, since the scan already did, so the index does not open those files again on every request.
Leave the scan uncached with a negative cache-sizeBryce Kwon-0/+15
The page cache counts a cache-size of 0 or less as off, but scan-path cached its list for any value other than 0, so a negative one still wrote a list into cache-root.
Keep a scan with a negative ttl for goodBryce Kwon-0/+21
"The cache" promises that a negative ttl never expires, but no age was ever below a negative cache-scan-ttl, so every request started a background rescan.
Key the cached scan on every setting it usesBryce Kwon-3/+19
Two cgitrc files sharing a cache-root read one list, so strict-export and trust-scan-config set in one applied to the other, and a changed setting stayed stale until the list expired. The first request after an upgrade scans again, and the files under the old names are never read.
Test a lock won after its file became the slotBryce Kwon-1/+29
Add the shared config writers and cgit_rcBryce Kwon-23/+23
The helpers are named by kind. cgitrc_repo and cgitrc_copy write the config file named first, and cgit_url, cgit_query and cgit_rc run cgit, each named after what it is handed first. A repository copies its defaults from the globals read before its repo.url, so cgitrc_repo places every setting itself, and a global can no longer land where it silently stops applying. The t00xx and t01xx files move to them here.
Share one lock-file helper between the cachesBryce Kwon-0/+25
Let go of a slot lock that cannot take its keyBryce Kwon-0/+15
A failed truncate or key write returned with the descriptor still open, so the lock was held while the page rendered uncached and the file was left behind. It is removed before its last close, as every holder does.
Keep lock contention out of the error logBryce Kwon-2/+20
process_slot logged every failure to lock, so each request that found its slot being filled left a line, while refresh_slot logged none, so an expired slot in a directory the server cannot write was served stale for good without a word. lock_slot now logs the step that failed, as the scan does, and leaves out only another request at work.
Lock the cached repolist with flockBryce Kwon-0/+38
The slot lock has to be an flock, since an exec filter drops a record lock when it closes the stdout a fill writes through. The scan only got by with fcntl because nothing reopens its file while it runs. One kind of lock lets the two share their code, and on Linux, where the kinds never see each other, an flock on the scan's file now holds a scan off like any other.
Open the lock files close-on-execBryce Kwon-0/+27
Each exec filter and snapshot compressor a fill runs inherited the slot's lock descriptor beside the stdout it writes into. An flock lasts until its last copy closes and nothing waits for a process a filter leaves behind, so a fill killed before its rename could leave the slot locked, and served stale or uncached, for as long as such a process lived. The scan holds its lock across no exec and opens the same way so that the two stay alike.
Tidy the cache test's helpers and outputsBryce Kwon-24/+18
The header's last sentence named two of the many later subjects, so it goes too. The second request's stderr is still kept, for the lock tests that come next.
Use test_dir_is_empty for the empty cache checksBryce Kwon-16/+8
The library's check also lists whatever was left behind when it fails.
Lock a cache slot with flockBryce Kwon-0/+38
The slot lock was a POSIX record lock, which a process loses the moment any descriptor on the file closes, and the fill puts the lock file on stdout, which every exec filter and snapshot compressor closes with its dup2. A second request on the slot could then rebuild it under the first and splice the two pages. An flock holds until the last descriptor goes.
Abandon a fill whose last flush fails to writeBryce Kwon-0/+16
The slot being filled was forgotten before the page's final flush, so a write that failed there, on a full disk for one, could not abandon the fill. cgit died into the lock file instead and the visitor got nothing. The mid-page path already delivered the page from the lock file.
Compare the cached and uncached pages wholeBryce Kwon-5/+1
The footer lost the time it was generated at, and both runs come from the same binary, so the two pages have nothing to differ in.
Cache every branch page under cache-dynamic-ttlBryce Kwon-0/+19
The dynamic ttl only applied when the url named a branch with h=, so the log, tree and refs of the default branch, which never carry one, fell back to cache-summary-ttl. The manual already gives each ttl the scope the code now uses.
Stop caching clone files and oversized responsesBryce Kwon-0/+43
The dumb transport reads files that already sit on the disk, so a pack copied into a slot cost that disk twice and the request a second write of every byte. A snapshot took a slot whatever its size, so a visitor naming distinct refs and ids could fill the cache root with archives. cache-max-slot-size, 64 MB unless set, now serves a larger response from the lock file and drops it, along with any expired copy it would have replaced.
Test the hardening passBryce Kwon-5/+4
Clean up the whole treeBryce Kwon-4/+2
Trim the comments and dead code across the treeBryce Kwon-6/+4
Deduplicate the cache test request listsBryce Kwon-48/+25
Renumber the test scripts into themed rangesBryce Kwon-0/+0
The numbering walks outward from the ground the suite stands on. - t000x for the git version, html validity and the cache - t01xx for page content, one script per page - t02xx for filters, submodule links, dates and limits, which cut across pages - t03xx for defence, the security regressions and the $HOME promise - t04xx for the helper tools under tools/