summaryrefslogtreecommitdiff
path: root/src/syscall/syscall_unix_test.go
Commit message (Collapse)AuthorAgeFilesLines
* all: use new "unix" build tag where appropriateIan Lance Taylor2022-03-291-1/+1
| | | | | | | | | | For #20322 For #51572 Change-Id: Id0b4799d097d01128e98ba4cc0092298357bca45 Reviewed-on: https://go-review.googlesource.com/c/go/+/389935 Trust: Ian Lance Taylor <iant@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* syscall: remove TestRlimitIan Lance Taylor2022-03-041-27/+0
| | | | | | | | | | | | | | | It's more trouble than it's worth. New code should be using x/sys/unix anyhow. Fixes #40564 Fixes #51479 Change-Id: I1c0e13f494380c1565e98359f088af9f52790b79 Reviewed-on: https://go-review.googlesource.com/c/go/+/390020 Trust: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
* syscall: use RLIMIT_CPU instead of RLIMIT_NOFILETamir Duberstein2022-02-091-17/+4
| | | | | | | | | | | | | | | | | The latter is subject to kern.maxfilelimit restrictions on darwin which are not reflected in the return value. This makes it difficult to reliably restore the default after the test is complete. RLIMIT_CPU should hopefully sidestep this problem. Updates #40564. Change-Id: Ifb33c7d46f2708130cef366dc245c643a2d5e465 Reviewed-on: https://go-review.googlesource.com/c/go/+/383234 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Trust: Bryan Mills <bcmills@google.com>
* syscall: fix finalizer fd close bugs in TestFcntlFlock and TestPassFDMichael Anthony Knyszek2021-11-021-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the syscall test suite takes very little time to run. It stands to reason that pretty much every time, zero GCs execute. With CL 309869, this changes because the minimum heap size is lowered, triggering two bugs in the test suite. One bug is in TestFcntlFlock, where a raw FD is wrapped in an os.File whose last reference is passed into a Cmd. That FD is then closed by a defer syscall.Close, instead of the os.File's Close, so the finalizer may fire *after* that FD has already been reused by another test. The second bug is in the child helper process of TestPassFD, where there's a small window in which a temp file's FD is encoded for an out-of-band unix domain socket message to the parent, but not yet sent. The point of encoding is also the last reference that FD's os.File, so a finalizer may run at any time. While it's safe for the finalizer to run after the FD is sent, if it runs before, the send will fail, since unix domain sockets require that any sent FDs are valid. Change-Id: I2d1bd7e6db6efcc6763273217fd85cb5b9764274 Reviewed-on: https://go-review.googlesource.com/c/go/+/360575 Trust: Michael Knyszek <mknyszek@google.com> Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@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>
* syscall: don't defer close raw Socketpair fds in testsTobias Klauser2021-04-141-2/+0
| | | | | | | | | | | | | The raw fds are successively wrapped using os.NewFile and will be closed by (*os.File).Close. Avoids a double close, in the worst case closing an unrelated fd. Change-Id: I86aabe5ed865eff43d264ddae1fb07c935868e97 Reviewed-on: https://go-review.googlesource.com/c/go/+/309353 Trust: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: replace os.MkdirTemp with T.TempDirianwoolf2021-04-071-10/+2
| | | | | | | | | | | Updates #45402 Change-Id: I573133d6b987e8ac23e3e2018652612af684c755 Reviewed-on: https://go-review.googlesource.com/c/go/+/307990 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: Emmanuel Odeke <emmanuel@orijtech.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>
* all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTempRuss Cox2020-12-091-4/+3
| | | | | | | | | | | | | | | | | | | | | | 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>
* all: update references to symbols moved from io/ioutil to ioRuss Cox2020-10-201-1/+1
| | | | | | | | | | | | | | | | | | | The old ioutil references are still valid, but update our code to reflect best practices and get used to the new locations. Code compiled with the bootstrap toolchain (cmd/asm, cmd/dist, cmd/compile, debug/elf) must remain Go 1.4-compatible and is excluded. Also excluded vendored code. For #41190. Change-Id: I6d86f2bf7bc37a9d904b6cee3fe0c7af6d94d5b1 Reviewed-on: https://go-review.googlesource.com/c/go/+/263142 Trust: Russ Cox <rsc@golang.org> Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
* all: enable more tests on macOS/ARM64Cherry Zhang2020-10-061-1/+1
| | | | | | | | | | Updates #38485. Change-Id: Iac96f5ffe88521fcb11eab306d0df6463bdce046 Reviewed-on: https://go-review.googlesource.com/c/go/+/256920 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* all: add GOOS=iosCherry Zhang2020-09-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | Introduce GOOS=ios for iOS systems. GOOS=ios matches "darwin" build tag, like GOOS=android matches "linux" and GOOS=illumos matches "solaris". Only ios/arm64 is supported (ios/amd64 is not). GOOS=ios and GOOS=darwin remain essentially the same at this point. They will diverge at later time, to differentiate macOS and iOS. Uses of GOOS=="darwin" are changed to (GOOS=="darwin" || GOOS=="ios"), except if it clearly means macOS (e.g. GOOS=="darwin" && GOARCH=="amd64"), it remains GOOS=="darwin". Updates #38485. Change-Id: I4faacdc1008f42434599efb3c3ad90763a83b67c Reviewed-on: https://go-review.googlesource.com/c/go/+/254740 Trust: Cherry Zhang <cherryyz@google.com> Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
* syscall: cap RLIMIT_NOFILE soft limit in TestRlimit on darwinCholerae Hu2020-08-171-7/+7
| | | | | | | | | | | | | On some machines, kern.maxfilesperproc is 4096. If Rlimit.Cur is larger than that, Setrlimit will get an errEINVAL. Fixes #40564. Change-Id: Ib94303c790a489ff0559c88d41a021e514d18f8d Reviewed-on: https://go-review.googlesource.com/c/go/+/246658 Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: remove scattered remnants of darwin/armAustin Clements2020-04-081-1/+1
| | | | | | | | | | | | | | This removes all conditions and conditional code (that I could find) that depended on darwin/arm. Fixes #35439 (since that only happened on darwin/arm) Fixes #37611. Change-Id: Ia4c32a5a4368ed75231075832b0b5bfb1ad11986 Reviewed-on: https://go-review.googlesource.com/c/go/+/227198 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com>
* syscall: treat ENFILE as a temporary errorLorenz Bauer2019-10-301-0/+6
| | | | | | | | | | | | | | | ENFILE is returned from accept when the whole system has run out of file descriptors. Mark the error as temporary, so that accept loops continue working. Fixes #35131 Updates #1891 Change-Id: Idf44c084731898ff4c720d06c250d3b8a42de312 Reviewed-on: https://go-review.googlesource.com/c/go/+/203117 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: move helper handler before AIX handler in TestPassFDClément Chigot2019-04-161-5/+5
| | | | | | | | | | | The AIX special handler which skips this test if unix network isn't supported, doesn't need to be called inside the helper process. Change-Id: I7ff2c4e6b20eceb977380294858cae63034ffe0d Reviewed-on: https://go-review.googlesource.com/c/go/+/172160 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
* syscall: add aix to syscall_unix_test.goClément Chigot2019-04-121-1/+22
| | | | | | | | | | | | | | | | | This file was forgotten during the port of aix/ppc64. In order to make its tests passed, a few things were added: - Add termios.h to zerrors - Add AF_LOCAL = AF_UNIX as this constant doesn't exits natively on AIX - Fix the alignment in cmsghdr structure. TestPassFD doesn't work on AIX TL<2 because getsockname isn't working as expected with unix socket. Change-Id: I928705bfc78ada29e66df61fe97d8f379f8c739b Reviewed-on: https://go-review.googlesource.com/c/go/+/171339 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: allow empty string argument to SetsockoptStringTobias Klauser2019-04-051-0/+8
| | | | | | | | | | | | Don't panic with "index out of range" on empty string argument. Fixes golang/go#31277 Change-Id: I005f9523caec76337cb2ec87272a6be4736bce18 Reviewed-on: https://go-review.googlesource.com/c/go/+/170937 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: implement syscalls on Darwin using libSystemKeith Randall2018-11-071-8/+10
| | | | | | | | | | | | | | | | | | | | | | There are still some references to the bare Syscall functions in the stdlib. I will root those out in a following CL. (This CL is big enough as it is.) Most are in vendor directories: cmd/vendor/golang.org/x/sys/unix/ vendor/golang_org/x/net/route/syscall.go syscall/bpf_bsd.go syscall/exec_unix.go syscall/flock.go Update #17490 Change-Id: I69ab707811530c26b652b291cadee92f5bf5c1a4 Reviewed-on: https://go-review.googlesource.com/c/141639 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Elias Naur <elias.naur@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: add missing err check in testTobias Klauser2017-11-291-0/+3
| | | | | | | | | | Follow CL 75810 which did the same for x/sys/unix. Change-Id: I6314a97989631d589369c7b6001d1523ec2cc242 Reviewed-on: https://go-review.googlesource.com/80555 Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: make TestFcntlFlock more robustMostyn Bramley-Moore2017-04-171-2/+6
| | | | | | | | | | | Avoid the use of constant absolute temp files in tests. This could produce flaky results, for example on multiuser development machines. Change-Id: Ia76157a0660fbe294bb31a46ded886cea5deec97 Reviewed-on: https://go-review.googlesource.com/40916 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* syscall: fix Send{msg,msgN}, Recvmsg and control message handling on solarisMikio Hara2016-10-031-6/+0
| | | | | | | | | | | | | | | | | | This change switches the use of socket implementation from the conventional SUS-based one to the latest POSIX-based one to make socket control message work correctly on Solaris. It looks like those two implementations, Socket over TLI/XTI and Socket, have different semantics in details but it wouldn't hurt the existing applications because the exposed syscall API doesn't support socket properties related to such a protocol independent application framework. Fixes #7402. Change-Id: I45a4e782d606bfbebe1404086c50a8c69af53461 Reviewed-on: https://go-review.googlesource.com/30171 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: re-enable TestPassFD on dragonflyMikio Hara2016-10-011-3/+0
| | | | | | | | | | At least it works well on DragonFly BSD 4.6. Change-Id: I3b210745246c6d8d42e32ba65ee3b9a17d171ff7 Reviewed-on: https://go-review.googlesource.com/30170 Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* all: use SeekStart, SeekCurrent, SeekEndJoe Tsai2016-05-061-2/+3
| | | | | | | | | | | | | | CL/19862 (f79b50b8d5bc159561c1dcf7c17e2a0db96a9a11) recently introduced the constants SeekStart, SeekCurrent, and SeekEnd to the io package. We should use these constants consistently throughout the code base. Updates #15269 Change-Id: If7fcaca7676e4a51f588528f5ced28220d9639a2 Reviewed-on: https://go-review.googlesource.com/22097 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Joe Tsai <joetsai@digital-static.net> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: link to https instead of httpBrad Fitzpatrick2015-07-111-1/+1
| | | | | | | | | | | | | The one in misc/makerelease/makerelease.go is particularly bad and probably warrants rotating our keys. I didn't update old weekly notes, and reverted some changes involving test code for now, since we're late in the Go 1.5 freeze. Otherwise, the rest are all auto-generated changes, and all manually reviewed. Change-Id: Ia2753576ab5d64826a167d259f48a2f50508792d Reviewed-on: https://go-review.googlesource.com/12048 Reviewed-by: Rob Pike <r@golang.org>
* all: extract "can I exec?" check from tests into internal/testenvRuss Cox2015-06-161-5/+4
| | | | | | | | Change-Id: I7b54be9d8b50b39e01c6be21f310ae9a10404e9d Reviewed-on: https://go-review.googlesource.com/10753 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: don't run fcntl child process test on iOSBrad Fitzpatrick2015-05-151-0/+3
| | | | | | | | | | Fixes darwin-arm{,64} builds. Child processes aren't allowed on iOS. Change-Id: I9258ed4df757ec394ef6327dbda96f5b9705bcdd Reviewed-on: https://go-review.googlesource.com/10142 Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
* syscall: add test for Flock_t roundtripShenghou Ma2015-05-151-12/+47
| | | | | | | | | See CL 9962 for the rationale. Change-Id: I73c714fce258430eea1e61d3835f5c8e9014ca1f Signed-off-by: Shenghou Ma <minux@golang.org> Reviewed-on: https://go-review.googlesource.com/9925 Reviewed-by: Ian Lance Taylor <iant@golang.org>
* syscall: skip fork test on darwin/arm64David Crawshaw2015-04-121-1/+2
| | | | | | | | Just like darwin/arm. Change-Id: Iadc30b7307ae56fd4f8a681d49672bed7ca6966f Reviewed-on: https://go-review.googlesource.com/8810 Reviewed-by: Minux Ma <minux@golang.org>
* syscall: exclude Go tool test on darwin/armDavid Crawshaw2015-02-261-0/+4
| | | | | | Change-Id: I44c1911beceaedaa35dad71d8be8a814528dce67 Reviewed-on: https://go-review.googlesource.com/6192 Reviewed-by: Minux Ma <minux@golang.org>
* build: move package sources from src/pkg to srcRuss Cox2014-09-081-0/+314
Preparation was in CL 134570043. This CL contains only the effect of 'hg mv src/pkg/* src'. For more about the move, see golang.org/s/go14nopkg.