Skip to content

Commit 81ca1c1

Browse files
committed
2
1 parent 4696e77 commit 81ca1c1

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/sync/waitgroup_test.go

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"os"
1111
"os/exec"
1212
"strings"
13-
"sync"
1413
. "sync"
1514
"sync/atomic"
1615
"testing"
@@ -120,27 +119,23 @@ func TestWaitGroupGo(t *testing.T) {
120119
// the process without causing Wait to unblock; previously there was a race.
121120
func TestIssue76126(t *testing.T) {
122121
testenv.MustHaveExec(t)
123-
// Call child in a child process
124-
// and inspect its failure message.
125-
cmd := exec.Command(os.Args[0], "-test.run=^TestIssue76126Child$")
126-
cmd.Env = append(os.Environ(), "SYNC_TEST_CHILD=1")
127-
buf := new(bytes.Buffer)
128-
cmd.Stderr = buf
129-
cmd.Run() // ignore error
130-
131-
got := buf.String()
132-
if strings.Contains(got, "panic: test") {
133-
// ok
134-
} else {
135-
t.Errorf("missing panic: test\n%s", got)
136-
}
137-
}
138-
139-
func TestIssue76126Child(t *testing.T) {
140122
if os.Getenv("SYNC_TEST_CHILD") != "1" {
141-
t.Skip("not child")
123+
// Call child in a child process
124+
// and inspect its failure message.
125+
cmd := exec.Command(os.Args[0], "-test.run=^TestIssue76126$")
126+
cmd.Env = append(os.Environ(), "SYNC_TEST_CHILD=1")
127+
buf := new(bytes.Buffer)
128+
cmd.Stderr = buf
129+
cmd.Run() // ignore error
130+
got := buf.String()
131+
if strings.Contains(got, "panic: test") {
132+
// ok
133+
} else {
134+
t.Errorf("missing panic: test\n%s", got)
135+
}
136+
return
142137
}
143-
var wg sync.WaitGroup
138+
var wg WaitGroup
144139
wg.Go(func() {
145140
panic("test")
146141
})

0 commit comments

Comments
 (0)