add test for download

This commit is contained in:
Simon Cruanes 2021-12-11 10:18:42 -05:00
parent 69c16b0a5d
commit 8813dd64f9
No known key found for this signature in database
GPG key ID: 4AC01D0849AA62B6
3 changed files with 25 additions and 0 deletions

2
tests/dl-out.expect Normal file
View file

@ -0,0 +1,2 @@
serve directory . on http://127.0.0.1:8083
0 0 52428800 data2

12
tests/download_chunked.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env sh
SERVER=$1
"$SERVER" . -p 8083 &
sleep 0.1
curl -N 'http://localhost:8083/foo_50' -o data2 \
-H 'Tranfer-encoding: chunked'
kill %1
wc data2

View file

@ -29,3 +29,14 @@
(rule (rule
(alias runtest) (alias runtest)
(action (diff upload-out.expect upload-out))) (action (diff upload-out.expect upload-out)))
(rule
(targets dl-out)
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
(locks /port)
(action (with-stdout-to %{targets}
(run ./download_chunked.sh %{bin}))))
(rule
(alias runtest)
(action (diff dl-out.expect dl-out)))