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.
This commit is contained in:
parent
0f13dd2b7f
commit
c215d9ec1c
@ -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* ((pipe (open-pipe* OPEN_READ
|
||||
#$(file-append opensmtpd
|
||||
"/sbin/smtpctl")
|
||||
"show" "queue"))
|
||||
(line (read-line pipe)))
|
||||
(close-pipe pipe)
|
||||
(eof-object? line)))
|
||||
|
||||
(let wait ()
|
||||
(if (queue-empty?)
|
||||
(file-exists? "/var/mail/root")
|
||||
(begin (sleep 1) (wait)))))
|
||||
(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)
|
||||
|
Loading…
Reference in New Issue
Block a user