]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: log stderr in TestLockRankGenerated on failure
authorBryan C. Mills <bcmills@google.com>
Tue, 29 Aug 2023 16:15:23 +0000 (12:15 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 29 Aug 2023 20:57:33 +0000 (20:57 +0000)
For #62334.

Change-Id: I6d93dacc914590ef9c5a034dd4633466ec0bde8d
Reviewed-on: https://go-review.googlesource.com/c/go/+/524056
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>

src/runtime/lockrank_test.go

index a7b1b8df7cde26e5724ddbdb53ba41f2f5d68d93..dd99eb4565a2165da2cb96743e585a58339d909e 100644 (file)
@@ -15,9 +15,13 @@ import (
 // Test that the generated code for the lock rank graph is up-to-date.
 func TestLockRankGenerated(t *testing.T) {
        testenv.MustHaveGoRun(t)
-       want, err := testenv.CleanCmdEnv(exec.Command(testenv.GoToolPath(t), "run", "mklockrank.go")).CombinedOutput()
+       cmd := testenv.CleanCmdEnv(testenv.Command(t, testenv.GoToolPath(t), "run", "mklockrank.go"))
+       want, err := cmd.Output()
        if err != nil {
-               t.Fatal(err)
+               if ee, ok := err.(*exec.ExitError); ok && len(ee.Stderr) > 0 {
+                       t.Fatalf("%v: %v\n%s", cmd, err, ee.Stderr)
+               }
+               t.Fatalf("%v: %v", cmd, err)
        }
        got, err := os.ReadFile("lockrank.go")
        if err != nil {