mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 03:05:29 -05:00
add an upload test
This commit is contained in:
parent
ed4c731523
commit
69c16b0a5d
5 changed files with 31 additions and 1 deletions
5
Makefile
5
Makefile
|
|
@ -5,9 +5,12 @@ all: build test
|
|||
build:
|
||||
@dune build @install
|
||||
|
||||
test:
|
||||
test: tests/foo_50
|
||||
@dune runtest --no-buffer --force
|
||||
|
||||
tests/foo_50:
|
||||
dd if=/dev/zero of=$@ bs=1M count=50
|
||||
|
||||
clean:
|
||||
@dune clean
|
||||
|
||||
|
|
|
|||
1
tests/.gitignore
vendored
Normal file
1
tests/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
foo_50
|
||||
11
tests/dune
11
tests/dune
|
|
@ -18,3 +18,14 @@
|
|||
(rule
|
||||
(alias runtest)
|
||||
(action (diff sse_count.expect sse_count.out)))
|
||||
|
||||
(rule
|
||||
(targets upload-out)
|
||||
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
||||
(locks /port)
|
||||
(action (with-stdout-to %{targets}
|
||||
(run ./upload_chunked.sh %{bin}))))
|
||||
|
||||
(rule
|
||||
(alias runtest)
|
||||
(action (diff upload-out.expect upload-out)))
|
||||
|
|
|
|||
2
tests/upload-out.expect
Normal file
2
tests/upload-out.expect
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
serve directory . on http://127.0.0.1:8083
|
||||
upload successful 0 0 52428800 data
|
||||
13
tests/upload_chunked.sh
Executable file
13
tests/upload_chunked.sh
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
rm data
|
||||
|
||||
SERVER=$1
|
||||
"$SERVER" . -p 8083 --upload --max-upload 100000000000 &
|
||||
|
||||
sleep 0.1
|
||||
|
||||
cat foo_50 | curl -N -X PUT http://localhost:8083/data --data-binary @- -H 'Transfer-Encoding: chunked'
|
||||
|
||||
kill %1
|
||||
wc data
|
||||
Loading…
Add table
Reference in a new issue