aboutsummaryrefslogtreecommitdiff
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022⁠–⁠2023 Bruno Victal <mirai@makinata.eu>.
;;;
;;; 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 gdm)
  #:use-module (gnu tests)
  #:use-module (gnu packages freedesktop)
  #:use-module (gnu packages ocr)
  #:use-module (gnu services)
  #:use-module (gnu services desktop)
  #:use-module (gnu services xorg)
  #:use-module (gnu system)
  #:use-module (gnu system vm)
  #:use-module (guix gexp)
  #:use-module (ice-9 format)
  #:export (%test-gdm-x11
            %test-gdm-wayland))

(define* (make-os #:key wayland?)
  (operating-system
    (inherit %simple-os)
    (services
     (modify-services %desktop-services
       (gdm-service-type config => (gdm-configuration
                                    (inherit config)
                                    (wayland? wayland?)))))))

(define* (run-gdm-test #:key wayland?)
  "Run tests in a vm which has gdm running."
  (define os
    (marionette-operating-system
     (make-os #:wayland? wayland?)
     #:imported-modules '((gnu services herd))))

  (define vm
    (virtual-machine
     (operating-system os)
     (memory-size 1024)))

  (define name (format #f "gdm-~:[x11~;wayland~]" wayland?))

  (define test
    (with-imported-modules '((gnu build marionette))
      #~(begin
          (use-modules (gnu build marionette)
                       (ice-9 format)
                       (srfi srfi-26)
                       (srfi srfi-64))

          (let ((marionette (make-marionette (list #$vm)))
                (expected-session-type #$(if wayland? "wayland" "x11")))

            (test-runner-current (system-test-runner #$output))
            (test-begin #$name)

            ;; service for gdm is called xorg-server
            (test-assert "service is running"
              (marionette-eval
               '(begin
                  (use-modules (gnu services herd))
                  (start-service 'xorg-server))
               marionette))

            (test-group "gdm ready"
              (test-assert "PID file present"
                (wait-for-file "/var/run/gdm/gdm.pid" marionette))

              ;; Waiting for gdm.pid is not enough, tests may still sporadically
              ;; fail; ensure that the login screen is up.
              ;; XXX: GNU Ocrad works but with '--invert' only.
              (test-assert "login screen up"
                (wait-for-screen-text marionette
                                      (cut string-contains <> "Guix")
                                      #:ocr #$(file-append ocrad "/bin/ocrad")
                                      #:ocr-arguments '("--invert")
                                      #:timeout 120))) ;for slow systems

            (test-equal (string-append "session-type is " expected-session-type)
              expected-session-type
              (marionette-eval
               '(begin
                  (use-modules (ice-9 popen)
                               (ice-9 rdelim))

                  (let* ((loginctl #$(file-append elogind "/bin/loginctl"))
                         (get-session-cmd (string-join `(,loginctl "show-user" "gdm"
                                                                   "--property Display" "--value")))
                         (session (call-with-port (open-input-pipe get-session-cmd) read-line))
                         (get-type-cmd (string-join `(,loginctl "show-session" ,session
                                                                "--property Type" "--value")))
                         (type (call-with-port (open-input-pipe get-type-cmd) read-line)))
                    type))
               marionette))

            (test-end)))))

  (gexp->derivation (string-append name "-test") test))

(define %test-gdm-x11
  (system-test
   (name "gdm-x11")
   (description "Basic tests for the GDM service. (X11)")
   (value (run-gdm-test))))

(define %test-gdm-wayland
  (system-test
   (name "gdm-wayland")
   (description "Basic tests for the GDM service. (Wayland)")
   (value (run-gdm-test #:wayland? #t))))
ae5f72a0b1825 Maxim Cournoyer 2024-10-07gnu: retroarch: Really disable online fetching of cores and resources....* gnu/packages/emulators.scm (retroarch) [phases] <configure>: Add --disable-update_core_info and --disable-online_updater configuration flags. Change-Id: Ie97a32e46324120d01af7f53e805f12893f63a75 Maxim Cournoyer 2024-10-07gnu: retroarch: Extend search-path support....* gnu/packages/patches/retroarch-improved-search-paths.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/emulators.scm (retroarch) [source]: Apply patch. [configure-flags]: Add '--disable-update_assets'. [native-search-paths]: New search paths for LIBRETRO_ASSETS_DIRECTORY, LIBRETRO_AUTOCONFIG_DIRECTORY, LIBRETRO_VIDEO_FILTER_DIRECTORY and LIBRETRO_VIDEO_SHADER_DIRECTORY. Fixes: https://issues.guix.gnu.org/38439 Change-Id: I593c223ad887277e4637adc8d7ef7439f9ced611 Maxim Cournoyer 2024-10-07gnu: retroarch: Reduce bundled libraries to a minimum....* gnu/packages/emulators.scm (retroarch) [source]: Add snippet removing most bundled sources. Apply patch to allow using system SPIRV-Cross. [phases] <configure>: Add --disable-builtinspirv_cross. Disable non-core features making use of bundled libraries (7zip, cheevos crtswitchres, discord, dr_mp3, ixbm, stb_font, stb_image, stb_vorbis and xdelta). [inputs]: Add spirv-cross. [license]: Add licenses of bundled sources. * gnu/packages/patches/retroarch-unbundle-spirv-cross.patch: New file. Change-Id: I824391424bf0fa2ec3888f02535b94dea3021378 Maxim Cournoyer 2024-10-07gnu: retroarch: Add missing fontconfig and v4l-utils inputs....* gnu/packages/emulators.scm (retroarch) [inputs]: Add fontconfig and v4l-utils. Change-Id: Ie82581b1f2cd8ce23f4ea04e5e09e3d6401d9464 Maxim Cournoyer 2024-10-07gnu: retroarch: Use gexps....* gnu/packages/emulators.scm (retroarch) [arguments] <phases>: Use gexps; locate resources using `search-input-file' and `search-input-directory'. Change-Id: I0b1c4ff074e6f8287c14ac3327a8d0271391fec2 Maxim Cournoyer 2024-10-07gnu: Add retroarch-joypad-autoconfig....* gnu/packages/emulators.scm (retroarch-joypad-autoconfig): New variable. Change-Id: I56fe94f78b661c082a6e59fd59980462a0884a03 Maxim Cournoyer 2024-10-07gnu: Add retroarch-core-info....* gnu/packages/emulators.scm (retroarch-core-info): New variable. Change-Id: I435c70673e1151bf300b9de2ea433abfe8508fbd Maxim Cournoyer 2024-10-07gnu: Add retroarch-assets....* gnu/packages/emulators.scm (retroarch-assets): New variable. Change-Id: I1ac0eb6fd3e1e9c1ef5b4b120e7ac72cf3b68ca0 Maxim Cournoyer 2024-10-05gnu: Add jg-cega....* gnu/packages/emulators.scm (jg-cega): New variable. Change-Id: Ice3799d9aa4600006ac386fa40e80fb97b3018c8 Maxim Cournoyer 2024-10-05gnu: Add jg-nestopia....* gnu/packages/emulators.scm (jg-nestopia): New variable. Change-Id: I2f686f43a8339a124b9ef9640638ab182ecf7079 Maxim Cournoyer 2024-10-05gnu: Add jg-bsnes....* gnu/packages/emulators.scm (jg-bsnes): New variable. Change-Id: If88a7bea0c87c8af8fce051f8bec891ff249449f Maxim Cournoyer 2024-10-05gnu: Add jgrf....* gnu/packages/emulators.scm (jgrf): New variable. Change-Id: I0cf706e66977ceb96902dcd54f9175031e129445 Maxim Cournoyer 2024-10-05gnu: Add jg-api....* gnu/packages/emulators.scm (jg-api): New variable. Change-Id: I2cd2086560f8353f8260209c4ee0f117c3615917 Maxim Cournoyer 2024-10-05gnu: bsnes: Remove input labels and use gexps....* gnu/packages/emulators.scm (bsnes) [arguments]: Use gexps. [inputs]: Remove labels. [home-page]: Update URL. Change-Id: I69046d977c4647f46c1359d62b762149b8f70160 Maxim Cournoyer 2024-09-02gnu: retroarch: Update to 1.19.1....* gnu/packages/game-development.scm (retroarch): Update to 1.19.1. Change-Id: I985de399994d8ee6777ad4849b77664b0742eae7 宋文武 2024-08-31gnu: emulators: Add 'bash' input for 'wrap-program'....It is required for cross-compilation. * gnu/packages/emulators.scm (higan)[inputs]: Add 'bash-minimal'. (pcsxr)[inputs]: Likewise. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Change-Id: I73ea46b3928faa60b16e87a4386b568495f689e4 Maxime Devos 2024-08-31build-systems: gnu: Export %default-gnu-imported-modules and %default-gnu-mod......Until now users would have to cargo cult or inspect the private %default-modules variable of (guix build-systems gnu) to discover which modules to include when extending the used modules via the #:modules argument. The renaming was automated via the command: $ git grep -l %gnu-build-system-modules | xargs sed 's/%gnu-build-system-modules/%default-gnu-imported-modules/' -i * guix/build-system/gnu.scm (%gnu-build-system-modules): Rename to... (%default-gnu-imported-modules): ... this. (%default-modules): Rename to... (%default-gnu-modules): ... this. Export. (dist-package, gnu-build, gnu-cross-build): Adjust accordingly. Change-Id: Idef307fff13cb76f3182d782b26e1cd3a5c757ee Maxim Cournoyer