summary refs log tree commit diff
path: root/gnu/tests/mail.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-18 19:41:08 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-18 19:41:08 +0100
commitc4d769d359c67680fe55c3b71e659cd31837f3ec (patch)
tree928fe50be266c8975f4abad56e07ce4ebaef55fe /gnu/tests/mail.scm
parentde2871c9faa44ee07f73470441f05d114a43bb48 (diff)
parent4de63cf3fc0a831d75cb507456821104f24800c2 (diff)
downloadguix-c4d769d359c67680fe55c3b71e659cd31837f3ec.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/tests/mail.scm')
-rw-r--r--gnu/tests/mail.scm29
1 files changed, 17 insertions, 12 deletions
diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm
index 298918b3a7..a50fb1dbca 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -99,8 +99,8 @@ match from any for local action inbound
 
           (test-assert "mbox is empty"
             (marionette-eval
-             '(and (file-exists? "/var/mail")
-                   (not (file-exists? "/var/mail/root")))
+             '(and (file-exists? "/var/spool/mail")
+                   (not (file-exists? "/var/spool/mail/root")))
              marionette))
 
           (test-eq "accept an email"
@@ -140,16 +140,21 @@ match from any for local action inbound
                              (ice-9 rdelim))
 
                 (define (queue-empty?)
-                  (eof-object?
-                   (read-line
-                    (open-input-pipe
-                     (string-append #$(file-append opensmtpd "/sbin/smtpctl")
-                                    " show queue")))))
-
-                (let wait ()
-                  (if (queue-empty?)
-                      (file-exists? "/var/mail/root")
-                      (begin (sleep 1) (wait)))))
+                  (let* ((pipe (open-pipe* OPEN_READ
+                                           #$(file-append opensmtpd
+                                                          "/sbin/smtpctl")
+                                           "show" "queue"))
+                         (line (read-line pipe)))
+                    (close-pipe pipe)
+                    (eof-object? line)))
+
+                (let wait ((n 20))
+                  (cond ((queue-empty?)
+                         (file-exists? "/var/spool/mail/root"))
+                        ((zero? n)
+                         (error "root mailbox didn't show up"))
+                        (else
+                         (sleep 1) (wait (- n 1))))))
              marionette))
 
           (test-end)