summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2018-02-19 21:58:18 +0100
committerLudovic Courtès <ludo@gnu.org>2018-02-19 22:04:11 +0100
commit27a2c9c3e071fdb380c2f4f389b7cf4008dc75f7 (patch)
tree5e1d58334b83240015cc1dd0109c16ec0b8d3830 /gnu
parentce0a62f6c5c8ea486869360f654356777cdf918e (diff)
marionette: Use QEMU's "VM channel" mechanism.
* gnu/tests.scm (<marionette-configuration>)[device]: Default to "/dev/virtio-ports/org.gnu.guix.port.0". * gnu/tests.scm (marionette-shepherd-service): Remove (guix build syscalls) from 'modules'. Remove 'tcsetattr' call from 'start'. * gnu/build/marionette.scm (make-marionette): Use "-virtserialport" instead of "-virtconsole".
Diffstat (limited to 'gnu')
-rw-r--r--gnu/build/marionette.scm7
-rw-r--r--gnu/tests.scm22
2 files changed, 10 insertions, 19 deletions
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index 7554a710a05..173a67cef94 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3;;; 3;;;
4;;; This file is part of GNU Guix. 4;;; This file is part of GNU Guix.
5;;; 5;;;
@@ -97,8 +97,11 @@ QEMU monitor and to the guest's backdoor REPL."
97 "-monitor" (string-append "unix:" socket-directory "/monitor") 97 "-monitor" (string-append "unix:" socket-directory "/monitor")
98 "-chardev" (string-append "socket,id=repl,path=" socket-directory 98 "-chardev" (string-append "socket,id=repl,path=" socket-directory
99 "/repl") 99 "/repl")
100
101 ;; See
102 ;; <http://www.linux-kvm.org/page/VMchannel_Requirements#Invocation>.
100 "-device" "virtio-serial" 103 "-device" "virtio-serial"
101 "-device" "virtconsole,chardev=repl")) 104 "-device" "virtserialport,chardev=repl,name=org.gnu.guix.port.0"))
102 105
103 (define (accept* port) 106 (define (accept* port)
104 (match (select (list port) '() (list port) timeout) 107 (match (select (list port) '() (list port) timeout)
diff --git a/gnu/tests.scm b/gnu/tests.scm
index 3e4c3d4e3a5..2aef370af5a 100644
--- a/gnu/tests.scm
+++ b/gnu/tests.scm
@@ -1,5 +1,5 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org> 2;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
3;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> 3;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
4;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr> 4;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
5;;; 5;;;
@@ -69,7 +69,7 @@
69 marionette-configuration make-marionette-configuration 69 marionette-configuration make-marionette-configuration
70 marionette-configuration? 70 marionette-configuration?
71 (device marionette-configuration-device ;string 71 (device marionette-configuration-device ;string
72 (default "/dev/hvc0")) 72 (default "/dev/virtio-ports/org.gnu.guix.port.0"))
73 (imported-modules marionette-configuration-imported-modules 73 (imported-modules marionette-configuration-imported-modules
74 (default '())) 74 (default '()))
75 (requirements marionette-configuration-requirements ;list of symbols 75 (requirements marionette-configuration-requirements ;list of symbols
@@ -87,17 +87,10 @@
87 87
88 (modules '((ice-9 match) 88 (modules '((ice-9 match)
89 (srfi srfi-9 gnu) 89 (srfi srfi-9 gnu)
90 (guix build syscalls)
91 (rnrs bytevectors))) 90 (rnrs bytevectors)))
92 (start 91 (start
93 (with-imported-modules `((guix build syscalls) 92 (with-imported-modules imported-modules
94 ,@imported-modules)
95 #~(lambda () 93 #~(lambda ()
96 (define (clear-echo termios)
97 (set-field termios (termios-local-flags)
98 (logand (lognot (local-flags ECHO))
99 (termios-local-flags termios))))
100
101 (define (self-quoting? x) 94 (define (self-quoting? x)
102 (letrec-syntax ((one-of (syntax-rules () 95 (letrec-syntax ((one-of (syntax-rules ()
103 ((_) #f) 96 ((_) #f)
@@ -112,13 +105,8 @@
112 (dynamic-wind 105 (dynamic-wind
113 (const #t) 106 (const #t)
114 (lambda () 107 (lambda ()
115 (let* ((repl (open-file #$device "r+0")) 108 (let ((repl (open-file #$device "r+0"))
116 (termios (tcgetattr (fileno repl))) 109 (console (open-file "/dev/console" "r+0")))
117 (console (open-file "/dev/console" "r+0")))
118 ;; Don't echo input back.
119 (tcsetattr (fileno repl) (tcsetattr-action TCSANOW)
120 (clear-echo termios))
121
122 ;; Redirect output to the console. 110 ;; Redirect output to the console.
123 (close-fdes 1) 111 (close-fdes 1)
124 (close-fdes 2) 112 (close-fdes 2)