File tree 4 files changed +41
-17
lines changed 4 files changed +41
-17
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ package cgotest
11
11
#include <stdlib.h>
12
12
#include <sys/stat.h>
13
13
#include <errno.h>
14
- #include <unistd.h>
15
14
16
15
#define SHIFT(x, y) ((x)<<(y))
17
16
#define KILO SHIFT(1, 10)
@@ -58,7 +57,6 @@ import "C"
58
57
import (
59
58
"syscall"
60
59
"testing"
61
- "time"
62
60
"unsafe"
63
61
)
64
62
@@ -126,20 +124,6 @@ func testMultipleAssign(t *testing.T) {
126
124
C .free (unsafe .Pointer (p ))
127
125
}
128
126
129
- func testSetgid (t * testing.T ) {
130
- // Issue 3871.
131
- c := make (chan bool )
132
- go func () {
133
- C .setgid (0 )
134
- c <- true
135
- }()
136
- select {
137
- case <- c :
138
- case <- time .After (5 * time .Second ):
139
- t .Error ("setgid hung" )
140
- }
141
- }
142
-
143
127
var (
144
128
cuint = (C .uint )(0 )
145
129
culong C.ulong
Original file line number Diff line number Diff line change
1
+ // Copyright 2012 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ package cgotest
6
+
7
+ import "testing"
8
+
9
+ func TestSetgid (t * testing.T ) { testSetgid (t ) }
Original file line number Diff line number Diff line change @@ -27,6 +27,5 @@ func Test1328(t *testing.T) { test1328(t) }
27
27
func TestParallelSleep (t * testing.T ) { testParallelSleep (t ) }
28
28
func TestSetEnv (t * testing.T ) { testSetEnv (t ) }
29
29
func TestHelpers (t * testing.T ) { testHelpers (t ) }
30
- func TestSetgid (t * testing.T ) { testSetgid (t ) }
31
30
32
31
func BenchmarkCgoCall (b * testing.B ) { benchCgoCall (b ) }
Original file line number Diff line number Diff line change
1
+ // Copyright 2012 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ // Test that setgid does not hang on GNU/Linux.
6
+ // See http://code.google.com/p/go/issues/detail?id=3871 for details.
7
+
8
+ package cgotest
9
+
10
+ /*
11
+ #include <sys/types.h>
12
+ #include <unistd.h>
13
+ */
14
+ import "C"
15
+
16
+ import (
17
+ "testing"
18
+ "time"
19
+ )
20
+
21
+ func testSetgid (t * testing.T ) {
22
+ c := make (chan bool )
23
+ go func () {
24
+ C .setgid (0 )
25
+ c <- true
26
+ }()
27
+ select {
28
+ case <- c :
29
+ case <- time .After (5 * time .Second ):
30
+ t .Error ("setgid hung" )
31
+ }
32
+ }
You can’t perform that action at this time.
0 commit comments