]> Cypherpunks repositories - gostls13.git/commitdiff
os/exec: deflake TestStdinCloseRace
authorIan Lance Taylor <iant@golang.org>
Tue, 21 Feb 2017 15:14:51 +0000 (07:14 -0800)
committerIan Lance Taylor <iant@golang.org>
Tue, 21 Feb 2017 17:12:57 +0000 (17:12 +0000)
Stop reporting errors from cmd.Process.Kill; they don't matter for
purposes of this test, and they can occur if the process exits quickly.

Fixes #19211.
Fixes #19213.

Change-Id: I1a0bb9170220ca69199abb8e8811b1dde43e1897
Reviewed-on: https://go-review.googlesource.com/37309
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/os/exec/exec_test.go

index 1a159e261f2bc745c5adb1b065bdeeb7fae6e9b3..5b8627db54b0d4ea40da016a1c11c678848dfa5e 100644 (file)
@@ -263,9 +263,13 @@ func TestStdinCloseRace(t *testing.T) {
                t.Fatalf("Start: %v", err)
        }
        go func() {
-               if err := cmd.Process.Kill(); err != nil {
-                       t.Errorf("Kill: %v", err)
-               }
+               // We don't check the error return of Kill. It is
+               // possible that the process has already exited, in
+               // which case Kill will return an error "process
+               // already finished". The purpose of this test is to
+               // see whether the race detector reports an error; it
+               // doesn't matter whether this Kill succeeds or not.
+               cmd.Process.Kill()
        }()
        go func() {
                // Send the wrong string, so that the child fails even