summaryrefslogtreecommitdiffhomepage
path: root/test/runtimes
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2021-03-06 09:52:23 -0800
committergVisor bot <gvisor-bot@google.com>2021-03-06 09:54:09 -0800
commit0a909ba75a556db6acbb2a30d2e741b365217c83 (patch)
treeef8cb5bcc1a6fcdb638c1d1687d530e7d4cc0908 /test/runtimes
parentfb733cdb8f4050fbc8ad083ea05c3e98b99b9acc (diff)
[op] Replace syscall package usage with golang.org/x/sys/unix in test/.
The syscall package has been deprecated in favor of golang.org/x/sys. Note that syscall is still used in some places because the following don't seem to have an equivalent in unix package: - syscall.SysProcIDMap - syscall.Credential Updates #214 PiperOrigin-RevId: 361332034
Diffstat (limited to 'test/runtimes')
-rw-r--r--test/runtimes/proctor/BUILD5
-rw-r--r--test/runtimes/proctor/lib/BUILD1
-rw-r--r--test/runtimes/proctor/lib/lib.go7
-rw-r--r--test/runtimes/proctor/main.go8
4 files changed, 13 insertions, 8 deletions
diff --git a/test/runtimes/proctor/BUILD b/test/runtimes/proctor/BUILD
index fdc6d3173..b4a9b12de 100644
--- a/test/runtimes/proctor/BUILD
+++ b/test/runtimes/proctor/BUILD
@@ -7,5 +7,8 @@ go_binary(
srcs = ["main.go"],
pure = True,
visibility = ["//test/runtimes:__pkg__"],
- deps = ["//test/runtimes/proctor/lib"],
+ deps = [
+ "//test/runtimes/proctor/lib",
+ "@org_golang_x_sys//unix:go_default_library",
+ ],
)
diff --git a/test/runtimes/proctor/lib/BUILD b/test/runtimes/proctor/lib/BUILD
index 0c8367dfe..f834f1b5a 100644
--- a/test/runtimes/proctor/lib/BUILD
+++ b/test/runtimes/proctor/lib/BUILD
@@ -13,6 +13,7 @@ go_library(
"python.go",
],
visibility = ["//test/runtimes/proctor:__pkg__"],
+ deps = ["@org_golang_x_sys//unix:go_default_library"],
)
go_test(
diff --git a/test/runtimes/proctor/lib/lib.go b/test/runtimes/proctor/lib/lib.go
index f2ba82498..36c60088a 100644
--- a/test/runtimes/proctor/lib/lib.go
+++ b/test/runtimes/proctor/lib/lib.go
@@ -22,7 +22,8 @@ import (
"os/signal"
"path/filepath"
"regexp"
- "syscall"
+
+ "golang.org/x/sys/unix"
)
// TestRunner is an interface that must be implemented for each runtime
@@ -59,7 +60,7 @@ func TestRunnerForRuntime(runtime string) (TestRunner, error) {
func PauseAndReap() {
// Get notified of any new children.
ch := make(chan os.Signal, 1)
- signal.Notify(ch, syscall.SIGCHLD)
+ signal.Notify(ch, unix.SIGCHLD)
for {
if _, ok := <-ch; !ok {
@@ -69,7 +70,7 @@ func PauseAndReap() {
// Reap the child.
for {
- if cpid, _ := syscall.Wait4(-1, nil, syscall.WNOHANG, nil); cpid < 1 {
+ if cpid, _ := unix.Wait4(-1, nil, unix.WNOHANG, nil); cpid < 1 {
break
}
}
diff --git a/test/runtimes/proctor/main.go b/test/runtimes/proctor/main.go
index 81cb68381..8c076a499 100644
--- a/test/runtimes/proctor/main.go
+++ b/test/runtimes/proctor/main.go
@@ -22,8 +22,8 @@ import (
"log"
"os"
"strings"
- "syscall"
+ "golang.org/x/sys/unix"
"gvisor.dev/gvisor/test/runtimes/proctor/lib"
)
@@ -42,14 +42,14 @@ func setNumFilesLimit() error {
// timeout if the NOFILE limit is too high. On gVisor, syscalls are
// slower so these tests will need even more time to pass.
const nofile = 32768
- rLimit := syscall.Rlimit{}
- err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
+ rLimit := unix.Rlimit{}
+ err := unix.Getrlimit(unix.RLIMIT_NOFILE, &rLimit)
if err != nil {
return fmt.Errorf("failed to get RLIMIT_NOFILE: %v", err)
}
if rLimit.Cur > nofile {
rLimit.Cur = nofile
- err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit)
+ err := unix.Setrlimit(unix.RLIMIT_NOFILE, &rLimit)
if err != nil {
return fmt.Errorf("failed to set RLIMIT_NOFILE: %v", err)
}