GNU bug report logs - #77681
[PATCH 0/6 emacs-team] Run emacs tests

Previous Next

Package: guix-patches;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Wed, 9 Apr 2025 18:56:02 UTC

Severity: normal

Tags: patch

Done: Liliana Marie Prikler <liliana.prikler <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #23 received at 77681 <at> debbugs.gnu.org (full text, mbox):

From: Morgan Smith <Morgan.J.Smith <at> outlook.com>
To: 77681 <at> debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>
Subject: [PATCH 6/6] gnu: emacs: Run tests.
Date: Wed,  9 Apr 2025 15:01:04 -0400
* gnu/packages/emacs.scm
(emacs-ert-selector): New function.
(emacs-minimal): Run tests.
(emacs-next-minimal): Run tests.
(emacs-next-minimal): Run tests.
(emacs->emacs-next): Run tests.

Change-Id: Ib5ffeae9b7f49b5f1a56d348c15ce4c4fb28f5ec
---
 gnu/packages/emacs.scm | 89 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 86 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 9a020d89aa..fbde2bd913 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -98,6 +98,26 @@ (define (%emacs-modules build-system)
       (srfi srfi-1)
       (ice-9 ftw))))
 
+(define* (emacs-ert-selector excluded-tests #:key run-nativecomp run-expensive run-unstable)
+  "Create an ERT selector that excludes tests."
+  (string-append
+   "(not (or "
+   (if run-nativecomp
+       ""
+       "(tag :nativecomp) ")
+   (if run-expensive
+       ""
+       "(tag :expensive-test) ")
+   (if run-unstable
+       ""
+       "(tag :unstable) ")
+   (string-join
+    (map
+     (lambda (test)
+       (string-append "\\\"" test "\\\""))
+     excluded-tests))
+   "))"))
+
 (define-public emacs-minimal
   (package
     (name "emacs-minimal")
@@ -153,9 +173,24 @@ (define-public emacs-minimal
     (build-system gnu-build-system)
     (arguments
      (list
-      #:tests? #f                       ; no check target
       #:modules (%emacs-modules build-system)
       #:configure-flags #~(list "--with-gnutls=no" "--disable-build-details")
+      #:make-flags #~(list
+                      ;; Broken tests.  This is inherited by other Emacs
+                      ;; packages so test them all when changing this value
+                      (string-append
+                       "SELECTOR="
+                       #$(emacs-ert-selector
+                          '("esh-util-test/path/get-remote"
+                            "esh-var-test/path-var/preserve-across-hosts"
+                            "ffap-tests--c-path"
+                            "grep-tests--rgrep-abbreviate-properties-darwin"
+                            "grep-tests--rgrep-abbreviate-properties-gnu-linux"
+                            "grep-tests--rgrep-abbreviate-properties-windows-nt-dos-semantics"
+                            "grep-tests--rgrep-abbreviate-properties-windows-nt-sh-semantics"
+                            "info-xref-test-makeinfo"
+                            "man-tests-find-header-file"
+                            "tramp-test48-remote-load-path"))))
       #:phases
       #~(modify-phases %standard-phases
           (add-after 'unpack 'enable-elogind
@@ -240,6 +275,13 @@ (define-public emacs-minimal
               (substitute* (find-files "." "^Makefile\\.in$")
                 (("/bin/pwd")
                  "pwd"))))
+          (add-after 'unpack 'fix-tests
+            (lambda* (#:key tests? inputs #:allow-other-keys)
+              (when tests?
+                (substitute* "test/src/process-tests.el"
+                  (("/bin//sh") (search-input-file inputs "bin/sh")))
+                (substitute* "test/lisp/eshell/em-script-tests.el"
+                  (("/usr/bin/env") (search-input-file inputs "bin/env"))))))
           (add-after 'install 'install-site-start
             ;; Use 'guix-emacs' in "site-start.el", which is used autoload the
             ;; Elisp packages found in EMACSLOADPATH.
@@ -595,7 +637,27 @@ (define-public emacs-next-minimal
                         "emacs-native-comp-driver-options.patch"
                         "emacs-next-native-comp-fix-filenames.patch"
                         "emacs-native-comp-pin-packages.patch"
-                        "emacs-pgtk-super-key-fix.patch")))))))
+                        "emacs-pgtk-super-key-fix.patch"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments emacs-minimal)
+       ((#:make-flags _)
+        #~(list
+           (string-append
+            "SELECTOR="
+            #$(emacs-ert-selector
+               '("bytecomp--fun-value-as-head"
+                 "esh-util-test/path/get-remote"
+                 "esh-var-test/path-var/preserve-across-hosts"
+                 "ffap-tests--c-path"
+                 "find-func-tests--locate-macro-generated-symbols"
+                 "grep-tests--rgrep-abbreviate-properties-darwin"
+                 "grep-tests--rgrep-abbreviate-properties-gnu-linux"
+                 "grep-tests--rgrep-abbreviate-properties-windows-nt-dos-semantics"
+                 "grep-tests--rgrep-abbreviate-properties-windows-nt-sh-semantics"
+                 "info-xref-test-makeinfo"
+                 "man-tests-find-header-file"
+                 "tab-bar-tests-quit-restore-window"
+                 "tramp-test48-remote-load-path"))))))))))
 
 (define* (emacs->emacs-next emacs #:optional name
                             #:key (version (package-version emacs-next-minimal))
@@ -608,7 +670,28 @@ (define* (emacs->emacs-next emacs #:optional name
                                   (string-drop (package-name emacs)
                                                (string-length "emacs"))))))
     (version version)
-    (source source)))
+    (source source)
+    (arguments
+     (substitute-keyword-arguments (package-arguments emacs)
+       ((#:make-flags _)
+        #~(list
+           (string-append
+            "SELECTOR="
+            #$(emacs-ert-selector
+               '("bytecomp--fun-value-as-head"
+                 "esh-util-test/path/get-remote"
+                 "esh-var-test/path-var/preserve-across-hosts"
+                 "ffap-tests--c-path"
+                 "find-func-tests--locate-macro-generated-symbols"
+                 "find-func-tests--locate-macro-generated-symbols"
+                 "grep-tests--rgrep-abbreviate-properties-darwin"
+                 "grep-tests--rgrep-abbreviate-properties-gnu-linux"
+                 "grep-tests--rgrep-abbreviate-properties-windows-nt-dos-semantics"
+                 "grep-tests--rgrep-abbreviate-properties-windows-nt-sh-semantics"
+                 "info-xref-test-makeinfo"
+                 "man-tests-find-header-file"
+                 "tab-bar-tests-quit-restore-window"
+                 "tramp-test48-remote-load-path")))))))))
 
 (define-public emacs-next (emacs->emacs-next emacs))
 (define-public emacs-next-pgtk (emacs->emacs-next emacs-pgtk))
-- 
2.49.0





This bug report was last modified 94 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.