From cbe58afca0bb3a28038284f678ba97707efa1b59 Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Sun, 15 Jan 2023 00:28:32 +0100 Subject: [PATCH] nixosTests.mindustry: init --- nixos/tests/all-tests.nix | 1 + nixos/tests/mindustry.nix | 28 ++++++++++++++++++++++++++++ pkgs/games/mindustry/default.nix | 6 ++++++ 3 files changed, 35 insertions(+) create mode 100644 nixos/tests/mindustry.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index acc42acf37a6..541b7199afe5 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -389,6 +389,7 @@ in { memcached = handleTest ./memcached.nix {}; merecat = handleTest ./merecat.nix {}; metabase = handleTest ./metabase.nix {}; + mindustry = handleTest ./mindustry.nix {}; minecraft = handleTest ./minecraft.nix {}; minecraft-server = handleTest ./minecraft-server.nix {}; minidlna = handleTest ./minidlna.nix {}; diff --git a/nixos/tests/mindustry.nix b/nixos/tests/mindustry.nix new file mode 100644 index 000000000000..b3f5423c601b --- /dev/null +++ b/nixos/tests/mindustry.nix @@ -0,0 +1,28 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "mindustry"; + meta = with pkgs.lib.maintainers; { + maintainers = [ fgaz ]; + }; + + nodes.machine = { config, pkgs, ... }: { + imports = [ + ./common/x11.nix + ]; + + services.xserver.enable = true; + environment.systemPackages = [ pkgs.mindustry ]; + }; + + enableOCR = true; + + testScript = + '' + machine.wait_for_x() + machine.execute("mindustry >&2 &") + machine.wait_for_window("Mindustry") + # Loading can take a while. Avoid wasting cycles on OCR during that time + machine.sleep(60) + machine.wait_for_text(r"(Play|Database|Editor|Mods|Settings|Quit)") + machine.screenshot("screen") + ''; +}) diff --git a/pkgs/games/mindustry/default.nix b/pkgs/games/mindustry/default.nix index 8e3f410632ba..6b663150d922 100644 --- a/pkgs/games/mindustry/default.nix +++ b/pkgs/games/mindustry/default.nix @@ -20,6 +20,8 @@ , libpulseaudio ? null , libjack2 ? null +, nixosTests + # Make the build version easily overridable. # Server and client build versions must match, and an empty build version means @@ -215,6 +217,10 @@ stdenv.mkDerivation rec { runHook postInstall ''; + passthru.tests = { + nixosTest = nixosTests.mindustry; + }; + meta = with lib; { homepage = "https://mindustrygame.github.io/"; downloadPage = "https://github.com/Anuken/Mindustry/releases";