summary refs log tree commit diff
path: root/gnu/build
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2018-09-03 19:20:06 +0200
committerMarius Bakke <mbakke@fastmail.com>2018-09-03 19:20:06 +0200
commit70dc8db8e7a44e0357c6b0582a710a918bd2e353 (patch)
tree083102cf532c523068f018e2b113947ca6a3db02 /gnu/build
parent279ed3efee9c71116d368163f805fe9494518687 (diff)
parentc702749dfd47ea6983768cd5b8cf828898445af0 (diff)
downloadguix-70dc8db8e7a44e0357c6b0582a710a918bd2e353.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/linux-modules.scm4
-rw-r--r--gnu/build/marionette.scm28
2 files changed, 29 insertions, 3 deletions
diff --git a/gnu/build/linux-modules.scm b/gnu/build/linux-modules.scm
index ae141b6f54..2d81175041 100644
--- a/gnu/build/linux-modules.scm
+++ b/gnu/build/linux-modules.scm
@@ -136,7 +136,7 @@ and normalizing it."
 (define (find-module-file directory module)
   "Lookup module NAME under DIRECTORY, and return its absolute file name.
 NAME can be a file name with or without '.ko', or it can be a module name.
-Return #f if it could not be found.
+Raise an error if it could not be found.
 
 Module names can differ from file names in interesting ways; for instance,
 module names usually (always?) use underscores as the inter-word separator,
@@ -162,7 +162,7 @@ whereas file names often, but not always, use hyphens.  Examples:
     ((file)
      file)
     (()
-     #f)
+     (error "kernel module not found" module directory))
     ((_ ...)
      (error "several modules by that name" module directory))))
 
diff --git a/gnu/build/marionette.scm b/gnu/build/marionette.scm
index bb018fc9c1..f94eab5cc0 100644
--- a/gnu/build/marionette.scm
+++ b/gnu/build/marionette.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -27,6 +28,7 @@
             marionette-eval
             wait-for-file
             wait-for-tcp-port
+            wait-for-unix-socket
             marionette-control
             marionette-screen-text
             wait-for-screen-text
@@ -214,6 +216,29 @@ MARIONETTE.  Raise an error on failure."
     ('failure
      (error "nobody's listening on port" port))))
 
+(define* (wait-for-unix-socket file-name marionette
+                                #:key (timeout 20))
+  "Wait for up to TIMEOUT seconds for FILE-NAME, a Unix domain socket, to
+accept connections in MARIONETTE.  Raise an error on failure."
+  (match (marionette-eval
+          `(begin
+             (let ((sock (socket PF_UNIX SOCK_STREAM 0)))
+               (let loop ((i 0))
+                 (catch 'system-error
+                   (lambda ()
+                     (connect sock AF_UNIX ,file-name)
+                     'success)
+                   (lambda args
+                     (if (< i ,timeout)
+                         (begin
+                           (sleep 1)
+                           (loop (+ 1 i)))
+                         'failure))))))
+          marionette)
+    ('success #t)
+    ('failure
+     (error "nobody's listening on unix domain socket" file-name))))
+
 (define (marionette-control command marionette)
   "Run COMMAND in the QEMU monitor of MARIONETTE.  COMMAND is a string such as
 \"sendkey ctrl-alt-f1\" or \"screendump foo.ppm\" (info \"(qemu-doc)
@@ -222,7 +247,8 @@ pcsys_monitor\")."
     (($ <marionette> _ _ monitor)
      (display command monitor)
      (newline monitor)
-     (wait-for-monitor-prompt monitor))))
+     ;; The "quit" command terminates QEMU immediately, with no output.
+     (unless (string=? command "quit") (wait-for-monitor-prompt monitor)))))
 
 (define* (marionette-screen-text marionette
                                  #:key