]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/internal/cryptotest: print stderr if go tool fails
authorIan Lance Taylor <iant@golang.org>
Fri, 31 Jan 2025 20:39:19 +0000 (12:39 -0800)
committerGopher Robot <gobot@golang.org>
Mon, 3 Feb 2025 16:20:05 +0000 (08:20 -0800)
Trying to find out why "go env GOMODCACHE" is failing
on the Windows longtest builder.

For #71508

Change-Id: I0642d5a5d85a549c6edde0be5bed8f0a16cca200
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/645895
Reviewed-by: Roland Shoemaker <roland@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/crypto/internal/cryptotest/fetchmodule.go

index 740b17b00156e0e8664fc334c19afc0e9be8c3b6..37f2a094972b9d2cebec7cffbb693ca4912ee854 100644 (file)
@@ -9,6 +9,7 @@ import (
        "encoding/json"
        "internal/testenv"
        "os"
+       "os/exec"
        "testing"
 )
 
@@ -23,7 +24,11 @@ func FetchModule(t *testing.T, module, version string) string {
        // instead. (For example, run.bash sets GOPATH=/nonexist-gopath.)
        out, err := testenv.Command(t, goTool, "env", "GOMODCACHE").Output()
        if err != nil {
-               t.Fatalf("%s env GOMODCACHE: %v\n%s", goTool, err, out)
+               t.Errorf("%s env GOMODCACHE: %v\n%s", goTool, err, out)
+               if ee, ok := err.(*exec.ExitError); ok {
+                       t.Logf("%s", ee.Stderr)
+               }
+               t.FailNow()
        }
        modcacheOk := false
        if gomodcache := string(bytes.TrimSpace(out)); gomodcache != "" {