From 4305ba78f05fd75ba1bc3be8457fcc2501da2c5e Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Wed, 1 Dec 2021 10:41:55 -0500 Subject: git-codereview: log stderr and stdout from successful commands The reason for the failures in golang/go#49899 is not clear. Perhaps the stderr output will shed some light on what is happening. For golang/go#49899 Change-Id: I37c6339c8ebd4a37e4ff5b3b813572193903cee4 Reviewed-on: https://go-review.googlesource.com/c/review/+/368174 Trust: Bryan Mills Run-TryBot: Bryan Mills TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor --- git-codereview/util_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/git-codereview/util_test.go b/git-codereview/util_test.go index fd419a2..2d3bebe 100644 --- a/git-codereview/util_test.go +++ b/git-codereview/util_test.go @@ -324,6 +324,8 @@ func testMain(t *testing.T, args ...string) { mainCanDie = false // reset for next invocation defer func() { + t.Helper() + runLog = runLogTrap testStdout = stdoutTrap testStderr = stderrTrap @@ -344,6 +346,13 @@ func testMain(t *testing.T, args ...string) { } t.Fatalf("%s\nstdout:\n%sstderr:\n%s", msg, testStdout, testStderr) } + + if testStdout.Len() > 0 { + t.Logf("stdout:\n%s", testStdout) + } + if testStderr.Len() > 0 { + t.Logf("stderr:\n%s", testStderr) + } }() exitTrap = func() { -- cgit v1.3