summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/tests/base.scm20
1 files changed, 13 insertions, 7 deletions
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 5c2af5b6d4..9a265309c0 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -150,14 +150,20 @@ info --version")
               (marionette-type "root\n\nid -un > logged-in\n" marionette)
 
               ;; It can take a while before the shell commands are executed.
-              (let loop ((i 0))
-                (unless (or (file-exists? "/root/logged-in") (> i 15))
-                  (sleep 1)
-                  (loop (+ i 1))))
               (marionette-eval '(use-modules (rnrs io ports)) marionette)
-              (marionette-eval '(call-with-input-file "/root/logged-in"
-                                  get-string-all)
-                               marionette)))
+              (marionette-eval
+               '(let loop ((i 0))
+                  (catch 'system-error
+                    (lambda ()
+                      (call-with-input-file "/root/logged-in"
+                        get-string-all))
+                    (lambda args
+                      (if (and (< i 15) (= ENOENT (system-error-errno args)))
+                          (begin
+                            (sleep 1)
+                            (loop (+ i 1)))
+                          (apply throw args)))))
+               marionette)))
 
           (test-assert "host name resolution"
             (match (marionette-eval