From 429f792845eedbbbe9653d01f77b345c6600ebc8 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 4 May 2021 00:12:44 +0100 Subject: [PATCH] apitest: Move cleanup_notify::Handle into SetupCore Signed-off-by: Ian Jackson --- apitest/apitest.rs | 7 ++++--- apitest/at-otter.rs | 2 +- wdriver/wdriver.rs | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apitest/apitest.rs b/apitest/apitest.rs index 93c779e3..f325bcca 100644 --- a/apitest/apitest.rs +++ b/apitest/apitest.rs @@ -72,6 +72,7 @@ pub struct SetupCore { pub mgmt_conn: RefCell, server_child: Child, pub wanted_tests: TrackWantedTests, + pub cln: cleanup_notify::Handle, } #[derive(Clone,Debug)] @@ -326,6 +327,7 @@ pub mod cleanup_notify { use std::panic::catch_unwind; use std::process::Command; + #[derive(Debug)] pub struct Handle(RawFd); #[throws(io::Error)] @@ -940,7 +942,7 @@ impl MgmtChannel { #[throws(AE)] pub fn setup_core(module_paths: &[&str], early_args: EarlyArgPredicate) -> - (O, cleanup_notify::Handle, Instance, SetupCore) + (O, Instance, SetupCore) where O: StructOpt + AsRef { let mut builder = env_logger::Builder::new(); @@ -1000,12 +1002,11 @@ pub fn setup_core(module_paths: &[&str], early_args: EarlyArgPredicate) -> let wanted_tests = opts.tests.track(); (caller_opts, - cln, Instance( instance_name ), SetupCore { - ds, + ds, cln, mgmt_conn: mgmt_conn.into(), server_child, wanted_tests, diff --git a/apitest/at-otter.rs b/apitest/at-otter.rs index e37c6bee..f1267471 100644 --- a/apitest/at-otter.rs +++ b/apitest/at-otter.rs @@ -725,7 +725,7 @@ fn tests(mut c: Ctx) { #[throws(Explode)] fn main() { { - let (opts, _cln, _instance, su) = setup_core( + let (opts, _instance, su) = setup_core( &[module_path!()], &mut |_|false )?; diff --git a/wdriver/wdriver.rs b/wdriver/wdriver.rs index 55a09c77..f4fb2601 100644 --- a/wdriver/wdriver.rs +++ b/wdriver/wdriver.rs @@ -816,17 +816,17 @@ impl Drop for Setup { #[throws(AE)] pub fn setup(exe_module_path: &str) -> (Setup, Instance) { - let (opts, cln, instance, core) = + let (opts, instance, core) = apitest::setup_core( &[exe_module_path, "otter_webdriver_tests"], &mut |s: &OsStr| s.to_str().unwrap().starts_with("--test=") )?; - prepare_xserver(&cln, &core.ds).did("setup X server")?; + prepare_xserver(&core.cln, &core.ds).did("setup X server")?; let final_hook = FinalInfoCollection; - prepare_geckodriver(&opts, &cln).did("setup webdriver server")?; + prepare_geckodriver(&opts, &core.cln).did("setup webdriver server")?; let (driver, screenshot_count, windows_squirreled) = prepare_thirtyfour(&core.ds).did("prepare web session")?; -- 2.30.2