Commit 4d6bfcf2 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

os/exec: fix test hang

Currently the test closes random files descriptors,
which leads to hang (in particular if netpoll fd is closed).
Try to open only fd 3, since the parent process expects it to be fd 3 anyway.
Fixes #5571.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/9778048
parent 2f5825d4
...@@ -540,13 +540,11 @@ func TestHelperProcess(*testing.T) { ...@@ -540,13 +540,11 @@ func TestHelperProcess(*testing.T) {
n, _ := strconv.Atoi(args[0]) n, _ := strconv.Atoi(args[0])
os.Exit(n) os.Exit(n)
case "describefiles": case "describefiles":
for fd := uintptr(3); fd < 25; fd++ { f := os.NewFile(3, fmt.Sprintf("fd3"))
f := os.NewFile(fd, fmt.Sprintf("fd-%d", fd)) ln, err := net.FileListener(f)
ln, err := net.FileListener(f) if err == nil {
if err == nil { fmt.Printf("fd3: listener %s\n", ln.Addr())
fmt.Printf("fd%d: listener %s\n", fd, ln.Addr()) ln.Close()
ln.Close()
}
} }
os.Exit(0) os.Exit(0)
case "extraFilesAndPipes": case "extraFilesAndPipes":
......
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