#!/usr/bin/env bash
# Shortcut for running the Go stress command.
#
# [1]: https://pkg.go.dev/golang.org/x/tools/cmd/stress

set -o errexit
set -o nounset
set -o verbose

rm -f /tmp/q.txt
rm -rf /tmp/q/*
rm -f stop.txt
rm -f test.o

set +o errexit
./tool/go test -race -o test.o "$1" -run=$2 -timeout=60s
set -o errexit

if [[ -f test.o ]]
then
    echo test.o >> .git/info/exclude
    stress ./test.o -test.run=$2 -test.timeout=60s -test.v
fi
