File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
blackbox-tests/test-cases/pkg Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ A file that will comprise the package source:
1515 $ echo " Hello, World!" > foo. txt
1616
1717Run the server in the background:
18+
19+ We have some really slow tests here
20+ $ export DUNE_WEBSERVER_TIMEOUT= 10
21+
1822 $ webserver_oneshot -- content-file foo. txt -- port-file port. txt &
1923 $ until test -f port. txt; do sleep 0.1 ; done
2024 $ PORT= $ (cat port. txt)
Original file line number Diff line number Diff line change @@ -36,8 +36,23 @@ module Server = struct
3636 loop ()
3737 ;;
3838
39+ let auto_shutdown_seconds =
40+ match Sys. getenv_opt " DUNE_WEBSERVER_TIMEOUT" with
41+ | None -> 5.
42+ | Some s -> Float. of_string s |> Option. value_exn
43+ ;;
44+
3945 let accept t ~f =
40- let descr, _sockaddr = Unix. accept ~cloexec: true t.sock in
46+ let descr, _sockaddr =
47+ let read_fds, _write_fds, _excpt_fds =
48+ Unix. select [ t.sock ] [] [] auto_shutdown_seconds
49+ in
50+ match read_fds with
51+ | _ :: _ -> Unix. accept ~cloexec: true t.sock
52+ | [] ->
53+ Format. eprintf " Exiting after timeout@." ;
54+ failwith " timeout"
55+ in
4156 let out = Unix. out_channel_of_descr descr in
4257 let in_ = Unix. in_channel_of_descr descr in
4358 let session = in_, out in
You can’t perform that action at this time.
0 commit comments