aboutsummaryrefslogtreecommitdiff
path: root/src/os/fifo_test.go
AgeCommit message (Collapse)Author
2024-09-03math,os,os/*: use testenv.ExecutableKir Kolyshkin
As some callers don't have a testing context, modify testenv.Executable to accept nil (similar to how testenv.GOROOT works). Change-Id: I39112a7869933785a26b5cb6520055b3cc42b847 Reviewed-on: https://go-review.googlesource.com/c/go/+/609835 Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-03-19os: kick FIFOs with O_NONBLOCK out of the kqueue on Darwin/iOSAndy Pan
Fixes #66239 Change-Id: I8210682c0cf4285b950e9fabe687b7ad2369835c Reviewed-on: https://go-review.googlesource.com/c/go/+/570397 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Run-TryBot: Andy Pan <panjf2000@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2024-03-11os: close pipe in testguoguangwu
Change-Id: Ic8b06c6fd9fc6a30b26f4e4614aa40b5cad3a5e7 GitHub-Last-Rev: 8397a8b30cf11c00e53b35e528f82a8534a00e01 GitHub-Pull-Request: golang/go#66240 Reviewed-on: https://go-review.googlesource.com/c/go/+/570515 Auto-Submit: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-05-17os: if descriptor is non-blocking, retain that in Fd methodIan Lance Taylor
For #58408 Fixes #60211 Change-Id: I30f5678b46e15121865b19d1c0f82698493fad4e Reviewed-on: https://go-review.googlesource.com/c/go/+/495079 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com>
2023-04-19os: check for ErrNotExist instead of ErrExist in TestNonPollableBryan C. Mills
An apparent typo in CL 484837 caused the test to check for ErrExist instead of ErrNotExist when opening /dev/net/tun for read. That causes the test to fail on platforms where /dev/net/ton does not exist, such as on the darwin-amd64-longtest builder. Updates #59545. Change-Id: I9402ce0dba11ab459674e8358ae9a8b97eabc8d2 Reviewed-on: https://go-review.googlesource.com/c/go/+/486255 Run-TryBot: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Commit-Queue: Bryan Mills <bcmills@google.com> Reviewed-by: Than McIntosh <thanm@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-04-18runtime: add and use pollDesc fd sequence fieldIan Lance Taylor
It is possible for a netpoll file to be closed and for the pollDesc to be reused while a netpoll is running. This normally only causes spurious wakeups, but if there is an error on the old file then the new file can be incorrectly marked as having an error. Fix this problem on most systems by introducing an fd sequence field and using that as a tag in a taggedPointer. The taggedPointer is stored in epoll or kqueue or whatever is being used. If the taggedPointer returned by the kernel has a tag that does not match the fd sequence field, the notification is for a closed file, and we can ignore it. We check the tag stored in the pollDesc, and we also check the tag stored in the pollDesc.atomicInfo. This approach does not work on 32-bit systems where the kernel only provides a 32-bit field to hold a user value. On those systems we continue to use the older method without the sequence protection. This is not ideal, but it is not an issue on Linux because the kernel provides a 64-bit field, and it is not an issue on Windows because there are no poller errors on Windows. It is potentially an issue on *BSD systems, but on those systems we already call fstat in newFile in os/file_unix.go to avoid adding non-pollable files to kqueue. So we currently don't know of any cases that will fail. Fixes #59545 Change-Id: I9a61e20dc39b4266a7a2978fc16446567fe683ac Reviewed-on: https://go-review.googlesource.com/c/go/+/484837 Auto-Submit: Ian Lance Taylor <iant@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Orlando Labao <orlando.labao43@gmail.com> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Bypass: Ian Lance Taylor <iant@google.com> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Bypass: Ian Lance Taylor <iant@golang.org>
2023-01-19os: deflake TestPipeEOF and TestFifoEOFBryan C. Mills
- Consolidate the two test bodies as one helper function. - Eliminate arbitrary timeout. - Shorten arbitrary sleeps in short mode. - Simplify goroutines. - Mark the tests as parallel. Fixes #36107. Updates #24164. Change-Id: I14fe4395963a7256cb6d2d743d348a1ade077d5b Reviewed-on: https://go-review.googlesource.com/c/go/+/457336 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Bryan Mills <bcmills@google.com>
2021-10-28all: go fix -fix=buildtag std cmd (except for bootstrap deps, vendor)Russ Cox
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>
2021-06-24os: enable TestFifoEOF on openbsdsiddharth
The test successfully runs on currently supported versions (6.8 and 6.9) of openbsd. Fixes #25877 Change-Id: I2694f08c5596b486453c2ac829f17b8bc455f828 Reviewed-on: https://go-review.googlesource.com/c/go/+/329732 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Trust: Tobias Klauser <tobias.klauser@gmail.com>
2021-04-09os: replace os.MkdirTemp with T.TempDirManlio Perillo
Updates #45402 Change-Id: Ib8e62a13ddff884e4d34b3a0fdc9a10db2b68da6 Reviewed-on: https://go-review.googlesource.com/c/go/+/308109 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
2021-02-20all: go fmt std cmd (but revert vendor)Russ Cox
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>
2020-12-09all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox
As part of #42026, these helpers from io/ioutil were moved to os. (ioutil.TempFile and TempDir became os.CreateTemp and MkdirTemp.) Update the Go tree to use the preferred names. As usual, code compiled with the Go 1.4 bootstrap toolchain and code vendored from other sources is excluded. ReadDir changes are in a separate CL, because they are not a simple search and replace. For #42026. Change-Id: If318df0216d57e95ea0c4093b89f65e5b0ababb3 Reviewed-on: https://go-review.googlesource.com/c/go/+/266365 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-06-14os: skip TestFifoEOF on androidTobias Klauser
TestFifoEOF fails on android because the mkfifo syscall is not allowed: --- FAIL: TestFifoEOF (0.00s) fifo_test.go:39: permission denied Change-Id: I007ff359831525add39cec34de4b3d3cd3adb047 Reviewed-on: https://go-review.googlesource.com/118815 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-06-13os: don't poll fifos on DarwinIan Lance Taylor
The Darwin kqueue implementation doesn't report any event when the last writer for a fifo is closed. Fixes #24164 Change-Id: Ic2c47018ef1284bf2e26379f8dd7646edaad4d05 Reviewed-on: https://go-review.googlesource.com/118566 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>