mirror of
https://github.com/golang/go
synced 2024-11-24 04:10:14 -07:00
os/exec: disable fd check in TestHelperProcess on Plan 9
On Plan 9, we can observe the following open file descriptors: 0 r c 0 (000000000000000a 0 00) 0 0 /dev/null 1 rw | 0 (0000000001df6742 0 00) 65536 54 #|/data1 2 rw | 0 (0000000001df6782 0 00) 65536 0 #|/data1 3 rw M 1956 (0000000000d66dd2 0 00) 8192 12 /tmp/333163398 4 r c 0 (0000000000000001 0 00) 0 528 /dev/bintime 5 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 6 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 7 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 8 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 9 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 10 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 11 r c 0 (000000000000000f 0 00) 0 32 /dev/random 12 r M 1956 (0000000000d66dd1 854 00) 8192 0 /tmp/go-build843954301/os/exec/_test/exec.test 13 r c 0 (000000000000000a 0 00) 0 0 /dev/null 14 rw | 0 (0000000001df6801 0 00) 65536 0 #|/data 15 rw | 0 (0000000001df6802 0 00) 65536 1275 #|/data1 R=rsc, bradfitz, aram CC=golang-codereviews https://golang.org/cl/51420044
This commit is contained in:
parent
5ce3e6a1ef
commit
1f0ca748c2
@ -480,6 +480,8 @@ func TestHelperProcess(*testing.T) {
|
||||
switch runtime.GOOS {
|
||||
case "dragonfly", "freebsd", "netbsd", "openbsd":
|
||||
ofcmd = "fstat"
|
||||
case "plan9":
|
||||
ofcmd = "/bin/cat"
|
||||
}
|
||||
|
||||
args := os.Args
|
||||
@ -570,6 +572,10 @@ func TestHelperProcess(*testing.T) {
|
||||
// the cloned file descriptors that result from opening
|
||||
// /dev/urandom.
|
||||
// http://golang.org/issue/3955
|
||||
case "plan9":
|
||||
// TODO(0intro): Determine why Plan 9 is leaking
|
||||
// file descriptors.
|
||||
// http://golang.org/issue/7118
|
||||
case "solaris":
|
||||
// TODO(aram): This fails on Solaris because libc opens
|
||||
// its own files, as it sees fit. Darwin does the same,
|
||||
@ -585,7 +591,14 @@ func TestHelperProcess(*testing.T) {
|
||||
}
|
||||
if got := f.Fd(); got != wantfd {
|
||||
fmt.Printf("leaked parent file. fd = %d; want %d\n", got, wantfd)
|
||||
out, _ := exec.Command(ofcmd, "-p", fmt.Sprint(os.Getpid())).CombinedOutput()
|
||||
var args []string
|
||||
switch runtime.GOOS {
|
||||
case "plan9":
|
||||
args = []string{fmt.Sprintf("/proc/%d/fd", os.Getpid())}
|
||||
default:
|
||||
args = []string{"-p", fmt.Sprint(os.Getpid())}
|
||||
}
|
||||
out, _ := exec.Command(ofcmd, args...).CombinedOutput()
|
||||
fmt.Print(string(out))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user