AgeCommit message (Collapse)AuthorLines
Test the scan settings no test reachedBryce Kwon-0/+128
Nothing exercised noweb, scan-hidden-path, section-from-path, an ordinary project-list, the gitweb settings or the command-line modes, so a regression could list repositories meant to stay hidden, and the command line could drop what a repository set or lose its sort.
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.
Show a blob at exactly max-blob-sizeBryce Kwon-0/+14
No fixture's size in whole kilobytes equalled the limit, so turning the comparison into greater or equal passed every test.
Test a followed single-file diff against the capBryce Kwon-5/+20
Follow empties the prefix, and the cap has to come from the path asked for, as the source warns. Only the line cap can show that. The pairs are filtered before they are counted, so a single-file page counts one file whatever the cap, and a followed check under max-diff-files could never fail.
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.
Name the build a test run is testingBryce Kwon-1/+7
After tools/build-development.sh or build-release.sh, a plain make test quietly rebuilt without the sanitizers or the hardening and tested that binary instead, with nothing in its output to say so.
Test the preview server's request handlingBryce Kwon-4/+227
Only split_cgi_output was ever run. The handler, which builds the CGI environment, guards the asset directory, caps the body, times cgit out, turns a failed run into a 500 and answers HEAD, ran in no test at all. The server listens on a port the system picks, so parallel runs cannot collide.
Report each preview server split case on its ownBryce Kwon-53/+77
The five cases ran as one test, and their names reached the log only with -v. python3 also ran under the trash directory's HOME, where a version manager's shim may find no interpreter, and without -I, so PYTHONPATH or the user's site packages could shadow a module.
Make the home access test see a rendered pageBryce Kwon-2/+18
Nothing checked that the traced request worked, and one that failed early opened fewer files and passed. cgit unsets HOME, so a read that fell back on the account's entry in the password database would name that home rather than the missing one the test set. Under Valgrind every test would have failed, as strace follows valgrind into the .valgrindrc it reads from the home directory.
Validate only pages that rendered in t0002Bryce Kwon-11/+26
test_url failed only on tidy's own errors, so a 404 or a 500 page in place of the stats or the blame page validated as well as the real one, and an empty body drew no more than warnings.
Show the Git version checks as skipped, not passedBryce Kwon-22/+20
CGIT_TEST_NO_GIT_VERSION ended t0001 before the test library started, so it wrote no counts and printed nothing. Without vendor/git/.git the submodule check passed with a note on stderr, which is the case for a tree from get-git or git archive, so the pin was checked nowhere.
Check the Lua-less build through the helpersBryce Kwon-15/+17
t0006 ran build/nolua/cgit by its path, so Valgrind never saw it, and its page checks passed a page that logged an error. The Makefile and README said the suite runs both binaries the same way, though only these four tests run the one without Lua.
Keep cgit under Valgrind whichever way it is askedBryce Kwon-11/+40
The library runs a script again for --tee, --verbose-log and --stress with the arguments setup.sh left it, and --valgrind was no longer among them, so -V --valgrind ran cgit bare. --valgrind=<tool> reached the library instead, which then wrapped every Git command and left cgit alone. --valgrind-only is refused, as it would need the library's own per-test switching.
Let a test run require the tools it must not skipBryce Kwon-23/+39
Nothing could make a missing prerequisite fail. A host without pkg-config builds without Lua, and make test then passed with every Lua test skipped and the lua pass of t0201 never run. The whole-script skips become named prerequisites so the same list covers them, and the strace probe now traces the file class of calls the tests use, so an strace too old for it skips rather than fails.
Fail a test script that leaves a sanitizer reportBryce Kwon-0/+42
Without -v a report went to /dev/null with the rest of stderr, and one from a process whose status a pipeline or a background job loses failed nothing at all.
Put a time limit on each request in the testsBryce Kwon-1/+4
A regression that blocked, such as a lock never let go or a filter that never returns, hung make test rather than failing it. The alarm is set in Perl, which the test library already wants for its chain lint, since a pending alarm survives the exec into cgit.
Stop marking setup.sh as executableBryce Kwon-0/+0
It is only ever sourced, as extensions/lib.sh is.
Leave no stray variables or globs from setup.shBryce Kwon-4/+9
The arguments were split back apart with globbing on, so one that matched a file in tests/ reached the library as that file's name.
Correct the comments on the test plumbingBryce Kwon-3/+10
cgit_rc keeps its name, close as it is to cgitrc_repo and cgitrc_copy, since every script calls it, so a comment now says what it runs.
Clean a trash directory a stopped test lockedBryce Kwon-0/+3
A script stopped by -i or --debug inside one of the SANITY tests leaves a directory without permissions, and make clean then failed on it.
Run every test script and sum up the resultsBryce Kwon-5/+79
make stopped at the first failing script and left every later one unrun. Each script's closing line also counts its skipped tests as passes, so a run that skipped half the suite read like a full one, and the counts the library writes for each script were never read.
Keep the test results where the library puts themBryce Kwon-8/+1
Only the counts were re-pointed at results/. The --tee, --verbose-log and --stress logs, the leak logs and the counts of a script skipped through GIT_SKIP_TESTS still went to test-results/, which nothing ignored or cleaned, so a summary read from one place would miss them.
Pin what the test library reads from the shellBryce Kwon-2/+9
An exported TEST_OUTPUT_DIRECTORY made every script bail out, and an exported GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main failed t0102.
Add a request helper that checks the answerBryce Kwon-0/+47
cgit exits 0 whatever goes wrong, and a die after the headers leaves a page cut short behind a 200 status, so cgit_rc and its siblings pass any page that does not crash. Only 71 of the 337 tests that request a page checked a status line. cgit_ok also wants an empty stderr and, for HTML, the closing tag. cgit_ok_url renders afresh with the page cache off, since the shared config caches a page under its request alone.
Fail where a test fixture breaksBryce Kwon-24/+29
mkrepo had no && chain, so a failed add or commit went unnoticed and every mkrepo call in the tests passed on a broken repository. The shared fixtures were built the same way. They are still built when setup.sh is sourced, so --run can pick out any test, but a failure now stops the run where it broke.
Stop the run when cgit cannot report its buildBryce Kwon-4/+23
The Lua probe piped cgit --version into grep, so a crash there, or a change of wording, turned every Lua test into a skip and the run still passed. The answer is now also held against the flags the binary was built with in build/CGIT-CFLAGS.
Keep the developer's environment out of the testsBryce Kwon-0/+15
The test library clears only Git's variables, so a CGI variable or CGIT_SCINTILLUA_PATH exported in the shell reached every request, and NO_HTTP alone strips every header. LUA_INIT runs code in each standalone interpreter. The umask is pinned so files the tests create get the same modes everywhere.
Fetch avatar icons without a RefererBryce Kwon-0/+1
The icons came from Gravatar or Libravatar with the page's url as the Referer, so the service learned which repositories and commits each visitor looked at.
Cut the nginx config down to a generic drop-inBryce Kwon-16/+2
The old file was a complete nginx.conf with TLS, compression, catch-all hosts and security headers, and it had to be taken apart before it ran beside a distribution's own nginx.conf. A server block included from the http block leaves the user, the MIME types and the logs to the distribution. Its header gives one default path per thing, adjusted where a system differs, which leaves packagers a plain base to adapt rather than a table for each distribution. HTTPS and git-http-backend are commented examples, so the file serves plain HTTP as shipped. The backend takes only the three smart HTTP paths at cgit's own repository urls, so every page still reaches cgit. git refuses a repository another user owns, which failed every clone until safe.directory was set for the backend, and a 3 MB push got 413 until the location lifted nginx's body limit. The split empties SCRIPT_NAME because a second SCRIPT_NAME after the include reaches fcgiwrap as well, and cgit reads the first one, which put every link under the request path. cgit sends nosniff and a locked policy on raw output itself, so the configs no longer carry one. The t0004 check that all three agree goes here, with the first of them to drop it.
Let a keyboard scroll the stats tableBryce Kwon-0/+6
It scrolls sideways like the hex dump, with nothing inside a keyboard can reach, so it takes focus and the shared focus ring the same way.
Name a pinned commit with the page in the titleBryce Kwon-0/+13
Let a keyboard scroll the hex dumpBryce Kwon-1/+10
Chrome and Firefox already let an overflowing box take focus, with their own ring, but WebKit does not. The table takes focus on a mouse click as well, where focus-visible keeps the ring off.
Read the file and diff tables as layoutBryce Kwon-0/+12
The file view's table only sets the line numbers beside the code, and the unified diff's is a single cell holding every file.
Read the login form table as layoutBryce Kwon-0/+1
Say which index column is sortedBryce Kwon-0/+13
Put a Lua filter's print output where it runsBryce Kwon-0/+20
LuaJIT and Lua 5.1 leave print's line in stdio's buffer until cgit exits, after the end of the page.
Report a snapshot format name that matches nothingBryce Kwon-0/+19
Answer an empty repository's feed with a feedBryce Kwon-0/+19
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.