Increasing FTP test stability

This commit is contained in:
Jay McCarthy 2010-08-28 18:52:29 -06:00
parent 3f8de79ba7
commit bc15f398f2

View File

@ -8,13 +8,21 @@
(thread (thread
(λ () (λ ()
(define-values (ip op) (tcp-accept listener)) (define-values (ip op) (tcp-accept listener))
(define ip->cop-t
(thread (λ () (thread (λ ()
(copy-port ip cop) (copy-port ip cop))))
(define tp->op-t
(thread (λ ()
(copy-port tp op))))
(thread-wait tp->op-t)
(thread-wait ip->cop-t)
(flush-output op)
(flush-output cop) (flush-output cop)
(close-output-port op)
(close-input-port ip))) (close-input-port ip)))
(thread (λ ()
(copy-port tp op)
(close-output-port op)))))
the-port)) the-port))
(define (ftp-port-split n) (define (ftp-port-split n)
@ -212,6 +220,8 @@ END
(ftp-connection? 1) => #f (ftp-connection? 1) => #f
(set! conn (ftp-establish-connection server port user passwd)) (set! conn (ftp-establish-connection server port user passwd))
(ftp-connection? conn) (ftp-connection? conn)
(when (ftp-connection? conn)
(test
(ftp-cd conn "gnu") (ftp-cd conn "gnu")
(for ([f (in-list (ftp-directory-list conn))]) (for ([f (in-list (ftp-directory-list conn))])
(match-define (list type ftp-date name) f) (match-define (list type ftp-date name) f)
@ -225,6 +235,10 @@ END
(delete-file (build-path tmp-dir pth)) (delete-file (build-path tmp-dir pth))
(delete-directory/files tmp-dir) (delete-directory/files tmp-dir)
(thread-wait pasv1-thread)
(thread-wait pasv2-thread)
(thread-wait main-thread)
(get-output-string cop) => (get-output-string cop) =>
#<<END #<<END
USER anonymous USER anonymous
@ -235,9 +249,10 @@ LIST
PASV PASV
TYPE I TYPE I
RETR =README-about-.diff-files RETR =README-about-.diff-files
QUIT
END END
)) ))))
(tests) (tests)