@@ -5,7 +5,15 @@ use crate::mem::MaybeUninit;
55use crate :: str;
66
77fn known_command ( ) -> Command {
8- if cfg ! ( windows) { Command :: new ( "help" ) } else { Command :: new ( "echo" ) }
8+ if cfg ! ( windows) {
9+ Command :: new ( "help" )
10+ } else if cfg ! ( all( target_vendor = "apple" , not( target_os = "macos" ) ) ) {
11+ // iOS/tvOS/watchOS/visionOS have a very limited set of commandline
12+ // binaries available.
13+ Command :: new ( "log" )
14+ } else {
15+ Command :: new ( "echo" )
16+ }
917}
1018
1119#[ cfg( target_os = "android" ) ]
@@ -19,7 +27,10 @@ fn shell_cmd() -> Command {
1927}
2028
2129#[ test]
22- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
30+ #[ cfg_attr(
31+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
32+ ignore = "no shell available"
33+ ) ]
2334fn smoke ( ) {
2435 let p = if cfg ! ( target_os = "windows" ) {
2536 Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 0" ] ) . spawn ( )
@@ -41,7 +52,10 @@ fn smoke_failure() {
4152}
4253
4354#[ test]
44- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
55+ #[ cfg_attr(
56+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
57+ ignore = "no shell available"
58+ ) ]
4559fn exit_reported_right ( ) {
4660 let p = if cfg ! ( target_os = "windows" ) {
4761 Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . spawn ( )
@@ -56,7 +70,10 @@ fn exit_reported_right() {
5670
5771#[ test]
5872#[ cfg( unix) ]
59- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
73+ #[ cfg_attr(
74+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
75+ ignore = "no shell available"
76+ ) ]
6077fn signal_reported_right ( ) {
6178 use crate :: os:: unix:: process:: ExitStatusExt ;
6279
@@ -80,7 +97,10 @@ pub fn run_output(mut cmd: Command) -> String {
8097}
8198
8299#[ test]
83- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
100+ #[ cfg_attr(
101+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
102+ ignore = "no shell available"
103+ ) ]
84104fn stdout_works ( ) {
85105 if cfg ! ( target_os = "windows" ) {
86106 let mut cmd = Command :: new ( "cmd" ) ;
@@ -94,7 +114,11 @@ fn stdout_works() {
94114}
95115
96116#[ test]
97- #[ cfg_attr( any( windows, target_os = "vxworks" ) , ignore) ]
117+ #[ cfg_attr( windows, ignore) ]
118+ #[ cfg_attr(
119+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
120+ ignore = "no shell available"
121+ ) ]
98122fn set_current_dir_works ( ) {
99123 // On many Unix platforms this will use the posix_spawn path.
100124 let mut cmd = shell_cmd ( ) ;
@@ -116,7 +140,11 @@ fn set_current_dir_works() {
116140}
117141
118142#[ test]
119- #[ cfg_attr( any( windows, target_os = "vxworks" ) , ignore) ]
143+ #[ cfg_attr( windows, ignore) ]
144+ #[ cfg_attr(
145+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
146+ ignore = "no shell available"
147+ ) ]
120148fn stdin_works ( ) {
121149 let mut p = shell_cmd ( )
122150 . arg ( "-c" )
@@ -134,7 +162,10 @@ fn stdin_works() {
134162}
135163
136164#[ test]
137- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
165+ #[ cfg_attr(
166+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
167+ ignore = "no shell available"
168+ ) ]
138169fn child_stdout_read_buf ( ) {
139170 let mut cmd = if cfg ! ( target_os = "windows" ) {
140171 let mut cmd = Command :: new ( "cmd" ) ;
@@ -165,7 +196,10 @@ fn child_stdout_read_buf() {
165196}
166197
167198#[ test]
168- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
199+ #[ cfg_attr(
200+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
201+ ignore = "no shell available"
202+ ) ]
169203fn test_process_status ( ) {
170204 let mut status = if cfg ! ( target_os = "windows" ) {
171205 Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . status ( ) . unwrap ( )
@@ -191,7 +225,10 @@ fn test_process_output_fail_to_start() {
191225}
192226
193227#[ test]
194- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
228+ #[ cfg_attr(
229+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
230+ ignore = "no shell available"
231+ ) ]
195232fn test_process_output_output ( ) {
196233 let Output { status, stdout, stderr } = if cfg ! ( target_os = "windows" ) {
197234 Command :: new ( "cmd" ) . args ( & [ "/C" , "echo hello" ] ) . output ( ) . unwrap ( )
@@ -206,7 +243,10 @@ fn test_process_output_output() {
206243}
207244
208245#[ test]
209- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
246+ #[ cfg_attr(
247+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
248+ ignore = "no shell available"
249+ ) ]
210250fn test_process_output_error ( ) {
211251 let Output { status, stdout, stderr } = if cfg ! ( target_os = "windows" ) {
212252 Command :: new ( "cmd" ) . args ( & [ "/C" , "mkdir ." ] ) . output ( ) . unwrap ( )
@@ -221,7 +261,10 @@ fn test_process_output_error() {
221261}
222262
223263#[ test]
224- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
264+ #[ cfg_attr(
265+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
266+ ignore = "no shell available"
267+ ) ]
225268fn test_finish_once ( ) {
226269 let mut prog = if cfg ! ( target_os = "windows" ) {
227270 Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . spawn ( ) . unwrap ( )
@@ -232,7 +275,10 @@ fn test_finish_once() {
232275}
233276
234277#[ test]
235- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
278+ #[ cfg_attr(
279+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
280+ ignore = "no shell available"
281+ ) ]
236282fn test_finish_twice ( ) {
237283 let mut prog = if cfg ! ( target_os = "windows" ) {
238284 Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . spawn ( ) . unwrap ( )
@@ -244,7 +290,10 @@ fn test_finish_twice() {
244290}
245291
246292#[ test]
247- #[ cfg_attr( any( target_os = "vxworks" ) , ignore) ]
293+ #[ cfg_attr(
294+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
295+ ignore = "no shell available"
296+ ) ]
248297fn test_wait_with_output_once ( ) {
249298 let prog = if cfg ! ( target_os = "windows" ) {
250299 Command :: new ( "cmd" ) . args ( & [ "/C" , "echo hello" ] ) . stdout ( Stdio :: piped ( ) ) . spawn ( ) . unwrap ( )
@@ -279,7 +328,10 @@ pub fn env_cmd() -> Command {
279328}
280329
281330#[ test]
282- #[ cfg_attr( target_os = "vxworks" , ignore) ]
331+ #[ cfg_attr(
332+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
333+ ignore = "no shell available"
334+ ) ]
283335fn test_override_env ( ) {
284336 use crate :: env;
285337
@@ -302,7 +354,10 @@ fn test_override_env() {
302354}
303355
304356#[ test]
305- #[ cfg_attr( target_os = "vxworks" , ignore) ]
357+ #[ cfg_attr(
358+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
359+ ignore = "no shell available"
360+ ) ]
306361fn test_add_to_env ( ) {
307362 let result = env_cmd ( ) . env ( "RUN_TEST_NEW_ENV" , "123" ) . output ( ) . unwrap ( ) ;
308363 let output = String :: from_utf8_lossy ( & result. stdout ) . to_string ( ) ;
@@ -314,7 +369,10 @@ fn test_add_to_env() {
314369}
315370
316371#[ test]
317- #[ cfg_attr( target_os = "vxworks" , ignore) ]
372+ #[ cfg_attr(
373+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
374+ ignore = "no shell available"
375+ ) ]
318376fn test_capture_env_at_spawn ( ) {
319377 use crate :: env;
320378
@@ -378,7 +436,10 @@ fn test_interior_nul_in_current_dir_is_error() {
378436
379437// Regression tests for #30862.
380438#[ test]
381- #[ cfg_attr( target_os = "vxworks" , ignore) ]
439+ #[ cfg_attr(
440+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
441+ ignore = "no `env` cmd available"
442+ ) ]
382443fn test_interior_nul_in_env_key_is_error ( ) {
383444 match env_cmd ( ) . env ( "has-some-\0 \0 s-inside" , "value" ) . spawn ( ) {
384445 Err ( e) => assert_eq ! ( e. kind( ) , ErrorKind :: InvalidInput ) ,
@@ -387,7 +448,10 @@ fn test_interior_nul_in_env_key_is_error() {
387448}
388449
389450#[ test]
390- #[ cfg_attr( target_os = "vxworks" , ignore) ]
451+ #[ cfg_attr(
452+ any( target_os = "vxworks" , all( target_vendor = "apple" , not( target_os = "macos" ) ) ) ,
453+ ignore = "no `env` cmd available"
454+ ) ]
391455fn test_interior_nul_in_env_value_is_error ( ) {
392456 match env_cmd ( ) . env ( "key" , "has-some-\0 \0 s-inside" ) . spawn ( ) {
393457 Err ( e) => assert_eq ! ( e. kind( ) , ErrorKind :: InvalidInput ) ,
0 commit comments