summary refs log tree commit diff
path: root/nixos/tests/wine.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/wine.nix')
-rw-r--r--nixos/tests/wine.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/nixos/tests/wine.nix b/nixos/tests/wine.nix
new file mode 100644
index 00000000000..c46c7d338b2
--- /dev/null
+++ b/nixos/tests/wine.nix
@@ -0,0 +1,41 @@
+{ system ? builtins.currentSystem
+, pkgs ? import ../.. { inherit system; config = { }; }
+}:
+
+let
+  inherit (pkgs.lib) concatMapStrings listToAttrs;
+  inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
+
+  hello32 = "${pkgs.pkgsCross.mingw32.hello}/bin/hello.exe";
+  hello64 = "${pkgs.pkgsCross.mingwW64.hello}/bin/hello.exe";
+
+  makeWineTest = packageSet: exes: variant: rec {
+    name = "${packageSet}-${variant}";
+    value = makeTest {
+      inherit name;
+      meta = with pkgs.lib.maintainers; { maintainers = [ chkno ]; };
+
+      machine = { pkgs, ... }: {
+        environment.systemPackages = [ pkgs."${packageSet}"."${variant}" ];
+        virtualisation.diskSize = "800";
+      };
+
+      testScript = ''
+        machine.wait_for_unit("multi-user.target")
+        ${concatMapStrings (exe: ''
+          greeting = machine.succeed(
+              "bash -c 'wine ${exe} 2> >(tee wine-stderr >&2)'"
+          )
+          assert 'Hello, world!' in greeting
+          machine.fail(
+              "fgrep 'Could not find Wine Gecko. HTML rendering will be disabled.' wine-stderr"
+          )
+        '') exes}
+      '';
+    };
+  };
+
+  variants = [ "base" "full" "minimal" "staging" "unstable" ];
+
+in listToAttrs (map (makeWineTest "winePackages" [ hello32 ]) variants
+  ++ map (makeWineTest "wineWowPackages" [ hello32 hello64 ]) variants)