Avoid output in ftp tests.
Also add a note explaining why the output is not tested.
This commit is contained in:
parent
6149134011
commit
26273db266
|
@ -22,12 +22,12 @@
|
||||||
(define-values [thd port] (tcp-serve dest text))
|
(define-values [thd port] (tcp-serve dest text))
|
||||||
(values thd (port->splitstr port)))
|
(values thd (port->splitstr port)))
|
||||||
|
|
||||||
(define ((progress-proc dir) get-count)
|
(define ((progress-proc output dir) get-count)
|
||||||
(thread
|
(thread
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ()
|
(let loop ()
|
||||||
(define-values (count changed-evt) (get-count))
|
(define-values [count changed-evt] (get-count))
|
||||||
(printf "~a bytes ~aloaded\n" count dir)
|
(fprintf output "~a bytes ~aloaded\n" count dir)
|
||||||
(sync changed-evt)
|
(sync changed-evt)
|
||||||
(loop)))))
|
(loop)))))
|
||||||
|
|
||||||
|
@ -51,12 +51,23 @@
|
||||||
(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)
|
(when (ftp-connection? conn)
|
||||||
|
(define output (open-output-bytes))
|
||||||
(test (ftp-cd conn "gnu")
|
(test (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 ?size) f)
|
(match-define (list* type ftp-date name ?size) f)
|
||||||
(test (ftp-make-file-seconds ftp-date)))
|
(test (ftp-make-file-seconds ftp-date)))
|
||||||
(ftp-download-file conn tmp-dir pth #:progress (progress-proc "down"))
|
(ftp-download-file conn tmp-dir pth
|
||||||
(ftp-upload-file conn (path->string (build-path tmp-dir pth)) #:progress (progress-proc "up"))
|
#:progress (progress-proc output "down"))
|
||||||
|
;; Note: It would be nice to test the output but there is no
|
||||||
|
;; easy way that I see to wait for the progress thread to
|
||||||
|
;; finish (it stays alive after the transfer), and it's
|
||||||
|
;; probably a bad idea to make a test that expects a specific
|
||||||
|
;; output
|
||||||
|
;; (get-output-bytes output #t) => #"0 bytes downloaded\n"
|
||||||
|
;; (get-output-bytes output #t) => #"744 bytes uploaded\n"
|
||||||
|
(ftp-upload-file conn (path->string (build-path tmp-dir pth))
|
||||||
|
#:progress (progress-proc output "up"))
|
||||||
|
;; (get-output-bytes output #t) => #"744 bytes uploaded\n"
|
||||||
(ftp-delete-file conn "3dldf/test.file")
|
(ftp-delete-file conn "3dldf/test.file")
|
||||||
(ftp-make-directory conn "test")
|
(ftp-make-directory conn "test")
|
||||||
(ftp-delete-directory conn "test")
|
(ftp-delete-directory conn "test")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user