aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2024 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu tests emacs)
  #:use-module (gnu tests)
  #:use-module (gnu packages emacs)
  #:use-module (gnu packages vim)
  #:use-module (gnu services)
  #:use-module (gnu system)
  #:use-module (gnu system vm)
  #:use-module (guix packages)
  #:use-module (guix gexp)
  #:use-module (srfi srfi-1)
  #:export (%test-emacs-native-comp-replacable))

(define (run-native-comp-replacable-test old-emacs new-emacs)
  (define vm (virtual-machine (marionette-operating-system %simple-os)))

  (define test
    (with-imported-modules '((gnu build marionette))
      #~(begin
          (use-modules (gnu build marionette)
                       (srfi srfi-1)
                       (srfi srfi-64))

          (define marionette (make-marionette (list #$vm)))
          (define (marionette-emacs-eval emacs code)
            (marionette-eval
             `(begin
                (use-modules (ice-9 rdelim) (ice-9 popen))
                (read-line
                 (open-pipe*
                  OPEN_READ
                  ,emacs "--batch"
                  ,(string-append "--eval=" code))))
             marionette))

          (define (emacs-native-comp-dir emacs)
            (marionette-emacs-eval emacs "(princ comp-native-version-dir)"))
          (define (emacs-abi-hash emacs)
            (marionette-emacs-eval emacs "(princ comp-abi-hash)"))
          (define (emacs-effective-version emacs)
            (marionette-emacs-eval
             emacs
             "(princ
               (format \"%s.%s\" emacs-major-version emacs-minor-version))"))

          (define old-emacs-bin #$(file-append old-emacs "/bin/emacs"))
          (define new-emacs-bin #$(file-append new-emacs "/bin/emacs"))

          (test-runner-current (system-test-runner #$output))
          (test-begin "emacs-native-comp-replacable")
          (test-equal "comp-abi-hash"
            (emacs-abi-hash old-emacs-bin)
            (emacs-abi-hash new-emacs-bin))
          (test-equal "native-comp-dir"
            (emacs-native-comp-dir old-emacs-bin)
            (emacs-native-comp-dir new-emacs-bin))
          (test-assert "old emacs has hierarchical layout"
            (file-exists?
             (string-append #$old-emacs "/lib/emacs/"
                            (emacs-effective-version old-emacs-bin)
                            "/native-lisp/"
                            (emacs-native-comp-dir old-emacs-bin)
                            "/preloaded/emacs-lisp/comp.eln")))
          (test-assert "new emacs has hierarchical layout"
            (file-exists?
             (string-append #$new-emacs "/lib/emacs/"
                            (emacs-effective-version new-emacs-bin)
                            "/native-lisp/"
                            (emacs-native-comp-dir new-emacs-bin)
                            "/preloaded/emacs-lisp/comp.eln")))
          (test-end))))

  (gexp->derivation "emacs-native-comp-compatible" test))

(define (package-without-replacement pkg)
  (package (inherit pkg) (replacement #f)))

(define %test-emacs-native-comp-replacable
  (system-test
   (name "emacs-native-comp")
   (description "Test whether an emacs replacement (if any) is valid.")
   (value (run-native-comp-replacable-test
           (package-without-replacement emacs)
           emacs))))
8-05-28 13:24:11 +0200'>2018-05-28file-systems: Remove 'title' field and add <file-system-label>....The 'title' field was easily overlooked and was an endless source of confusion. Now, the value of the 'device' field is self-contained. * gnu/system/file-systems.scm (<file-system>): Change constructor name to '%file-system'. [title]: Remove. (<file-system-label>): New record type with printer. (report-deprecation, device-expression) (process-file-system-declaration, file-system): New macros. (file-system-title): New procedure. (file-system->spec, spec->file-system): Adjust to handle <file-system-label>. * gnu/system.scm (bootable-kernel-arguments): Add case for 'file-system-label?'. (read-boot-parameters): Likewise. (mapped-device-user): Avoid 'file-system-title'. (fs->boot-device): Remove. (operating-system-boot-parameters): Use 'file-system-device' instead of 'fs->boot-device'. (device->sexp): Add case for 'file-system-label?'. * gnu/bootloader/grub.scm (grub-root-search): Add case for 'file-system-label?'. * gnu/system/examples/bare-bones.tmpl, gnu/system/examples/beaglebone-black.tmpl, gnu/system/examples/lightweight-desktop.tmpl, gnu/system/examples/vm-image.tmpl: Remove uses of 'title'. * gnu/system/vm.scm (virtualized-operating-system): Remove uses of 'file-system-title'. * guix/scripts/system.scm (check-file-system-availability): Likewise, and adjust fix-it hint. (check-initrd-modules)[file-system-/dev]: Likewise. * gnu/build/file-systems.scm (canonicalize-device-spec): Remove 'title' parameter. [canonical-title]: Remove. Match on SPEC's type rather than on CANONICAL-TITLE. (mount-file-system): Adjust caller. * gnu/build/linux-boot.scm (boot-system): Interpret ROOT here. * gnu/services/base.scm (file-system->fstab-entry): Remove use of 'file-system-title'. * doc/guix.texi (File Systems): Remove documentation of the 'title' field. Rewrite documentation of 'device' and document 'file-system-label'. Ludovic Courtès 2018-01-21doc: No longer mention Wicd in OS examples....* gnu/system/examples/desktop.tmpl, gnu/system/examples/lightweight-desktop.tmpl: Mention NetworkManager instead of Wicd. Ludovic Courtès 2017-10-11doc: Give an example with a FAT UUID....* gnu/system/examples/lightweight-desktop.tmpl <file-systems>: Add a UUID for the /boot/efi partition. * doc/guix.texi (Using the Configuration System): Mention it. Ludovic Courtès 2017-08-23gnu: bootloader: Deprecate "device" field in favor of "target"....* gnu/bootloader.scm (<bootloader-configuration>): Deprecate "device" field in favor of "target" field. This is mostly a renaming but also a generalization to support UEFI targets being paths to a mounted partition instead of a device name. * gnu/system/examples/bare-bones.tmpl: * gnu/system/examples/desktop.tmpl: * gnu/system/examples/lightweight-desktop.tmpl: * gnu/system/examples/vm-image.tmpl: * gnu/system/install.scm: * gnu/tests.scm: * gnu/tests/install.scm: * gnu/tests/nfs.scm: * tests/system.scm: Adapt all invocations of bootloader-configuration. * guix/scripts/system.scm (perform-action): Rename device argument to bootloader-target. (process-action): Adapt caller. * doc/guix.texi (Proceeding with the Installation): * doc/guix.texi (Bootloader Configuration): Update documentation. Andy Wingo 2017-08-20gnu: grub-efi-bootloader: Specialize grub-install invocation....* gnu/bootloader/grub.scm (install-grub-efi): Fix grub-install invocation for EFI systems. * gnu/system/examples/bare-bones.tmpl: Use the newer "bootloader-configuration" syntax. * gnu/system/examples/desktop.tmpl: Use bootloader-configuration sytax. Also, use the same label for the LUKS-mapped device and the root partition. Remove unneeded "title" field for the file-system based on LUKS; as noted in the manual, the "title" field is ignored for mapped devices. * gnu/system/examples/lightweight-desktop.tmpl: Use bootloader-configuration, and use grub-efi-bootloader. Andy Wingo 2017-05-19doc: Update for UEFI systems....* doc/guix.texi (USB Stick Installation): Mention UEFI. (Preparing for Installation): Add notes about EFI System Partition, and mounting partitions before init. (Proceeding with the Installation): Mention the GRUB-EFI package. (Using the Configuration System): Lightweight desktop is now a UEFI system. (GRUB Configuration): Expand on package field. Add indexes. * gnu/system/examples/lightweight-desktop.tmpl: Adjust to native EFI configuration. Marius Bakke 2017-02-23gnu: lightweight-desktop.tmpl: Remove xmonad....* gnu/system/examples/lightweight-desktop.tmpl (packages): Remove xmonad. Leo Famulari 2017-02-23gnu: lightweight-desktop.tmpl: Complete i3-wm....* gnu/system/examples/lightweight-desktop.tmpl (packages): Add i3status and dmenu. (use-package-modules): Add suckless. Leo Famulari 2017-02-13system: Use the normalized codeset for the locale name in the examples....* gnu/system/examples/bare-bones.tmpl <locale>: Change to "en_US.utf8". * gnu/system/examples/desktop.tmpl <locale>: Likewise. * gnu/system/examples/lightweight-desktop.tmpl <locale>: Likewise. Ludovic Courtès 2016-09-08gnu: lightweight-desktop.tmpl: Fix typo....* gnu/system/examples/lightweight-desktop.tmpl: While it is currently unknown if Bob has a brother, it is sufficiently documented that Alice is, in fact, Bob's sister. Efraim Flashner