diff --git a/_oasis b/_oasis index dd1502b75a..5283a8590e 100644 --- a/_oasis +++ b/_oasis @@ -35,6 +35,15 @@ Library cohttp XMETARequires: re.emacs, stringext, uri, uri.services, fieldslib, sexplib, bytes, base64 +Library cohttp_test + Build$: flag(tests) + Install: false + Path: lib + Findlibname: test + FindlibParent: cohttp + Modules: Cohttp_test + BuildDepends: cohttp, oUnit + Flag lwt Description: build the Lwt library Default: false @@ -104,9 +113,18 @@ Library cohttp_lwt_unix_test Path: lwt Findlibname: lwt-unix-test FindlibParent: cohttp - BuildDepends: cohttp.lwt, unix, lwt.unix, oUnit + BuildDepends: cohttp.test, cohttp.lwt, unix, lwt.unix, oUnit Modules: Cohttp_lwt_unix_test +Library cohttp_async_test + Build$: flag(async) && flag(tests) + Install: false + Path: async + Findlibname: async-test + FindlibParent: cohttp + BuildDepends: cohttp.test, cohttp.async, oUnit + Modules: Cohttp_async_test + Document cohttp Title: Cohttp docs Type: ocamlbuild (0.3) @@ -286,6 +304,15 @@ Executable test_net_async_server Install: false BuildDepends: cohttp, cohttp.async, oUnit (>= 1.0.2) +Executable test_async_integration + Path: lib_test + MainIs: test_async_integration.ml + Build$: flag(tests) && flag(async) + Custom: true + CompiledObject: best + Install: false + BuildDepends: cohttp.async-test + Executable "cohttp-server-async" Path: bin MainIs: cohttp_server_async.ml @@ -406,6 +433,11 @@ Test test_sanity Command: $test_sanity WorkingDirectory: lib_test +Test test_async_integration + Run$: flag(tests) && flag(async) + Command: $test_async_integration + WorkingDirectory: lib_test + SourceRepository master Type: git Location: https://github.com/mirage/ocaml-cohttp.git diff --git a/_tags b/_tags index 31f352b63c..2e683cb8f7 100644 --- a/_tags +++ b/_tags @@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: 5fa3841c8dc3c29fb17f88da786b068b) +# DO NOT EDIT (digest: ca939fa07e91bbabbbe072870f7f76b4) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process @@ -35,16 +35,20 @@ true: annot, bin_annot "lib/body.cmx": for-pack(Cohttp) "lib/string_io.cmx": for-pack(Cohttp) "lib/conf.cmx": for-pack(Cohttp) +# Library cohttp_test +"lib/cohttp_test.cmxs": use_cohttp_test : pkg_base64 : pkg_bytes : pkg_fieldslib : pkg_fieldslib.syntax +: pkg_oUnit : pkg_re.emacs : pkg_sexplib : pkg_sexplib.syntax : pkg_stringext : pkg_uri : pkg_uri.services +: use_cohttp # Library cohttp_lwt "lwt/cohttp_lwt.cmxs": use_cohttp_lwt # Library cohttp_lwt_unix @@ -69,21 +73,6 @@ true: annot, bin_annot : use_cohttp_lwt # Library cohttp_async "async/cohttp_async.cmxs": use_cohttp_async -: pkg_async -: pkg_base64 -: pkg_bytes -: pkg_conduit.async -: pkg_fieldslib -: pkg_fieldslib.syntax -: pkg_magic-mime -: pkg_re.emacs -: pkg_sexplib -: pkg_sexplib.syntax -: pkg_stringext -: pkg_threads -: pkg_uri -: pkg_uri.services -: use_cohttp # Library cohttp_lwt_unix_test "lwt/cohttp_lwt_unix_test.cmxs": use_cohttp_lwt_unix_test : pkg_base64 @@ -105,6 +94,27 @@ true: annot, bin_annot : use_cohttp : use_cohttp_lwt : use_cohttp_lwt_unix +: use_cohttp_test +# Library cohttp_async_test +"async/cohttp_async_test.cmxs": use_cohttp_async_test +: pkg_async +: pkg_base64 +: pkg_bytes +: pkg_conduit.async +: pkg_fieldslib +: pkg_fieldslib.syntax +: pkg_magic-mime +: pkg_oUnit +: pkg_re.emacs +: pkg_sexplib +: pkg_sexplib.syntax +: pkg_stringext +: pkg_threads +: pkg_uri +: pkg_uri.services +: use_cohttp +: use_cohttp_async +: use_cohttp_test # Executable test_parser : pkg_base64 : pkg_bytes @@ -406,11 +416,33 @@ true: annot, bin_annot : pkg_uri.services : use_cohttp : use_cohttp_async +: custom +# Executable test_async_integration +: pkg_async +: pkg_base64 +: pkg_bytes +: pkg_conduit.async +: pkg_fieldslib +: pkg_fieldslib.syntax +: pkg_magic-mime +: pkg_oUnit +: pkg_re.emacs +: pkg_sexplib +: pkg_sexplib.syntax +: pkg_stringext +: pkg_threads +: pkg_uri +: pkg_uri.services +: use_cohttp +: use_cohttp_async +: use_cohttp_async_test +: use_cohttp_test : pkg_async : pkg_conduit.async : pkg_threads : use_cohttp_async -: custom +: use_cohttp_async_test +: custom # Executable cohttp-server-async : pkg_async : pkg_base64 @@ -651,6 +683,7 @@ true: annot, bin_annot : use_cohttp_lwt : use_cohttp_lwt_unix : use_cohttp_lwt_unix_test +: use_cohttp_test : pkg_base64 : pkg_bytes : pkg_conduit.lwt-unix @@ -671,6 +704,7 @@ true: annot, bin_annot : use_cohttp_lwt : use_cohttp_lwt_unix : use_cohttp_lwt_unix_test +: use_cohttp_test : custom # OASIS_STOP true: principal, strict_sequence, debug diff --git a/async/cohttp_async.ml b/async/cohttp_async.ml index 92e9ba4643..c3f2be9015 100644 --- a/async/cohttp_async.ml +++ b/async/cohttp_async.ml @@ -321,4 +321,5 @@ module Server = struct >>| fun server -> { server } + let close { server } = Tcp.Server.close server end diff --git a/async/cohttp_async.mli b/async/cohttp_async.mli index 1c4da31b4d..7f29c265c2 100644 --- a/async/cohttp_async.mli +++ b/async/cohttp_async.mli @@ -191,4 +191,6 @@ module Server : sig ('address, 'listening_on) Tcp.Where_to_listen.t -> (body:Body.t -> 'address -> Request.t -> response Deferred.t) -> ('address, 'listening_on) t Deferred.t + + val close : (_, _) t -> unit Deferred.t end diff --git a/async/cohttp_async_test.ml b/async/cohttp_async_test.ml new file mode 100644 index 0000000000..0c33ba03c1 --- /dev/null +++ b/async/cohttp_async_test.ml @@ -0,0 +1,49 @@ +open Core.Std +open Async.Std +open OUnit +open Cohttp_async + +type 'a io = 'a Deferred.t +type body = Body.t +type spec = Request.t -> body -> (Response.t * body) io +type async_test = unit -> unit io + +let response_sequence = Cohttp_test.response_sequence failwith + +let temp_server ?port spec callback = + let port = match port with + | None -> Cohttp_test.next_port () + | Some p -> p in + let uri = Uri.of_string ("http://0.0.0.0:" ^ (string_of_int port)) in + let server = Server.create (Tcp.on_port port) (fun ~body _sock req -> spec req body) in + server >>= fun server -> + callback uri >>= fun res -> + Server.close server >>| fun () -> + res + +let test_server_s ?port ?(name="Cohttp Server Test") spec f = + temp_server ?port spec begin fun uri -> + Log.Global.info "Test %s running on %s" name (Uri.to_string uri); + let tests = f uri in + let results = + tests + |> Deferred.List.map ~how:`Sequential ~f:(fun (name, test) -> + Log.Global.debug "Running %s" name; + let res = + try_with test >>| function + | Ok () -> `Ok + | Error exn -> `Exn exn in + res >>| (fun res -> (name, res))) in + results >>| (fun results -> + let ounit_tests = + results + |> List.map ~f:(fun (name, res) -> + name >:: fun () -> + match res with + | `Ok -> () + | `Exn x -> raise x) in + name >::: ounit_tests) + end + +let run_async_tests test = + test >>| (fun a -> a |> OUnit.run_test_tt_main) diff --git a/async/cohttp_async_test.mldylib b/async/cohttp_async_test.mldylib new file mode 100644 index 0000000000..af704331e8 --- /dev/null +++ b/async/cohttp_async_test.mldylib @@ -0,0 +1,4 @@ +# OASIS_START +# DO NOT EDIT (digest: 3dc3ad561bd9817e1c4a2f960f9cd7fe) +Cohttp_async_test +# OASIS_STOP diff --git a/async/cohttp_async_test.mli b/async/cohttp_async_test.mli new file mode 100644 index 0000000000..96a4cb8e97 --- /dev/null +++ b/async/cohttp_async_test.mli @@ -0,0 +1,4 @@ +open Async.Std + +include Cohttp_test.S with type 'a io = 'a Deferred.t and type body = Cohttp_async.Body.t +val run_async_tests : OUnit.test io -> OUnit.test_result list Deferred.t diff --git a/async/cohttp_async_test.mllib b/async/cohttp_async_test.mllib new file mode 100644 index 0000000000..af704331e8 --- /dev/null +++ b/async/cohttp_async_test.mllib @@ -0,0 +1,4 @@ +# OASIS_START +# DO NOT EDIT (digest: 3dc3ad561bd9817e1c4a2f960f9cd7fe) +Cohttp_async_test +# OASIS_STOP diff --git a/lib/META b/lib/META index 72d4744e5d..6bb3083571 100644 --- a/lib/META +++ b/lib/META @@ -1,5 +1,5 @@ # OASIS_START -# DO NOT EDIT (digest: 6a971f1fc0aa571e67858b56e5337a8c) +# DO NOT EDIT (digest: 0993413eb2018c7116a8e1ceec9b45f9) version = "0.17.2" description = "HTTP library for Lwt, Async, JavaScript and Mirage" requires = @@ -9,10 +9,21 @@ archive(byte, plugin) = "cohttp.cma" archive(native) = "cohttp.cmxa" archive(native, plugin) = "cohttp.cmxs" exists_if = "cohttp.cma" +package "test" ( + version = "0.17.2" + description = "HTTP library for Lwt, Async, JavaScript and Mirage" + requires = "cohttp oUnit" + archive(byte) = "cohttp_test.cma" + archive(byte, plugin) = "cohttp_test.cma" + archive(native) = "cohttp_test.cmxa" + archive(native, plugin) = "cohttp_test.cmxs" + exists_if = "cohttp_test.cma" +) + package "lwt-unix-test" ( version = "0.17.2" description = "HTTP library for Lwt, Async, JavaScript and Mirage" - requires = "cohttp.lwt unix lwt.unix oUnit" + requires = "cohttp.test cohttp.lwt unix lwt.unix oUnit" archive(byte) = "cohttp_lwt_unix_test.cma" archive(byte, plugin) = "cohttp_lwt_unix_test.cma" archive(native) = "cohttp_lwt_unix_test.cmxa" @@ -53,6 +64,17 @@ package "js" ( exists_if = "cohttp_lwt_xhr.cma" ) +package "async-test" ( + version = "0.17.2" + description = "HTTP library for Lwt, Async, JavaScript and Mirage" + requires = "cohttp.test cohttp.async oUnit" + archive(byte) = "cohttp_async_test.cma" + archive(byte, plugin) = "cohttp_async_test.cma" + archive(native) = "cohttp_async_test.cmxa" + archive(native, plugin) = "cohttp_async_test.cmxs" + exists_if = "cohttp_async_test.cma" +) + package "async" ( version = "0.17.2" description = "HTTP library for Lwt, Async, JavaScript and Mirage" diff --git a/lib/cohttp_test.ml b/lib/cohttp_test.ml new file mode 100644 index 0000000000..31e95a49db --- /dev/null +++ b/lib/cohttp_test.ml @@ -0,0 +1,31 @@ +open Cohttp + +module type S = sig + type 'a io + type body + + type spec = Request.t -> body -> (Response.t * body) io + type async_test = unit -> unit io + + val response_sequence : (Response.t * body) io list -> spec + val temp_server : ?port:int -> spec -> (Uri.t -> 'a io) -> 'a io + val test_server_s : ?port:int -> ?name:string -> spec + -> (Uri.t -> (string * async_test) list) -> OUnit.test io + val run_async_tests : OUnit.test io -> OUnit.test_results io +end + +let port = ref 9193 + +let next_port () = + let current_port = !port in + incr port; + current_port + +let response_sequence fail responses = + let xs = ref responses in + fun _ _ -> + match !xs with + | x::xs' -> + xs := xs'; + x + | [] -> fail "response_sequence: Server exhausted responses" diff --git a/lib/cohttp_test.mldylib b/lib/cohttp_test.mldylib new file mode 100644 index 0000000000..f963c3c4da --- /dev/null +++ b/lib/cohttp_test.mldylib @@ -0,0 +1,4 @@ +# OASIS_START +# DO NOT EDIT (digest: f17d8de0cfcc25325cac44106642e75d) +Cohttp_test +# OASIS_STOP diff --git a/lib/cohttp_test.mli b/lib/cohttp_test.mli new file mode 100644 index 0000000000..587c651aab --- /dev/null +++ b/lib/cohttp_test.mli @@ -0,0 +1,32 @@ +open Cohttp + +module type S = sig + type 'a io + type body + + (** A server that is being tested must be defined by providing a spec *) + type spec = Request.t -> body -> (Response.t * body) io + + type async_test = unit -> unit io + + (** A server that returns the list of responses in sequences and crashes + on further requests *) + val response_sequence : (Response.t * body) io list -> spec + + (** Create a temporary server according to spec that lives until the callback + thread is determined. The uri provided in the callback should be the base + uri for any requests made to the temp server *) + val temp_server : ?port:int -> spec -> (Uri.t -> 'a io) -> 'a io + + (** Create a test suite against a server defined by spec. Tests + run sequentially. *) + val test_server_s : ?port:int -> ?name:string -> spec + -> (Uri.t -> (string * async_test) list) -> OUnit.test io + + (** Run an async unit test and return and print the result *) + val run_async_tests : OUnit.test io -> OUnit.test_results io +end + +(** Internal API. Subject to breakage *) +val next_port : unit -> int +val response_sequence : (string -> 'a) -> 'a list -> 'b -> 'c -> 'a diff --git a/lib/cohttp_test.mllib b/lib/cohttp_test.mllib new file mode 100644 index 0000000000..f963c3c4da --- /dev/null +++ b/lib/cohttp_test.mllib @@ -0,0 +1,4 @@ +# OASIS_START +# DO NOT EDIT (digest: f17d8de0cfcc25325cac44106642e75d) +Cohttp_test +# OASIS_STOP diff --git a/lib_test/test_async_integration.ml b/lib_test/test_async_integration.ml new file mode 100644 index 0000000000..25110a60fc --- /dev/null +++ b/lib_test/test_async_integration.ml @@ -0,0 +1,29 @@ +open Core.Std +open Async.Std +open OUnit +open Cohttp +open Cohttp_async +open Cohttp_async_test + +let chunk_body = ["one"; ""; " "; "bar"; ""] + +let server = + response_sequence [ + (* empty_chunk *) + Server.respond `OK ~body:(Body.of_string_list chunk_body) + ] + +let ts = + test_server_s server begin fun uri -> + let empty_chunk () = + let headers = Header.init_with "connection" "close" in + Client.get ~headers uri >>= fun (_, body) -> + body |> Body.to_string >>| fun body -> + assert_equal body (String.concat ~sep:"" chunk_body) in + [ "empty chunk test", empty_chunk + ] + end + +let () = + ts |> run_async_tests >>= (fun _ -> Shutdown.exit 0) |> don't_wait_for; + never_returns (Scheduler.go ()) diff --git a/lwt/cohttp_lwt_unix_test.ml b/lwt/cohttp_lwt_unix_test.ml index 03865bb827..ac97883f7f 100644 --- a/lwt/cohttp_lwt_unix_test.ml +++ b/lwt/cohttp_lwt_unix_test.ml @@ -3,30 +3,18 @@ open OUnit open Cohttp open Cohttp_lwt_unix -type spec = Request.t -> Cohttp_lwt_body.t - -> (Response.t * Cohttp_lwt_body.t) Lwt.t +type 'a io = 'a Lwt.t +type body = Cohttp_lwt_body.t -type async_test = unit -> unit Lwt.t - -let port = ref 9193 +type spec = Request.t -> body -> (Response.t * body) io -let next_port () = - let current_port = !port in - incr port; - current_port +type async_test = unit -> unit Lwt.t -let response_sequence responses = - let xs = ref responses in - fun _ _ -> - match !xs with - | x::xs' -> - xs := xs'; - x - | [] -> Lwt.fail_with "response_sequence: Server exhausted responses" +let response_sequence = Cohttp_test.response_sequence Lwt.fail_with let temp_server ?port spec callback = let port = match port with - | None -> next_port () + | None -> Cohttp_test.next_port () | Some p -> p in let server = Server.make ~callback:(fun _ req body -> spec req body) () in let uri = Uri.of_string ("http://0.0.0.0:" ^ (string_of_int port)) in diff --git a/lwt/cohttp_lwt_unix_test.mli b/lwt/cohttp_lwt_unix_test.mli index adaf2f3cee..6c1d8933b4 100644 --- a/lwt/cohttp_lwt_unix_test.mli +++ b/lwt/cohttp_lwt_unix_test.mli @@ -1,25 +1 @@ -(** Primitive testing framework for end to end tests *) -open Cohttp_lwt_unix - -(** A server that is being tested must be defined by providing a spec *) -type spec = Request.t -> Cohttp_lwt_body.t - -> (Response.t * Cohttp_lwt_body.t) Lwt.t - -type async_test = unit -> unit Lwt.t - -(** A server that returns the list of responses in sequences and crashes - on further requests *) -val response_sequence : (Response.t * Cohttp_lwt_body.t) Lwt.t list -> spec - -(** Create a temporary server according to spec that lives until the callback - thread is determined. The uri provided in the callback should be the base - uri for any requests made to the temp server *) -val temp_server : ?port:int -> spec -> (Uri.t -> 'a Lwt.t) -> 'a Lwt.t - -(** Create a test suite against a server defined by spec. Tests - run sequentially. *) -val test_server_s : ?port:int -> ?name:string -> spec - -> (Uri.t -> (string * async_test) list) -> OUnit.test Lwt.t - -(** Run an async unit test and return and print the result *) -val run_async_tests : OUnit.test Lwt.t -> OUnit.test_result list Lwt.t +include Cohttp_test.S with type 'a io = 'a Lwt.t and type body = Cohttp_lwt_body.t diff --git a/myocamlbuild.ml b/myocamlbuild.ml index c0e8215c37..d8f7f5b03f 100644 --- a/myocamlbuild.ml +++ b/myocamlbuild.ml @@ -1,5 +1,5 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 93a0d03554e33b5760ad108e3a889b01) *) +(* DO NOT EDIT (digest: ff6dfa24b5c9bce29b3a58476f2a0337) *) module OASISGettext = struct (* # 22 "src/oasis/OASISGettext.ml" *) @@ -610,11 +610,13 @@ let package_default = MyOCamlbuildBase.lib_ocaml = [ ("cohttp", ["lib"], []); + ("cohttp_test", ["lib"], []); ("cohttp_lwt", ["lwt"], []); ("cohttp_lwt_unix", ["lwt"], []); ("cohttp_lwt_xhr", ["js"], []); ("cohttp_async", ["async"], []); - ("cohttp_lwt_unix_test", ["lwt"], []) + ("cohttp_lwt_unix_test", ["lwt"], []); + ("cohttp_async_test", ["async"], []) ]; lib_c = []; flags = []; @@ -634,6 +636,6 @@ let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false} let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;; -# 638 "myocamlbuild.ml" +# 640 "myocamlbuild.ml" (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default;; diff --git a/setup.ml b/setup.ml index 8c7a842fdc..6a1d73af45 100644 --- a/setup.ml +++ b/setup.ml @@ -1,7 +1,7 @@ (* setup.ml generated for the first time by OASIS v0.4.5 *) (* OASIS_START *) -(* DO NOT EDIT (digest: f783e0506dc9d191380283a42a517685) *) +(* DO NOT EDIT (digest: 49fd2e9bf4e7c269d6718358f9bf3193) *) (* Regenerated by OASIS v0.4.5 Visit http://oasis.forge.ocamlcore.org for more information and @@ -6852,6 +6852,14 @@ let setup_t = [(OASISExpr.EBool true, ("$test_sanity", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] + }); + ("test_async_integration", + CustomPlugin.Test.main + { + CustomPlugin.cmd_main = + [(OASISExpr.EBool true, ("$test_async_integration", []))]; + cmd_clean = [(OASISExpr.EBool true, None)]; + cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; doc = @@ -6921,6 +6929,14 @@ let setup_t = [(OASISExpr.EBool true, ("$test_sanity", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] + }); + ("test_async_integration", + CustomPlugin.Test.clean + { + CustomPlugin.cmd_main = + [(OASISExpr.EBool true, ("$test_async_integration", []))]; + cmd_clean = [(OASISExpr.EBool true, None)]; + cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; clean_doc = @@ -6988,6 +7004,14 @@ let setup_t = [(OASISExpr.EBool true, ("$test_sanity", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] + }); + ("test_async_integration", + CustomPlugin.Test.distclean + { + CustomPlugin.cmd_main = + [(OASISExpr.EBool true, ("$test_async_integration", []))]; + cmd_clean = [(OASISExpr.EBool true, None)]; + cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; distclean_doc = []; @@ -7144,6 +7168,44 @@ let setup_t = lib_findlib_name = Some "cohttp"; lib_findlib_containers = [] }); + Library + ({ + cs_name = "cohttp_test"; + cs_data = PropList.Data.create (); + cs_plugin_data = [] + }, + { + bs_build = + [ + (OASISExpr.EBool true, false); + (OASISExpr.EFlag "tests", true) + ]; + bs_install = [(OASISExpr.EBool true, false)]; + bs_path = "lib"; + bs_compiled_object = Best; + bs_build_depends = + [ + InternalLibrary "cohttp"; + FindlibPackage ("oUnit", None) + ]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_c_sources = []; + bs_data_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])] + }, + { + lib_modules = ["Cohttp_test"]; + lib_pack = false; + lib_internal_modules = []; + lib_findlib_parent = Some "cohttp"; + lib_findlib_name = Some "test"; + lib_findlib_containers = [] + }); Flag ({ cs_name = "lwt"; @@ -7418,6 +7480,7 @@ let setup_t = bs_compiled_object = Best; bs_build_depends = [ + InternalLibrary "cohttp_test"; InternalLibrary "cohttp_lwt_unix"; FindlibPackage ("unix", None); FindlibPackage ("lwt.unix", None); @@ -7441,6 +7504,48 @@ let setup_t = lib_findlib_name = Some "lwt-unix-test"; lib_findlib_containers = [] }); + Library + ({ + cs_name = "cohttp_async_test"; + cs_data = PropList.Data.create (); + cs_plugin_data = [] + }, + { + bs_build = + [ + (OASISExpr.EBool true, false); + (OASISExpr.EAnd + (OASISExpr.EFlag "async", + OASISExpr.EFlag "tests"), + true) + ]; + bs_install = [(OASISExpr.EBool true, false)]; + bs_path = "async"; + bs_compiled_object = Best; + bs_build_depends = + [ + InternalLibrary "cohttp_test"; + InternalLibrary "cohttp_async"; + FindlibPackage ("oUnit", None) + ]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_c_sources = []; + bs_data_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])] + }, + { + lib_modules = ["Cohttp_async_test"]; + lib_pack = false; + lib_internal_modules = []; + lib_findlib_parent = Some "cohttp"; + lib_findlib_name = Some "async-test"; + lib_findlib_containers = [] + }); Doc ({ cs_name = "cohttp"; @@ -8144,6 +8249,40 @@ let setup_t = exec_custom = true; exec_main_is = "test_net_async_server.ml" }); + Executable + ({ + cs_name = "test_async_integration"; + cs_data = PropList.Data.create (); + cs_plugin_data = [] + }, + { + bs_build = + [ + (OASISExpr.EBool true, false); + (OASISExpr.EAnd + (OASISExpr.EFlag "tests", + OASISExpr.EFlag "async"), + true) + ]; + bs_install = [(OASISExpr.EBool true, false)]; + bs_path = "lib_test"; + bs_compiled_object = Best; + bs_build_depends = + [InternalLibrary "cohttp_async_test"]; + bs_build_tools = [ExternalTool "ocamlbuild"]; + bs_c_sources = []; + bs_data_files = []; + bs_ccopt = [(OASISExpr.EBool true, [])]; + bs_cclib = [(OASISExpr.EBool true, [])]; + bs_dlllib = [(OASISExpr.EBool true, [])]; + bs_dllpath = [(OASISExpr.EBool true, [])]; + bs_byteopt = [(OASISExpr.EBool true, [])]; + bs_nativeopt = [(OASISExpr.EBool true, [])] + }, + { + exec_custom = true; + exec_main_is = "test_async_integration.ml" + }); Executable ({ cs_name = "cohttp-server-async"; @@ -8661,6 +8800,38 @@ let setup_t = ]; test_tools = [ExternalTool "ocamlbuild"] }); + Test + ({ + cs_name = "test_async_integration"; + cs_data = PropList.Data.create (); + cs_plugin_data = [] + }, + { + test_type = (`Test, "custom", Some "0.4"); + test_command = + [ + (OASISExpr.EBool true, + ("$test_async_integration", [])) + ]; + test_custom = + { + pre_command = [(OASISExpr.EBool true, None)]; + post_command = [(OASISExpr.EBool true, None)] + }; + test_working_directory = Some "lib_test"; + test_run = + [ + (OASISExpr.ENot (OASISExpr.EFlag "tests"), false); + (OASISExpr.EFlag "tests", false); + (OASISExpr.EAnd + (OASISExpr.EFlag "tests", + OASISExpr.EAnd + (OASISExpr.EFlag "tests", + OASISExpr.EFlag "async")), + true) + ]; + test_tools = [ExternalTool "ocamlbuild"] + }); SrcRepo ({ cs_name = "master"; @@ -8686,7 +8857,7 @@ let setup_t = }; oasis_fn = Some "_oasis"; oasis_version = "0.4.5"; - oasis_digest = Some "%hIuñÂT\028h*(ÏØ¦t%"; + oasis_digest = Some "r\143.\005\031Jçõ!ß½ ÿ}\143\154"; oasis_exec = None; oasis_setup_args = []; setup_update = false @@ -8694,6 +8865,6 @@ let setup_t = let setup () = BaseSetup.setup setup_t;; -# 8698 "setup.ml" +# 8869 "setup.ml" (* OASIS_STOP *) let () = setup ();;