Commit e8cfd4db authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6bb1677f
...@@ -183,12 +183,11 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -183,12 +183,11 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
argv = append(argv, targvExtra...) argv = append(argv, targvExtra...)
cmd := exec.Command(os.Args[0], argv...) cmd := exec.Command(os.Args[0], argv...)
cmd.Env = append(os.Environ(), "TRACETEST_EX_VERIFY_IN_SUBPROCESS=1") cmd.Env = append(os.Environ(), "TRACETEST_EX_VERIFY_IN_SUBPROCESS=1")
bout, err := cmd.Output() bout, err := cmd.CombinedOutput() // NOTE `go test` combines everything to stdout only
stdout := string(bout) out := string(bout)
stderr := ""
ecode := 0 ecode := 0
if testing.Verbose() { if testing.Verbose() {
t.Logf("stdout:\n%s\n", stdout) t.Logf("stdout:\n%s\n", out)
} }
if err != nil { if err != nil {
e, ok := err.(*exec.ExitError) e, ok := err.(*exec.ExitError)
...@@ -196,7 +195,6 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -196,7 +195,6 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
// e.g. could not respawn at all // e.g. could not respawn at all
t.Fatal(err) t.Fatal(err)
} }
stderr = string(e.Stderr)
ecode = e.ExitCode() ecode = e.ExitCode()
} }
...@@ -209,8 +207,8 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -209,8 +207,8 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
badf("exit code: %d ; expected: %d", ecode, expectOK.exitCode) badf("exit code: %d ; expected: %d", ecode, expectOK.exitCode)
} }
if stderr != expectOK.stderrRe { // XXX match with re if out != expectOK.outputRe { // XXX match with re
badf("unexpected stderr:\n%s\nwant: %s\n", stderr, expectOK.stderrRe) badf("unexpected output:\n%s\nwant: %s\n", out, expectOK.outputRe)
} }
if bad != "" { if bad != "" {
...@@ -221,7 +219,7 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -221,7 +219,7 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
// testExpect describes what result to expect from a test. // testExpect describes what result to expect from a test.
type testExpect struct { type testExpect struct {
exitCode int exitCode int
stderrRe string outputRe string
} }
// testExpectMap maps <test name> -> testExpect. // testExpectMap maps <test name> -> testExpect.
var testExpectMap = map[string]testExpect{ var testExpectMap = map[string]testExpect{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment