@@ -33,6 +33,7 @@ var dialTimeoutTests = []struct {
33
33
}
34
34
35
35
func TestDialTimeout (t * testing.T ) {
36
+ // Cannot use t.Parallel - modifies global hooks.
36
37
origTestHookDialChannel := testHookDialChannel
37
38
defer func () { testHookDialChannel = origTestHookDialChannel }()
38
39
defer sw .Set (socktest .FilterConnect , nil )
@@ -110,6 +111,8 @@ var acceptTimeoutTests = []struct {
110
111
}
111
112
112
113
func TestAcceptTimeout (t * testing.T ) {
114
+ t .Parallel ()
115
+
113
116
switch runtime .GOOS {
114
117
case "plan9" :
115
118
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -161,6 +164,8 @@ func TestAcceptTimeout(t *testing.T) {
161
164
}
162
165
163
166
func TestAcceptTimeoutMustReturn (t * testing.T ) {
167
+ t .Parallel ()
168
+
164
169
switch runtime .GOOS {
165
170
case "plan9" :
166
171
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -205,6 +210,8 @@ func TestAcceptTimeoutMustReturn(t *testing.T) {
205
210
}
206
211
207
212
func TestAcceptTimeoutMustNotReturn (t * testing.T ) {
213
+ t .Parallel ()
214
+
208
215
switch runtime .GOOS {
209
216
case "plan9" :
210
217
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -254,6 +261,8 @@ var readTimeoutTests = []struct {
254
261
}
255
262
256
263
func TestReadTimeout (t * testing.T ) {
264
+ t .Parallel ()
265
+
257
266
switch runtime .GOOS {
258
267
case "plan9" :
259
268
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -313,6 +322,8 @@ func TestReadTimeout(t *testing.T) {
313
322
}
314
323
315
324
func TestReadTimeoutMustNotReturn (t * testing.T ) {
325
+ t .Parallel ()
326
+
316
327
switch runtime .GOOS {
317
328
case "plan9" :
318
329
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -454,6 +465,8 @@ var writeTimeoutTests = []struct {
454
465
}
455
466
456
467
func TestWriteTimeout (t * testing.T ) {
468
+ t .Parallel ()
469
+
457
470
switch runtime .GOOS {
458
471
case "plan9" :
459
472
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -500,6 +513,8 @@ func TestWriteTimeout(t *testing.T) {
500
513
}
501
514
502
515
func TestWriteTimeoutMustNotReturn (t * testing.T ) {
516
+ t .Parallel ()
517
+
503
518
switch runtime .GOOS {
504
519
case "plan9" :
505
520
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -569,6 +584,8 @@ var writeToTimeoutTests = []struct {
569
584
}
570
585
571
586
func TestWriteToTimeout (t * testing.T ) {
587
+ t .Parallel ()
588
+
572
589
switch runtime .GOOS {
573
590
case "nacl" , "plan9" :
574
591
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -620,6 +637,8 @@ func TestWriteToTimeout(t *testing.T) {
620
637
}
621
638
622
639
func TestReadTimeoutFluctuation (t * testing.T ) {
640
+ t .Parallel ()
641
+
623
642
switch runtime .GOOS {
624
643
case "plan9" :
625
644
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -656,6 +675,8 @@ func TestReadTimeoutFluctuation(t *testing.T) {
656
675
}
657
676
658
677
func TestReadFromTimeoutFluctuation (t * testing.T ) {
678
+ t .Parallel ()
679
+
659
680
switch runtime .GOOS {
660
681
case "plan9" :
661
682
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -692,6 +713,8 @@ func TestReadFromTimeoutFluctuation(t *testing.T) {
692
713
}
693
714
694
715
func TestWriteTimeoutFluctuation (t * testing.T ) {
716
+ t .Parallel ()
717
+
695
718
switch runtime .GOOS {
696
719
case "plan9" :
697
720
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -731,12 +754,27 @@ func TestWriteTimeoutFluctuation(t *testing.T) {
731
754
}
732
755
}
733
756
757
+ func TestVariousDeadlines (t * testing.T ) {
758
+ t .Parallel ()
759
+ testVariousDeadlines (t )
760
+ }
761
+
734
762
func TestVariousDeadlines1Proc (t * testing.T ) {
735
- testVariousDeadlines (t , 1 )
763
+ // Cannot use t.Parallel - modifies global GOMAXPROCS.
764
+ if testing .Short () {
765
+ t .Skip ("skipping in short mode" )
766
+ }
767
+ defer runtime .GOMAXPROCS (runtime .GOMAXPROCS (1 ))
768
+ testVariousDeadlines (t )
736
769
}
737
770
738
771
func TestVariousDeadlines4Proc (t * testing.T ) {
739
- testVariousDeadlines (t , 4 )
772
+ // Cannot use t.Parallel - modifies global GOMAXPROCS.
773
+ if testing .Short () {
774
+ t .Skip ("skipping in short mode" )
775
+ }
776
+ defer runtime .GOMAXPROCS (runtime .GOMAXPROCS (4 ))
777
+ testVariousDeadlines (t )
740
778
}
741
779
742
780
type neverEnding byte
@@ -748,14 +786,12 @@ func (b neverEnding) Read(p []byte) (int, error) {
748
786
return len (p ), nil
749
787
}
750
788
751
- func testVariousDeadlines (t * testing.T , maxProcs int ) {
789
+ func testVariousDeadlines (t * testing.T ) {
752
790
switch runtime .GOOS {
753
791
case "plan9" :
754
792
t .Skipf ("not supported on %s" , runtime .GOOS )
755
793
}
756
794
757
- defer runtime .GOMAXPROCS (runtime .GOMAXPROCS (maxProcs ))
758
-
759
795
type result struct {
760
796
n int64
761
797
err error
@@ -869,6 +905,8 @@ func testVariousDeadlines(t *testing.T, maxProcs int) {
869
905
// TestReadWriteProlongedTimeout tests concurrent deadline
870
906
// modification. Known to cause data races in the past.
871
907
func TestReadWriteProlongedTimeout (t * testing.T ) {
908
+ t .Parallel ()
909
+
872
910
switch runtime .GOOS {
873
911
case "plan9" :
874
912
t .Skipf ("not supported on %s" , runtime .GOOS )
@@ -947,6 +985,8 @@ func TestReadWriteProlongedTimeout(t *testing.T) {
947
985
}
948
986
949
987
func TestReadWriteDeadlineRace (t * testing.T ) {
988
+ t .Parallel ()
989
+
950
990
switch runtime .GOOS {
951
991
case "nacl" , "plan9" :
952
992
t .Skipf ("not supported on %s" , runtime .GOOS )
0 commit comments