1{
2 system ? builtins.currentSystem,
3 pkgs ? import ../.. {
4 inherit system;
5 config = { };
6 },
7}:
8
9let
10 inherit (pkgs.lib)
11 concatMapStrings
12 listToAttrs
13 optionals
14 optionalString
15 ;
16 inherit (import ../lib/testing-python.nix { inherit system pkgs; }) makeTest;
17
18 hello32 = "${pkgs.pkgsCross.mingw32.hello}/bin/hello.exe";
19 hello64 = "${pkgs.pkgsCross.mingwW64.hello}/bin/hello.exe";
20
21 makeWineTest = packageSet: exes: variant: rec {
22 name = "${packageSet}-${variant}";
23 value = makeTest {
24 inherit name;
25 meta = with pkgs.lib.maintainers; {
26 maintainers = [ chkno ];
27 };
28
29 nodes.machine =
30 { pkgs, ... }:
31 {
32 environment.systemPackages = [ pkgs."${packageSet}"."${variant}" ];
33 virtualisation.diskSize = 800;
34 };
35
36 testScript = ''
37 machine.wait_for_unit("multi-user.target")
38 ${concatMapStrings (
39 exe:
40 ''
41 greeting = machine.succeed(
42 "bash -c 'wine ${exe} 2> >(tee wine-stderr >&2)'"
43 )
44 assert 'Hello, world!' in greeting
45 ''
46 # only the full version contains Gecko, but the error is not printed reliably in other variants
47 + optionalString (variant == "full") ''
48 machine.fail(
49 "fgrep 'Could not find Wine Gecko. HTML rendering will be disabled.' wine-stderr"
50 )
51 ''
52 ) exes}
53 '';
54 };
55 };
56
57 variants = [
58 "base"
59 "full"
60 "minimal"
61 "staging"
62 "unstable"
63 "wayland"
64 ];
65
66in
67listToAttrs (
68 map (makeWineTest "winePackages" [ hello32 ]) variants
69 ++ optionals pkgs.stdenv.hostPlatform.is64bit (
70 map
71 (makeWineTest "wineWowPackages" [
72 hello32
73 hello64
74 ])
75 # This wayland combination times out after spending many hours.
76 # https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.wine.wineWowPackages-wayland.x86_64-linux
77 (pkgs.lib.remove "wayland" variants)
78 ++
79 map
80 (makeWineTest "wineWow64Packages" [
81 hello32
82 hello64
83 ])
84 # This wayland combination times out after spending many hours.
85 # https://hydra.nixos.org/job/nixos/trunk-combined/nixos.tests.wine.wineWowPackages-wayland.x86_64-linux
86 (pkgs.lib.remove "wayland" variants)
87 )
88)