1 // run-pass 2 // ignore-emscripten no processes 3 // ignore-sgx no processes 4 5 use std::alloc::{Layout, handle_alloc_error}; 6 use std::env; 7 use std::process::Command; 8 use std::str; 9 main()10fn main() { 11 if env::args().len() > 1 { 12 handle_alloc_error(Layout::new::<[u8; 42]>()) 13 } 14 15 let me = env::current_exe().unwrap(); 16 let output = Command::new(&me).arg("next").output().unwrap(); 17 assert!(!output.status.success(), "{:?} is a success", output.status); 18 19 let mut stderr = str::from_utf8(&output.stderr).unwrap(); 20 21 // When running inside QEMU user-mode emulation, there will be an extra message printed by QEMU 22 // in the stderr whenever a core dump happens. Remove it before the check. 23 stderr = stderr 24 .strip_suffix("qemu: uncaught target signal 6 (Aborted) - core dumped\n") 25 .unwrap_or(stderr); 26 27 assert_eq!(stderr, "memory allocation of 42 bytes failed\n"); 28 } 29