test-spawn: add program to test spawning

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-05-28 19:01:24 +08:00
parent 2e69ae8a12
commit 8c19cfb1b7
3 changed files with 28 additions and 0 deletions

9
test-spawn/Cargo.toml Normal file
View file

@ -0,0 +1,9 @@
[package]
name = "test-spawn"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
xous = {path = "../xous-rs" }

19
test-spawn/src/main.rs Normal file
View file

@ -0,0 +1,19 @@
fn main() {
println!("Loading stub file");
let spawn_stub = include_bytes!("spawn-stub");
println!("About to launch a process...");
let args = xous::ProcessArgs::new(spawn_stub);
let process = xous::create_process(args).unwrap();
println!(
"Connected to process. PID: {:?}, CID: {:?}",
process.pid, process.cid
);
let result = xous::send_message(
process.cid,
xous::Message::new_blocking_scalar(4, 1, 2, 3, 4),
)
.unwrap();
println!("Result of ping: {:?}", result);
println!("Hello, world!");
}

BIN
test-spawn/src/spawn-stub Normal file

Binary file not shown.