summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrancesco Gazzetta <fgaz@fgaz.me>2022-11-24 20:46:05 +0100
committerFrancesco Gazzetta <fgaz@fgaz.me>2022-11-24 20:48:42 +0100
commitcc0182e2d1796351802f19703be1926fc9e1656f (patch)
treee7cf7d97e43ba3e2a6d427ba0cdd4ca689c79bc0
parent533eaa27814ac31d7c049018ccb002b3d6c06653 (diff)
downloadnixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.tar
nixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.tar.gz
nixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.tar.bz2
nixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.tar.lz
nixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.tar.xz
nixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.tar.zst
nixpkgs-cc0182e2d1796351802f19703be1926fc9e1656f.zip
nixosTests.warzone2100: init
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/warzone2100.nix26
-rw-r--r--pkgs/games/warzone2100/default.nix2
3 files changed, 29 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 1fa5b0b1c13..bb3d50d9a78 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -689,6 +689,7 @@ in {
   virtualbox = handleTestOn ["x86_64-linux"] ./virtualbox.nix {};
   vscodium = discoverTests (import ./vscodium.nix);
   vsftpd = handleTest ./vsftpd.nix {};
+  warzone2100 = handleTest ./warzone2100.nix {};
   wasabibackend = handleTest ./wasabibackend.nix {};
   wiki-js = handleTest ./wiki-js.nix {};
   wine = handleTest ./wine.nix {};
diff --git a/nixos/tests/warzone2100.nix b/nixos/tests/warzone2100.nix
new file mode 100644
index 00000000000..568e04a4699
--- /dev/null
+++ b/nixos/tests/warzone2100.nix
@@ -0,0 +1,26 @@
+import ./make-test-python.nix ({ pkgs, ... }: {
+  name = "warzone2100";
+  meta = with pkgs.lib.maintainers; {
+    maintainers = [ fgaz ];
+  };
+
+  nodes.machine = { config, pkgs, ... }: {
+    imports = [
+      ./common/x11.nix
+    ];
+
+    services.xserver.enable = true;
+    environment.systemPackages = [ pkgs.warzone2100 ];
+  };
+
+  enableOCR = true;
+
+  testScript =
+    ''
+      machine.wait_for_x()
+      machine.execute("warzone2100 >&2 &")
+      machine.wait_for_window("Warzone 2100")
+      machine.wait_for_text(r"(Single Player|Multi Player|Tutorial|Options|Quit Game)")
+      machine.screenshot("screen")
+    '';
+})
diff --git a/pkgs/games/warzone2100/default.nix b/pkgs/games/warzone2100/default.nix
index f819c9b2bc1..6307decb6a4 100644
--- a/pkgs/games/warzone2100/default.nix
+++ b/pkgs/games/warzone2100/default.nix
@@ -29,6 +29,7 @@
 
 , testers
 , warzone2100
+, nixosTests
 
 , withVideos ? false
 }:
@@ -111,6 +112,7 @@ stdenv.mkDerivation rec {
       # The command always exits with code 1
       command = "(warzone2100 --version || [ $? -eq 1 ])";
     };
+    nixosTest = nixosTests.warzone2100;
   };
 
   meta = with lib; {