@@ -5,7 +5,15 @@ use crate::mem::MaybeUninit;
5
5
use crate :: str;
6
6
7
7
fn 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
+ }
9
17
}
10
18
11
19
#[ cfg( target_os = "android" ) ]
@@ -19,7 +27,10 @@ fn shell_cmd() -> Command {
19
27
}
20
28
21
29
#[ 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
+ ) ]
23
34
fn smoke ( ) {
24
35
let p = if cfg ! ( target_os = "windows" ) {
25
36
Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 0" ] ) . spawn ( )
@@ -41,7 +52,10 @@ fn smoke_failure() {
41
52
}
42
53
43
54
#[ 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
+ ) ]
45
59
fn exit_reported_right ( ) {
46
60
let p = if cfg ! ( target_os = "windows" ) {
47
61
Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . spawn ( )
@@ -56,7 +70,10 @@ fn exit_reported_right() {
56
70
57
71
#[ test]
58
72
#[ 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
+ ) ]
60
77
fn signal_reported_right ( ) {
61
78
use crate :: os:: unix:: process:: ExitStatusExt ;
62
79
@@ -80,7 +97,10 @@ pub fn run_output(mut cmd: Command) -> String {
80
97
}
81
98
82
99
#[ 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
+ ) ]
84
104
fn stdout_works ( ) {
85
105
if cfg ! ( target_os = "windows" ) {
86
106
let mut cmd = Command :: new ( "cmd" ) ;
@@ -94,7 +114,11 @@ fn stdout_works() {
94
114
}
95
115
96
116
#[ 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
+ ) ]
98
122
fn set_current_dir_works ( ) {
99
123
// On many Unix platforms this will use the posix_spawn path.
100
124
let mut cmd = shell_cmd ( ) ;
@@ -116,7 +140,11 @@ fn set_current_dir_works() {
116
140
}
117
141
118
142
#[ 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
+ ) ]
120
148
fn stdin_works ( ) {
121
149
let mut p = shell_cmd ( )
122
150
. arg ( "-c" )
@@ -134,7 +162,10 @@ fn stdin_works() {
134
162
}
135
163
136
164
#[ 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
+ ) ]
138
169
fn child_stdout_read_buf ( ) {
139
170
let mut cmd = if cfg ! ( target_os = "windows" ) {
140
171
let mut cmd = Command :: new ( "cmd" ) ;
@@ -165,7 +196,10 @@ fn child_stdout_read_buf() {
165
196
}
166
197
167
198
#[ 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
+ ) ]
169
203
fn test_process_status ( ) {
170
204
let mut status = if cfg ! ( target_os = "windows" ) {
171
205
Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . status ( ) . unwrap ( )
@@ -191,7 +225,10 @@ fn test_process_output_fail_to_start() {
191
225
}
192
226
193
227
#[ 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
+ ) ]
195
232
fn test_process_output_output ( ) {
196
233
let Output { status, stdout, stderr } = if cfg ! ( target_os = "windows" ) {
197
234
Command :: new ( "cmd" ) . args ( & [ "/C" , "echo hello" ] ) . output ( ) . unwrap ( )
@@ -206,7 +243,10 @@ fn test_process_output_output() {
206
243
}
207
244
208
245
#[ 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
+ ) ]
210
250
fn test_process_output_error ( ) {
211
251
let Output { status, stdout, stderr } = if cfg ! ( target_os = "windows" ) {
212
252
Command :: new ( "cmd" ) . args ( & [ "/C" , "mkdir ." ] ) . output ( ) . unwrap ( )
@@ -221,7 +261,10 @@ fn test_process_output_error() {
221
261
}
222
262
223
263
#[ 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
+ ) ]
225
268
fn test_finish_once ( ) {
226
269
let mut prog = if cfg ! ( target_os = "windows" ) {
227
270
Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . spawn ( ) . unwrap ( )
@@ -232,7 +275,10 @@ fn test_finish_once() {
232
275
}
233
276
234
277
#[ 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
+ ) ]
236
282
fn test_finish_twice ( ) {
237
283
let mut prog = if cfg ! ( target_os = "windows" ) {
238
284
Command :: new ( "cmd" ) . args ( & [ "/C" , "exit 1" ] ) . spawn ( ) . unwrap ( )
@@ -244,7 +290,10 @@ fn test_finish_twice() {
244
290
}
245
291
246
292
#[ 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
+ ) ]
248
297
fn test_wait_with_output_once ( ) {
249
298
let prog = if cfg ! ( target_os = "windows" ) {
250
299
Command :: new ( "cmd" ) . args ( & [ "/C" , "echo hello" ] ) . stdout ( Stdio :: piped ( ) ) . spawn ( ) . unwrap ( )
@@ -279,7 +328,10 @@ pub fn env_cmd() -> Command {
279
328
}
280
329
281
330
#[ 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
+ ) ]
283
335
fn test_override_env ( ) {
284
336
use crate :: env;
285
337
@@ -302,7 +354,10 @@ fn test_override_env() {
302
354
}
303
355
304
356
#[ 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
+ ) ]
306
361
fn test_add_to_env ( ) {
307
362
let result = env_cmd ( ) . env ( "RUN_TEST_NEW_ENV" , "123" ) . output ( ) . unwrap ( ) ;
308
363
let output = String :: from_utf8_lossy ( & result. stdout ) . to_string ( ) ;
@@ -314,7 +369,10 @@ fn test_add_to_env() {
314
369
}
315
370
316
371
#[ 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
+ ) ]
318
376
fn test_capture_env_at_spawn ( ) {
319
377
use crate :: env;
320
378
@@ -378,7 +436,10 @@ fn test_interior_nul_in_current_dir_is_error() {
378
436
379
437
// Regression tests for #30862.
380
438
#[ 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
+ ) ]
382
443
fn test_interior_nul_in_env_key_is_error ( ) {
383
444
match env_cmd ( ) . env ( "has-some-\0 \0 s-inside" , "value" ) . spawn ( ) {
384
445
Err ( e) => assert_eq ! ( e. kind( ) , ErrorKind :: InvalidInput ) ,
@@ -387,7 +448,10 @@ fn test_interior_nul_in_env_key_is_error() {
387
448
}
388
449
389
450
#[ 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
+ ) ]
391
455
fn test_interior_nul_in_env_value_is_error ( ) {
392
456
match env_cmd ( ) . env ( "key" , "has-some-\0 \0 s-inside" ) . spawn ( ) {
393
457
Err ( e) => assert_eq ! ( e. kind( ) , ErrorKind :: InvalidInput ) ,
0 commit comments