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
argv = append(argv, targvExtra...)
cmd := exec.Command(os.Args[0], argv...)
cmd.Env = append(os.Environ(), "TRACETEST_EX_VERIFY_IN_SUBPROCESS=1")
bout, err := cmd.Output()
stdout := string(bout)
stderr := ""
bout, err := cmd.CombinedOutput() // NOTE `go test` combines everything to stdout only
out := string(bout)
ecode := 0
if testing.Verbose() {
t.Logf("stdout:\n%s\n", stdout)
t.Logf("stdout:\n%s\n", out)
}
if err != nil {
e, ok := err.(*exec.ExitError)
......@@ -196,7 +195,6 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string
// e.g. could not respawn at all
t.Fatal(err)
}
stderr = string(e.Stderr)
ecode = e.ExitCode()
}
......@@ -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)
}
if stderr != expectOK.stderrRe { // XXX match with re
badf("unexpected stderr:\n%s\nwant: %s\n", stderr, expectOK.stderrRe)
if out != expectOK.outputRe { // XXX match with re
badf("unexpected output:\n%s\nwant: %s\n", out, expectOK.outputRe)
}
if bad != "" {
......@@ -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.
type testExpect struct {
exitCode int
stderrRe string
outputRe string
}
// testExpectMap maps <test name> -> 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