]> Cypherpunks repositories - gostls13.git/commit
sync: fix pool wrap-around test
authorAustin Clements <austin@google.com>
Wed, 26 Jun 2019 15:11:45 +0000 (11:11 -0400)
committerAustin Clements <austin@google.com>
Wed, 26 Jun 2019 19:48:39 +0000 (19:48 +0000)
commit93c05627f9e542476d8f88e2e472082d526689ff
tree871808878eaff54730468f860305637e9c246bac
parent4b41f7f8188ce8f711cacd3097a2cb02af5c333c
sync: fix pool wrap-around test

TestPoolDequeue in long mode does a little more than 1<<21 pushes.
This was originally because the head and tail indexes were 21 bits and
the intent was to test wrap-around behavior. However, in the final
version they were both 32 bits, so the test no longer tested
wrap-around.

It would take too long to reach 32-bit wrap around in a test, so
instead we initialize the poolDequeue with indexes that are already
nearly at their limit. This keeps the knowledge of the maximum index
in one place, and lets us test wrap-around even in short mode.

Change-Id: Ib9b8d85b6d9b5be235849c2b32e81c809e806579
Reviewed-on: https://go-review.googlesource.com/c/go/+/183979
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/sync/export_test.go
src/sync/pool_test.go