aboutsummaryrefslogtreecommitdiff
path: root/test/chan
AgeCommit message (Collapse)Author
2021-07-14[dev.typeparams] cmd/compile/internal/types2: implement close(ch) where ch ↵Robert Griesemer
is of type parameter type Change-Id: I45189468553e83390fd2640b5708c60a7852fbb5 Reviewed-on: https://go-review.googlesource.com/c/go/+/333713 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-12-14[dev.typeparams] merge: merge branch 'dev.regabi' into 'dev.typeparams'Robert Griesemer
The following files had merge conflicts and were merged manually: src/cmd/compile/fmtmap_test.go src/cmd/compile/internal/gc/noder.go src/go/parser/error_test.go test/assign.go test/chan/perm.go test/fixedbugs/issue22822.go test/fixedbugs/issue4458.go test/init.go test/interface/explicit.go test/map1.go test/method2.go The following files had manual changes to make tests pass: test/run.go test/used.go src/cmd/compile/internal/types2/stdlib_test.go Change-Id: Ia495aaaa80ce321ee4ec2a9105780fbe913dbd4c
2020-12-03[dev.typeparams] test: adjust more test cases to match compiler -G outputRobert Griesemer
With this CL, the first ~500 errorcheck tests pass when running go run run.go -v -G in the $GOROOT/test directory (the log output includes a few dozen tests that are currently skipped). Change-Id: I9eaa2319fb39a090df54f8699ddc29ffe58b1bf1 Reviewed-on: https://go-review.googlesource.com/c/go/+/274975 Trust: Robert Griesemer <gri@golang.org> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
2020-11-28test: match gofrontend error messagesIan Lance Taylor
These changes match the following gofrontend error messages: blank1.go:16:1: error: may not define methods on non-local type chan/perm.go:28:9: error: expected channel chan/perm.go:29:11: error: left operand of ‘<-’ must be channel chan/perm.go:69:9: error: argument must be channel complit1.go:25:16: error: attempt to slice object that is not array, slice, or string complit1.go:26:16: error: attempt to slice object that is not array, slice, or string complit1.go:27:17: error: attempt to slice object that is not array, slice, or string complit1.go:49:41: error: may only omit types within composite literals of slice, array, or map type complit1.go:50:14: error: expected struct, slice, array, or map type for composite literal convlit.go:24:9: error: invalid type conversion (cannot use type unsafe.Pointer as type string) convlit.go:25:9: error: invalid type conversion (cannot use type unsafe.Pointer as type float64) convlit.go:26:9: error: invalid type conversion (cannot use type unsafe.Pointer as type int) ddd1.go:63:9: error: invalid use of ‘...’ calling non-variadic function fixedbugs/bug176.go:12:18: error: index expression is not integer constant fixedbugs/bug332.go:17:10: error: use of undefined type ‘T’ fixedbugs/issue4232.go:22:16: error: integer constant overflow fixedbugs/issue4232.go:33:16: error: integer constant overflow fixedbugs/issue4232.go:44:25: error: integer constant overflow fixedbugs/issue4232.go:55:16: error: integer constant overflow fixedbugs/issue4458.go:19:14: error: type has no method ‘foo’ fixedbugs/issue5172.go:24:14: error: too many expressions for struct init.go:17:9: error: reference to undefined name ‘runtime’ initializerr.go:26:29: error: duplicate value for index 1 interface/explicit.go:60:14: error: type assertion only valid for interface types label.go:64:9: error: reference to undefined label ‘go2’ label1.go:18:97: error: continue statement not within for label1.go:22:97: error: continue statement not within for label1.go:106:89: error: continue statement not within for label1.go:108:26: error: invalid continue label ‘on’ label1.go:111:118: error: break statement not within for or switch or select label1.go:113:23: error: invalid break label ‘dance’ map1.go:64:9: error: not enough arguments map1.go:65:9: error: not enough arguments map1.go:67:9: error: argument 1 must be a map method2.go:36:11: error: reference to undefined field or method ‘val’ method2.go:37:11: error: reference to undefined field or method ‘val’ method2.go:41:12: error: method requires pointer (use ‘(*T).g’) syntax/chan1.go:13:19: error: send statement used as value; use select for non-blocking send syntax/chan1.go:17:11: error: send statement used as value; use select for non-blocking send Change-Id: I98047b60a376e3d2788836300f7fcac3f2c285cb Reviewed-on: https://go-review.googlesource.com/c/go/+/273527 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
2020-03-25test/chan: fix trivial typossjnam
Substition -> Substitution Change-Id: Iede578d733d1c041133742b61eb0573c3bd3b17c GitHub-Last-Rev: 7815bd346dbe23a5412d0602a4f6480b893c447d GitHub-Pull-Request: golang/go#38059 Reviewed-on: https://go-review.googlesource.com/c/go/+/225417 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-07-10test: add a test for gccgo bug in handling break statement in a selectCherry Zhang
Gccgo CL 184998 added optimizations for one- and two-case select statements. But it didn't handle break statement in the select case correctly. The fix is CL 185519. This CL adds a test. Change-Id: Ide1b199f106172b41dd77c1f6e0d662fccdd8cc5 Reviewed-on: https://go-review.googlesource.com/c/go/+/185520 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-02-06test/chan: fix broken link to Squinting at Power SeriesYasser Abdolmaleki
Change-Id: Idee94a1d93555d53442098dd7479982e3f5afbba Reviewed-on: https://go-review.googlesource.com/c/161339 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-09-15all: fix article typosKunpei Sakai
a -> an Change-Id: I7362bdc199e83073a712be657f5d9ba16df3077e Reviewed-on: https://go-review.googlesource.com/63850 Reviewed-by: Rob Pike <r@golang.org>
2017-07-08test: deflake chan/select3.goJosh Bleecher Snyder
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-05-18test: gofmt chan/*.goJosh Bleecher Snyder
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-04-24cmd/compile: more error position tests for the typecheckerAlberto Donizetti
This change adds line position tests for several yyerror calls in the typechecker that are currently not tested in any way. Untested yyerror calls were found by replacing them with yerrorl(src.NoXPos, ...) (thus destroying position information in the error), and then running the test suite. No failures means no test coverage for the relevant yyerror call. For #19683 Change-Id: Iedb3d2f02141b332e9bfa76dbf5ae930ad2fddc3 Reviewed-on: https://go-review.googlesource.com/41477 Run-TryBot: Alberto Donizetti <alb.donizetti@gmail.com> Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2017-04-24test/chan: add missing flag.Parse in doubleselect.go张嵩
doubleselect.go defines a flag to control the number of iterations, but never called flag.Parse so it was unusable. Change-Id: Ib5d0c7119e7f7c9a808dcc02d0d9cc6ba5bbc16e Reviewed-on: https://go-review.googlesource.com/41299 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-05-02all: make copyright headers consistent with one space after periodEmmanuel Odeke
Follows suit with https://go-review.googlesource.com/#/c/20111. Generated by running $ grep -R 'Go Authors. All' * | cut -d":" -f1 | while read F;do perl -pi -e 's/Go Authors. All/Go Authors. All/g' $F;done The code in cmd/internal/unvendor wasn't changed. Fixes #15213 Change-Id: I4f235cee0a62ec435f9e8540a1ec08ae03b1a75f Reviewed-on: https://go-review.googlesource.com/21819 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-06-26Fix several out of date references to 4g/5g/6g/8g/9g.Aaron Jacobs
Change-Id: Ifb8e4e13c7778a7c0113190051415e096f5db94f Reviewed-on: https://go-review.googlesource.com/11390 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Andrew Gerrand <adg@golang.org>
2014-07-16cmd/gc: implement 'for range x {'Russ Cox
Fixes #6102. LGTM=gri R=ken, r, gri CC=golang-codereviews https://golang.org/cl/113120043
2014-06-17test: speed up chan/select5Josh Bleecher Snyder
No functional changes. Generating shorter functions improves compilation time. On my laptop, this test's running time goes from 5.5s to 1.5s; the wall clock time to run all tests goes down 1s. On Raspberry Pi, this CL cuts 50s off the wall clock time to run all tests. Fixes #7503. LGTM=bradfitz R=golang-codereviews, bradfitz CC=golang-codereviews https://golang.org/cl/72590045
2013-09-20test/chan: avoid wrap-around in memstats comparisonCarl Shapiro
The select2.go test assumed that the memory allocated between its two samplings of runtime.ReadMemStats is strictly increasing. To avoid failing the tests when this is not true, a greater-than check is introduced before computing the difference in allocated memory. R=golang-dev, r, cshapiro CC=golang-dev https://golang.org/cl/13701046
2013-06-09all: fix typosShenghou Ma
R=golang-dev, bradfitz, khr, r CC=golang-dev https://golang.org/cl/7461046
2013-04-12test: raise the allocation threshold for chan/select2.go failureCarl Shapiro
Updates #5282 R=golang-dev, r CC=golang-dev https://golang.org/cl/8718045
2012-04-20test: use testlib in a few more cases (part 2)Shenghou Ma
Introduced "runoutput" cmd for running generated program R=golang-dev, iant, bradfitz, remyoudompheng CC=golang-dev https://golang.org/cl/5869049
2012-02-19test/chan: document testsRob Pike
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5677094
2012-02-16test: use testlib (first 100)Russ Cox
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-06runtime: delete UpdateMemStats, replace with ReadMemStats(&stats).Rémy Oudompheng
Unexports runtime.MemStats and rename MemStatsType to MemStats. The new accessor requires passing a pointer to a user-allocated MemStats structure. Fixes #2572. R=bradfitz, rsc, bradfitz, gustavo CC=golang-dev, remy https://golang.org/cl/5616072
2012-02-01test: test that x := <-c accepts a general expressionIan Lance Taylor
The gccgo compiler used to fail to parse this. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5610051
2012-01-24test: Add the usual Copyright notice.Olivier Duperray
Fixes #2759. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5570053
2011-11-08renaming_4: gofix -r everything/but/src/pkgRob Pike
R=rsc CC=golang-dev https://golang.org/cl/5338043
2011-11-06gc: Better error message for range over non-receive channel.Luuk van Dijk
Fixes #2354 R=rsc CC=golang-dev https://golang.org/cl/5346044
2011-11-01non-pkg: gofix -r error -force=errorRuss Cox
R=golang-dev, iant, r, r CC=golang-dev https://golang.org/cl/5307066
2011-10-13gc: disallow close on receive-only channelsRuss Cox
Fixes #2353. Fixes #2246. R=golang-dev, r, gri CC=golang-dev https://golang.org/cl/5282042
2011-09-26runtime: check for nil value pointer in select syncsend caseIan Lance Taylor
Fixes #2309. R=rsc, bradfitz CC=golang-dev https://golang.org/cl/5128053
2011-09-26test: silence/coalesce some testsRuss Cox
Add copyright notice to nilptr.go. R=golang-dev, r CC=golang-dev https://golang.org/cl/5139048
2011-08-22test/chan/sieve2.go: remove container/vector.Rob Pike
R=golang-dev, dsymonds, r CC=golang-dev https://golang.org/cl/4918043
2011-08-18test/chan/select5.go: change "with" to "if" in templateaRob Pike
I converted this program yesterday and the output is the same as it used to be, ignoring space, but the result is not the best expression of the algorithm. The old {.section Maybe} pieces are now {{with .Maybe}}, as a direct translation, but I they should be {{if .Maybe}} as the output is just a bool and there is no cascading. I have verified that the output of the program is unaffected. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/4889053
2011-08-17gc: implement nil chan supportRuss Cox
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-17test/chan/select5.go: update to new templatesRob Pike
R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/4911041
2011-08-17template: delete old template code.Rob Pike
It's already in old/template; make that build. Update a couple of references to point to the old template. They can be updated later. Update goplay to use exp/template. R=golang-dev, dsymonds CC=golang-dev https://golang.org/cl/4902046
2011-07-18runtime: fix select pass 3Hector Chu
Fixes #2075 R=rsc, ken, r CC=golang-dev https://golang.org/cl/4748045
2011-07-18runtime: fix panic for make(chan [0]byte).Nigel Tao
I suspect that this was introduced by http://code.google.com/p/go/source/detail?r=6e4ee32fffd1 R=r CC=golang-dev https://golang.org/cl/4764045
2011-03-11go code: replace closed(c) with x, ok := <-cRuss Cox
R=golang-dev, rog, bradfitzwork, r CC=golang-dev https://golang.org/cl/4243072
2011-02-09template: reverse order of arguments to ExecuteRob Pike
In line with other functions such as Fprintf, put the thing to be written first. Apologies for the breakages this is sure to cause. R=rsc, gri, adg, eds, r2, aam CC=golang-dev https://golang.org/cl/4169042
2011-02-01gc: fix send precedenceRuss Cox
Test and fix case found by Robert. Add receive inside send to tree too. R=ken2 CC=golang-dev https://golang.org/cl/3973052
2011-01-31replace non-blocking send, receive syntax with selectRuss Cox
R=golang-dev, nigeltao, niemeyer, r CC=golang-dev https://golang.org/cl/4079053
2011-01-30test: another select testRuss Cox
R=r CC=golang-dev https://golang.org/cl/4004044
2011-01-28runtime: select bugRuss Cox
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-21spec, runtime, tests: send on closed channel panicsRuss Cox
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-21test/chan/doubleselect: fix various racesRuss Cox
There were duplicate closes and missing closes, with the result that the program was rarely testing as much as it seemed to be. Now it finishes. R=r CC=golang-dev https://golang.org/cl/4008046
2010-09-27gc: allow select case expr = <-cRuss Cox
Fixes #1139. R=ken2 CC=golang-dev https://golang.org/cl/2194046
2010-09-10test: Reduce race conditions in chan/nonblock.go.Ian Lance Taylor
nonblock.go wants to test nonblocking operations on synchronous channels, so it is inherently racy. This introduces loops to make the race conditions much more likely to succeed when using gccgo. R=r CC=golang-dev https://golang.org/cl/2161043
2010-09-04test: remove semiocolons.Rob Pike
The ken directory is untouched so we have some examples with explicit semis. R=gri CC=golang-dev https://golang.org/cl/2157041
2010-08-03gc: empty selectRuss Cox
R=ken2 CC=golang-dev https://golang.org/cl/1871057