unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 67260@debbugs.gnu.org
Cc: Suhail <suhail@bayesians.ca>,
	andrew@trop.in, cox.katherine.e+guix@gmail.com,
	liliana.prikler@gmail.com
Subject: [bug#67260] [PATCH emacs-team v11 3/7] gnu: emacs: Check integrity of native-compiled files.
Date: Sat, 24 Feb 2024 07:18:52 +0100	[thread overview]
Message-ID: <35fc3027f372eddbd21a2c6b5a591453591a6825.1708761863.git.liliana.prikler@gmail.com> (raw)
In-Reply-To: <cover.1708761863.git.liliana.prikler@gmail.com>

In the previous commit, we've added a patch that potentially messes with
how built-in (especially preloaded) Lisp libraries are loaded.  Thus, we
might want to assert that these files still load fine, as reported when
querying the builtin documentation of functions provided by them.

* gnu/packages/aux-files/emacs/comp-integrity.el: New file.
* gnu/Makefile.am (dist_noinst_DATA): Register it here.
* gnu/packages/emacs.scm (emacs-no-x)[#:phases]: Add ‘validate-comp-integrity’.
---
 Makefile.am                                   |   1 +
 .../aux-files/emacs/comp-integrity.el         | 126 ++++++++++++++++++
 gnu/packages/emacs.scm                        |  13 +-
 3 files changed, 139 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/aux-files/emacs/comp-integrity.el

diff --git a/Makefile.am b/Makefile.am
index d3b9532c7a..6837c4c87c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -421,6 +421,7 @@ dist_noinst_DATA =				\
 # Auxiliary files for packages.
 AUX_FILES =						\
   gnu/packages/aux-files/chromium/master-preferences.json		\
+  gnu/packages/aux-files/emacs/comp-integrity.el		\
   gnu/packages/aux-files/emacs/guix-emacs.el		\
   gnu/packages/aux-files/findclass.php			\
   gnu/packages/aux-files/guix.vim			\
diff --git a/gnu/packages/aux-files/emacs/comp-integrity.el b/gnu/packages/aux-files/emacs/comp-integrity.el
new file mode 100644
index 0000000000..ed6a348fed
--- /dev/null
+++ b/gnu/packages/aux-files/emacs/comp-integrity.el
@@ -0,0 +1,126 @@
+(require 'ert)
+
+(eval-when-compile
+  (require 'help-fns)
+
+  (defmacro expect-help (fun result &optional feature)
+    `(progn
+       (eval-when-compile (when ',feature
+                            (require ',feature)))
+
+       (ert-deftest ,(intern (concat "expect-" (symbol-name fun)
+                                     "-" (symbol-name result)))
+           ()
+           (should
+            (eq ',result
+                (let ((desc (substring-no-properties
+                             (with-output-to-string
+                               (help-fns-function-description-header ',fun)))))
+                  (cond ((string-search "native-compiled" desc) 'native)
+                        ((string-search "byte-compiled" desc) 'byte)
+                        ((string-search "built-in" desc) 'built-in)
+                        (t nil))))))))
+
+  (defmacro expect-native (fun &optional feature)
+    `(progn (expect-help ,fun native ,feature)))
+
+  (defmacro expect-builtin (fun &optional feature)
+    `(progn (expect-help ,fun built-in ,feature))))
+
+(expect-native abbrev-mode)
+(expect-native backquote-process)
+(expect-native mode-line-widen)
+(expect-native buffer-menu)
+(expect-native button-mode)
+(expect-native byte-run-strip-symbol-positions)
+(expect-native case-table-get-table)
+(expect-native cconv-convert)
+(expect-native use-default-char-width-table)
+(expect-native cl-generic-p)
+(expect-native cl-struct-define)
+(expect-native x-setup-function-keys)
+(expect-native encode-composition-rule)
+(expect-native custom-declare-face)
+(expect-native minibuffer-prompt-properties--setter)
+(expect-native custom-add-choice)
+(expect-native debug-early)
+(expect-native display-table-slot disp-table)
+(expect-native dnd-open-file)
+(expect-native dos-mode25 dos-fns)
+(expect-native find-file-text dos-w32)
+(expect-native dynamic-setting-handle-config-changed-event)
+(expect-native easy-menu-item-present-p)
+(expect-native eldoc-mode)
+(expect-native electric-indent-mode)
+(expect-native elisp-mode-syntax-propertize)
+(expect-native getenv)
+(expect-native epa-file-find-file-hook)
+(expect-native face-list)
+(expect-native find-file-noselect)
+(expect-native fill-region)
+(expect-native font-lock-change-mode)
+(expect-native font-lock-add-keywords)
+(expect-native fontset-plain-name)
+(expect-native format-read)
+(expect-native frame-edges)
+(expect-native fringe-mode)
+(expect-native help-quick)
+(expect-native image-type)
+(expect-native indent-region)
+(expect-native indian-compose-regexp)
+(expect-native msdos-setup-keyboard term/internal)
+(expect-native isearch-abort)
+(expect-native iso-transl-set-language)
+(expect-native jit-lock-mode)
+(expect-native jka-compr-build-file-regexp)
+(expect-native keymap-global-set)
+(expect-native forward-sexp)
+(expect-native lisp-string-in-doc-position-p)
+(expect-native ls-lisp-set-options ls-lisp)
+(expect-native macroexp-compiling-p)
+(expect-native map-y-or-n-p)
+(expect-native menu-find-file-existing)
+(expect-native completion-boundaries)
+(expect-native egyptian-shape-grouping)
+(expect-native mouse-double-click-time)
+(expect-native convert-define-charset-argument)
+(expect-native coding-system-change-eol-conversion)
+(expect-native store-substring mule-util)
+(expect-native mouse-wheel-change-button)
+(expect-native advice-function-mapc)
+(expect-native comment-string-strip)
+(expect-native obarray-make)
+(expect-native oclosure-type)
+(expect-native forward-page)
+(expect-native sentence-end)
+(expect-native show-paren-function)
+(expect-native pgtk-dnd-init-frame pgtk-dnd)
+(expect-native prog-context-menu)
+(expect-native regexp-opt)
+(expect-native get-register)
+(expect-native query-replace-descr)
+(expect-native rfn-eshadow-setup-minibuffer)
+(expect-native read-multiple-choice)
+(expect-native scroll-bar-scale)
+(expect-native gui-select-text)
+(expect-native seq-first)
+(expect-native hack-read-symbol-shorthands)
+(expect-native next-error-find-buffer)
+(expect-native exit-splash-screen)
+(expect-native buffer-local-boundp)
+(expect-native syntax-propertize-multiline)
+(expect-native tab-bar-mode)
+(expect-native tabulated-list-put-tag)
+(expect-native text-mode)
+(expect-native timer-activate)
+(expect-native tool-bar-mode)
+(expect-native tooltip-mode)
+(expect-native tty-color-desc)
+(expect-native ucs-normalize-hfs-nfd-comp-p ucs-normalize)
+(expect-native uniquify-item-p)
+(expect-native vc-mode)
+(expect-native emacs-version)
+(expect-native define-widget)
+(expect-native window-right)
+(expect-native x-dnd-init-frame)
+(expect-native x-handle-no-bitmap-icon)
diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 182de0204d..f0200ad27c 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -380,7 +380,18 @@ (define-public emacs-no-x
                      "-B" #$(this-package-input "libgccjit") "/lib/gcc/"))))))
             (add-after 'build 'build-trampolines
               (lambda* (#:key make-flags #:allow-other-keys)
-                (apply invoke "make" "trampolines" make-flags)))))))
+                (apply invoke "make" "trampolines" make-flags)))
+            (add-after 'validate-runpath 'validate-comp-integrity
+              (lambda* (#:key outputs #:allow-other-keys)
+                (if #$(%current-target-system)
+                    (display "Cannot validate native-comp on cross builds.\n")
+                    (invoke
+                     (string-append (assoc-ref outputs "out") "/bin/emacs")
+                     "--batch"
+                     "--load"
+                     #$(local-file
+                        (search-auxiliary-file "emacs/comp-integrity.el"))
+                     "-f" "ert-run-tests-batch-and-exit"))))))))
     (inputs
      (modify-inputs (package-inputs emacs-minimal)
        (prepend gnutls
-- 
2.41.0





  parent reply	other threads:[~2024-02-24  8:15 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 13:42 [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling Liliana Marie Prikler
2023-11-18 13:38 ` [bug#67260] [PATCH emacs-team 2/2] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2023-11-18 15:44 ` [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling Andrew Tropin
2023-11-18 15:51   ` Liliana Marie Prikler
2023-11-22 12:09 ` Mekeor Melire
2023-11-22 17:39   ` Liliana Marie Prikler
2023-11-25 11:13 ` [bug#67260] [PATCH emacs-team v3 1/3] gnu: emacs: Build trampolines Liliana Marie Prikler
2023-11-25 11:13   ` [bug#67260] [PATCH emacs-team v3 2/3] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2023-11-25 11:13   ` [bug#67260] [PATCH emacs-team v3 3/3] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-18  5:55 ` [bug#67260] [PATCH emacs-team 0/2] Think ahead when compiling Suhail via Guix-patches via
2024-01-21 12:12 ` [bug#67260] [PATCH v5 1/6] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v5 3/6] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v5 4/6] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v5 2/6] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v5 5/6] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-01-21 14:09   ` [bug#67260] [PATCH v5 6/6] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-22  4:16 ` Suhail via Guix-patches via
2024-01-22  4:36 ` Suhail via Guix-patches via
2024-01-22 20:21 ` [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v6 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v6 4/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v6 5/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v6 6/7] gnu: emacs-magit: " Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v6 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 14:09   ` [bug#67260] [PATCH v6 7/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-22 20:21 ` [bug#67260] [PATCH v8 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v8 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v8 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v8 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v8 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v8 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-01-21 14:09   ` [bug#67260] [PATCH v8 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-22 20:21 ` [bug#67260] [PATCH v7 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v7 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v7 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v7 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v7 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-01-21 12:12   ` [bug#67260] [PATCH v7 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-01-21 14:09   ` [bug#67260] [PATCH v7 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-01-25 23:53 ` [bug#67260] [PATCH v6 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Suhail via Guix-patches via
2024-01-26  7:49 ` Suhail via Guix-patches via
2024-01-26  8:20 ` Suhail via Guix-patches via
2024-01-26 22:45 ` Suhail via Guix-patches via
2024-01-27 15:36 ` Suhail via Guix-patches via
2024-01-27 16:24 ` Suhail via Guix-patches via
2024-01-27 17:15 ` Suhail via Guix-patches via
2024-01-27 19:39 ` Suhail via Guix-patches via
2024-01-28  0:13 ` Suhail via Guix-patches via
2024-01-28  0:18 ` Suhail via Guix-patches via
2024-01-28 16:17 ` Suhail via Guix-patches via
2024-02-13 18:30 ` [bug#67260] [PATCH v7 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v7 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-02-13 18:30     ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v7 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-02-13 18:30     ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v7 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-02-13 18:30     ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v7 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-02-13 18:30     ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v7 7/7] gnu: emacs-magit: " Liliana Marie Prikler
2024-02-13 18:30     ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v7 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-02-13 18:30     ` [bug#67260] [PATCH v9 " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH v9 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-02-14  0:56 ` [bug#67260] [PATCH emacs-team v9*] Think ahead when compiling Suhail via Guix-patches via
2024-02-14  8:41 ` [bug#67260] [PATCH emacs-team v9*] Test for AOT native-comp Suhail via Guix-patches via
2024-02-16 15:09 ` [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 2/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 1/7] gnu: emacs: Wrap EMACSNATIVELOADPATH Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 6/7] gnu: emacs-org: " Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v10 3/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-02-17 14:49 ` [bug#67260] [PATCH emacs-team v10 0/7] Preload most of the things Suhail via Guix-patches via
2024-02-17 15:15   ` Liliana Marie Prikler
2024-02-18  0:56     ` Suhail via Guix-patches via
2024-02-18  9:19       ` Liliana Marie Prikler
2024-02-19 21:42         ` Suhail via Guix-patches via
2024-02-20 17:51           ` Liliana Marie Prikler
2024-02-20 18:41             ` Suhail via Guix-patches via
2024-02-24  8:04 ` [bug#67260] [PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio! Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v11 1/7] gnu: emacs: Build trampolines Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v11 6/7] gnu: emacs-org: Fix native builds Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v11 4/7] gnu: emacs: Disable jit compilation Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v11 7/7] gnu: emacs-magit: Fix native builds Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v11 2/7] gnu: emacs: Don't hash file names in native compilation Liliana Marie Prikler
2024-02-13 18:30   ` [bug#67260] [PATCH emacs-team v11 5/7] build-system: emacs: Compute relative file names Liliana Marie Prikler
2024-02-24  6:18   ` Liliana Marie Prikler [this message]
2024-03-04  7:13   ` [bug#67260] [PATCH emacs-team v11 0/7] You thought it was term/internal.el, but it was me, Dio! Andrew Tropin via Guix-patches via
2024-03-04 19:59     ` Liliana Marie Prikler
2024-03-01 17:35 ` Suhail via Guix-patches via
2024-03-01 19:40   ` bug#67260: " Liliana Marie Prikler
2024-03-07  8:55     ` [bug#67260] " Andrew Tropin via Guix-patches via
2024-03-07 17:52       ` Liliana Marie Prikler
2024-03-08  9:20         ` Andrew Tropin via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35fc3027f372eddbd21a2c6b5a591453591a6825.1708761863.git.liliana.prikler@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=67260@debbugs.gnu.org \
    --cc=andrew@trop.in \
    --cc=cox.katherine.e+guix@gmail.com \
    --cc=suhail@bayesians.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).