1
0
mirror of https://github.com/golang/go synced 2024-11-15 03:30:37 -07:00

cmd/link: print the seed in TestRandLayout

When the test fails, print the seed, to help debug.

Change-Id: I1530ce433f3c6b573fbba061452f57c7649cad77
Reviewed-on: https://go-review.googlesource.com/c/go/+/587925
Reviewed-by: Than McIntosh <thanm@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Cherry Mui 2024-05-24 13:18:50 -04:00
parent 54efef99b2
commit 23778fcb27

View File

@ -1397,17 +1397,17 @@ func TestRandLayout(t *testing.T) {
cmd := testenv.Command(t, testenv.GoToolPath(t), "build", "-ldflags=-randlayout="+seed, "-o", exe, src)
out, err := cmd.CombinedOutput()
if err != nil {
t.Fatalf("build failed: %v\n%s", err, out)
t.Fatalf("seed=%v: build failed: %v\n%s", seed, err, out)
}
cmd = testenv.Command(t, exe)
err = cmd.Run()
if err != nil {
t.Fatalf("executable failed to run: %v\n%s", err, out)
t.Fatalf("seed=%v: executable failed to run: %v\n%s", seed, err, out)
}
cmd = testenv.Command(t, testenv.GoToolPath(t), "tool", "nm", exe)
out, err = cmd.CombinedOutput()
if err != nil {
t.Fatalf("fail to run \"go tool nm\": %v\n%s", err, out)
t.Fatalf("seed=%v: fail to run \"go tool nm\": %v\n%s", seed, err, out)
}
syms[i] = string(out)
}