mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
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>
This commit is contained in:
parent
0f5697a81d
commit
49c680f948
1 changed files with 12 additions and 1 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue