chiark / gitweb /
apitest: Move cleanup_notify::Handle into SetupCore
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 3 May 2021 23:12:44 +0000 (00:12 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 3 May 2021 23:13:06 +0000 (00:13 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest/apitest.rs
apitest/at-otter.rs
wdriver/wdriver.rs

index 93c779e3a203a512a961fde6a95f3e46edd34358..f325bccaa32b2be6c1703a72e2b877decaa8f6d6 100644 (file)
@@ -72,6 +72,7 @@ pub struct SetupCore {
   pub mgmt_conn: RefCell<MgmtChannelForGame>,
   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<O>(module_paths: &[&str], early_args: EarlyArgPredicate) ->
-  (O, cleanup_notify::Handle, Instance, SetupCore)
+  (O, Instance, SetupCore)
   where O: StructOpt + AsRef<Opts>
 {
   let mut builder = env_logger::Builder::new();
@@ -1000,12 +1002,11 @@ pub fn setup_core<O>(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,
index e37c6beee2d163ab6db3493ebbaf2db843eff344..f126747151daa362217486968608421cb515f9aa 100644 (file)
@@ -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
     )?;
index 55a09c77de336b4706bf9d1f280870a355c7199c..f4fb26019b9100a1992f7ef7314f9550de0470a6 100644 (file)
@@ -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")?;