Commit 48cc3c4b authored by Cherry Zhang's avatar Cherry Zhang

syscall: skip TestUnshare if kernel does not support net namespace

Fixes #16056.

Change-Id: Ic3343914742713851b8ae969b101521f25e85e7b
Reviewed-on: https://go-review.googlesource.com/24132Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 0ec62565
...@@ -155,6 +155,12 @@ func TestUnshare(t *testing.T) { ...@@ -155,6 +155,12 @@ func TestUnshare(t *testing.T) {
} }
t.Fatal(err) t.Fatal(err)
} }
if _, err := os.Stat("/proc/self/ns/net"); err != nil {
if os.IsNotExist(err) {
t.Skip("kernel doesn't support net namespace")
}
t.Fatal(err)
}
cmd := exec.Command("cat", path) cmd := exec.Command("cat", path)
cmd.SysProcAttr = &syscall.SysProcAttr{ cmd.SysProcAttr = &syscall.SysProcAttr{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment