[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
04/07: tests: opensmtpd: Gracefully handle test failure.
From: |
guix-commits |
Subject: |
04/07: tests: opensmtpd: Gracefully handle test failure. |
Date: |
Mon, 16 Mar 2020 09:06:03 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit c215d9ec1ce108844b14c0c2952199a0da5f4176
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Mar 16 12:18:59 2020 +0100
tests: opensmtpd: Gracefully handle test failure.
Previously the 'wait' loop would run for ~1024 seconds, at which point
we'd reach the file descriptor limit due to the leak in 'queue-empty?'.
* gnu/tests/mail.scm (run-opensmtpd-test)[test]("mail arrived"): In
'queue-empty?', close PIPE to avoid file descriptor leak. In 'wait'
loop, arrange to run at most 20 times.
---
gnu/tests/mail.scm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/gnu/tests/mail.scm b/gnu/tests/mail.scm
index 298918b..58172cd 100644
--- a/gnu/tests/mail.scm
+++ b/gnu/tests/mail.scm
@@ -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/mail/root"))
+ ((zero? n)
+ (error "root mailbox didn't show up"))
+ (else
+ (sleep 1) (wait (- n 1))))))
marionette))
(test-end)
- branch master updated (bc6bf14 -> 76d2b9a), guix-commits, 2020/03/16
- 02/07: tests: dhcpd: Adjust network interface name., guix-commits, 2020/03/16
- 03/07: services: dhcpd: Use 'invoke/quiet' when validating the config file., guix-commits, 2020/03/16
- 05/07: tests: opensmtpd: Check /var/spool/mail instead of /var/mail., guix-commits, 2020/03/16
- 06/07: tests: nfs: Ensure 'rpcinfo' can be found., guix-commits, 2020/03/16
- 01/07: tests: rsync: Set PATH., guix-commits, 2020/03/16
- 04/07: tests: opensmtpd: Gracefully handle test failure.,
guix-commits <=
- 07/07: gnu: Add libgccjit., guix-commits, 2020/03/16