#!/bin/sh
# script/test: run the test suite. Quiet on success; on failure, rerun
# verbosely for full diagnostic output (the exit 1 ensures the rerun
# never turns a failure into a pass).
set -eu

ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"

main() {
    cd "$ROOT"
    go test -race -timeout 30s ./... || {
        echo "--- Rerunning with -v for details ---"
        go test -race -timeout 30s -v ./...
        exit 1
    }
}

main "$@"
