@@ -8,14 +8,17 @@ BUILD_TAGS="${BUILD_TAGS:-}"
88TEST_RESULTS=" ${TEST_RESULTS:- .} "
99mkdir -p " $TEST_RESULTS "
1010
11+ GO_CMD=" ${GO_CMD:- go} "
12+ echo " Running tests with $GO_CMD "
13+
1114# Packages that don't support -shuffle on yet
1215NO_SHUFFLE_PATTERN=" (github\.com/DataDog/dd-trace-go/v2/ddtrace/tracer|\
1316github\.com/DataDog/dd-trace-go/v2/internal/civisibility/utils|\
1417github\.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo|\
1518github\.com/DataDog/dd-trace-go/v2/instrumentation/httptrace)$"
1619
17- mapfile -t SHUFFLE_PACKAGES < <( go list ./... | grep -v /contrib/ | grep -Ev " $NO_SHUFFLE_PATTERN " )
18- mapfile -t NO_SHUFFLE_PACKAGES < <( go list ./... | grep -v /contrib/ | grep -E " $NO_SHUFFLE_PATTERN " )
20+ mapfile -t SHUFFLE_PACKAGES < <( $GO_CMD list ./... | grep -v /contrib/ | grep -Ev " $NO_SHUFFLE_PATTERN " )
21+ mapfile -t NO_SHUFFLE_PACKAGES < <( $GO_CMD list ./... | grep -v /contrib/ | grep -E " $NO_SHUFFLE_PATTERN " )
1922
2023# Set +e so that we run all test commands even if one fails
2124set +e
2932 echo " Running standard tests for core packages"
3033fi
3134
32- export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
35+ if [[ " $GO_CMD " == " go" ]]; then
36+ export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
37+ fi
3338
3439# Run tests with shuffle for packages that support it
35- gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report.xml" -- -v -race " $TAGS_ARG " -shuffle=on -coverprofile=coverage.txt -covermode=atomic " ${SHUFFLE_PACKAGES[@]} "
40+ gotestsum --raw-command -- junitfile " ${TEST_RESULTS} /gotestsum-report.xml" -- $GO_CMD test -json -v -race " $TAGS_ARG " -shuffle=on -coverprofile=coverage.txt -covermode=atomic " ${SHUFFLE_PACKAGES[@]} "
3641test_exit=$?
3742[[ $test_exit -ne 0 ]] && report_error=1
3843
3944# Run tests without shuffle for packages that don't support it yet
40- gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report-noshuffle.xml" -- -v -race " $TAGS_ARG " -coverprofile=coverage-noshuffle.txt -covermode=atomic " ${NO_SHUFFLE_PACKAGES[@]} "
45+ gotestsum --raw-command -- junitfile " ${TEST_RESULTS} /gotestsum-report-noshuffle.xml" -- $GO_CMD test -json -v -race " $TAGS_ARG " -coverprofile=coverage-noshuffle.txt -covermode=atomic " ${NO_SHUFFLE_PACKAGES[@]} "
4146test_exit=$?
4247[[ $test_exit -ne 0 ]] && report_error=1
4348
4449cd ./internal/exectracetest
45- gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report-exectrace.xml" -- -v -race " $TAGS_ARG " -coverprofile=coverage.txt -covermode=atomic ./...
50+ gotestsum --raw-command -- junitfile " ${TEST_RESULTS} /gotestsum-report-exectrace.xml" -- $GO_CMD test -json -v -race " $TAGS_ARG " -coverprofile=coverage.txt -covermode=atomic ./...
4651test_exit=$?
4752[[ $test_exit -ne 0 ]] && report_error=1
4853
0 commit comments