@@ -23,23 +23,36 @@ pub fn next_test_port() -> u16 {
23
23
base_port ( ) + NEXT_OFFSET . fetch_add ( 1 , Ordering :: Relaxed ) as u16
24
24
}
25
25
26
- /// Get a temporary path which could be the location of a unix socket
27
- pub fn next_test_unix ( ) -> Path {
26
+ // iOS has a pretty long tmpdir path which causes pipe creation
27
+ // to like: invalid argument: path must be smaller than SUN_LEN
28
+ fn next_test_unix_socket ( ) -> String {
28
29
static COUNT : AtomicUint = ATOMIC_UINT_INIT ;
29
30
// base port and pid are an attempt to be unique between multiple
30
31
// test-runners of different configurations running on one
31
32
// buildbot, the count is to be unique within this executable.
32
- let string = format ! ( "rust-test-unix-path-{}-{}-{}" ,
33
- base_port( ) ,
34
- unsafe { libc:: getpid( ) } ,
35
- COUNT . fetch_add( 1 , Ordering :: Relaxed ) ) ;
33
+ format ! ( "rust-test-unix-path-{}-{}-{}" ,
34
+ base_port( ) ,
35
+ unsafe { libc:: getpid( ) } ,
36
+ COUNT . fetch_add( 1 , Ordering :: Relaxed ) )
37
+ }
38
+
39
+ /// Get a temporary path which could be the location of a unix socket
40
+ #[ cfg( not( target_os = "ios" ) ) ]
41
+ pub fn next_test_unix ( ) -> Path {
42
+ let string = next_test_unix_socket ( ) ;
36
43
if cfg ! ( unix) {
37
44
os:: tmpdir ( ) . join ( string)
38
45
} else {
39
46
Path :: new ( format ! ( "{}{}" , r"\\.\pipe\" , string) )
40
47
}
41
48
}
42
49
50
+ /// Get a temporary path which could be the location of a unix socket
51
+ #[ cfg( target_os = "ios" ) ]
52
+ pub fn next_test_unix ( ) -> Path {
53
+ Path :: new ( format ! ( "/var/tmp/{}" , next_test_unix_socket( ) ) )
54
+ }
55
+
43
56
/// Get a unique IPv4 localhost:port pair starting at 9600
44
57
pub fn next_test_ip4 ( ) -> SocketAddr {
45
58
SocketAddr { ip : Ipv4Addr ( 127 , 0 , 0 , 1 ) , port : next_test_port ( ) }
@@ -99,7 +112,7 @@ pub fn raise_fd_limit() {
99
112
/// multithreaded scheduler testing, depending on the number of cores available.
100
113
///
101
114
/// This fixes issue #7772.
102
- #[ cfg( target_os= "macos" ) ]
115
+ #[ cfg( any ( target_os = "macos" , target_os = "ios" ) ) ]
103
116
#[ allow( non_camel_case_types) ]
104
117
mod darwin_fd_limit {
105
118
use libc;
@@ -156,7 +169,7 @@ mod darwin_fd_limit {
156
169
}
157
170
}
158
171
159
- #[ cfg( not( target_os= "macos" ) ) ]
172
+ #[ cfg( not( any ( target_os = "macos" , target_os = "ios" ) ) ) ]
160
173
mod darwin_fd_limit {
161
174
pub unsafe fn raise_fd_limit ( ) { }
162
175
}
0 commit comments