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
1 changed files with 14 additions and 9 deletions
|
@ -140,16 +140,21 @@ match from any for local action inbound
|
||||||
(ice-9 rdelim))
|
(ice-9 rdelim))
|
||||||
|
|
||||||
(define (queue-empty?)
|
(define (queue-empty?)
|
||||||
(eof-object?
|
(let* ((pipe (open-pipe* OPEN_READ
|
||||||
(read-line
|
#$(file-append opensmtpd
|
||||||
(open-input-pipe
|
"/sbin/smtpctl")
|
||||||
(string-append #$(file-append opensmtpd "/sbin/smtpctl")
|
"show" "queue"))
|
||||||
" show queue")))))
|
(line (read-line pipe)))
|
||||||
|
(close-pipe pipe)
|
||||||
|
(eof-object? line)))
|
||||||
|
|
||||||
(let wait ()
|
(let wait ((n 20))
|
||||||
(if (queue-empty?)
|
(cond ((queue-empty?)
|
||||||
(file-exists? "/var/mail/root")
|
(file-exists? "/var/mail/root"))
|
||||||
(begin (sleep 1) (wait)))))
|
((zero? n)
|
||||||
|
(error "root mailbox didn't show up"))
|
||||||
|
(else
|
||||||
|
(sleep 1) (wait (- n 1))))))
|
||||||
marionette))
|
marionette))
|
||||||
|
|
||||||
(test-end)
|
(test-end)
|
||||||
|
|
Reference in a new issue