]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: fix test hang
authorDmitriy Vyukov <dvyukov@google.com>
Tue, 28 May 2013 17:09:27 +0000 (21:09 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Tue, 28 May 2013 17:09:27 +0000 (21:09 +0400)
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

src/pkg/os/exec/exec_test.go

index 6f5860e9554cf7236cfb7f0ae561aec40f6fe1a5..eae9fb14411737247a5b35913b7292c15a049d41 100644 (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":