about summary refs log tree commit diff
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2015-03-18 14:55:10 +0100
committeraszlig <aszlig@redmoonstudios.org>2015-03-18 14:55:10 +0100
commit57634b99c1b836d29af878071d4b9afb0be7c1ca (patch)
tree68ca115c8224ef8b8c8173db77861775f607f6a4
parent903106efb392dc6235dd02523c29b3fbfed37462 (diff)
tests: Refactor to something similar as machines/.
Similar to callMachine, we now have callTest. The latter uses
make-test.nix, so we don't need to import the file explicitly anymore
and can just write our VM test by using either an attrset or a lambda
function which also gets our own packages in a vuizvui namespace.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
-rw-r--r--release.nix7
-rw-r--r--tests/aszlig/i3.nix6
-rw-r--r--tests/default.nix15
-rw-r--r--tests/labnet/heinrich.nix2
4 files changed, 23 insertions, 7 deletions
diff --git a/release.nix b/release.nix
index a6bbc06d..1193e1bd 100644
--- a/release.nix
+++ b/release.nix
@@ -8,10 +8,9 @@ in with pkgs.lib; with builtins; {
     attrs.build.config.system.build.toplevel
   ) (import ./machines { inherit system; });
 
-  tests = {
-    aszlig.i3 = import ./tests/aszlig/i3.nix { inherit system; };
-    labnet.heinrich = import ./tests/labnet/heinrich.nix { inherit system; };
-  };
+  tests = mapAttrsRecursiveCond (t: !(t ? test)) (const id) (import ./tests {
+    inherit system;
+  });
 
   manual = let
     modules = import <nixpkgs/nixos/lib/eval-config.nix> {
diff --git a/tests/aszlig/i3.nix b/tests/aszlig/i3.nix
index e90ff0f4..c6b84b76 100644
--- a/tests/aszlig/i3.nix
+++ b/tests/aszlig/i3.nix
@@ -1,4 +1,6 @@
-import ../make-test.nix ({ pkgs, ... }: {
+{ pkgs, ... }:
+
+{
   name = "i3";
 
   machine = { lib, ... }: {
@@ -26,4 +28,4 @@ import ../make-test.nix ({ pkgs, ... }: {
     $machine->sleep(20);
     $machine->screenshot("i3");
   '';
-})
+}
diff --git a/tests/default.nix b/tests/default.nix
new file mode 100644
index 00000000..96b7da48
--- /dev/null
+++ b/tests/default.nix
@@ -0,0 +1,15 @@
+{ system ? builtins.currentSystem, ... }:
+
+let
+  callTest = path: import ./make-test.nix (import path) {
+    inherit system;
+  };
+
+in {
+  aszlig = {
+    i3 = callTest ./aszlig/i3.nix;
+  };
+  labnet = {
+    heinrich = callTest ./labnet/heinrich.nix;
+  };
+}
diff --git a/tests/labnet/heinrich.nix b/tests/labnet/heinrich.nix
index cacf4267..c195bbdf 100644
--- a/tests/labnet/heinrich.nix
+++ b/tests/labnet/heinrich.nix
@@ -1,4 +1,4 @@
-import ../make-test.nix {
+{
   name = "heinrich";
 
   nodes = let