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
This commit is contained in:
Dmitriy Vyukov 2013-05-28 21:09:27 +04:00
parent 2f5825d427
commit 4d6bfcf245
1 changed files with 5 additions and 7 deletions

View File

@ -540,13 +540,11 @@ func TestHelperProcess(*testing.T) {
n, _ := strconv.Atoi(args[0])
os.Exit(n)
case "describefiles":
for fd := uintptr(3); fd < 25; fd++ {
f := os.NewFile(fd, fmt.Sprintf("fd-%d", fd))
ln, err := net.FileListener(f)
if err == nil {
fmt.Printf("fd%d: listener %s\n", fd, ln.Addr())
ln.Close()
}
f := os.NewFile(3, fmt.Sprintf("fd3"))
ln, err := net.FileListener(f)
if err == nil {
fmt.Printf("fd3: listener %s\n", ln.Addr())
ln.Close()
}
os.Exit(0)
case "extraFilesAndPipes":