// since the goroutines can't be stopped/preempted.
// Disable GC for this test (see issue #10958).
defer debug.SetGCPercent(debug.SetGCPercent(-1))
+ // Now that GCs are disabled, block until any outstanding GCs
+ // are also done.
+ runtime.GC()
for try := 0; try < N; try++ {
done := make(chan bool)
x := uint32(0)
// since the goroutines can't be stopped/preempted.
// Disable GC for this test (see issue #10958).
defer debug.SetGCPercent(debug.SetGCPercent(-1))
+ // Now that GCs are disabled, block until any outstanding GCs
+ // are also done.
+ runtime.GC()
for try := 0; try < N; try++ {
if load {
// Create P goroutines and wait until they all run.
// If runtime triggers a forced GC during this test then it will deadlock,
// since the goroutines can't be stopped/preempted during spin wait.
defer debug.SetGCPercent(debug.SetGCPercent(-1))
+ // Now that GCs are disabled, block until any outstanding GCs
+ // are also done.
+ runtime.GC()
iters := int(1e5)
if testing.Short() {
func BadTraceback() {
// Disable GC to prevent traceback at unexpected time.
debug.SetGCPercent(-1)
+ // Out of an abundance of caution, also make sure that there are
+ // no GCs actively in progress.
+ runtime.GC()
// Run badLR1 on its own stack to minimize the stack size and
// exercise the stack bounds logic in the hex dump.
runtime.GOMAXPROCS(1)
// Disable GC so we have complete control of what we're testing.
debug.SetGCPercent(-1)
+ // Out of an abundance of caution, also make sure that there are
+ // no GCs actively in progress.
+ runtime.GC()
// Start a goroutine with no sync safe-points.
var ready, ready2 uint32