status-go/_assets/scripts/test-with-coverage.sh
Igor Sirotin cc722359b5
chore_: run tests concurrently (#5731)
* chore_: fake flaky tests

* chore_: run tests in parallel (wip)

* chore_: test-with-coverage-old

* chore_: lint-fix fake flaky tests

* chore_: cleanup

* chore_:

* chore_: lint-fix fake flaky tests

* chore_: enable running some tests sequentially

* chore_: enable back all tests

* chore_: no sequential packages

* chore_: cleanup

* chore_: remove fake flaky packages

* chore_: cleanup

* chore_: attempt UNIT_TEST_COUNT as test count

* chore_: spawn multiple processes

* fix_: don't spawn multiple processes

* chore_: revert redirect_stdout changes

* fix_: update Jenkinsfile

* fix_: use env variables

* fix_: typo
2024-08-26 10:03:26 +01:00

23 lines
661 B
Bash
Executable File

#!/usr/bin/env bash
set -eu
packages=""
coverage_file_path="$(mktemp coverage.out.rerun.XXXXXXXXXX)"
count=1
# This is a hack to workaround gotestsum behaviour. When using a --raw-command,
# gotestsum will only pass the package when rerunning a test. Otherwise we should pass the package ourselves.
# https://github.com/gotestyourself/gotestsum/blob/03568ab6d48faabdb632013632ac42687b5f17d1/cmd/main.go#L331-L336
if [[ "$*" != *"-test.run"* ]]; then
packages="${UNIT_TEST_PACKAGES}"
count=${UNIT_TEST_COUNT}
fi
go test -json \
${packages} \
-count=${count} \
-covermode=atomic \
-coverprofile="${coverage_file_path}" \
-coverpkg ./... \
"$@"