runtime/secret: run crash tests under memory validating modes

The crashing test for runtime/secret does not run afoul of the memory
validators like the standard tests does. Pass through to the crashing
binary to shake out as many problems as possible.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-asan-clang15,gotip-linux-amd64-msan-clang15,gotip-linux-arm64-asan-clang15
Change-Id: I1999fc2012ef520c80cf77d5b2d4bf4b1b8cb0b2
Reviewed-on: https://go-review.googlesource.com/c/go/+/724622
Reviewed-by: Mark Freeman <markfreeman@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
Daniel Morsing
2025-12-01 15:13:08 +00:00
parent 34b9742c81
commit 841fafcd58

View File

@@ -10,6 +10,9 @@ import (
"bytes"
"debug/elf"
"fmt"
"internal/asan"
"internal/msan"
"internal/race"
"internal/testenv"
"io"
"os"
@@ -120,7 +123,18 @@ func TestCore(t *testing.T) {
t.Fatalf("error initing module %v\n%s", err, out)
}
cmd = exec.Command(testenv.GoToolPath(t), "build", "-o", filepath.Join(tmpDir, "a.exe"))
// Pass through the flags for any of the memory validating modes
args := []string{"build", "-o", filepath.Join(tmpDir, "a.exe")}
if msan.Enabled {
args = append(args, "-msan")
}
if asan.Enabled {
args = append(args, "-asan")
}
if race.Enabled {
args = append(args, "-race")
}
cmd = exec.Command(testenv.GoToolPath(t), args...)
cmd.Dir = tmpDir
out, err = testenv.CleanCmdEnv(cmd).CombinedOutput()
if err != nil {