File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 11
11
class TestPipe : XCTestCase {
12
12
13
13
static var allTests : [ ( String , ( TestPipe ) -> ( ) throws -> Void ) ] {
14
- return [
15
- ( " test_MaxPipes " , test_MaxPipes) ,
14
+ var tests : [ ( String , ( TestPipe ) -> ( ) throws -> Void ) ] = [
16
15
( " test_Pipe " , test_Pipe) ,
17
16
]
17
+
18
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
19
+ tests. append ( contentsOf: [
20
+ ( " test_MaxPipes " , test_MaxPipes) ,
21
+ ] )
22
+ #endif
23
+ return tests
18
24
}
19
25
26
+ #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT
20
27
func test_MaxPipes( ) {
21
28
// Try and create enough pipes to exhaust the process's limits. 1024 is a reasonable
22
29
// hard limit for the test. This is reached when testing on Linux (at around 488 pipes)
@@ -27,14 +34,15 @@ class TestPipe: XCTestCase {
27
34
pipes. reserveCapacity ( maxPipes)
28
35
for _ in 1 ... maxPipes {
29
36
let pipe = Pipe ( )
30
- if pipe. fileHandleForReading. fileDescriptor == - 1 {
37
+ if ! pipe. fileHandleForReading. _isPlatformHandleValid {
31
38
XCTAssertEqual ( pipe. fileHandleForReading. fileDescriptor, pipe. fileHandleForWriting. fileDescriptor)
32
39
break
33
40
}
34
41
pipes. append ( pipe)
35
42
}
36
43
pipes = [ ]
37
44
}
45
+ #endif
38
46
39
47
func test_Pipe( ) throws {
40
48
let aPipe = Pipe ( )
You can’t perform that action at this time.
0 commit comments