Commit 198be3c2 authored by cznic's avatar cznic
Browse files

all_test: tolerate a cgo-less toolchain in the recursive -race check

TestConcurrentGoroutines re-invokes itself under -race and treats anything
the recursive run prints other than two known "cannot run here" messages as a
failure. With CGO_ENABLED=0 the go tool refuses with "-race requires cgo;
enable cgo by setting CGO_ENABLED=1", which matched neither, so the whole
suite failed on an environment where the check simply cannot run -- and a
CGo-free driver is a natural thing to build and test with cgo disabled.
Accept that message alongside the existing two and skip, as the test already
does for a toolchain without race support and for an unsupported VMA range.
Nothing changes when cgo is available: the recursive -race run still executes
and still has to pass.

Found while reviewing GitHub PR #6, whose author hit it in a CGO_ENABLED=0
lane; unrelated to that change.
parent 1fb71c49
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -751,6 +751,10 @@ func TestConcurrentGoroutines(t *testing.T) {
			t.Logf("recursive test -race: PASS")
		case
			strings.Contains(s, "-race is not supported"),
			// The race detector needs cgo. A CGo-free driver is a
			// natural thing to test with CGO_ENABLED=0, and doing so
			// must not fail the suite over a check that cannot run.
			strings.Contains(s, "-race requires cgo"),
			strings.Contains(s, "unsupported VMA range"):

			t.Logf("recursive test -race: SKIP: %v", err)