123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204 |
- (define-module (gnu tests vnc)
- #:use-module (gnu bootloader)
- #:use-module (gnu bootloader grub)
- #:use-module (gnu packages)
- #:use-module (gnu packages ocr)
- #:use-module (gnu packages glib)
- #:use-module (gnu packages gnome)
- #:use-module (gnu packages ratpoison)
- #:use-module (gnu packages vnc)
- #:use-module (gnu packages xorg)
- #:use-module (gnu services)
- #:use-module (gnu services dbus)
- #:use-module (gnu services desktop)
- #:use-module (gnu services networking)
- #:use-module (gnu services ssh)
- #:use-module (gnu services vnc)
- #:use-module (gnu services xorg)
- #:use-module (gnu system)
- #:use-module (gnu system file-systems)
- #:use-module (gnu system shadow)
- #:use-module (gnu system vm)
- #:use-module (gnu tests)
- #:use-module (guix gexp)
- #:use-module (guix modules)
- #:export (%test-xvnc))
- (define %xvnc-os
- (operating-system
-
- (host-name "komputilo")
- (timezone "Europe/Berlin")
- (locale "en_US.UTF-8")
- (bootloader (bootloader-configuration
- (bootloader grub-bootloader)
- (targets '("/dev/sdX"))))
- (file-systems (cons (file-system
- (device (file-system-label "my-root"))
- (mount-point "/")
- (type "ext4"))
- %base-file-systems))
- (users (cons (user-account
- (name "dummy")
- (group "users")
- (supplementary-groups '("wheel" "netdev"
- "audio" "video")))
- %base-user-accounts))
- (packages (cons* dbus
- dconf
- `(,glib "bin")
- glib
- gnome-settings-daemon
- ratpoison
- tigervnc-client
- xterm
- %base-packages))
- (services (cons*
- (service openssh-service-type (openssh-configuration
- (permit-root-login #t)
- (allow-empty-passwords? #t)))
- (service xvnc-service-type (xvnc-configuration
- (display-number 5)
- (security-types (list "None"))
- (log-level 100)
- (localhost? #f)
- (xdmcp? #t)
- (inetd? #t)))
- (modify-services %desktop-services
- (gdm-service-type config => (gdm-configuration
- (inherit config)
- (auto-login? #t)
- (auto-suspend? #f)
- (default-user "root")
- (debug? #t)
- (xdmcp? #t))))))))
- (define (run-xvnc-test)
- "Run tests in %XVNC-OS."
- (define os (marionette-operating-system
- %xvnc-os
- #:imported-modules (source-module-closure
- '((gnu services herd)))))
- (define vm (virtual-machine
- (operating-system os)
- (memory-size 1024)))
- (define test
- (with-imported-modules (source-module-closure
- '((gnu build marionette)
- (guix build utils)))
- #~(begin
- (use-modules (gnu build marionette)
- (guix build utils)
- (srfi srfi-26)
- (srfi srfi-64))
- (let ((marionette (make-marionette (list #$vm))))
- (test-runner-current (system-test-runner #$output))
- (test-begin "xvnc")
- (test-assert "service running"
- (marionette-eval
- '(begin
- (use-modules (gnu services herd))
- (start-service 'xvnc))
- marionette))
- (test-assert "wait for port 5905, IPv4"
- (wait-for-tcp-port 5905 marionette))
- (test-assert "wait for port 5905, IPv6"
- (wait-for-tcp-port 5905 marionette
- #:address
- '(make-socket-address
- AF_INET6 (inet-pton AF_INET6 "::1") 5905)))
- (test-assert "gdm auto-suspend is disabled"
-
-
-
- (marionette-eval
- '(begin
- ;; Check that DCONF_PROFILE is set...
- (invoke "/bin/sh" "-lc" "\
- pgrep gdm | head -n1 | xargs -I{} grep -Fq DCONF_PROFILE /proc/{}/environ")
- ;; ... and that
- (invoke "/bin/sh" "-lc" "\
- sudo -E -u gdm env DCONF_PROFILE=/etc/dconf/profile/gdm dbus-run-session \
- 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"
-
-
- (begin
- (define (ratpoison-abort)
- (marionette-control "sendkey ctrl-g" marionette))
- (define (ratpoison-help)
- (marionette-control "sendkey ctrl-t" marionette)
- (marionette-type "?" marionette)
- (sleep 1))
- (define (ratpoison-exec command)
- (marionette-control "sendkey ctrl-t" marionette)
- (marionette-type "!" marionette)
- (marionette-type (string-append command "\n") marionette))
-
-
- (wait-for-screen-text marionette
- (cut string-contains <> "key bindings")
- #:ocr #$(file-append tesseract-ocr
- "/bin/tesseract")
- #:pre-action ratpoison-help
- #:post-action ratpoison-abort)
-
-
- (ratpoison-exec "vncviewer localhost:5905")
-
-
-
- (wait-for-screen-text marionette
- (cut string-contains <> "uix")
- #:ocr #$(file-append tesseract-ocr
- "/bin/tesseract")
- #:timeout 120)))
- (test-end)))))
- (gexp->derivation "xvnc-test" test))
- (define %test-xvnc
- (system-test
- (name "xvnc")
- (description "Basic tests for the Xvnc service. One of the tests validate
- that XDMCP works with GDM, and is therefore heavy in terms of disk and memory
- requirements.")
- (value (run-xvnc-test))))
|