aboutsummaryrefslogtreecommitdiff
path: root/src/syscall
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2023-11-02 14:36:30 -0400
committerGopher Robot <gobot@golang.org>2023-11-02 21:22:57 +0000
commitb7cbcf0c274a0e9f9703468c8ea1d511efe90c5e (patch)
tree0f4ee844d96c6baf9d87a12ff33885834ef0abcb /src/syscall
parent2d428cfd85933cbe5c59a32498c82bda12ca5c96 (diff)
downloadgo-b7cbcf0c274a0e9f9703468c8ea1d511efe90c5e.tar.gz
go-b7cbcf0c274a0e9f9703468c8ea1d511efe90c5e.zip
syscall: copy rlimit.go's build constraint to rlimit_test.go
Tests in rlimit_test.go exist to test the behavior of automatically bumping RLIMIT_NOFILE on Unix implemented in rlimit.go (issue #46279), with darwin-specific behavior split out into rlimit_darwin.go and the rest left empty in rlimit_stub.go. Since the behavior happens only on Unix, it doesn't make sense to test it on other platforms. Copy rlimit.go's 'unix' build constraint to rlimit_test.go to accomplish that. Also simplify the build constraint in rlimit_stub.go while here, so that its maintenance is easier and it starts to match all non-darwin Unix GOOS values (previously, 'hurd' happened to be missed). In particular, this fixes a problem where TestOpenFileLimit was failing in some environments when testing the wasip1/wasm port. The RLIMIT_NOFILE bumping behavior isn't implemented there, so the test was testing the environment and not the Go project. Updates #46279. For #61116. Change-Id: Ic993f9cfc021d4cda4fe3d7fed8e2e180f78a2ca Reviewed-on: https://go-review.googlesource.com/c/go/+/539435 Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Bryan Mills <bcmills@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/syscall')
-rw-r--r--src/syscall/rlimit_stub.go2
-rw-r--r--src/syscall/rlimit_test.go2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/syscall/rlimit_stub.go b/src/syscall/rlimit_stub.go
index e8f839dd99..7daa935dd5 100644
--- a/src/syscall/rlimit_stub.go
+++ b/src/syscall/rlimit_stub.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-//go:build aix || dragonfly || freebsd || linux || netbsd || openbsd || solaris
+//go:build unix && !darwin
package syscall
diff --git a/src/syscall/rlimit_test.go b/src/syscall/rlimit_test.go
index e48f45e3aa..764694fe2d 100644
--- a/src/syscall/rlimit_test.go
+++ b/src/syscall/rlimit_test.go
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+//go:build unix
+
package syscall_test
import (