]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't overwrite global stop channel in tests
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 15 Aug 2025 21:08:50 +0000 (21:08 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 15 Aug 2025 21:45:43 +0000 (14:45 -0700)
This is used by TestStopTheWorldDeadlock, and the new
TestReadMetricsSched test accidentally modifies this global variable
instead of (as intended) defining a local one.

Change-Id: I7aaece83f285d051ad8b56b7591c76613c39613a
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/696556
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>

src/runtime/metrics_test.go

index 385891d7d9fe005dd46ed8c8978dd76f6ed87bf3..f565d8a59f010096d5bc21a076e938e89bda861e 100644 (file)
@@ -1774,7 +1774,7 @@ func TestReadMetricsSched(t *testing.T) {
        t.Run("waiting", func(t *testing.T) {
                // Force waiting count to be high.
                const waitingCount = 1000
-               stop = make(chan bool)
+               stop := make(chan bool)
                for i := 0; i < waitingCount; i++ {
                        go func() { <-stop }()
                }