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 <dmitshur@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Dmitri Shuralyov
2023-09-03 14:53:17 -04:00
committed by Gopher Robot
parent 51546915a6
commit 81cb935067
2 changed files with 3 additions and 3 deletions

View File

@@ -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 {

View File

@@ -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)