From patchwork Thu Dec 1 13:20:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bruno Victal X-Patchwork-Id: 44989 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 998D827BBEC; Thu, 1 Dec 2022 13:22:33 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 14E8B27BBE9 for ; Thu, 1 Dec 2022 13:22:32 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p0jVu-0001I8-VA; Thu, 01 Dec 2022 08:22:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0jVs-0001Hf-2R for guix-patches@gnu.org; Thu, 01 Dec 2022 08:22:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p0jVr-0003FP-R4 for guix-patches@gnu.org; Thu, 01 Dec 2022 08:22:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p0jVq-0002xU-HN for guix-patches@gnu.org; Thu, 01 Dec 2022 08:22:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#59739] [PATCH] tests: Add gdm test. Resent-From: mirai@makinata.eu Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 01 Dec 2022 13:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59739 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 59739@debbugs.gnu.org Cc: Bruno Victal X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166990089511362 (code B ref -1); Thu, 01 Dec 2022 13:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 1 Dec 2022 13:21:35 +0000 Received: from localhost ([127.0.0.1]:39653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0jVP-0002xC-6H for submit@debbugs.gnu.org; Thu, 01 Dec 2022 08:21:35 -0500 Received: from lists.gnu.org ([209.51.188.17]:40386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p0jVM-0002x5-IU for submit@debbugs.gnu.org; Thu, 01 Dec 2022 08:21:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0jVM-00013e-DU for guix-patches@gnu.org; Thu, 01 Dec 2022 08:21:32 -0500 Received: from smtpm1.myservices.hosting ([185.26.105.232]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p0jVK-00036r-CP for guix-patches@gnu.org; Thu, 01 Dec 2022 08:21:32 -0500 Received: from mail1.netim.hosting (unknown [185.26.106.172]) by smtpm1.myservices.hosting (Postfix) with ESMTP id C5E1A2098C for ; Thu, 1 Dec 2022 14:21:14 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mail1.netim.hosting (Postfix) with ESMTP id 7DEE280099; Thu, 1 Dec 2022 14:21:14 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail1.netim.hosting Received: from mail1.netim.hosting ([127.0.0.1]) by localhost (mail1-1.netim.hosting [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OXuNKBbfhcef; Thu, 1 Dec 2022 14:21:11 +0100 (CET) Received: from guix-nuc.home.arpa (bl12-93-156.dsl.telepac.pt [85.245.93.156]) (Authenticated sender: lumen@makinata.eu) by mail1.netim.hosting (Postfix) with ESMTPSA id CE8FD80098; Thu, 1 Dec 2022 14:21:10 +0100 (CET) From: mirai@makinata.eu Date: Thu, 1 Dec 2022 13:20:51 +0000 Message-Id: <3d4b9857d25b823a7fe2cc0d3fc635b3e8ae88ba.1669900368.git.mirai@makinata.eu> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Received-SPF: pass client-ip=185.26.105.232; envelope-from=mirai@makinata.eu; helo=smtpm1.myservices.hosting X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches From: Bruno Victal * gnu/tests/gdm.scm: New file. * gnu/local.mk: Register it. --- Small test suite for investigating the issue 57589 (https://issues.guix.gnu.org/57589) basing on the hint at reply #6. gnu/local.mk | 1 + gnu/tests/gdm.scm | 126 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 gnu/tests/gdm.scm base-commit: a712c07d6ada1160855c583556e854ccb48c47e1 diff --git a/gnu/local.mk b/gnu/local.mk index 379e600b06..be6870b469 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -759,6 +759,7 @@ GNU_SYSTEM_MODULES = \ %D%/tests/docker.scm \ %D%/tests/file-sharing.scm \ %D%/tests/ganeti.scm \ + %D%/tests/gdm.scm \ %D%/tests/guix.scm \ %D%/tests/monitoring.scm \ %D%/tests/nfs.scm \ diff --git a/gnu/tests/gdm.scm b/gnu/tests/gdm.scm new file mode 100644 index 0000000000..137e70544e --- /dev/null +++ b/gnu/tests/gdm.scm @@ -0,0 +1,126 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Bruno Victal . +;;; +;;; 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 . + +(define-module (gnu tests gdm) + #:use-module (gnu tests) + #:use-module (gnu packages freedesktop) + #:use-module (gnu services) + #:use-module (gnu services desktop) + #:use-module (gnu services xorg) + #:use-module (gnu system) + #:use-module (gnu system file-systems) + #:use-module (gnu system vm) + #:use-module (guix gexp) + #:use-module (ice-9 format) + #:export (%test-gdm-x11 + %test-gdm-wayland + %test-gdm-wayland-tmpfs)) + +(define* (make-os #:key wayland? tmp-tmpfs?) + (operating-system + (inherit %simple-os) + (services + (modify-services %desktop-services + (gdm-service-type config => (gdm-configuration + (inherit config) + (wayland? wayland?))))) + (file-systems (if tmp-tmpfs? (cons (file-system + (mount-point "/tmp") + (device "none") + (type "tmpfs") + (flags '(no-dev no-suid)) + (check? #f)) + %base-file-systems) + %base-file-systems)))) + +(define* (run-gdm-test #:key wayland? tmp-tmpfs?) + "Run tests in a vm which has gdm running." + (define os + (marionette-operating-system + (make-os #:wayland? wayland? #:tmp-tmpfs? tmp-tmpfs?) + #:imported-modules '((gnu services herd)))) + + (define vm + (virtual-machine + (operating-system os) + (memory-size 1024))) + + (define name (format #f "gdm-~:[x11~;wayland~]~:[~;-tmpfs~]" wayland? tmp-tmpfs?)) + + (define test + (with-imported-modules '((gnu build marionette)) + #~(begin + (use-modules (gnu build marionette) + (ice-9 format) + (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-assert "gdm ready" + (wait-for-file "/var/run/gdm/gdm.pid" marionette)) + + (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") + (description "Basic tests for the GDM service. (X11)") + (value (run-gdm-test)))) + +(define %test-gdm-wayland + (system-test + (name "gdm") + (description "Basic tests for the GDM service. (Wayland)") + (value (run-gdm-test #:wayland? #t)))) + +(define %test-gdm-wayland-tmpfs + (system-test + (name "gdm") + (description "Basic tests for the GDM service. (Wayland, /tmp as tmpfs)") + (value (run-gdm-test #:wayland? #t #:tmp-tmpfs? #t))))