summary refs log tree commit diff
path: root/gnu/packages/jami.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-11-07 21:32:19 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2022-11-12 00:39:35 -0500
commit008f3a28c6ca6f689f00f11af1f195f14625a51a (patch)
tree3b773b9c9f923b49563e72f6b6d28a91ba07c32c /gnu/packages/jami.scm
parentd7d09a277376744a17500ad62f6ba5580a53c878 (diff)
downloadguix-008f3a28c6ca6f689f00f11af1f195f14625a51a.tar.gz
gnu: jami: Enable unit tests.
* gnu/packages/patches/jami-fix-qml-imports.patch: New file.
* gnu/packages/patches/jami-fix-unit-tests-build.patch: Likewise.
* gnu/packages/patches/jami-libjami-headers-search.patch: Likewise.
* gnu/packages/patches/jami-sip-unregister.patch: Likewise.
* gnu/packages/patches/jami-xcb-link.patch: Likewise.
* gnu/local.mk: Register them.
* gnu/packages/jami.scm (%jami-sources): Apply new patches.
(jami) [tests?]: Delete argument to run tests.
[configure-flags]: Remove TESTS? argument.
Enable tests with -DENABLE_TESTS=ON.  Remove -DLIBJAMI_INCLUDE_DIR.
[phases] {check}: New phase override.
[native-inputs]: Add settings-desktop-schemas.
[inputs]: Add glib and libxcb.
Diffstat (limited to 'gnu/packages/jami.scm')
-rw-r--r--gnu/packages/jami.scm46
1 files changed, 37 insertions, 9 deletions
diff --git a/gnu/packages/jami.scm b/gnu/packages/jami.scm
index 7849a36e27..a9a988ca5a 100644
--- a/gnu/packages/jami.scm
+++ b/gnu/packages/jami.scm
@@ -95,7 +95,12 @@
      (base32
       "0hbsjjs61n7268lyjnjb9lzfpkkd65fmz76l1bg4awlz1f3cyywm"))
     (patches (search-patches "jami-disable-integration-tests.patch"
-                             "jami-no-webengine.patch"))))
+                             "jami-libjami-headers-search.patch"
+                             "jami-fix-unit-tests-build.patch"
+                             "jami-fix-qml-imports.patch"
+                             "jami-no-webengine.patch"
+                             "jami-sip-unregister.patch"
+                             "jami-xcb-link.patch"))))
 
 ;; Jami maintains a set of patches for some key dependencies (currently
 ;; pjproject and ffmpeg) of Jami that haven't yet been integrated upstream.
@@ -504,19 +509,14 @@ protocols, as well as decentralized calling using P2P-DHT.")
     (arguments
      (list
       #:qtbase qtbase
-      ;; The test suite fails to build (see:
-      ;; https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/882).
-      #:tests? #f
       #:configure-flags
-      #~(list "-DENABLE_TESTS=OFF"
+      #~(list "-DENABLE_TESTS=ON"
               ;; Disable the webengine since it grows the closure size by
               ;; about 450 MiB and requires more resources.
               "-DWITH_WEBENGINE=OFF"
               ;; Use libwrap to link directly to libjami instead of
               ;; communicating via D-Bus to jamid, the Jami daemon.
-              "-DENABLE_LIBWRAP=ON"
-              (string-append "-DLIBJAMI_INCLUDE_DIR="
-                             #$(this-package-input "libjami") "/include/jami"))
+              "-DENABLE_LIBWRAP=ON")
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'change-directory/maybe
@@ -531,7 +531,32 @@ protocols, as well as decentralized calling using P2P-DHT.")
                 (("// clang-format on.*" anchor)
                  (string-append "const char VERSION_STRING[] = \""
                                 #$version "\";\n"
-                                anchor))))))))
+                                anchor)))))
+          (replace 'check
+            (lambda* (#:key tests? #:allow-other-keys)
+              (when tests?
+                (setenv "QT_QPA_PLATFORM" "offscreen")
+                (setenv "QT_QUICK_BACKEND" "software")
+                ;; The tests require a writable HOME.
+                (setenv "HOME" "/tmp")
+
+                (display "Running unittests...\n")
+                (invoke "tests/unittests" "-mutejamid")
+
+                ;; XXX: There are currently multiple failures with the
+                ;; functional tests (see:
+                ;; https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/883),
+                ;; so the code below is disabled for now.
+                ;;
+                ;; (display "Running functional tests...\n")
+                ;; ;; This is to allow building from the source tarball or
+                ;; ;; directly from the git repository.
+                ;; (let  ((tests-qml (if (file-exists? "../client-qt/tests")
+                ;;                       "../client-qt/tests/qml"
+                ;;                       "../tests/qml")))
+                ;;   (invoke "tests/qml_tests" "-mutejamid"
+                ;;           "-input" tests-qml))
+                ))))))
     (native-inputs
      (list googletest
            pkg-config
@@ -539,11 +564,14 @@ protocols, as well as decentralized calling using P2P-DHT.")
            qttools
            doxygen
            graphviz
+           gsettings-desktop-schemas    ;for tests
            vulkan-headers))
     (inputs
      (list ffmpeg-jami
+           glib                         ;for integration with GNOME
            libjami
            libnotify
+           libxcb
            libxkbcommon
            network-manager
            qrencode