diff options
| author | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2013-01-27 00:24:09 +0100 |
|---|---|---|
| committer | Rémy Oudompheng <oudomphe@phare.normalesup.org> | 2013-01-27 00:24:09 +0100 |
| commit | 75104237c82f943bffc41334acd179cf28f30ea2 (patch) | |
| tree | f0729cc4e295f7994932262ea84abe06c7cb01df /src/pkg/os/exec/exec_test.go | |
| parent | c48f7d6b8af8b1a8ced44453a9970801faeeb9f5 (diff) | |
| download | go-75104237c82f943bffc41334acd179cf28f30ea2.tar.xz | |
all: make tests able to run multiple times.
It is now possible to run "go test -cpu=1,2,4 std"
successfully.
Fixes #3185.
R=golang-dev, dave, minux.ma, bradfitz
CC=golang-dev
https://golang.org/cl/7196052
Diffstat (limited to 'src/pkg/os/exec/exec_test.go')
| -rw-r--r-- | src/pkg/os/exec/exec_test.go | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pkg/os/exec/exec_test.go b/src/pkg/os/exec/exec_test.go index 0702d3bdf6..ff8954fd02 100644 --- a/src/pkg/os/exec/exec_test.go +++ b/src/pkg/os/exec/exec_test.go @@ -144,6 +144,8 @@ func TestPipes(t *testing.T) { check("Wait", err) } +var testedAlreadyLeaked = false + func TestExtraFiles(t *testing.T) { if runtime.GOOS == "windows" { t.Skip("no operating system support; skipping") @@ -151,10 +153,13 @@ func TestExtraFiles(t *testing.T) { // Ensure that file descriptors have not already been leaked into // our environment. - for fd := os.Stderr.Fd() + 1; fd <= 101; fd++ { - err := os.NewFile(fd, "").Close() - if err == nil { - t.Logf("Something already leaked - closed fd %d", fd) + if !testedAlreadyLeaked { + testedAlreadyLeaked = true + for fd := os.Stderr.Fd() + 1; fd <= 101; fd++ { + err := os.NewFile(fd, "").Close() + if err == nil { + t.Logf("Something already leaked - closed fd %d", fd) + } } } |
