From fcb75c8695f13d66be0865bf1bc62c12a15788b3 Mon Sep 17 00:00:00 2001 From: "Bryan C. Mills" Date: Tue, 29 Aug 2023 12:15:23 -0400 Subject: [PATCH] runtime: log stderr in TestLockRankGenerated on failure For #62334. Change-Id: I6d93dacc914590ef9c5a034dd4633466ec0bde8d Reviewed-on: https://go-review.googlesource.com/c/go/+/524056 TryBot-Result: Gopher Robot Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI Auto-Submit: Bryan Mills Run-TryBot: Bryan Mills --- src/runtime/lockrank_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/runtime/lockrank_test.go b/src/runtime/lockrank_test.go index a7b1b8df7cde2..dd99eb4565a21 100644 --- a/src/runtime/lockrank_test.go +++ b/src/runtime/lockrank_test.go @@ -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 {