aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/net/timeout_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/net/timeout_test.go')
-rw-r--r--libgo/go/net/timeout_test.go51
1 files changed, 45 insertions, 6 deletions
diff --git a/libgo/go/net/timeout_test.go b/libgo/go/net/timeout_test.go
index ca94e24c816..98e3164fb98 100644
--- a/libgo/go/net/timeout_test.go
+++ b/libgo/go/net/timeout_test.go
@@ -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)
@@ -956,7 +996,6 @@ func TestReadWriteDeadlineRace(t *testing.T) {
if testing.Short() {
N = 50
}
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(4))
ln, err := newLocalListener("tcp")
if err != nil {