diff --git a/merge-check.sh b/merge-check.sh index 54e8f90c..05cee58c 100755 --- a/merge-check.sh +++ b/merge-check.sh @@ -12,7 +12,7 @@ # 1. formatted and vetted, with and without the build tag `integration`; # 2. the unit level: `go test ./...` untagged and without the race detector, timed and held to a bound # (unit_bound below): a test with no database, bus, running service or other process (novox/hq ADR 0391, -# how-we-build section 5). Over the bound the check fails and names the slowest tests (issue 895); +# how-we-build section 5). With a bound set, over it the check fails and names the slowest tests (issue 895); # 3. the integration level: the whole suite with `-tags integration`, packages in parallel, against the # throwaway store the build seat raised at the release the mesh runs; every live test on a bus of its own # (internal/testbus), so nothing is serialised. Under the race detector when the toolchain has a C @@ -27,9 +27,11 @@ set -eu export GOFLAGS=-mod=vendor GOPROXY=off # **The unit level's bound, in seconds** (issue 895): the slowest package's own test time of the untagged run, the -# compile not counted. It is a few seconds while the tests of the last packages are still being split from the -# integration level; it becomes 1 s (how-we-build section 5: the whole unit suite under a second) when that is done. -unit_bound=5 +# compile not counted. A run over it fails the check and names the slowest tests. It is 3 s since the tests carry the +# `integration` tag (design 47 milestone 3): the slowest packages, cmd/mesh-controller and internal/catalogue, measured +# 2.6-2.8 s in about 2000 small tests each. How-we-build section 5 asks 1 s for the whole unit suite: issue 1055 +# (a catalogue loaded once per package run, fewer source-scanning tests). +unit_bound=3 # judge_store_tests says each listed test of one package as `go test -v` reported it, and counts in $missing each # that did not pass: $1 the package, $2 go test's exit status, $3 the file holding its output, then the names. @@ -74,6 +76,10 @@ judge_unit_run() { tests=$(grep -c '^T' "$out.judged" || true) skipped=$(awk -F'\t' '$1 == "S" {print $2}' "$out.judged") level=$(awk -F'\t' '$1 == "P" && $2 + 0 > m {m = $2 + 0} END {printf "%.2f", m}' "$out.judged") + if [ -z "$bound" ]; then + echo "unit level: $tests tests ($skipped skipped), $level s (no bound enforced yet)" + return 0 + fi echo "unit level: $tests tests ($skipped skipped), $level s (bound $bound s)" if awk -v t="$level" -v b="$bound" 'BEGIN {exit !(t + 0 > b + 0)}'; then echo "the unit level took $level s, over its bound of $bound s; the slowest tests:"