add: test helper binaries

This commit is contained in:
Suyono 2023-12-01 22:33:52 +00:00
parent 212ae4847a
commit 342ac49bea
3 changed files with 35 additions and 0 deletions

View File

@ -5,6 +5,15 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[[bin]]
name = "dummy"
path = "src/bin/test-helper/dummy.rs"
[[bin]]
name = "spawner"
path = "src/bin/test-helper/spawner.rs"
[dependencies]
anyhow = "1.0.75"
lazy_static = "1.4.0"

View File

@ -0,0 +1,11 @@
use std::{env, thread, time};
fn main() {
let myi: u64;
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
myi = args[1].parse().unwrap();
thread::sleep(time::Duration::from_secs(myi));
}
}

View File

@ -0,0 +1,15 @@
use std::error::Error;
use std::process::Command;
use std::env;
fn main() -> Result<(), Box<dyn Error>> {
let args: Vec<String> = env::args().collect();
if args.len() > 1 {
let x: u64 = args[1].parse()?;
for _i in 0..x {
// println!("spawning {}", _i);
Command::new("/usr/local/bin/dummy").arg("10").spawn()?;
}
}
Ok(())
}