summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/boot-parameters.scm23
-rw-r--r--tests/services/lightdm.scm52
2 files changed, 75 insertions, 0 deletions
diff --git a/tests/boot-parameters.scm b/tests/boot-parameters.scm
index 8e48e1775e..03a1d01aff 100644
--- a/tests/boot-parameters.scm
+++ b/tests/boot-parameters.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2019, 2020 Miguel Ángel Arruga Vivas <rosen644835@gmail.com>
+;;; Copyright © 2022 Josselin Poiret <dev@jpoiret.xyz>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -303,4 +304,26 @@
(operating-system-boot-parameters %default-operating-system
%default-root-device)))
+(define %uuid-menu-entry
+ (menu-entry
+ (label "test")
+ (device (uuid "6d5b13d4-6092-46d0-8be4-073dc07413cc"))
+ (linux "/boot/bzImage")
+ (initrd "/boot/initrd.cpio.gz")))
+
+(define %file-system-label-menu-entry
+ (menu-entry
+ (label "test")
+ (device (file-system-label "test-label"))
+ (linux "/boot/bzImage")
+ (initrd "/boot/initrd.cpio.gz")))
+
+(test-equal "menu-entry roundtrip, uuid"
+ %uuid-menu-entry
+ (sexp->menu-entry (menu-entry->sexp %uuid-menu-entry)))
+
+(test-equal "menu-entry roundtrip, file-system-label"
+ %file-system-label-menu-entry
+ (sexp->menu-entry (menu-entry->sexp %file-system-label-menu-entry)))
+
(test-end "boot-parameters")
diff --git a/tests/services/lightdm.scm b/tests/services/lightdm.scm
new file mode 100644
index 0000000000..283df2befc
--- /dev/null
+++ b/tests/services/lightdm.scm
@@ -0,0 +1,52 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2022 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 (tests services lightdm)
+ #:use-module (guix diagnostics)
+ #:use-module (gnu services lightdm)
+ #:use-module (srfi srfi-64))
+
+;;; Tests for the (gnu services lightdm) module.
+
+;;; Access some internals for whitebox testing.
+(define validate-lightdm-configuration (@@ (gnu services lightdm)
+ validate-lightdm-configuration))
+
+(test-begin "lightdm-service")
+
+(test-equal "error on missing greeter"
+ 'ok
+ (catch 'quit
+ (lambda ()
+ (validate-lightdm-configuration (lightdm-configuration (greeters '()))))
+ (lambda _
+ 'ok)))
+
+(test-equal "error when a greeter has multiple configurations"
+ 'ok
+ (catch 'quit
+ (lambda ()
+ (lightdm-configuration
+ (greeters (list (lightdm-gtk-greeter-configuration
+ (theme-name "boring"))
+ (lightdm-gtk-greeter-configuration
+ (theme-name "blue"))))))
+ (lambda _
+ 'ok)))
+
+(test-end "lightdm-service")