add: test helper binaries
This commit is contained in:
parent
212ae4847a
commit
342ac49bea
@ -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"
|
||||
|
||||
11
src/bin/test-helper/dummy.rs
Normal file
11
src/bin/test-helper/dummy.rs
Normal 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));
|
||||
}
|
||||
}
|
||||
15
src/bin/test-helper/spawner.rs
Normal file
15
src/bin/test-helper/spawner.rs
Normal 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(())
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user