mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-07 00:34:42 +00:00
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
|
||||
if outcome == "build-fail" {
|
||||
outcome = "FAIL"
|
||||
outcome = "fail"
|
||||
}
|
||||
pkgTests[""].logs.WriteString(goOutput.Output)
|
||||
ch <- &testAttempt{
|
||||
@ -152,7 +152,15 @@ func runTests(ctx context.Context, attempt int, pt *packageTests, goTestArgs, te
|
||||
logs: pkgTests[""].logs,
|
||||
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
|
||||
}
|
||||
testName := goOutput.Test
|
||||
@ -276,7 +284,11 @@ func main() {
|
||||
// when a package times out.
|
||||
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))
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user