From f707e53fd52284e58b9ea5d7889ad360d34d5116 Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 24 Feb 2025 09:57:04 +0100 Subject: all: surround -test.run arguments with ^$ If the -test.run value is not surrounded by ^$ then any test that matches the -test.run value will be run. This is normally not the desired behavior, as it can lead to unexpected tests being run. Change-Id: I3447aaebad5156bbef7f263cdb9f6b8c32331324 Reviewed-on: https://go-review.googlesource.com/c/go/+/651956 Reviewed-by: Cherry Mui Reviewed-by: Ian Lance Taylor LUCI-TryBot-Result: Go LUCI --- src/runtime/syscall_windows_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/runtime/syscall_windows_test.go') diff --git a/src/runtime/syscall_windows_test.go b/src/runtime/syscall_windows_test.go index 7a7269d125..6709267403 100644 --- a/src/runtime/syscall_windows_test.go +++ b/src/runtime/syscall_windows_test.go @@ -657,7 +657,7 @@ func TestWERDialogue(t *testing.T) { if err != nil { t.Fatal(err) } - cmd := testenv.CleanCmdEnv(testenv.Command(t, exe, "-test.run=TestWERDialogue")) + cmd := testenv.CleanCmdEnv(testenv.Command(t, exe, "-test.run=^TestWERDialogue$")) cmd.Env = append(cmd.Env, "TEST_WER_DIALOGUE=1", "GOTRACEBACK=wer") // Child process should not open WER dialogue, but return immediately instead. // The exit code can't be reliably tested here because Windows can change it. @@ -1043,7 +1043,7 @@ func TestNumCPU(t *testing.T) { _GetProcessAffinityMask := kernel32.MustFindProc("GetProcessAffinityMask") _SetProcessAffinityMask := kernel32.MustFindProc("SetProcessAffinityMask") - cmd := exec.Command(testenv.Executable(t), "-test.run=TestNumCPU") + cmd := exec.Command(testenv.Executable(t), "-test.run=^TestNumCPU$") cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1") var buf strings.Builder cmd.Stdout = &buf -- cgit v1.3-6-g1900