From 4436c0151e661370f0461b996373bdf7d25cdcbc Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Wed, 29 Jul 2020 19:00:33 +0200 Subject: [PATCH] pt2-clone: add nixos test --- nixos/tests/all-tests.nix | 1 + nixos/tests/pt2-clone.nix | 35 +++++++++++++++++++ pkgs/applications/audio/pt2-clone/default.nix | 5 +++ 3 files changed, 41 insertions(+) create mode 100644 nixos/tests/pt2-clone.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 12f3ee30331..19397427b2a 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -285,6 +285,7 @@ in prosody = handleTest ./xmpp/prosody.nix {}; prosodyMysql = handleTest ./xmpp/prosody-mysql.nix {}; proxy = handleTest ./proxy.nix {}; + pt2-clone = handleTest ./pt2-clone.nix {}; qboot = handleTestOn ["x86_64-linux" "i686-linux"] ./qboot.nix {}; quagga = handleTest ./quagga.nix {}; quorum = handleTest ./quorum.nix {}; diff --git a/nixos/tests/pt2-clone.nix b/nixos/tests/pt2-clone.nix new file mode 100644 index 00000000000..b502172e2ee --- /dev/null +++ b/nixos/tests/pt2-clone.nix @@ -0,0 +1,35 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "pt2-clone"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ fgaz ]; + }; + + machine = { config, pkgs, ... }: { + imports = [ + ./common/x11.nix + ]; + + services.xserver.enable = true; + sound.enable = true; + environment.systemPackages = [ pkgs.pt2-clone ]; + }; + + enableOCR = true; + + testScript = + '' + machine.wait_for_x() + # Add a dummy sound card, or the program won't start + machine.execute("modprobe snd-dummy") + + machine.execute("pt2-clone &") + + machine.wait_for_window(r"ProTracker") + machine.sleep(5) + # One of the few words that actually get recognized + if "LENGTH" not in machine.get_screen_text(): + raise Exception("Program did not start successfully") + machine.screenshot("screen") + ''; +}) + diff --git a/pkgs/applications/audio/pt2-clone/default.nix b/pkgs/applications/audio/pt2-clone/default.nix index 38f02e3c991..b76be35da29 100644 --- a/pkgs/applications/audio/pt2-clone/default.nix +++ b/pkgs/applications/audio/pt2-clone/default.nix @@ -1,6 +1,7 @@ { stdenv , fetchFromGitHub , cmake +, nixosTests , alsaLib , SDL2 }: @@ -19,6 +20,10 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; buildInputs = [ SDL2 ] ++ stdenv.lib.optional stdenv.isLinux alsaLib; + passthru.tests = { + pt2-clone-opens = nixosTests.pt2-clone; + }; + meta = with stdenv.lib; { description = "A highly accurate clone of the classic ProTracker 2.3D software for Amiga"; homepage = "https://16-bits.org/pt2.php";