diff options
author | Bryan C. Mills <bcmills@google.com> | 2019-10-17 09:57:42 -0400 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2019-10-17 18:16:38 +0000 |
commit | f38a51069278054205ac2d6aa20b3968b1f5c06f (patch) | |
tree | a801f573f58f1453ec333702716c57241319bfed /src/os/exec/exec_test.go | |
parent | 4569f1baa8283f115adaf15fdbf6b6f57a2e643f (diff) | |
download | go-f38a51069278054205ac2d6aa20b3968b1f5c06f.tar.gz go-f38a51069278054205ac2d6aa20b3968b1f5c06f.zip |
os/exec: re-enable TestExtraFiles checks skipped on various OSes
The issues associated with these skipped checks are closed.
If they are working around unfixed bugs, the issues should remain open.
If they are working around unfixable properties of the system, the skips
should refer to those properties rather than closed issues.
Updates #2603
Updates #3955
Updates #25628
Change-Id: I3491c69b2ef5bad0fb12001fe8f7e06b424883ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/201718
Run-TryBot: Bryan C. Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/os/exec/exec_test.go')
-rw-r--r-- | src/os/exec/exec_test.go | 79 |
1 files changed, 30 insertions, 49 deletions
diff --git a/src/os/exec/exec_test.go b/src/os/exec/exec_test.go index 41ffb60e6e..60a8d0228b 100644 --- a/src/os/exec/exec_test.go +++ b/src/os/exec/exec_test.go @@ -821,59 +821,40 @@ func TestHelperProcess(*testing.T) { fmt.Printf("ReadAll from fd 3: %v", err) os.Exit(1) } - switch runtime.GOOS { - case "dragonfly": - // TODO(jsing): Determine why DragonFly is leaking - // file descriptors... - case "darwin": - // TODO(bradfitz): broken? Sometimes. - // https://golang.org/issue/2603 - // Skip this additional part of the test for now. - case "netbsd": - // TODO(jsing): This currently fails on NetBSD due to - // the cloned file descriptors that result from opening - // /dev/urandom. - // https://golang.org/issue/3955 - case "illumos", "solaris": - // TODO(aram): This fails on Solaris because libc opens - // its own files, as it sees fit. Darwin does the same, - // see: https://golang.org/issue/2603 - default: - // Now verify that there are no other open fds. - var files []*os.File - for wantfd := basefds() + 1; wantfd <= 100; wantfd++ { - if poll.IsPollDescriptor(wantfd) { - continue + // Now verify that there are no other open fds. + var files []*os.File + for wantfd := basefds() + 1; wantfd <= 100; wantfd++ { + if poll.IsPollDescriptor(wantfd) { + continue + } + f, err := os.Open(os.Args[0]) + if err != nil { + fmt.Printf("error opening file with expected fd %d: %v", wantfd, err) + os.Exit(1) + } + if got := f.Fd(); got != wantfd { + fmt.Printf("leaked parent file. fd = %d; want %d\n", got, wantfd) + var args []string + switch runtime.GOOS { + case "plan9": + args = []string{fmt.Sprintf("/proc/%d/fd", os.Getpid())} + case "aix": + args = []string{fmt.Sprint(os.Getpid())} + default: + args = []string{"-p", fmt.Sprint(os.Getpid())} } - f, err := os.Open(os.Args[0]) + cmd := exec.Command(ofcmd, args...) + out, err := cmd.CombinedOutput() if err != nil { - fmt.Printf("error opening file with expected fd %d: %v", wantfd, err) - os.Exit(1) + fmt.Fprintf(os.Stderr, "%s failed: %v\n", strings.Join(cmd.Args, " "), err) } - if got := f.Fd(); got != wantfd { - fmt.Printf("leaked parent file. fd = %d; want %d\n", got, wantfd) - var args []string - switch runtime.GOOS { - case "plan9": - args = []string{fmt.Sprintf("/proc/%d/fd", os.Getpid())} - case "aix": - args = []string{fmt.Sprint(os.Getpid())} - default: - args = []string{"-p", fmt.Sprint(os.Getpid())} - } - cmd := exec.Command(ofcmd, args...) - out, err := cmd.CombinedOutput() - if err != nil { - fmt.Fprintf(os.Stderr, "%s failed: %v\n", strings.Join(cmd.Args, " "), err) - } - fmt.Printf("%s", out) - os.Exit(1) - } - files = append(files, f) - } - for _, f := range files { - f.Close() + fmt.Printf("%s", out) + os.Exit(1) } + files = append(files, f) + } + for _, f := range files { + f.Close() } // Referring to fd3 here ensures that it is not // garbage collected, and therefore closed, while |