@@ -403,67 +403,3 @@ impl ExitCode {
403
403
self . 0 as i32
404
404
}
405
405
}
406
-
407
- #[ cfg( all( test, not( target_os = "emscripten" ) ) ) ]
408
- mod tests {
409
- use super :: * ;
410
-
411
- use crate :: ffi:: OsStr ;
412
- use crate :: mem;
413
- use crate :: ptr;
414
- use crate :: sys:: cvt;
415
-
416
- macro_rules! t {
417
- ( $e: expr) => {
418
- match $e {
419
- Ok ( t) => t,
420
- Err ( e) => panic!( "received error for `{}`: {}" , stringify!( $e) , e) ,
421
- }
422
- }
423
- }
424
-
425
- extern {
426
- fn sigemptyset ( set : * mut libc:: sigset_t ) -> libc:: c_int ;
427
- fn sigaddset ( set : * mut libc:: sigset_t , signum : libc:: c_int ) -> libc:: c_int ;
428
- }
429
-
430
- #[ test]
431
- fn test_process_mask ( ) {
432
- unsafe {
433
- // Test to make sure that a signal mask does not get inherited.
434
- let mut cmd = Command :: new ( OsStr :: new ( "cat" ) ) ;
435
-
436
- let mut set: libc:: sigset_t = mem:: uninitialized ( ) ;
437
- let mut old_set: libc:: sigset_t = mem:: uninitialized ( ) ;
438
- t ! ( cvt( sigemptyset( & mut set) ) ) ;
439
- t ! ( cvt( sigaddset( & mut set, libc:: SIGINT ) ) ) ;
440
- t ! ( cvt( libc:: pthread_sigmask( libc:: SIG_SETMASK , & set, & mut old_set) ) ) ;
441
-
442
- cmd. stdin ( Stdio :: MakePipe ) ;
443
- cmd. stdout ( Stdio :: MakePipe ) ;
444
-
445
- let ( mut cat, mut pipes) = t ! ( cmd. spawn( Stdio :: Null , true ) ) ;
446
- let stdin_write = pipes. stdin . take ( ) . unwrap ( ) ;
447
- let stdout_read = pipes. stdout . take ( ) . unwrap ( ) ;
448
-
449
- t ! ( cvt( libc:: pthread_sigmask( libc:: SIG_SETMASK , & old_set,
450
- ptr:: null_mut( ) ) ) ) ;
451
-
452
- t ! ( cvt( libc:: kill( cat. id( ) as libc:: pid_t, libc:: SIGINT ) ) ) ;
453
- // We need to wait until SIGINT is definitely delivered. The
454
- // easiest way is to write something to cat, and try to read it
455
- // back: if SIGINT is unmasked, it'll get delivered when cat is
456
- // next scheduled.
457
- let _ = stdin_write. write ( b"Hello" ) ;
458
- drop ( stdin_write) ;
459
-
460
- // Either EOF or failure (EPIPE) is okay.
461
- let mut buf = [ 0 ; 5 ] ;
462
- if let Ok ( ret) = stdout_read. read ( & mut buf) {
463
- assert_eq ! ( ret, 0 ) ;
464
- }
465
-
466
- t ! ( cat. wait( ) ) ;
467
- }
468
- }
469
- }
0 commit comments