progress on test ...

This commit is contained in:
craff 2022-12-06 18:18:39 -10:00
parent 405623610d
commit 45d49f5dcc
8 changed files with 49 additions and 48 deletions

View file

@ -7,7 +7,7 @@
(executable (executable
(name sse_server_domains) (name sse_server_domains)
(modules sse_server_domains) (modules sse_server_domains)
(enabled_if (>= %{ocaml_version} 5.00.0)) (enabled_if (>= %{ocaml_version} 5.0.0))
(libraries tiny_httpd tiny_httpd_domains unix ptime ptime.clock.os)) (libraries tiny_httpd tiny_httpd_domains unix ptime ptime.clock.os))
(executable (executable
@ -24,7 +24,7 @@
(executable (executable
(name echo_domains) (name echo_domains)
(flags :standard -warn-error -a+8) (flags :standard -warn-error -a+8)
(enabled_if (>= %{ocaml_version} 5.00.0)) (enabled_if (>= %{ocaml_version} 5.0.0))
(modules echo_domains vfs_domains) (modules echo_domains vfs_domains)
(libraries tiny_httpd tiny_httpd_camlzip tiny_httpd_domains)) (libraries tiny_httpd tiny_httpd_camlzip tiny_httpd_domains))
@ -34,7 +34,15 @@
(enabled_if (= %{system} "linux")) (enabled_if (= %{system} "linux"))
(package tiny_httpd) (package tiny_httpd)
(action (action
(with-stdout-to %{targets} (run %{script})))) (with-stdout-to %{targets} (run %{script} 8082))))
(rule
(targets test_output_domains.txt)
(deps (:script ./run_test.sh) ./sse_client.exe ./sse_server_domains.exe)
(enabled_if (and (= %{system} "linux") (>= %{ocaml_version} 5.0.0)))
(package tiny_httpd)
(action
(with-stdout-to %{targets} (run %{script} 8083))))
(rule (rule
(alias runtest) (alias runtest)
@ -44,6 +52,14 @@
(action (action
(diff test_output.txt.expected test_output.txt))) (diff test_output.txt.expected test_output.txt)))
(rule
(alias runtest)
(package tiny_httpd_domains)
(enabled_if (and (= %{system} "linux") (>= %{ocaml_version} 5.0.0)))
(deps test_output_domains.txt)
(action
(diff test_output_domains.txt.expected test_output_domains.txt)))
; produce an embedded FS ; produce an embedded FS
(rule (rule
(targets vfs.ml) (targets vfs.ml)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PORT=8082 PORT=$1
./sse_server.exe -p $PORT & ./sse_server.exe -p $PORT &
PID=$! PID=$!
@ -10,14 +10,3 @@ sleep 0.1
kill $PID kill $PID
echo "success" echo "success"
if [ -f ./sse_server_domains.exe ]; then
./sse_server_domains.exe -p $PORT &
PID=$!
sleep 0.1
./sse_client.exe -p $PORT --alarm=1 /count | tr -d '\r' || true
kill $PID
echo "success with domains"
fi

View file

@ -24,29 +24,3 @@ data: 8
data: 9 data: 9
success success
listening on http://localhost:8082/
connect to 127.0.0.1:8082
HTTP/1.1 200 OK
content-type: text/event-stream
data: 0
data: 1
data: 2
data: 3
data: 4
data: 5
data: 6
data: 7
data: 8
data: 9
success with domains

View file

@ -2,7 +2,7 @@
(library (library
(name tiny_httpd_domains) (name tiny_httpd_domains)
(public_name tiny_httpd_domains) (public_name tiny_httpd_domains)
(enabled_if (>= %{ocaml_version} 5.00.0)) (enabled_if (>= %{ocaml_version} 5.0.0))
(synopsis "Allowing to use ocaml domains instead of theads") (synopsis "Allowing to use ocaml domains instead of theads")
(flags :standard -safe-string -warn-error -a+8) (flags :standard -safe-string -warn-error -a+8)
(libraries tiny_httpd domainslib)) (libraries tiny_httpd domainslib))

View file

@ -5,7 +5,15 @@
(locks /port) (locks /port)
(enabled_if (= %{system} "linux")) (enabled_if (= %{system} "linux"))
(package tiny_httpd_camlzip) (package tiny_httpd_camlzip)
(action (with-stdout-to %{targets} (run ./echo1.sh %{bin})))) (action (with-stdout-to %{targets} (run ./echo1.sh %{bin} 8085))))
(rule
(targets echo1_domains.out)
(deps (:bin ../examples/echo_domains.exe))
(locks /port)
(enabled_if (and (= %{system} "linux") (>= %{ocaml_version} 5.0.0)))
(package tiny_httpd_domains)
(action (with-stdout-to %{targets} (run ./echo1.sh %{bin} 8095))))
(rule (rule
(alias runtest) (alias runtest)
@ -13,19 +21,33 @@
(enabled_if (= %{system} "linux")) (enabled_if (= %{system} "linux"))
(action (diff echo1.expect echo1.out))) (action (diff echo1.expect echo1.out)))
(rule
(alias runtest)
(package tiny_httpd_camlzip)
(enabled_if (and (= %{system} "linux") (>= %{ocaml_version} 5.0.0)))
(action (diff echo1_domains.expect echo1_domains.out)))
(rule (rule
(targets sse_count.out) (targets sse_count.out)
(deps (:bin ../examples/sse_server.exe)) (deps (:bin ../examples/sse_server.exe))
(locks /port) (locks /port)
(enabled_if (= %{system} "linux")) (enabled_if (= %{system} "linux"))
(package tiny_httpd) (package tiny_httpd)
(action (with-stdout-to %{targets} (run ./sse_count.sh %{bin})))) (action (with-stdout-to %{targets} (run ./sse_count.sh %{bin} 8086))))
(rule
(targets sse_count_domains.out)
(deps (:bin ../examples/sse_server_domains.exe))
(locks /port)
(enabled_if (and (= %{system} "linux") (>= %{ocaml_version} 5.0.0)))
(package tiny_httpd_domains)
(action (with-stdout-to %{targets} (run ./sse_count.sh %{bin} 8096))))
(rule (rule
(alias runtest) (alias runtest)
(package tiny_httpd) (package tiny_httpd)
(enabled_if (= %{system} "linux")) (enabled_if (= %{system} "linux"))
(action (diff sse_count.expect sse_count.out))) (action (diff sse_count_domains.expect sse_count_domains.out)))
(rule (rule
(targets upload-out) (targets upload-out)

View file

@ -43,7 +43,7 @@ sub
<a href="/vfs/test_out.txt"> <a href="/vfs/test_out.txt">
test_out.txt test_out.txt
</a> </a>
(431b) (209b)
</li> </li>
</ul> </ul>
</body> </body>

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
ECHO=$1 ECHO=$1
PORT=8085 PORT=$2
"$ECHO" -p $PORT & "$ECHO" -p $PORT &
PID=$! PID=$!

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh #!/usr/bin/env sh
SSE_SERVER=$1 SSE_SERVER=$1
PORT=8086 PORT=$2
"$SSE_SERVER" -p $PORT & "$SSE_SERVER" -p $PORT &
PID=$! PID=$!