support testing/synctest when a non-test package imports "testing" too

As spotted by scripts/check-third-party.sh, it's possible to import
the testing package without using `go test`, so our previous solution
to only load testing/synctest when running `go test` was not enough.

Add a regression test via stdimporter in gogarble.txtar.
This commit is contained in:
Daniel Martí
2025-08-30 16:33:50 +01:00
parent 298a131506
commit 36fcc61c4e
4 changed files with 8 additions and 13 deletions
+2
View File
@@ -91,6 +91,7 @@ import (
"runtime"
"runtime/debug"
"syscall"
"testing"
"time"
)
@@ -107,6 +108,7 @@ func main() {
debug.WriteHeapDump(1)
time.Now()
syscall.Listen(0, 1)
testing.MainStart(nil, nil, nil, nil, nil)
}
}