#!/bin/sh # mesh-check-toolchain: go # # The controller's own check (novox/hq ADR 0237 as amended): the second layer of a pull request's merge # check, `mesh/repo-check`, run by the build seat in the mesh's Go toolchain — and by hand: # `MESH_TEST_POSTGRES=… sh merge-check.sh`. # # The gate — every machine composed with this change's controller, which judges itself — is the build # seat's first layer (`mesh/merge-gate`), run because the mesh's module graph builds `mesh-controller` # from this repository; it is not repeated here. This is the code's own quality and its suite: # # 1. formatted and vetted; # 2. the whole suite, 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 compiler, and said when it has not. # # Exit 0 is a pass; anything else fails `mesh/repo-check` with the last line printed. set -eu export GOFLAGS=-mod=vendor GOPROXY=off unformatted=$(gofmt -l cmd internal examples) if [ -n "$unformatted" ]; then echo "not gofmt'd:" echo "$unformatted" exit 1 fi CGO_ENABLED=0 go vet ./... if command -v gcc >/dev/null 2>&1; then CGO_ENABLED=1 go test -race -count=1 -timeout 30m ./... else echo "NOT RACE-CHECKED: the toolchain holds no C compiler; the suite runs without the race detector" CGO_ENABLED=0 go test -count=1 -timeout 30m ./... fi # **The store tests of novox/hq ADR 0299 ran** (review of #232): a test that needs the store skips without one, # and a skip passes unseen. With the store this check is given, each must have run and passed, said by name; # without one, that is said. adr0299='^(TestAStopWithoutAMergeWalksTheOthersAgain|TestAStopWithoutAMergeEndsTheMergesThatContainIt|TestAStopWalksTheOthersAgainInTheOpenBatch|TestAStopNamesWhatStaysOnTheMachinesAndWhatStillCarriesIt|TestAStopWithoutAMergeLeavesItOutOfABatch|TestSavingPlansAndMovingMergesIsOneAct)$' if [ -n "${MESH_TEST_POSTGRES:-}" ]; then ran=$(CGO_ENABLED=0 go test -count=1 -v -run "$adr0299" ./cmd/mesh-controller 2>&1 | grep -E '^--- (PASS|FAIL|SKIP)' || true) printf 'ADR 0299 store tests:\n%s\n' "$ran" if [ "$(printf '%s\n' "$ran" | grep -c '^--- PASS')" -ne 6 ]; then echo "ADR 0299's store tests did not all run and pass against the store" exit 1 fi else echo "NOT STORE-CHECKED: no MESH_TEST_POSTGRES, so ADR 0299's store tests skipped" fi