aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/exec_linux_test.go
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2016-06-02 17:17:02 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2016-06-02 22:26:03 +0000
commit49c680f948310cfc7ab3062ca9a96a4adb6ae8cd (patch)
tree6737bfe42f5198ad5fb18f1957d8d04a84ba6a1b /src/syscall/exec_linux_test.go
parent0f5697a81deab54f1673a48bd0ce613ebf1ddae6 (diff)
downloadgo-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.go13
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,
}