#!/bin/sh # script/test: run the backend test suite with the race detector and # coverage. Go's own -timeout bounds the tests and not their compile, # so a cold build cache cannot fail it. The race detector needs cgo, # and so a C compiler. If the tests fail, they run again with -v for # the details, and the script fails even if that run passes. set -eu ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" main() { cd "$ROOT" go test -timeout 30s -race -cover ./... || { echo "--- Rerunning with -v for details ---" go test -timeout 30s -race -v ./... exit 1 } } main "$@"