Commit d731315c authored by Russ Cox's avatar Russ Cox

net: run all timeout tests in parallel

For #10571.

Change-Id: I9a42226078b9c52dbe0c65cb101b5f452233e911
Reviewed-on: https://go-review.googlesource.com/18205Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
Reviewed-by: default avatarMikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent f2c36df9
......@@ -33,6 +33,7 @@ var dialTimeoutTests = []struct {
}
func TestDialTimeout(t *testing.T) {
// Cannot use t.Parallel - modifies global hooks.
origTestHookDialChannel := testHookDialChannel
defer func() { testHookDialChannel = origTestHookDialChannel }()
defer sw.Set(socktest.FilterConnect, nil)
......@@ -110,6 +111,8 @@ var acceptTimeoutTests = []struct {
}
func TestAcceptTimeout(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -161,6 +164,8 @@ func TestAcceptTimeout(t *testing.T) {
}
func TestAcceptTimeoutMustReturn(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -205,6 +210,8 @@ func TestAcceptTimeoutMustReturn(t *testing.T) {
}
func TestAcceptTimeoutMustNotReturn(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -254,6 +261,8 @@ var readTimeoutTests = []struct {
}
func TestReadTimeout(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -313,6 +322,8 @@ func TestReadTimeout(t *testing.T) {
}
func TestReadTimeoutMustNotReturn(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -454,6 +465,8 @@ var writeTimeoutTests = []struct {
}
func TestWriteTimeout(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -500,6 +513,8 @@ func TestWriteTimeout(t *testing.T) {
}
func TestWriteTimeoutMustNotReturn(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -569,6 +584,8 @@ var writeToTimeoutTests = []struct {
}
func TestWriteToTimeout(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "nacl", "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -620,6 +637,8 @@ func TestWriteToTimeout(t *testing.T) {
}
func TestReadTimeoutFluctuation(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -656,6 +675,8 @@ func TestReadTimeoutFluctuation(t *testing.T) {
}
func TestReadFromTimeoutFluctuation(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -692,6 +713,8 @@ func TestReadFromTimeoutFluctuation(t *testing.T) {
}
func TestWriteTimeoutFluctuation(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -731,12 +754,27 @@ func TestWriteTimeoutFluctuation(t *testing.T) {
}
}
func TestVariousDeadlines(t *testing.T) {
t.Parallel()
testVariousDeadlines(t)
}
func TestVariousDeadlines1Proc(t *testing.T) {
testVariousDeadlines(t, 1)
// Cannot use t.Parallel - modifies global GOMAXPROCS.
if testing.Short() {
t.Skip("skipping in short mode")
}
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1))
testVariousDeadlines(t)
}
func TestVariousDeadlines4Proc(t *testing.T) {
testVariousDeadlines(t, 4)
// Cannot use t.Parallel - modifies global GOMAXPROCS.
if testing.Short() {
t.Skip("skipping in short mode")
}
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
testVariousDeadlines(t)
}
type neverEnding byte
......@@ -748,14 +786,12 @@ func (b neverEnding) Read(p []byte) (int, error) {
return len(p), nil
}
func testVariousDeadlines(t *testing.T, maxProcs int) {
func testVariousDeadlines(t *testing.T) {
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
}
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(maxProcs))
type result struct {
n int64
err error
......@@ -869,6 +905,8 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
// TestReadWriteProlongedTimeout tests concurrent deadline
// modification. Known to cause data races in the past.
func TestReadWriteProlongedTimeout(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......@@ -947,6 +985,8 @@ func TestReadWriteProlongedTimeout(t *testing.T) {
}
func TestReadWriteDeadlineRace(t *testing.T) {
t.Parallel()
switch runtime.GOOS {
case "nacl", "plan9":
t.Skipf("not supported on %s", runtime.GOOS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment