summaryrefslogtreecommitdiffstats
path: root/nixos/tests
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-03-03 12:04:33 -0800
committerGitHub <noreply@github.com>2020-03-03 12:04:33 -0800
commit407be0a57734d84f3b42ef8c8582309feebf20e4 (patch)
tree61c8f9e5688dc907e303e94d21ad633d4e9e9038 /nixos/tests
parente88113846c1a5f5c7f62ae7a97cbb7ea154774e3 (diff)
parente0e4d591cc4ed4ff14c3f5bffb96d99b971ae639 (diff)
Merge pull request #81327 from flokli/add-cage
nixos/cage: init
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/cage.nix43
2 files changed, 44 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 047f34c58b23..d67ded83edb8 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -39,6 +39,7 @@ in
buildbot = handleTest ./buildbot.nix {};
caddy = handleTest ./caddy.nix {};
cadvisor = handleTestOn ["x86_64-linux"] ./cadvisor.nix {};
+ cage = handleTest ./cage.nix {};
cassandra = handleTest ./cassandra.nix {};
ceph-single-node = handleTestOn ["x86_64-linux"] ./ceph-single-node.nix {};
ceph-multi-node = handleTestOn ["x86_64-linux"] ./ceph-multi-node.nix {};
diff --git a/nixos/tests/cage.nix b/nixos/tests/cage.nix
new file mode 100644
index 000000000000..a6f73e00c066
--- /dev/null
+++ b/nixos/tests/cage.nix
@@ -0,0 +1,43 @@
+import ./make-test-python.nix ({ pkgs, ...} :
+
+{
+ name = "cage";
+ meta = with pkgs.stdenv.lib.maintainers; {
+ maintainers = [ matthewbauer flokli ];
+ };
+
+ machine = { ... }:
+
+ {
+ imports = [ ./common/user-account.nix ];
+ services.cage = {
+ enable = true;
+ user = "alice";
+ program = "${pkgs.xterm}/bin/xterm -cm -pc"; # disable color and bold to make OCR easier
+ };
+
+ # this needs a fairly recent kernel, otherwise:
+ # [backend/drm/util.c:215] Unable to add DRM framebuffer: No such file or directory
+ # [backend/drm/legacy.c:15] Virtual-1: Failed to set CRTC: No such file or directory
+ # [backend/drm/util.c:215] Unable to add DRM framebuffer: No such file or directory
+ # [backend/drm/legacy.c:15] Virtual-1: Failed to set CRTC: No such file or directory
+ # [backend/drm/drm.c:618] Failed to initialize renderer on connector 'Virtual-1': initial page-flip failed
+ # [backend/drm/drm.c:701] Failed to initialize renderer for plane
+ boot.kernelPackages = pkgs.linuxPackages_latest;
+
+ virtualisation.memorySize = 1024;
+ };
+
+ enableOCR = true;
+
+ testScript = { nodes, ... }: let
+ user = nodes.machine.config.users.users.alice;
+ in ''
+ with subtest("Wait for cage to boot up"):
+ start_all()
+ machine.wait_for_file("/run/user/${toString user.uid}/wayland-0.lock")
+ machine.wait_until_succeeds("pgrep xterm")
+ machine.wait_for_text("alice@machine")
+ machine.screenshot("screen")
+ '';
+})