mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-18 12:37:05 +02:00
With Go 1.14.3 we can run race-enabled code on muslc, so this opens path to run unit-tests-race under Talos environment with rootfs, enabling all the tests to run under race detector. Also fixed the tests run by specifying platform in the test environment. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
38 lines
605 B
Bash
Executable File
38 lines
605 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# Set up common test environment variables
|
|
export PLATFORM=container
|
|
|
|
perform_tests() {
|
|
echo "Performing tests on $1"
|
|
go test -v -covermode=atomic -coverprofile=coverage.txt -count 1 "$1"
|
|
}
|
|
|
|
perform_race_tests() {
|
|
echo "Performing race tests on $1"
|
|
CGO_ENABLED=1 go test -v -race -count 1 "$1"
|
|
}
|
|
|
|
perform_short_tests() {
|
|
echo "Performing short tests on $1"
|
|
go test -v -short -count 1 "$1"
|
|
}
|
|
|
|
case $1 in
|
|
--race)
|
|
shift
|
|
perform_race_tests "${1:-./...}"
|
|
;;
|
|
--short)
|
|
shift
|
|
perform_short_tests "${1:-./...}"
|
|
;;
|
|
*)
|
|
perform_tests "${1:-./...}"
|
|
;;
|
|
esac
|
|
|
|
exit 0
|