aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2021-06-01 17:00:26 -0700
committerMatthew Dempsky <mdempsky@google.com>2021-06-02 22:34:36 +0000
commit6b1cdeaef3099b32d244cef7bb5adc4d7b7628fc (patch)
treed72f5cb310db73c2a62ccdc392c8915ec33a37f0 /src/cmd/link
parentc7b98115815a04d9efa664c163d39f5fea38b32c (diff)
downloadgo-6b1cdeaef3099b32d244cef7bb5adc4d7b7628fc.tar.gz
go-6b1cdeaef3099b32d244cef7bb5adc4d7b7628fc.zip
[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>
Diffstat (limited to 'src/cmd/link')
-rw-r--r--src/cmd/link/internal/ld/dwarf_test.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/cmd/link/internal/ld/dwarf_test.go b/src/cmd/link/internal/ld/dwarf_test.go
index 2f59c2fe0a..543dd5caac 100644
--- a/src/cmd/link/internal/ld/dwarf_test.go
+++ b/src/cmd/link/internal/ld/dwarf_test.go
@@ -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)
}