cmd/testwrapper: Display package-level output
Updates tailscale/corp#26861 Signed-off-by: James Sanderson <jsanderson@tailscale.com>
This commit is contained in:
parent
e74a705c67
commit
fa374fa852
@ -141,7 +141,7 @@ func runTests(ctx context.Context, attempt int, pt *packageTests, goTestArgs, te
|
|||||||
}
|
}
|
||||||
outcome := goOutput.Action
|
outcome := goOutput.Action
|
||||||
if outcome == "build-fail" {
|
if outcome == "build-fail" {
|
||||||
outcome = "FAIL"
|
outcome = "fail"
|
||||||
}
|
}
|
||||||
pkgTests[""].logs.WriteString(goOutput.Output)
|
pkgTests[""].logs.WriteString(goOutput.Output)
|
||||||
ch <- &testAttempt{
|
ch <- &testAttempt{
|
||||||
@ -152,7 +152,15 @@ func runTests(ctx context.Context, attempt int, pt *packageTests, goTestArgs, te
|
|||||||
logs: pkgTests[""].logs,
|
logs: pkgTests[""].logs,
|
||||||
pkgFinished: true,
|
pkgFinished: true,
|
||||||
}
|
}
|
||||||
|
case "output":
|
||||||
|
// Capture all output from the package except for the final
|
||||||
|
// "FAIL tailscale.io/control 0.684s" line, as
|
||||||
|
// printPkgOutcome will output a similar line
|
||||||
|
if !strings.HasPrefix(goOutput.Output, fmt.Sprintf("FAIL\t%s\t", goOutput.Package)) {
|
||||||
|
pkgTests[""].logs.WriteString(goOutput.Output)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
testName := goOutput.Test
|
testName := goOutput.Test
|
||||||
@ -276,7 +284,11 @@ type nextRun struct {
|
|||||||
// when a package times out.
|
// when a package times out.
|
||||||
failed = true
|
failed = true
|
||||||
}
|
}
|
||||||
os.Stdout.ReadFrom(&tr.logs)
|
if testingVerbose || tr.outcome == "fail" {
|
||||||
|
// Output package-level output which is where e.g.
|
||||||
|
// panics outside tests will be printed
|
||||||
|
io.Copy(os.Stdout, &tr.logs)
|
||||||
|
}
|
||||||
printPkgOutcome(tr.pkg, tr.outcome, thisRun.attempt, tr.end.Sub(tr.start))
|
printPkgOutcome(tr.pkg, tr.outcome, thisRun.attempt, tr.end.Sub(tr.start))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user