@@ -23,23 +23,36 @@ pub fn next_test_port() -> u16 {
2323 base_port ( ) + NEXT_OFFSET . fetch_add ( 1 , Ordering :: Relaxed ) as u16
2424}
2525
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 {
2829 static COUNT : AtomicUint = ATOMIC_UINT_INIT ;
2930 // base port and pid are an attempt to be unique between multiple
3031 // test-runners of different configurations running on one
3132 // 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 ( ) ;
3643 if cfg ! ( unix) {
3744 os:: tmpdir ( ) . join ( string)
3845 } else {
3946 Path :: new ( format ! ( "{}{}" , r"\\.\pipe\" , string) )
4047 }
4148}
4249
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+
4356/// Get a unique IPv4 localhost:port pair starting at 9600
4457pub fn next_test_ip4 ( ) -> SocketAddr {
4558 SocketAddr { ip : Ipv4Addr ( 127 , 0 , 0 , 1 ) , port : next_test_port ( ) }
@@ -99,7 +112,7 @@ pub fn raise_fd_limit() {
99112/// multithreaded scheduler testing, depending on the number of cores available.
100113///
101114/// This fixes issue #7772.
102- #[ cfg( target_os= "macos" ) ]
115+ #[ cfg( any ( target_os = "macos" , target_os = "ios" ) ) ]
103116#[ allow( non_camel_case_types) ]
104117mod darwin_fd_limit {
105118 use libc;
@@ -156,7 +169,7 @@ mod darwin_fd_limit {
156169 }
157170}
158171
159- #[ cfg( not( target_os= "macos" ) ) ]
172+ #[ cfg( not( any ( target_os = "macos" , target_os = "ios" ) ) ) ]
160173mod darwin_fd_limit {
161174 pub unsafe fn raise_fd_limit ( ) { }
162175}
0 commit comments