summaryrefslogtreecommitdiff
path: root/src/net/tcpsock_unix_test.go
Commit message (Collapse)AuthorAgeFilesLines
* net: pass a testing.TB to newLocal* helpersBryan C. Mills2021-12-131-4/+1
| | | | | | | | | | | | | | | | | | | | | | | Passing in an explicit testing.TB gives two benefits: 1. It allows the helper to fail the test itself, instead of returning an error to the caller. A non-nil error invariably fails the calling test, and none of these callers bother to add detail to the error when logging it anyway so returning the error just added noise to the test bodies. 2. It allows the helper to use t.Cleanup to perform any needed cleanup tasks, which will be used in CL 370695 to clean up temp directories used as namespaces for unix socket paths. For #34611 Change-Id: I805e701687c12de2caca955649369294229c10b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/370696 Trust: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox2021-10-281-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | When these packages are released as part of Go 1.18, Go 1.16 will no longer be supported, so we can remove the +build tags in these files. Ran go fix -fix=buildtag std cmd and then reverted the bootstrapDirs as defined in src/cmd/dist/buildtool.go, which need to continue to build with Go 1.4 for now. Also reverted src/vendor and src/cmd/vendor, which will need to be updated in their own repos first. Manual changes in runtime/pprof/mprof_test.go to adjust line numbers. For #41184. Change-Id: Ic0f93f7091295b6abc76ed5cd6e6746e1280861e Reviewed-on: https://go-review.googlesource.com/c/go/+/344955 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
* all: go fmt std cmd (but revert vendor)Russ Cox2021-02-201-0/+1
| | | | | | | | | | | | | | | | Make all our package sources use Go 1.17 gofmt format (adding //go:build lines). Part of //go:build change (#41184). See https://golang.org/design/draft-gobuild Change-Id: Ia0534360e4957e58cd9a18429c39d0e32a6addb4 Reviewed-on: https://go-review.googlesource.com/c/go/+/294430 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: add js/wasm architectureRichard Musiol2018-06-041-1/+1
| | | | | | | | | | | | | | | | This commit adds the js/wasm architecture to the net package. The net package is not supported by js/wasm, but a simple fake networking is available so tests of other packages that require basic TCP sockets can pass. The tests of the net package itself are mostly disabled. Updates #18892 Change-Id: Id287200c39f0a3e23d20ef17260ca15ccdcca032 Reviewed-on: https://go-review.googlesource.com/109995 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: skip external net tests on iOSElias Naur2018-05-171-4/+2
| | | | | | | | | | | | | | | | | | | | | | CL 113095 tried to deflake net tests on iOS by skipping the test that uses the most sockets. That didn't work well enough and will be reverted in CL 113555. The flakes appeared after the iOS exec harness started to forward environment variables, causing testenv.Builder to be non-empty on the iOS builder. This CL attempts to fix the flakes with the more conservative strategy of skipping tests that only run on builders. The skipped tests happen to be those requiring external network access; it's plausible that the iOS builder network isn't reliable enough to run the many parallel DNS lookups and dial outs, while keeping the number of open file descriptors below the 250 limit. Change-Id: I9cafdaf2845dd6f3844c4819dcaaaa5970f5da15 Reviewed-on: https://go-review.googlesource.com/113575 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* Revert "net: skip socket hungry test on iOS"Elias Naur2018-05-171-5/+0
| | | | | | | | | | | | This reverts commit 3027932ac3d8d943a404e0b6f9d9ea390c8e6840. Reason for revert: It didn't work well enough; a replacement CL that skips external net tests altogether on iOS is coming. Change-Id: Ib2c5656cee92bcae744f9c99fbcb9f9f2baa0694 Reviewed-on: https://go-review.googlesource.com/113555 Run-TryBot: Elias Naur <elias.naur@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* net: skip socket hungry test on iOSElias Naur2018-05-141-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The iOS builder recently gained access to the GO_BUILDER_NAME environment variable, which in turn enabled some net tests that were previously guarded by testenv.Builder() == "". Some such tests have been disabled because they don't work; others have increased the pressure on open file descriptors, pushing the low iOS limit of 250. Since many net tests run with t.Parallel(), the "too many open files" error hit many different tests, so instead of playing whack-a-mole, lower the file descriptor demand by skipping the most file descriptor hungry test, TestTCPSpuriousConnSetupCompletionWithCancel. Before: $ GO_BUILDER_NAME=darwin-arm64 GOARCH=arm64 go test -short -v net ... Socket statistical information: ... (inet4, stream, default): opened=5245 connected=193 listened=75 accepted=177 closed=5399 openfailed=0 connectfailed=5161 listenfailed=0 acceptfailed=143 closefailed=0 ... After: $ GO_BUILDER_NAME=darwin-arm64 GOARCH=arm64 go test -short -v net ... Socket statistical information: ... (inet4, stream, default): opened=381 connected=194 listened=75 accepted=169 closed=547 openfailed=0 connectfailed=297 listenfailed=0 acceptfailed=134 closefailed=0 ... Fixes #25365 (Hopefully). Change-Id: I8343de1b687ffb79001a846b1211df7aadd0535b Reviewed-on: https://go-review.googlesource.com/113095 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
* net: don't let cancelation of a DNS lookup affect another lookupIan Lance Taylor2018-03-161-0/+1
| | | | | | | | | | | | Updates #8602 Updates #20703 Fixes #22724 Change-Id: I27b72311b2c66148c59977361bd3f5101e47b51d Reviewed-on: https://go-review.googlesource.com/100840 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: handle spurious netpoll wakeups in connectIan Lance Taylor2017-06-151-1/+38
| | | | | | | | | | | | | | | | | | | | In some cases the netpoll code can cause a spurious wakeup. This is normally harmless, as the woken up code simply retries the operation. However, for connect, the test we were using to see whether the connect had succeeded (setsockopt(SO_ERROR)) was not reliable in the case of a spurious wakeup. Change to using a reliable test (getpeername). On Darwin we used a different technique: a second call to connect; change Darwin to use getpeername as well. Return the result of getpeername to avoid having to call it twice. Fixes #19289. Change-Id: I119ec8e7a41f482f1e590d4c65a37f6103fa22d9 Reviewed-on: https://go-review.googlesource.com/45815 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* net: deflake TestTCPSupriousConnSetupCompletion [sic]Brad Fitzpatrick2016-11-111-2/+2
| | | | | | | | | | | | And rename it. Fixes #17703 Change-Id: I73c82a9b3f96180699c6d33c069a666018eb30f9 Reviewed-on: https://go-review.googlesource.com/33149 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* net: prevent spurious TCP connection setup notification on darwinMikio Hara2016-03-161-0/+79
On the latest darwin kernels, kevent in runtime-integrated network poller sometimes reports SYN-SENT state sockets as ESTABLISHED ones, though it's still unclear what's the root cause. This change prevents such spurious notifications by additional connect system calls. Fixes #14548. Change-Id: Ie29788e38ca735ca77259befeba3229d6a30ac52 Reviewed-on: https://go-review.googlesource.com/20468 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>