aboutsummaryrefslogtreecommitdiff
path: root/gnu/tests
diff options
context:
space:
mode:
authorBruno Victal <mirai@makinata.eu>2023-06-30 14:58:14 +0100
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-07-19 10:38:15 -0400
commit95424292993551854fb7373cef997fd39340ea4b (patch)
tree84f91e3e8d1b6e1dad52d480d4c53a26c4235cfc /gnu/tests
parentab2abe16debaae362ea04f32d66332423d2dba1b (diff)
downloadguix-95424292993551854fb7373cef997fd39340ea4b.tar
guix-95424292993551854fb7373cef997fd39340ea4b.tar.gz
tests: xvnc: Group up GDM test and use GNU Ocrad instead of Tesseract.
* gnu/tests/vnc.scm (run-xvnc-test): Group up GDM test. Use GNU Ocrad. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Diffstat (limited to 'gnu/tests')
-rw-r--r--gnu/tests/vnc.scm70
1 files changed, 39 insertions, 31 deletions
diff --git a/gnu/tests/vnc.scm b/gnu/tests/vnc.scm
index 5c4bd43fa3..a34bc466b7 100644
--- a/gnu/tests/vnc.scm
+++ b/gnu/tests/vnc.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>.
+;;; Copyright © 2023 Bruno Victal <mirai@makinata.eu>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -104,6 +105,8 @@
(operating-system os)
(memory-size 1024)))
+ (define ocr (file-append ocrad "/bin/ocrad"))
+
(define test
(with-imported-modules (source-module-closure
'((gnu build marionette)
@@ -152,43 +155,48 @@ gsettings get org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type \
| grep -Fq nothing"))
marionette))
- (test-assert "vnc lands on the gdm login screen"
+ (test-group "vnc lands on the gdm login screen"
;; This test runs vncviewer on the local VM and verifies that it
;; manages to access the GDM login screen (via XDMCP).
- (begin
- (define (ratpoison-abort)
- (marionette-control "sendkey ctrl-g" marionette))
-
- (define (ratpoison-help)
- (marionette-control "sendkey ctrl-t" marionette)
- (marionette-type "?" marionette)
- (sleep 1)) ;wait for help screen to appear
-
- (define (ratpoison-exec command)
- (marionette-control "sendkey ctrl-t" marionette)
- (marionette-type "!" marionette)
- (marionette-type (string-append command "\n") marionette))
-
- ;; Wait until the ratpoison help screen can be displayed; this
- ;; means the window manager is ready.
+ (define (ratpoison-abort)
+ (marionette-control "sendkey ctrl-g" marionette))
+
+ (define (ratpoison-help)
+ (marionette-control "sendkey ctrl-t" marionette)
+ (marionette-type "?" marionette)
+ (sleep 1)) ;wait for help screen to appear
+
+ (define (ratpoison-exec command)
+ (marionette-control "sendkey ctrl-t" marionette)
+ (marionette-type "!" marionette)
+ (marionette-type (string-append command "\n") marionette))
+
+ ;; Wait until the ratpoison help screen can be displayed; this
+ ;; means the window manager is ready.
+ ;; XXX: The letters are half of the height preferred by
+ ;; GNU Ocrad, scale it by 2.
+ (test-assert "window manager is ready"
(wait-for-screen-text marionette
(cut string-contains <> "key bindings")
- #:ocr #$(file-append tesseract-ocr
- "/bin/tesseract")
+ #:ocr #$ocr
+ #:ocr-arguments '("--scale=2")
#:pre-action ratpoison-help
- #:post-action ratpoison-abort)
-
- ;; Run vncviewer and expect the GDM login screen (accessed via
- ;; XDMCP). This can take a while to appear on slower machines.
- (ratpoison-exec "vncviewer localhost:5905")
- ;; XXX: tesseract narrowly recognizes "Guix" as "uix" from the
- ;; background image; ocrad fares worst. Sadly, 'Username' is
- ;; not recognized at all.
+ #:post-action ratpoison-abort))
+
+ ;; Run vncviewer and expect the GDM login screen (accessed via
+ ;; XDMCP). This can take a while to appear on slower machines.
+ (ratpoison-exec "vncviewer localhost:5905")
+
+ (test-assert "GDM login screen ready"
+ ;; XXX: The '--invert' argument as the sole option to GNU
+ ;; Ocrad is required for it to recognize "Guix" from the
+ ;; background image. 'Username' from the UI would be a better
+ ;; choice but is not recognized at all.
(wait-for-screen-text marionette
- (cut string-contains <> "uix")
- #:ocr #$(file-append tesseract-ocr
- "/bin/tesseract")
- #:timeout 120)))
+ (cut string-contains <> "Guix")
+ #:ocr #$ocr
+ #:ocr-arguments '("--invert")
+ #:timeout 120))) ;for slow systems
(test-end)))))