summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-03-16 17:39:08 +0100
committerLudovic Courtès <ludo@gnu.org>2020-03-16 22:58:37 +0100
commita55472955d7dbe7385fb25a5c31b26f8ebfa6e93 (patch)
treecc6f20eb9ea7dbb0c52296d8dc1032d8273a9d80 /gnu
parent8a65ca6f8c1270e63d3581ca11b6b86e22a5e9e7 (diff)
downloadguix-a55472955d7dbe7385fb25a5c31b26f8ebfa6e93.tar.gz
tests: nfs-server: Use marionette helper procedures.
* gnu/tests/nfs.scm (run-nfs-server-test)[test](wait-for-file): Remove.
("nscd is listening on its socket"): Use 'wait-for-unix-socket'.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/tests/nfs.scm30
1 files changed, 2 insertions, 28 deletions
diff --git a/gnu/tests/nfs.scm b/gnu/tests/nfs.scm
index 635c4a7322..00109b752e 100644
--- a/gnu/tests/nfs.scm
+++ b/gnu/tests/nfs.scm
@@ -196,18 +196,6 @@
 
           (define marionette
             (make-marionette (list #$(virtual-machine os))))
-          (define (wait-for-file file)
-            ;; Wait until FILE  exists in the guest
-            (marionette-eval
-             `(let loop ((i 10))
-                (cond ((file-exists? ,file)
-                       #t)
-                      ((> i 0)
-                       (sleep 1)
-                       (loop (- i 1)))
-                      (else
-                       (error "File didn't show up: " ,file))))
-             marionette))
 
           (mkdir #$output)
           (chdir #$output)
@@ -231,22 +219,8 @@
              marionette))
 
           (test-assert "nscd is listening on its socket"
-            (marionette-eval
-             ;; XXX: Work around a race condition in nscd: nscd creates its
-             ;; PID file before it is listening on its socket.
-             '(let ((sock (socket PF_UNIX SOCK_STREAM 0)))
-                (let try ()
-                  (catch 'system-error
-                    (lambda ()
-                      (connect sock AF_UNIX "/var/run/nscd/socket")
-                      (close-port sock)
-                      (format #t "nscd is ready~%")
-                      #t)
-                    (lambda args
-                      (format #t "waiting for nscd...~%")
-                      (usleep 500000)
-                      (try)))))
-             marionette))
+            (wait-for-unix-socket "/var/run/nscd/socket"
+                                  marionette))
 
           (test-assert "network is up"
             (marionette-eval