From 81cb9350676d634779777766b655683bf1869772 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sun, 3 Sep 2023 14:53:17 -0400 Subject: [PATCH] unix, windows: use ^TestName$ regular pattern for invoking a single test For reasons motivated in the commit message of CL 524948. Change-Id: I0085411f30a77634962239ee36d15e7b6ef893ef Reviewed-on: https://go-review.googlesource.com/c/sys/+/525618 Auto-Submit: Dmitri Shuralyov LUCI-TryBot-Result: Go LUCI Reviewed-by: Dmitri Shuralyov Reviewed-by: Ian Lance Taylor --- unix/syscall_zos_test.go | 2 +- windows/svc/svc_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/unix/syscall_zos_test.go b/unix/syscall_zos_test.go index 42ae5ba8..0be76924 100644 --- a/unix/syscall_zos_test.go +++ b/unix/syscall_zos_test.go @@ -757,7 +757,7 @@ func TestFlock(t *testing.T) { if err != nil { t.Fatalf("Flock: %s", err.Error()) } - cmd := exec.Command(os.Args[0], "-test.run=TestFlock", f.Name()) + cmd := exec.Command(os.Args[0], "-test.run=^TestFlock$", f.Name()) cmd.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=1") out, err := cmd.CombinedOutput() if len(out) > 0 || err != nil { diff --git a/windows/svc/svc_test.go b/windows/svc/svc_test.go index 6439a06b..5bb0641e 100644 --- a/windows/svc/svc_test.go +++ b/windows/svc/svc_test.go @@ -182,7 +182,7 @@ func TestIsWindowsServiceWhenParentExits(t *testing.T) { // in parent process // Start the child and exit quickly. - child := exec.Command(os.Args[0], "-test.run=TestIsWindowsServiceWhenParentExits") + child := exec.Command(os.Args[0], "-test.run=^TestIsWindowsServiceWhenParentExits$") child.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=child") err := child.Start() if err != nil { @@ -221,7 +221,7 @@ func TestIsWindowsServiceWhenParentExits(t *testing.T) { for i := 0; i < 10; i++ { childDumpPath := filepath.Join(t.TempDir(), "issvc.txt") - parent := exec.Command(os.Args[0], "-test.run=TestIsWindowsServiceWhenParentExits") + parent := exec.Command(os.Args[0], "-test.run=^TestIsWindowsServiceWhenParentExits$") parent.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=parent", "GO_WANT_HELPER_PROCESS_FILE="+childDumpPath)