Commit graph

12 commits

Author SHA1 Message Date
Josh Bleecher Snyder a1e7fb4eed test: deflake chan/select3.go
On a slow or distracted machine, 0.1s is sometimes
not long enough for a non-blocking function call to complete.
This causes rare test flakes.
They can be easily reproduced by reducing the wait time to (say) 100ns.

For non-blocking functions, increase the window from 100ms to 10s.
Using different windows for block and non-blocking functions,
allows us to reduce the time for blocking functions.
The risk here is false negatives, but that risk is low;
this test is run repeatedly on many fast machines,
for which 10ms is ample time.
This reduces the time required to run the test by a factor of 10,
from ~1s to ~100ms.

Fixes #20299

Change-Id: Ice9a641a66c6c101d738a2ebe1bcb144ae3c9916
Reviewed-on: https://go-review.googlesource.com/47812
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-08 02:10:12 +00:00
Josh Bleecher Snyder 26a852112d test: gofmt chan/*.go
These are functional tests, so it is safe to gofmt them.

Change-Id: I3067279c1d49809ac6a62054448ab8a6c3de9bda
Reviewed-on: https://go-review.googlesource.com/43623
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-05-18 22:35:07 +00:00
Rob Pike 3fb5f329b9 test/chan: document tests
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5677094
2012-02-19 17:44:02 +11:00
Russ Cox 0b477ef17e test: use testlib (first 100)
X ,s;^// \$G (\$D/)?\$F\.go *$;// compile;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A *$;// build;g
X ,s;^// \$G (\$D/)?\$F\.go && \$L \$F\.\$A && \./\$A\.out *$;// run;g
X ,s;^// errchk \$G( -e)? (\$D/)?\$F\.go *$;// errorcheck;g

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5656082
2012-02-16 23:48:57 -05:00
Ian Lance Taylor 4e77e0f294 test: test that x := <-c accepts a general expression
The gccgo compiler used to fail to parse this.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5610051
2012-02-01 07:31:00 -08:00
Russ Cox 3770b0e60c gc: implement nil chan support
The spec has defined nil chans this way for months.
I'm behind.

R=ken2
CC=golang-dev
https://golang.org/cl/4897050
2011-08-17 15:54:17 -04:00
Russ Cox 3f915f51a8 go code: replace closed(c) with x, ok := <-c
R=golang-dev, rog, bradfitzwork, r
CC=golang-dev
https://golang.org/cl/4243072
2011-03-11 14:47:44 -05:00
Russ Cox 504da53c85 runtime: select bug
The sanity checking in pass 2 is wrong
when a select is offering to communicate in
either direction on a channel and neither case
is immediately ready.

R=ken2
CC=golang-dev
https://golang.org/cl/3991047
2011-01-28 17:17:38 -05:00
Russ Cox 27c74d3499 spec, runtime, tests: send on closed channel panics
Close of closed channel panics.
Receive from closed channel never panics,
even if done repeatedly.

Fixes #1349.
Fixes #1419.

R=gri, iant, ken2, r, gri1, r2, iant2, rog, albert.strasheim, niemeyer, ejsherry
CC=golang-dev
https://golang.org/cl/3989042
2011-01-21 15:07:13 -05:00
Russ Cox 3f19d8ae8d gc: empty select
R=ken2
CC=golang-dev
https://golang.org/cl/1871057
2010-08-03 01:07:57 -07:00
Robert Griesemer 47b835e4a8 channel tests: added a couple of tests with closed channels
R=rsc
CC=golang-dev
https://golang.org/cl/1774047
2010-07-14 13:18:57 -07:00
Robert Griesemer d00b479888 select statement: initial set of test cases for corner cases
R=r, rsc
CC=golang-dev
https://golang.org/cl/1772043
2010-07-14 09:55:08 -07:00