Commit 8d58ab5c authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 8ee01a27
...@@ -183,16 +183,18 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -183,16 +183,18 @@ 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.CombinedOutput() bout, err := cmd.Output()
out := string(bout) stdout := string(bout)
stderr := ""
ecode := 0 ecode := 0
if err != nil { if err != nil {
e, ok := err.(*exec.ExitError) e, ok := err.(*exec.ExitError)
if !ok { if !ok {
// e.g. could not respawn at all // e.g. could not respawn at all
t.Log(out) t.Log(stdout)
t.Fatal(err) t.Fatal(err)
} }
stderr = string(e.Stderr)
ecode = e.ExitCode() ecode = e.ExitCode()
} }
...@@ -205,8 +207,8 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -205,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 out != expectOK.outputRe { // XXX match with re if stderr != expectOK.stderrRe { // XXX match with re
badf("unexpected output:\n%s\nwant: %s\n", out, expectOK.outputRe) badf("unexpected stderr:\n%s\nwant: %s\n", stderr, expectOK.stderrRe)
} }
if bad != "" { if bad != "" {
...@@ -217,7 +219,7 @@ func verifyInSubprocess(t *testing.T, f func(t *testing.T), targvExtra ...string ...@@ -217,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
outputRe string stderrRe 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