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
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.CombinedOutput()
out := string(bout)
bout, err := cmd.Output()
stdout := string(bout)
stderr := ""
ecode := 0
if err != nil {
e, ok := err.(*exec.ExitError)
if !ok {
// e.g. could not respawn at all
t.Log(out)
t.Log(stdout)
t.Fatal(err)
}
stderr = string(e.Stderr)
ecode = e.ExitCode()
}
......@@ -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)
}
if out != expectOK.outputRe { // XXX match with re
badf("unexpected output:\n%s\nwant: %s\n", out, expectOK.outputRe)
if stderr != expectOK.stderrRe { // XXX match with re
badf("unexpected stderr:\n%s\nwant: %s\n", stderr, expectOK.stderrRe)
}
if bad != "" {
......@@ -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.
type testExpect struct {
exitCode int
outputRe string
stderrRe 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