Skip to content

Commit

Permalink
Rollup merge of rust-lang#63206 - BaoshanPang:master, r=alexcrichton
Browse files Browse the repository at this point in the history
remove unsupported test case

r? @alexcrichton
  • Loading branch information
Centril authored Aug 2, 2019
2 parents 726f39a + 208672f commit ed7b044
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions src/libstd/sys/vxworks/process/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,67 +403,3 @@ impl ExitCode {
self.0 as i32
}
}

#[cfg(all(test, not(target_os = "emscripten")))]
mod tests {
use super::*;

use crate::ffi::OsStr;
use crate::mem;
use crate::ptr;
use crate::sys::cvt;

macro_rules! t {
($e:expr) => {
match $e {
Ok(t) => t,
Err(e) => panic!("received error for `{}`: {}", stringify!($e), e),
}
}
}

extern {
fn sigemptyset(set: *mut libc::sigset_t) -> libc::c_int;
fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_int;
}

#[test]
fn test_process_mask() {
unsafe {
// Test to make sure that a signal mask does not get inherited.
let mut cmd = Command::new(OsStr::new("cat"));

let mut set: libc::sigset_t = mem::uninitialized();
let mut old_set: libc::sigset_t = mem::uninitialized();
t!(cvt(sigemptyset(&mut set)));
t!(cvt(sigaddset(&mut set, libc::SIGINT)));
t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &set, &mut old_set)));

cmd.stdin(Stdio::MakePipe);
cmd.stdout(Stdio::MakePipe);

let (mut cat, mut pipes) = t!(cmd.spawn(Stdio::Null, true));
let stdin_write = pipes.stdin.take().unwrap();
let stdout_read = pipes.stdout.take().unwrap();

t!(cvt(libc::pthread_sigmask(libc::SIG_SETMASK, &old_set,
ptr::null_mut())));

t!(cvt(libc::kill(cat.id() as libc::pid_t, libc::SIGINT)));
// We need to wait until SIGINT is definitely delivered. The
// easiest way is to write something to cat, and try to read it
// back: if SIGINT is unmasked, it'll get delivered when cat is
// next scheduled.
let _ = stdin_write.write(b"Hello");
drop(stdin_write);

// Either EOF or failure (EPIPE) is okay.
let mut buf = [0; 5];
if let Ok(ret) = stdout_read.read(&mut buf) {
assert_eq!(ret, 0);
}

t!(cat.wait());
}
}
}

0 comments on commit ed7b044

Please sign in to comment.