tests: gdm: Prefer OCR to delay.

* gnu/tests/gdm.scm (run-gdm-test): Use wait-for-screen-text instead of sleep.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
Bruno Victal 2023-06-30 14:58:13 +01:00 committed by Maxim Cournoyer
parent 6a86e2d13a
commit ab2abe16de
No known key found for this signature in database
GPG Key ID: 1260E46482E63562

View File

@ -19,6 +19,7 @@
(define-module (gnu tests gdm) (define-module (gnu tests gdm)
#:use-module (gnu tests) #:use-module (gnu tests)
#:use-module (gnu packages freedesktop) #:use-module (gnu packages freedesktop)
#:use-module (gnu packages ocr)
#:use-module (gnu services) #:use-module (gnu services)
#:use-module (gnu services desktop) #:use-module (gnu services desktop)
#:use-module (gnu services xorg) #:use-module (gnu services xorg)
@ -57,6 +58,7 @@
#~(begin #~(begin
(use-modules (gnu build marionette) (use-modules (gnu build marionette)
(ice-9 format) (ice-9 format)
(srfi srfi-26)
(srfi srfi-64)) (srfi srfi-64))
(let ((marionette (make-marionette (list #$vm))) (let ((marionette (make-marionette (list #$vm)))
@ -73,11 +75,19 @@
(start-service 'xorg-server)) (start-service 'xorg-server))
marionette)) marionette))
(test-assert "gdm ready" (test-group "gdm ready"
(test-assert "PID file present"
(wait-for-file "/var/run/gdm/gdm.pid" marionette)) (wait-for-file "/var/run/gdm/gdm.pid" marionette))
;; waiting for gdm.pid is not enough, tests may still sporadically fail. ;; Waiting for gdm.pid is not enough, tests may still sporadically
(sleep 1) ;; 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) (test-equal (string-append "session-type is " expected-session-type)
expected-session-type expected-session-type