]> Cypherpunks repositories - gostls13.git/commit
internal/synctest: new package for testing concurrent code
authorDamien Neil <dneil@google.com>
Tue, 11 Jun 2024 18:02:18 +0000 (11:02 -0700)
committerDamien Neil <dneil@google.com>
Tue, 19 Nov 2024 19:40:40 +0000 (19:40 +0000)
commitd90ce588eac7b9105c0ca556a7c6e975fd5c1eca
tree4692a7f87738058c89bba874fe6d53b82786c44a
parent944df9a7516021f0405cd8adb1e6894ae9872cb5
internal/synctest: new package for testing concurrent code

Add an internal (for now) implementation of testing/synctest.

The synctest.Run function executes a tree of goroutines in an
isolated environment using a fake clock. The synctest.Wait function
allows a test to wait for all other goroutines within the test
to reach a blocking point.

For #67434
For #69687

Change-Id: Icb39e54c54cece96517e58ef9cfb18bf68506cfc
Reviewed-on: https://go-review.googlesource.com/c/go/+/591997
Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
26 files changed:
src/go/build/deps_test.go
src/internal/synctest/synctest.go [new file with mode: 0644]
src/internal/synctest/synctest_test.go [new file with mode: 0644]
src/runtime/chan.go
src/runtime/coro.go
src/runtime/lockrank.go
src/runtime/mgc.go
src/runtime/mgcmark.go
src/runtime/mklockrank.go
src/runtime/proc.go
src/runtime/runtime2.go
src/runtime/select.go
src/runtime/sema.go
src/runtime/sizeof_test.go
src/runtime/synctest.go [new file with mode: 0644]
src/runtime/synctest_test.go [new file with mode: 0644]
src/runtime/testdata/testsynctest/main.go [new file with mode: 0644]
src/runtime/time.go
src/runtime/time_linux_amd64.s
src/runtime/traceback.go
src/runtime/traceruntime.go
src/sync/runtime.go
src/sync/waitgroup.go
src/time/time.go
src/time/zoneinfo_plan9.go
src/time/zoneinfo_read.go