]> Cypherpunks repositories - gostls13.git/commit
runtime: make TestSpuriousWakeupsNeverHangSemasleep more robust
authorMichael Anthony Knyszek <mknyszek@google.com>
Tue, 11 Feb 2025 17:56:21 +0000 (17:56 +0000)
committerGopher Robot <gobot@golang.org>
Wed, 12 Feb 2025 16:23:26 +0000 (08:23 -0800)
commita9357490919feed070e952ebc681b1a7af30aac2
treef8c78126baa88ca5c0463e77c4a0c94db0e2f395
parent58834c3ee08ea85b764c7cc3318ce7a68ea92cbd
runtime: make TestSpuriousWakeupsNeverHangSemasleep more robust

This change modifies this test (which involves an arbitrary timeout) to
be a little less flaky by double-checking that our subprocess program
completed even if the ticker fires and we've exceeded our timeout. The
logic behind this change is that the testing goroutine might get delayed
for any number of reasons, but the subprocess could still complete in
time. Still, the goroutine will wake up to handle the ticker and see its
over time, even though the event it was waiting for did actually happen.

I can't reproduce #71548 locally, so I suspect because this test calls
t.Parallel other load can delay the testing goroutine enough for this to
happen (especially with GODEBUG=gccheckmark=1, which pauses
everything to perform a full mark and sweep, and runtime tests love to
call runtime.GC).

For #71548.

Change-Id: I83e86a0115f65950886b57b5af0b4a517ef5f90f
Reviewed-on: https://go-review.googlesource.com/c/go/+/648576
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Commit-Queue: Michael Knyszek <mknyszek@google.com>
src/runtime/semasleep_test.go