1
0
mirror of https://github.com/golang/go synced 2024-11-11 23:10:23 -07:00

[dev.typeparams] cmd/link: include "go build" output in test logs

If running "go build" outputs anything, write it to the test log even
if the test succeeds. This makes it easier to diagnose errors within
the compiler by adding print statements and finding them in the test
log, even if the compiler exits successfully.

Change-Id: Id04716c4e1dcd9220c35ea0040ea516c1dd5237c
Reviewed-on: https://go-review.googlesource.com/c/go/+/324329
Trust: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Matthew Dempsky 2021-06-01 17:00:26 -07:00
parent c7b9811581
commit 6b1cdeaef3

View File

@ -101,8 +101,11 @@ func gobuild(t *testing.T, dir string, testfile string, gcflags string) *builtFi
}
cmd := exec.Command(testenv.GoToolPath(t), "build", gcflags, "-o", dst, src)
if b, err := cmd.CombinedOutput(); err != nil {
t.Logf("build: %s\n", b)
b, err := cmd.CombinedOutput()
if len(b) != 0 {
t.Logf("## build output:\n%s", b)
}
if err != nil {
t.Fatalf("build error: %v", err)
}