aboutsummaryrefslogtreecommitdiff
path: root/gnu/tests/lightdm.scm
blob: 0fd809a9844408feaeda29846c9e4b21c0932f96 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022, 2023 Maxim Cournoyer <maxim.cournoyer@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 lightdm)
  #:use-module (gnu bootloader)
  #:use-module (gnu bootloader grub)
  #:use-module (gnu packages)
  #:use-module (gnu packages ocr)
  #:use-module (gnu packages ratpoison)
  #:use-module (gnu packages vnc)
  #:use-module (gnu packages xorg)
  #:use-module (gnu services)
  #:use-module (gnu services base)
  #:use-module (gnu services dbus)
  #:use-module (gnu services desktop)
  #:use-module (gnu services networking)
  #:use-module (gnu services lightdm)
  #:use-module (gnu services ssh)
  #:use-module (gnu services xorg)
  #:use-module (gnu system)
  #:use-module (gnu system file-systems)
  #:use-module (gnu system keyboard)
  #:use-module (gnu system shadow)
  #:use-module (gnu system vm)
  #:use-module (gnu tests)
  #:use-module (guix gexp)
  #:use-module (guix modules)
  #:use-module (srfi srfi-1)
  #:export (%test-lightdm))

(define minimal-desktop-services
  (list polkit-wheel-service
        (service upower-service-type)
        (service accountsservice-service-type)
        (service polkit-service-type)
        (service elogind-service-type)
        (service dbus-root-service-type)
        (service x11-socket-directory-service-type)))

