mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
cf6d6050f7
* The WASI targets deal with the `main` symbol a bit differently than native so some `codegen` and `assembly` tests have been ignored. * All `ignore-emscripten` directives have been updated to `ignore-wasm32` to be more clear that all wasm targets are ignored and it's not just Emscripten. * Most `ignore-wasm32-bare` directives are now gone. * Some ignore directives for wasm were switched to `needs-unwind` instead. * Many `ignore-wasm32*` directives are removed as the tests work with WASI as opposed to `wasm32-unknown-unknown`.
33 lines
844 B
Rust
33 lines
844 B
Rust
//@ run-pass
|
|
//@ ignore-wasm32 spawning processes is not supported
|
|
//@ ignore-sgx no processes
|
|
|
|
use std::{env, process};
|
|
|
|
fn child() {
|
|
print!("[stdout 0]");
|
|
print!("[stdout {}]", 1);
|
|
println!("[stdout {}]", 2);
|
|
println!();
|
|
eprint!("[stderr 0]");
|
|
eprint!("[stderr {}]", 1);
|
|
eprintln!("[stderr {}]", 2);
|
|
eprintln!();
|
|
}
|
|
|
|
fn parent() {
|
|
let this = env::args().next().unwrap();
|
|
let output = process::Command::new(this).arg("-").output().unwrap();
|
|
assert!(output.status.success());
|
|
|
|
let stdout = String::from_utf8(output.stdout).unwrap();
|
|
let stderr = String::from_utf8(output.stderr).unwrap();
|
|
|
|
assert_eq!(stdout, "[stdout 0][stdout 1][stdout 2]\n\n");
|
|
assert_eq!(stderr, "[stderr 0][stderr 1][stderr 2]\n\n");
|
|
}
|
|
|
|
fn main() {
|
|
if env::args().count() == 2 { child() } else { parent() }
|
|
}
|