scripts/check.sh runs make lint, test, oracle and e2e together, each into a log printed whole with its time when it ends, then make speed on its own. The tests that time frames against fixed bounds (TestSharedEditWithinAFrame, TestStreamGridAtFrameSpeed, TestScrollsAtFrameSpeed) move from make test to make speed beside the speed gate, so none of them shares the CPU with the e2e sessions.
- commit
- 05c0cd4c91b29fd6735acbf31a8823f2ee9682bb
- parent
- 159a874b6ebf0f5541cc8382607f0eae2e1b3894
- author
- Dami <dami.etoile@gmail.com>
- kind
- build risk score 1.8 of 3, Jev's estimate
| M | Makefile | 31 | +++++++++++-------- |
| A | scripts/ | 51 | ++++++++++++++++++++++++++++++ |
@@ -21,29 +21,34 @@ run: build
2121 dist:2222 VERSION=$(VERSION) scripts/dist.sh2323 24+# Unit tests, all but the timed ones, which run alone in make speed.2425 test:25- STRESS_DIR=$(DEPS)/stress go test ./...26+ STRESS_DIR=$(DEPS)/stress go test -skip '^($(TIMED_UI)|$(TIMED_NBVIEW))$$' ./...2627 27-# Everything that must pass before a push: lint, unit tests, the speed gate, the28-# excelize oracle and the end-to-end tests in libghostty.29-check:30- $(MAKE) lint31- STRESS_DIR=$(DEPS)/stress go test ./...32- $(MAKE) speed33- $(MAKE) oracle34- $(MAKE) e2e28+# Everything that must pass before a push: lint, unit tests, the excelize29+# oracle and the end-to-end tests in libghostty at once, then the speed30+# gate and timed tests alone (scripts/check.sh).31+check: $(GHOSTTY_STAMP)32+ @scripts/check.sh3533 3634 # gofmt, vet (with the stress benchmarks), staticcheck, shape limits and3735 # the docs checks, at once.3836 lint:3937 scripts/lint.sh4038 39+# Tests that time frames against fixed bounds: make test skips them and40+# make speed runs them alone, as the speed gate.41+TIMED_UI := TestSpeed|TestSharedEditWithinAFrame|TestStreamGridAtFrameSpeed42+TIMED_NBVIEW := TestScrollsAtFrameSpeed43+4144 # The speed gate: frames and recalculation on mid-sized sheets against42-# internal/ui/testdata/speed.json, in about two seconds, alone so that43-# no other package's tests share the CPU. speed-update rewrites the44-# baseline. See docs/contributing/limits.md#the-speed-gate.45+# internal/ui/testdata/speed.json, in about two seconds, and the tests46+# that time frames, alone so that no other tests share the CPU.47+# speed-update rewrites the baseline. See48+# docs/contributing/limits.md#the-speed-gate.4549 speed:46- go test ./internal/ui -run '^TestSpeed$$' -count=1 -speed50+ go test ./internal/ui -run '^($(TIMED_UI))$$' -count=1 -speed51+ go test ./internal/ui/nbview -run '^($(TIMED_NBVIEW))$$' -count=14752 4853 speed-update:4954 go test ./internal/ui -run '^TestSpeed$$' -count=1 -speed-update -v@@ -0,0 +1,51 @@
1+2+# make check: lint, unit tests, the excelize oracle and the end-to-end3+# tests run at once, each into a log of its own printed whole when it4+# ends, so their output never interleaves; then the speed gate and the5+# timed tests run alone, on a CPU no other tests share. Exits 1 if any6+# phase failed. See docs/contributing/testing.md.7+set -u8+cd "$(dirname "$0")/.."9+MAKE=${MAKE:-make}10+11+out=$(mktemp -d)12+trap 'rm -rf "$out"' EXIT13+start=$(date +%s)14+fail=""15+16+phase() {17+ "$MAKE" --no-print-directory "$1" >"$out/$1" 2>&118+ echo $? >"$out/$1.status"19+ date +%s >"$out/$1.end"20+}21+22+report() {23+ status=$(cat "$out/$1.status")24+ took=$(($(cat "$out/$1.end") - start))25+ if [ "$status" = 0 ]; then26+ echo "=== $1: ok, done at ${took}s"27+ else28+ echo "=== $1: FAILED, done at ${took}s"29+ fail="$fail $1"30+ fi31+ cat "$out/$1"32+}33+34+# e2e first: it's the longest.35+for p in e2e test lint oracle; do36+ phase "$p" &37+ eval "pid_$p=$!"38+done39+for p in lint oracle test e2e; do40+ eval "wait \$pid_$p"41+ report "$p"42+done43+44+phase speed45+report speed46+47+echo "=== make check: $(($(date +%s) - start))s"48+if [ -n "$fail" ]; then49+ echo "failed:$fail"50+ exit 151+fi