diff options
author | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-06-02 17:17:02 +0900 |
---|---|---|
committer | Mikio Hara <mikioh.mikioh@gmail.com> | 2016-06-02 22:26:03 +0000 |
commit | 49c680f948310cfc7ab3062ca9a96a4adb6ae8cd (patch) | |
tree | 6737bfe42f5198ad5fb18f1957d8d04a84ba6a1b /src/syscall/exec_linux_test.go | |
parent | 0f5697a81deab54f1673a48bd0ce613ebf1ddae6 (diff) | |
download | go-49c680f948310cfc7ab3062ca9a96a4adb6ae8cd.tar.gz go-49c680f948310cfc7ab3062ca9a96a4adb6ae8cd.zip |
syscall: deflake TestUnshare
Change-Id: I21a08c2ff5ebb74e158723cca323574432870ba8
Reviewed-on: https://go-review.googlesource.com/23662
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/syscall/exec_linux_test.go')
-rw-r--r-- | src/syscall/exec_linux_test.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/syscall/exec_linux_test.go b/src/syscall/exec_linux_test.go index 1afe88cb1b..a562c9cbf2 100644 --- a/src/syscall/exec_linux_test.go +++ b/src/syscall/exec_linux_test.go @@ -145,7 +145,18 @@ func TestUnshare(t *testing.T) { t.Skip("skipping test on Kubernetes-based builders; see Issue 12815") } - cmd := exec.Command("cat", "/proc/net/dev") + path := "/proc/net/dev" + if _, err := os.Stat(path); err != nil { + if os.IsNotExist(err) { + t.Skip("kernel doesn't support proc filesystem") + } + if os.IsPermission(err) { + t.Skip("unable to test proc filesystem due to permissions") + } + t.Fatal(err) + } + + cmd := exec.Command("cat", path) cmd.SysProcAttr = &syscall.SysProcAttr{ Unshareflags: syscall.CLONE_NEWNET, } |