mirror of
https://github.com/c-cube/tiny_httpd.git
synced 2025-12-06 11:15:35 -05:00
test: use different ports for each test, run some targets only on linux
This commit is contained in:
parent
bcce3e22dc
commit
b468854626
10 changed files with 24 additions and 15 deletions
2
.github/workflows/main.yml
vendored
2
.github/workflows/main.yml
vendored
|
|
@ -16,6 +16,6 @@ jobs:
|
|||
- run: opam pin -n .
|
||||
- run: opam depext -yt tiny_httpd tiny_httpd_camlzip
|
||||
- run: opam install -t . --deps-only
|
||||
- run: opam exec -- dune build
|
||||
- run: opam exec -- dune build @install
|
||||
- run: opam exec -- dune runtest
|
||||
if: ${{ matrix.operating-system == 'unbuntu-latest' }}
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
serve directory . on http://127.0.0.1:8083
|
||||
serve directory . on http://127.0.0.1:8084
|
||||
0 0 52428800 data2
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
SERVER=$1
|
||||
"$SERVER" . -p 8083 &
|
||||
PORT=8084
|
||||
"$SERVER" . -p $PORT &
|
||||
|
||||
sleep 0.1
|
||||
|
||||
curl -N 'http://localhost:8083/foo_50' -o data2 \
|
||||
curl -N "http://localhost:${PORT}/foo_50" -o data2 \
|
||||
-H 'Tranfer-encoding: chunked'
|
||||
|
||||
kill %1
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
(targets echo1.out)
|
||||
(deps (:bin ../examples/echo.exe))
|
||||
(locks /port)
|
||||
(enabled_if (= %{system} "linux"))
|
||||
(action (with-stdout-to %{targets} (run ./echo1.sh %{bin}))))
|
||||
|
||||
(rule
|
||||
|
|
@ -13,6 +14,7 @@
|
|||
(targets sse_count.out)
|
||||
(deps (:bin ../examples/sse_server.exe))
|
||||
(locks /port)
|
||||
(enabled_if (= %{system} "linux"))
|
||||
(action (with-stdout-to %{targets} (run ./sse_count.sh %{bin}))))
|
||||
|
||||
(rule
|
||||
|
|
@ -23,6 +25,7 @@
|
|||
(targets upload-out)
|
||||
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
||||
(locks /port)
|
||||
(enabled_if (= %{system} "linux"))
|
||||
(action (with-stdout-to %{targets}
|
||||
(run ./upload_chunked.sh %{bin}))))
|
||||
|
||||
|
|
@ -34,6 +37,7 @@
|
|||
(targets dl-out)
|
||||
(deps (:bin ../src/bin/http_of_dir.exe) foo_50)
|
||||
(locks /port)
|
||||
(enabled_if (= %{system} "linux"))
|
||||
(action (with-stdout-to %{targets}
|
||||
(run ./download_chunked.sh %{bin}))))
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
listening on http://127.0.0.1:8083
|
||||
listening on http://127.0.0.1:8085
|
||||
echo:
|
||||
{meth=GET; host=localhost:8083;
|
||||
{meth=GET; host=localhost:8085;
|
||||
headers=[user-agent: test
|
||||
accept: */*
|
||||
host: localhost:8083];
|
||||
host: localhost:8085];
|
||||
path="/echo/?a=b&c=d"; body=""; path_components=["echo"];
|
||||
query=["c","d";"a","b"]}
|
||||
(query: "c" = "d";"a" = "b")
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
ECHO=$1
|
||||
PORT=8085
|
||||
|
||||
"$ECHO" -p 8083 &
|
||||
"$ECHO" -p $PORT &
|
||||
sleep 0.1
|
||||
curl -N 'http://localhost:8083/echo/?a=b&c=d' -H user-agent:test
|
||||
curl -N "http://localhost:${PORT}/echo/?a=b&c=d" -H user-agent:test
|
||||
kill %1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
listening on http://localhost:8083/
|
||||
listening on http://localhost:8086/
|
||||
data: 0
|
||||
|
||||
data: 1
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
SSE_SERVER=$1
|
||||
PORT=8086
|
||||
|
||||
"$SSE_SERVER" -p 8083 &
|
||||
"$SSE_SERVER" -p $PORT &
|
||||
sleep 0.1
|
||||
|
||||
curl -N 'http://localhost:8083/count/10' -H user-agent:test
|
||||
curl -N "http://localhost:${PORT}/count/10" -H user-agent:test
|
||||
kill %1
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
serve directory . on http://127.0.0.1:8083
|
||||
serve directory . on http://127.0.0.1:8087
|
||||
upload successful 0 0 52428800 data
|
||||
|
|
|
|||
|
|
@ -3,11 +3,13 @@
|
|||
rm data
|
||||
|
||||
SERVER=$1
|
||||
"$SERVER" . -p 8083 --upload --max-upload 100000000000 &
|
||||
PORT=8087
|
||||
|
||||
"$SERVER" . -p $PORT --upload --max-upload 100000000000 &
|
||||
|
||||
sleep 0.1
|
||||
|
||||
cat foo_50 | curl -N -X PUT http://localhost:8083/data --data-binary @- -H 'Transfer-Encoding: chunked'
|
||||
cat foo_50 | curl -N -X PUT http://localhost:$PORT/data --data-binary @- -H 'Transfer-Encoding: chunked'
|
||||
|
||||
kill %1
|
||||
wc data
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue