Skip to content

Commit

Permalink
unix, windows: use ^TestName$ regular pattern for invoking a single test
Browse files Browse the repository at this point in the history
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 <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
dmitshur authored and gopherbot committed Sep 6, 2023
1 parent 5154691 commit 81cb935
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion unix/syscall_zos_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions windows/svc/svc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 81cb935

Please sign in to comment.