summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorBrett Gilio <brettg@posteo.net>2019-12-02 15:34:48 -0600
committerBrett Gilio <brettg@posteo.net>2019-12-06 16:27:59 -0600
commitf74bb2078407026fb145d1099aca69851f57ff41 (patch)
tree60ef1c3379f9882eb505aca3dc209cca44450e5f /gnu/packages
parent0ffc2d537d7080da2072df086400cb7f23462a36 (diff)
downloadguix-f74bb2078407026fb145d1099aca69851f57ff41.tar.gz
gnu: emacs-telega: Use test suites.
--
Brett M. Gilio
https://git.sr.ht/~brettgilio/

>From 03a2617b29c92dc83828495305d73ec4074a5102 Mon Sep 17 00:00:00 2001
From: Brett Gilio <brettg@posteo.net>
Date: Mon, 2 Dec 2019 15:26:27 -0600
Subject: [PATCH 1/2] gnu: emacs-telega: Use test suites.

* gnu/packages/emacs-xyz.scm (emacs-telega)[arguments]: Adds support for
  running the ert and server test suites.

Signed-off-by: Brett Gilio <brettg@posteo.net>
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/emacs-xyz.scm39
1 files changed, 34 insertions, 5 deletions
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 0ce7f7979d..a02df2a9ce 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -19967,7 +19967,7 @@ fish-completion.  It can be used in both Eshell and M-x shell.")
          (file-name (git-file-name name version))))
       (build-system gnu-build-system)
       (arguments
-       `(#:tests? #f
+       `(#:test-target "test"
          #:modules ((guix build gnu-build-system)
                     ((guix build emacs-build-system) #:prefix emacs:)
                     (guix build utils)
@@ -19977,17 +19977,45 @@ fish-completion.  It can be used in both Eshell and M-x shell.")
                              (guix build emacs-utils))
          #:phases
          (modify-phases %standard-phases
-           (add-after 'unpack 'unpack-patch
+           (add-after 'unpack 'prefix-patch
              (lambda _
                (substitute* "server/Makefile"
                  (("CC=cc")
                   "CC=gcc")
                  (("INSTALL_PREFIX=\\$\\(HOME\\)/.telega")
                   (string-append "INSTALL_PREFIX=" (assoc-ref %outputs "out")
-                                 "/bin")))
+                                 "/bin"))
+                 ;; Manually invoke `run_tests.py` after install phase.
+                 (("python3 run_tests.py")
+                  ""))
+               #t))
+           ;; The telega test suite checks for a version of Emacs
+           ;; compiled with imagemagick and svg support. Since we
+           ;; are using `emacs-minimal`, this step will fail.
+           ;; Grok the failing test, and remove problematic assertions.
+           (add-after 'unpack 'ert-suite-patch
+             (lambda _
+               (substitute* "telega-core.el"
+                 (("\\(image-type-available-p 'imagemagick\\) nil")
+                  "t")
+                 (("\\(image-type-available-p 'svg\\) nil")
+                  "t"))
+               #t))
+           ;; The server test suite has a hardcoded path.
+           ;; Reset this behavior to use the proper path.
+           (add-after 'unpack 'server-suite-patch
+             (lambda _
+               (substitute* "server/run_tests.py"
+                 (("~/.telega/telega-server")
+                  (string-append (assoc-ref %outputs "out")
+                                 "/bin/telega-server")))
+               #t))
+           (add-after 'install 'run-server-suite
+             (lambda _
+               (invoke "python3" "server/run_tests.py")
                #t))
            (delete 'configure)
-
+           
            ;; Build emacs-side using `emacs-build-system'
            (add-after 'compress-documentation 'emacs-add-source-to-load-path
              (assoc-ref emacs:%standard-phases 'add-source-to-load-path))
@@ -20001,7 +20029,8 @@ fish-completion.  It can be used in both Eshell and M-x shell.")
        `(("emacs-visual-fill-column" ,emacs-visual-fill-column)))
       (native-inputs
        `(("tdlib" ,tdlib)
-         ("emacs" ,emacs-minimal)))
+         ("emacs" ,emacs-minimal)
+         ("python" ,python)))
       (synopsis "GNU Emacs client for the Telegram messenger")
       (description
        "Telega is full-featured, unofficial client for the Telegram messaging