about summary refs log tree commit diff
path: root/pkgs/tools/inputmethods/ibus
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-11-07 15:05:42 +0100
committerJan Tojnar <jtojnar@gmail.com>2019-12-07 00:58:30 +0100
commitf6afb29ee1c3a60e4dd98916a81ca79b3dc9feee (patch)
tree9c12ee950cc1accdca690f48def313d354c2de1c /pkgs/tools/inputmethods/ibus
parent973c2fcf3dd783b031db2b9488fc3b29028ed981 (diff)
ibus: add installed tests
Diffstat (limited to 'pkgs/tools/inputmethods/ibus')
-rw-r--r--pkgs/tools/inputmethods/ibus/default.nix28
1 files changed, 27 insertions, 1 deletions
diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix
index 86b2931aebb36..4951074bc43ae 100644
--- a/pkgs/tools/inputmethods/ibus/default.nix
+++ b/pkgs/tools/inputmethods/ibus/default.nix
@@ -30,6 +30,7 @@
 , wayland ? null
 , buildPackages
 , runtimeShell
+, nixosTests
 }:
 
 assert withWayland -> wayland != null && libxkbcommon != null;
@@ -67,7 +68,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  outputs = [ "out" "dev" ];
+  outputs = [ "out" "dev" "installedTests" ];
 
   postPatch = ''
     echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh
@@ -84,11 +85,17 @@ stdenv.mkDerivation rec {
     (enableFeature enablePython2Library "python-library")
     (enableFeature enablePython2Library "python2") # XXX: python2 library does not work anyway
     (enableFeature enableUI "ui")
+    "--enable-install-tests"
     "--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji"
     "--with-emoji-annotation-dir=${cldr-emoji-annotation}/share/unicode/cldr/common/annotations"
     "--with-ucd-dir=${unicode-character-database}/share/unicode"
   ];
 
+  makeFlags = [
+    "test_execsdir=${placeholder ''installedTests''}/libexec/installed-tests/ibus"
+    "test_sourcesdir=${placeholder ''installedTests''}/share/installed-tests/ibus"
+  ];
+
   nativeBuildInputs = [
     autoreconfHook
     gtk-doc
@@ -128,6 +135,25 @@ stdenv.mkDerivation rec {
     $out/bin/ibus version
   '';
 
+  postInstall = ''
+    # It has some hardcoded FHS paths and also we do not use it
+    # since we set up the environment in NixOS tests anyway.
+    moveToOutput "bin/ibus-desktop-testing-runner" "$installedTests"
+  '';
+
+  postFixup = ''
+    # set necessary environment also for tests
+    for f in $installedTests/libexec/installed-tests/ibus/*; do
+        wrapGApp $f
+    done
+  '';
+
+  passthru = {
+    tests = {
+      installed-tests = nixosTests.installed-tests.ibus;
+    };
+  };
+
   meta = {
     homepage = "https://github.com/ibus/ibus";
     description = "Intelligent Input Bus, input method framework";