From: Ian Jackson Date: Tue, 22 Dec 2020 21:35:14 +0000 (+0000) Subject: wip simple test X-Git-Tag: otter-0.2.0~171 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=50829a1f87642f9bf6b9a5312150dba70f2d9457;p=otter.git wip simple test Signed-off-by: Ian Jackson --- diff --git a/wdriver.rs b/wdriver.rs index e776ca0d..138c9ec0 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -5,4 +5,9 @@ pub use fehler::throws; pub use structopt::StructOpt; +pub use std::env; +pub use std::io::Write; +pub use std::os::unix::process::CommandExt; +pub use std::process::Command; + pub type AE = anyhow::Error; diff --git a/wdriver/simple.rs b/wdriver/simple.rs index a33d9d85..9f1fa8f7 100644 --- a/wdriver/simple.rs +++ b/wdriver/simple.rs @@ -6,10 +6,29 @@ use otter_webdriver_tests::*; #[derive(StructOpt)] struct Opts { - + #[structopt(long="--no-bwrap")] + no_bwrap: bool, } #[throws(AE)] fn main(){ - + let opts = Opts::from_args(); + + if !opts.no_bwrap { + println!("running bwrap"); + + let mut bcmd = Command::new("bwrap"); + bcmd.args("--unshare-net \ + --dev-bind / / \ + --tmpfs /tmp \ + --die-with-parent".split(" ")) + .arg(env::current_exe().expect("failed to find current executable")) + .arg("--no-bwrap") + .args(env::args_os().skip(1)); + + std::io::stdout().flush().unwrap(); + Err(bcmd.exec()).unwrap() + } + + println!("hi!"); }