#!/bin/sh
# script/test: run the test suite. On failure, rerun verbosely so the
# failing tests are visible in the output.
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 "$@"
