Documentation
¶
Overview ¶
Command test-parallelism prints the -p `make preflight` gives its test and race stages, so one run cannot saturate a machine other sessions share (iss-2610102020442624): twice the online cores less the one-minute load, never more than the cores divided among the preflights the first gate admits at once (load.preflights in ~/.abcd.noindex/config.json, or ABCD_LOAD_PREFLIGHTS; one by default) and never fewer than a quarter of them (implement.PreflightParallelism, machineload.GoTestParallelism). Each stage runs it as it starts, so the number reflects the load at that moment. On a CI runner, or where the machine cannot be read, it prints go's own default, GOMAXPROCS.
Given -timeout and a stage's base package budget, it prints that budget instead, or twice it when the one-minute load passes one runnable per online core, so a package slowed by the load is not killed with no test hung (iss-2610241911052191, implement.PreflightTimeout, machineload.GoTestTimeout). On a CI runner, or where the machine cannot be read, it prints the base.
Usage: go test -p "$(go run ./cmd/test-parallelism)" ./...
go test -timeout "$(go run ./cmd/test-parallelism -timeout 40m)" ./...
It is developer tooling, never part of a release: it prints one value and a newline, reads the machine once, writes nothing and exits 0. A slot setting it cannot use is named on stderr and read as one; the load gate before the stage refuses that setting first. A machine config.json it cannot read is read as one without a word: the load gate before the stage names it. An argument it does not know, or a base that is not a positive duration, is a recipe mistake: it prints nothing on standard output and exits 2, so the stage fails there.