From 5fa7cc5335d64a790d7f0f784a11b25b040cc443 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 12 Jun 2017 23:21:24 +0200 Subject: marionette: Factorize 'wait-for-file'. * gnu/build/marionette.scm (wait-for-file): New procedure. * gnu/tests/base.scm (run-mcron-test)[test](wait-for-file): Remove. Pass second argument in 'wait-for-file' calls. * gnu/tests/ssh.scm (run-ssh-test)[test](wait-for-file): Remove. Pass second argument in 'wait-for-file' calls. * gnu/tests/messaging.scm (run-xmpp-test)[test](guest-wait-for-file): Remove. Use 'wait-for-file' instead, with second argument. --- gnu/tests/ssh.scm | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'gnu/tests/ssh.scm') diff --git a/gnu/tests/ssh.scm b/gnu/tests/ssh.scm index 5f06151081..9c83a9cd48 100644 --- a/gnu/tests/ssh.scm +++ b/gnu/tests/ssh.scm @@ -69,20 +69,6 @@ When SFTP? is true, run an SFTP server test." (make-marionette (list #$command "-net" "user,hostfwd=tcp::2222-:22"))) - (define (wait-for-file file) - ;; Wait until FILE exists in the guest; 'read' its content and - ;; return it. - (marionette-eval - `(let loop ((i 10)) - (cond ((file-exists? ,file) - (call-with-input-file ,file read)) - ((> i 0) - (sleep 1) - (loop (- i 1))) - (else - (error "file didn't show up" ,file)))) - marionette)) - (define (make-session-for-test) "Make a session with predefined parameters for a test." (make-session #:user "root" @@ -141,7 +127,7 @@ root with an empty password." ;; Check sshd's PID file. (test-equal "sshd PID" - (wait-for-file #$pid-file) + (wait-for-file #$pid-file marionette) (marionette-eval '(begin (use-modules (gnu services herd) @@ -166,7 +152,7 @@ root with an empty password." (channel-open-session channel) (channel-request-exec channel "echo hello > /root/witness") (and (zero? (channel-get-exit-status channel)) - (wait-for-file "/root/witness")))))) + (wait-for-file "/root/witness" marionette)))))) ;; Connect to the guest over SFTP. Make sure we can write and ;; read a file there. -- cgit v1.2.3