@@ -6,17 +6,32 @@ report_error=0
66
77TEST_RESULTS=" ${TEST_RESULTS:- .} "
88mkdir -p " $TEST_RESULTS "
9- mapfile -t PACKAGE_NAMES < <( go list ./... | grep -v /contrib/)
109
11- # Set +e so that we run both of the test commands even if
12- # the first one fails
10+ # Packages that don't support -shuffle on yet
11+ NO_SHUFFLE_PATTERN=" (github\.com/DataDog/dd-trace-go/v2/ddtrace/tracer|\
12+ github\.com/DataDog/dd-trace-go/v2/internal/civisibility/utils|\
13+ github\.com/DataDog/dd-trace-go/v2/profiler|\
14+ github\.com/DataDog/dd-trace-go/v2/instrumentation/appsec/dyngo|\
15+ github\.com/DataDog/dd-trace-go/v2/instrumentation/httptrace)$"
16+
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 " )
19+
20+ # Set +e so that we run all test commands even if one fails
1321set +e
1422
1523export GOEXPERIMENT=synctest # TODO: remove once go1.25 is the minimum supported version
1624
17- gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report.xml" -- -v -race -coverprofile=coverage.txt -covermode=atomic " ${PACKAGE_NAMES[@]} "
25+ # Run tests with shuffle for packages that support it
26+ gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report.xml" -- -v -race -shuffle=on -coverprofile=coverage.txt -covermode=atomic " ${SHUFFLE_PACKAGES[@]} "
27+ test_exit=$?
28+ [[ $test_exit -ne 0 ]] && report_error=1
29+
30+ # Run tests without shuffle for packages that don't support it yet
31+ gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report-noshuffle.xml" -- -v -race -coverprofile=coverage-noshuffle.txt -covermode=atomic " ${NO_SHUFFLE_PACKAGES[@]} "
1832test_exit=$?
1933[[ $test_exit -ne 0 ]] && report_error=1
34+
2035cd ./internal/exectracetest
2136gotestsum --junitfile " ${TEST_RESULTS} /gotestsum-report-exectrace.xml" -- -v -race -coverprofile=coverage.txt -covermode=atomic ./...
2237test_exit=$?
0 commit comments