(define %lightdm-os
  (operating-system
    (inherit %simple-os)
    (packages (cons* ocrad ratpoison xterm %base-packages))
    (services
     (cons* (set-xorg-configuration (xorg-configuration
                                     (keyboard-layout (keyboard-layout "us")))
                                    lightdm-service-type)

            (service lightdm-service-type
                     (lightdm-configuration
                      (allow-empty-passwords? #t)
                      (debug? #t)
                      (xdmcp? #t)
                      (vnc-server? #t)
                      (vnc-server-command
                       (file-append tigervnc-server "/bin/Xvnc"
                                    "  -SecurityTypes None"))
                      (greeters (list (lightdm-gtk-greeter-configuration
                                       (allow-debugging? #t))))
                      (seats (list (lightdm-seat-configuration
                                    (name "*")
                                    (user-session "ratpoison"))))))

            ;; For debugging.
            (service dhcp-client-service-type)
            (service openssh-service-type
                     (openssh-configuration
                      (permit-root-login #t)
                      (allow-empty-passwords? #t)))
            (append minimal-desktop-services
                    (remove (lambda (service)
                              (eq? (service-kind service) guix-service-type))
                            %base-services))))))

(define (run-lightdm-test)
  "Run tests in %LIGHTDM-OS."

  (define os (marionette-operating-system
              %lightdm-os
              #:imported-modules (source-module-closure
                                  '((gnu services herd)))))

  (define vm (virtual-machine os))

  (define test
    (with-imported-modules (source-module-closure
                            '((gnu build marionette)))
      #~(begin
          (use-modules (gnu build marionette)
                       (srfi srfi-26)
                       (srfi srfi-64))

          (let ((marionette (make-marionette (list #$vm))))

            (test-runner-current (system-test-runner #$output))
            (test-begin "lightdm")

            (test-assert "service is running"
              (marionette-eval
               '(begin
                  (use-modules (gnu services herd))
                  (start-service 'lightdm))
               marionette))

            (test-assert "service can be stopped"
              (marionette-eval
               '(begin
                  (use-modules (gnu services herd))
                  (stop-service 'lightdm))
               marionette))

            (test-assert "service can be restarted"
              (marionette-eval
               '(begin
                  (use-modules (gnu services herd))
                  (restart-service 'lightdm))
               marionette))

            (test-assert "login screen is displayed"
              ;; GNU Ocrad fails to recognize the "Log In" button text, so use
              ;; Tesseract.
              (wait-for-screen-text marionette
                                    (cut string-contains <> "Log In")
                                    #:ocr #$(file-append tesseract-ocr
                                                         "/bin/tesseract")
                                    #:timeout 60)) ;for slow systems

            (test-assert "can connect to TCP port 5900 on IPv4"
              (wait-for-tcp-port 5900 marionette))

            (test-assert "can connect to TCP port 5900 on IPv6"
              (wait-for-tcp-port 5900 marionette
                                 #:address
                                 `(make-socket-address
                                   AF_INET6
                                   (inet-pton AF_INET6 "::1")
                                   5900)))

            (test-end)))))

  (gexp->derivation "lightdm-test" test))

(define %test-lightdm
  (system-test
   (name "lightdm")
   (description "Basic tests for the LightDM service.")
   (value (run-lightdm-test))))
s]: Change from HARFBUZZ-3 to HARFBUZZ-5. Marius Bakke 2022-12-02gnu: ungoogled-chromium: Generalize OpenJPEG substitution....* gnu/packages/chromium.scm (ungoogled-chromium)[arguments]: Don't hard code openjpeg version. Marius Bakke 2022-11-27gnu: ungoogled-chromium: Update to 107.0.5304.121-1....* gnu/packages/chromium.scm (%chromium-version): Set to 107.0.5304.121. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-11-17gnu: ungoogled-chromium: Build with Clang 15....* gnu/packages/chromium.scm (ungoogled-chromium)[arguments]: Remove obsolete compiler flags. [native-inputs]: Change from CLANG-14 and LLD-AS-LD-WRAPPER to CLANG-15 and LLD-AS-LD-WRAPPER-15. Marius Bakke 2022-11-17gnu: ungoogled-chromium-wayland: Use PipeWire by default....* gnu/packages/chromium.scm (ungoogled-chromium/wayland)[arguments]<#:builder>: Add --enable-features=WebRTCPipeWireCapture to wrapping executable. Andrew Tropin 2022-11-11gnu: ungoogled-chromium: Update to 107.0.5304.110-1....* gnu/packages/chromium.scm (%chromium-version): Set to 107.0.5304.110. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-11-03gnu: ungoogled-chromium: Update to 107.0.5304.87-1....* gnu/packages/chromium.scm (%chromium-version): Set to 107.0.5304.87. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-10-27gnu: ungoogled-chromium: Update to 107.0.5304.68-1....* gnu/packages/chromium.scm (%preserved-third-party-files): Adjust for M107. (%chromium-version): Set to 107.0.5304.68. (%ungoogled-origin): Update hash. (%chromium-gcc-patchset, gcc-patch): Remove. (%gcc-patches): Empty list. (ungoogled-chromium)[source]: Update hash. [arguments]: Add clang_base_path and use_system_libwayland_server to #:configure-flags. Adjust substitutions. [inputs]: Add QTBASE-5. Marius Bakke 2022-10-13gnu: ungoogled-chromium: Update to 106.0.5249.119-1....* gnu/packages/chromium.scm (%chromium-version): Set to 106.0.5249.119. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-10-12gnu: ungoogled-chromium: Update to 106.0.5249.103-1....* gnu/packages/chromium.scm (%chromium-version): Set to 106.0.5249.103. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-10-01gnu: ungoogled-chromium: Update to 106.0.5249.91-1....* gnu/packages/chromium.scm (%chromium-version): Set to 106.0.5249.91. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-09-28gnu: ungoogled-chromium: Update to 106.0.5249.61-1....* gnu/packages/chromium.scm (%preserved-third-party-files): Adjust for M106. (%chromium-version): Set to 106.0.5249.61. (%arch-revision): New variable. (%ungoogled-origin): Update hash. (%chromium-gcc-patchset): Update to chromium-106-patchset-3. (%gcc-patches): Adjust accordingly. (arch-patch): New procedure. (%ungoogled-chromium-unroll-ffmpeg.patch): Remove variable. (%reverse-patches): New variable. (ungoogled-chromium-snippet): Apply %REVERSE-PATCHES instead of just the one. (ungoogled-chromium): Update hash. [arguments]: Adjust compiler flags and header inclusions. Marius Bakke 2022-09-15Merge branch 'staging' into core-updates...Conflicts resolved in: gnu/local.mk gnu/packages/cmake.scm gnu/packages/glib.scm gnu/packages/gnome.scm gnu/packages/gtk.scm gnu/packages/sdl.scm pango-next, vala-next and librsvg-bootstrap were removed in the process. Maxim Cournoyer 2022-09-14gnu: ungoogled-chromium: Update to 105.0.5195.125-1....* gnu/packages/chromium.scm (%chromium-version): Set to 105.0.5195.125-1. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke 2022-09-08Merge branch 'staging' into core-updatesMarius Bakke 2022-09-03gnu: ungoogled-chromium: Update to 105.0.5195.102-1....* gnu/packages/chromium.scm (%chromium-version): Set to 105.0.5195.102-1. (%ungoogled-origin, ungoogled-chromium): Update hashes. Marius Bakke