From e158d1961823657cc42e43f50be3fd7004e9570c Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Wed, 29 Jul 2020 19:40:38 +0200 Subject: [PATCH 1/2] ft2-clone: add nixos test --- nixos/tests/all-tests.nix | 1 + nixos/tests/ft2-clone.nix | 35 +++++++++++++++++++ pkgs/applications/audio/ft2-clone/default.nix | 5 +++ 3 files changed, 41 insertions(+) create mode 100644 nixos/tests/ft2-clone.nix diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 12f3ee303311..37d40644b7bc 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -108,6 +108,7 @@ in fontconfig-default-fonts = handleTest ./fontconfig-default-fonts.nix {}; freeswitch = handleTest ./freeswitch.nix {}; fsck = handleTest ./fsck.nix {}; + ft2-clone = handleTest ./ft2-clone.nix {}; gerrit = handleTest ./gerrit.nix {}; gotify-server = handleTest ./gotify-server.nix {}; grocy = handleTest ./grocy.nix {}; diff --git a/nixos/tests/ft2-clone.nix b/nixos/tests/ft2-clone.nix new file mode 100644 index 000000000000..c877054234ec --- /dev/null +++ b/nixos/tests/ft2-clone.nix @@ -0,0 +1,35 @@ +import ./make-test-python.nix ({ pkgs, ... }: { + name = "ft2-clone"; + meta = with pkgs.lib.maintainers; { + maintainers = [ fgaz ]; + }; + + machine = { config, pkgs, ... }: { + imports = [ + ./common/x11.nix + ]; + + services.xserver.enable = true; + sound.enable = true; + environment.systemPackages = [ pkgs.ft2-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("ft2-clone &") + + machine.wait_for_window(r"Fasttracker") + machine.sleep(5) + # One of the few words that actually get recognized + if "Songlen" not in machine.get_screen_text(): + raise Exception("Program did not start successfully") + machine.screenshot("screen") + ''; +}) + diff --git a/pkgs/applications/audio/ft2-clone/default.nix b/pkgs/applications/audio/ft2-clone/default.nix index 60040119d64f..a7f85a8ae927 100644 --- a/pkgs/applications/audio/ft2-clone/default.nix +++ b/pkgs/applications/audio/ft2-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 = { + ft2-clone-starts = nixosTests.ft2-clone; + }; + meta = with stdenv.lib; { description = "A highly accurate clone of the classic Fasttracker II software for MS-DOS"; homepage = "https://16-bits.org/ft2.php"; From 75414df39ebb69865aa7d700be827d296e468d6d Mon Sep 17 00:00:00 2001 From: Francesco Gazzetta Date: Thu, 30 Jul 2020 14:14:55 +0200 Subject: [PATCH 2/2] ft2-clone: fix some darwin dependencies Still failing, but it goes further than before --- pkgs/applications/audio/ft2-clone/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/audio/ft2-clone/default.nix b/pkgs/applications/audio/ft2-clone/default.nix index a7f85a8ae927..1e704ccbb390 100644 --- a/pkgs/applications/audio/ft2-clone/default.nix +++ b/pkgs/applications/audio/ft2-clone/default.nix @@ -4,6 +4,7 @@ , nixosTests , alsaLib , SDL2 +, libiconv }: stdenv.mkDerivation rec { @@ -18,7 +19,9 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake ]; - buildInputs = [ SDL2 ] ++ stdenv.lib.optional stdenv.isLinux alsaLib; + buildInputs = [ SDL2 ] + ++ stdenv.lib.optional stdenv.isLinux alsaLib + ++ stdenv.lib.optional stdenv.isDarwin libiconv; passthru.tests = { ft2-clone-starts = nixosTests.ft2-clone;