depot/third_party/nixpkgs/nixos/tests/wine.nix
Default email 81047829ea Project import generated by Copybara.
GitOrigin-RevId: 48d63e924a2666baf37f4f14a18f19347fbd54a2
2022-02-10 15:34:41 -05:00

41 lines
1.3 KiB
Nix

{ 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" "wayland" ];
in listToAttrs (map (makeWineTest "winePackages" [ hello32 ]) variants
++ map (makeWineTest "wineWowPackages" [ hello32 hello64 ]) variants)