chiark / gitweb /
wdt: wip test selection
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Jan 2021 19:09:22 +0000 (19:09 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 29 Jan 2021 23:46:35 +0000 (23:46 +0000)
This is very incomplete but it doesn't cause any *trouble* per se.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
wdriver.rs
wdriver/wdt-simple.rs

index 3ac7379abcc60e2a8e9c3c091e511c4607a5a488..e49f2bd8c42dc0d580c0e2b195fbe4dbb8d08394 100644 (file)
@@ -930,7 +930,32 @@ fn check_window_name_sanity(name: &str) -> &str {
   name
 }
 
+#[macro_export]
+macro_rules! test {
+  ($c:expr, $tname:expr, $s:stmt) => {
+    if $c.su.want_test($tname) {
+      debug!("{} starting", $tname);
+      $s
+      info!("{} completed", $tname);
+    } else {
+      trace!("{} skipped", $tname);
+    }
+  }
+}
+
+#[macro_export]
+macro_rules! ctx_with_setup {
+  {$ctx:ident} => {
+    impl Deref for $ctx {
+      type Target = self::Setup;
+      fn deref(&self) -> &self::Setup { &self.su }
+    }
+  }
+}
+
 impl Setup {
+  pub fn want_test(&self, _tname: &str) -> bool { true }
+
   #[throws(AE)]
   pub fn new_window<'s>(&'s mut self, instance: &Instance, name: &str)
                         -> Window {
index e43a9c8d833b331ae12e9e706c6e5eed1c546f64..46f4c200e7fb2b3c07ec98c5edec30a5f54a7e0d 100644 (file)
@@ -10,6 +10,7 @@ struct Ctx {
   bob: Window,
   spec: otter::spec::GameSpec,
 }
+ctx_with_setup!{Ctx}
 
 impl Ctx {
   #[throws(AE)]
@@ -228,10 +229,14 @@ fn main(){
 
     let mut c = Ctx { su, alice, bob, spec };
 
-    c.drag().always_context("drag")?;
-    let pc = c.rotate().always_context("rotate")?;
-    c.drag_off(pc).always_context("drag off")?;
-    c.unselect(pc).always_context("unselect")?;
+    test!(c, "drag", c.drag().always_context("drag")?);
+
+    test!(c, "drag-rotate-unselect", {
+      let pc = c.rotate().always_context("rotate")?;
+      c.drag_off(pc).always_context("drag off")?;
+      c.unselect(pc).always_context("unselect")?;
+    });
+
     c.conflict().always_context("conflict handling")?;
 
     debug!("finishing");