summaryrefslogtreecommitdiffstats
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* The two git calls were missing their NULL, so every push cost one level too muchdev2026-11-141-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | execvp walks argv until it finds a NULL. head_ref built a four-element array and fast_forward a five-element one, filled every slot, and never wrote the terminator - so the fifth and sixth entries were whatever the stack happened to be holding, and the exec either failed or ran something that was not the argument list anybody meant. Both answers were load-bearing, and both failures were silent: symbolic-ref fails the hook cannot tell which branch HEAD is, so it charges every deletion the most: admin merge-base fails the update cannot be shown to be a fast-forward, so it costs force Together that meant a user with write could create a branch and then never update it, and nobody but an admin could delete anything - with the refusal pointing at the policy, which was fine, and at a level the user did not hold, which looked deliberate. It was not. It was the shape of a C array. Fixed by writing the arrays out with their NULL visible, and commented, because the compiler will not catch this one: the array is big enough, the types are right, and the bug is in the element that is not there. The core suite could not see this, and that was the real problem - it passes --ff and --head precisely so that it needs no git, which leaves the asking itself untested. So there is now a stand-in named git in the suite, and the real one kept out of PATH: it answers symbolic-ref to order and exits merge-base either way, which covers fast-forward and non-fast-forward, HEAD's branch and not, and the case with no git at all, where the hook must fail toward denying rather than toward guessing. Eight checks, all of which failed before the fix. The container suite caught this by being the only suite that runs the real thing, which is worth noting for the next time someone suggests the integration suite is the slow one that can be skipped.
* Layout: cmd/, src/, test/, everything built into obj/dev2026-11-147-0/+1430
The tree had grown sideways: main.c living among the sources it dispatches to, one test binary covering everything, object files left in the source directory because the Makefile put them there and, worse, tracked them. Now the command line is cmd/main.c, the engine is src/ and nothing in it knows about the command line, and each area of the engine has its own program under test/ - glob, norm, parse, need, check - each linking the library and reporting its own count. A failure says which area broke instead of taking the whole run down with a single "unit: 171" line, which is the only thing a per-file split buys and it is worth the small duplication the shared test.h absorbs. Objects go to obj/, test runners to obj/test_runner/, so a build leaves the tree as it found it. The stale src/*.o and tests/unit that were committed earlier are gone; they were build output in a source tree and the .gitignore that should have stopped them arrived after they did. The Makefile follows the same shape as the other C trees here: directories in variables, wildcards for the sources, one pattern rule that makes its own directory, test runners built from the same objects as the binary so they cannot test a different build than ships, and `test` running every runner with a foreach so the first failure stops the line. `strict` is `all` with -Werror, which is what CI now calls instead of passing CFLAGS in from outside; the sanitizer and install targets are unchanged in what they do. Behaviour is unchanged: 171 direct checks and 154 behavioural ones, same as before the move, and make install still stages a working hook symlink.