diff --git a/README.md b/README.md index e92607ef..db8d655d 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,7 @@ In a toplevel, using ocamlfind: ```ocaml # #use "topfind";; # #require "containers";; +# #require "containers-data";; # CCList.flat_map;; - : ('a -> 'b list) -> 'a list -> 'b list = # open Containers;; (* optional *) diff --git a/containers-thread.opam b/containers-thread.opam index 7c2ba13a..0e7ac437 100644 --- a/containers-thread.opam +++ b/containers-thread.opam @@ -14,6 +14,7 @@ depends: [ "base-threads" "dune-configurator" "containers" { = version } + "iter" { with-test } "qtest" { with-test } "qcheck" { with-test } "ounit" { with-test } diff --git a/dune b/dune index 2dd4be13..b918fb11 100644 --- a/dune +++ b/dune @@ -1,6 +1,6 @@ (rule (targets README.md.corrected) - (deps (package containers)) + (deps (package containers-data)) (action (run ocaml-mdx test %{dep:README.md} -o %{targets}))) (alias diff --git a/qtest/dune b/qtest/dune index faf6d55e..163f1066 100644 --- a/qtest/dune +++ b/qtest/dune @@ -1,16 +1,13 @@ (executable (name make) - (modules make) - ) + (flags :standard -warn-error -a) + (modules make)) (rule (targets run_qtest.ml) (deps make.bc (source_tree ../src)) - ;(libraries (qtest qcheck)) - (action - (run ./make.bc -target %{targets})) - ) + (action (run ./make.bc -target %{targets} ../src/core ../src/unix/))) (executable (name run_qtest) @@ -18,14 +15,45 @@ (modules run_qtest) ; disable some warnings in qtests (flags :standard -warn-error -a -w -3-33-35-27-39 -nolabels) - (libraries iter gen qcheck containers containers.unix - containers.data containers.thread containers.iter - containers.sexp uutf) - ) + (libraries iter gen qcheck containers containers.unix unix uutf)) (alias (name runtest) - (deps run_qtest.exe) - (action (run %{deps})) - ) + (package containers) + (action (run ./run_qtest.exe))) +(rule + (targets run_qtest_data.ml) + (deps make.bc (source_tree ../src/data)) + (action (run ./make.bc -target %{targets} ../src/data))) + +(executable + (name run_qtest_data) + (modes native) + (modules run_qtest_data) + ; disable some warnings in qtests + (flags :standard -warn-error -a -w -3-33-35-27-39) + (libraries iter gen qcheck containers containers-data)) + +(alias + (name runtest) + (package containers-data) + (action (run ./run_qtest_data.exe))) + +(rule + (targets run_qtest_thread.ml) + (deps make.bc (source_tree ../src/threads)) + (action (run ./make.bc -target %{targets} ../src/threads))) + +(executable + (name run_qtest_thread) + (modes native) + (modules run_qtest_thread) + ; disable some warnings in qtests + (flags :standard -warn-error -a -w -3-33-35-27-39) + (libraries qcheck containers containers-thread iter threads)) + +(alias + (name runtest) + (package containers-thread) + (action (run ./run_qtest_thread.exe))) diff --git a/qtest/make.ml b/qtest/make.ml index 715234ff..6a5d0c68 100644 --- a/qtest/make.ml +++ b/qtest/make.ml @@ -16,6 +16,7 @@ let is_code file = is_suffix ~sub:".ml" file || is_suffix ~sub:".mli" file let do_not_test file = assert (not (is_suffix ~sub:"make.ml" file)); + str_sub ~sub:"Labels.ml" file || is_suffix ~sub:"containers.ml" file || is_suffix ~sub:"containers_top.ml" file || is_suffix ~sub:"mkflags.ml" file || @@ -37,9 +38,11 @@ let list_files dir : string list = in f ~prefix:"" [] dir -let run_qtest target = +let run_qtest target dirs = let files = - list_files "../src/" + dirs + |> List.map list_files + |> List.flatten |> List.map (Printf.sprintf "'%s'") |> String.concat " " in @@ -51,8 +54,9 @@ let run_qtest target = let () = let target = ref "" in + let dirs = ref [] in Arg.parse ["-target", Arg.Set_string target, " set target"] - (fun _ -> ()) "make.ml -target file"; + (fun d -> dirs := d :: !dirs) "make.ml -target file dir+"; if !target="" then failwith "please specify a target"; if Sys.command "which qtest > /dev/null" <> 0 then ( (* create empty file *) @@ -60,5 +64,5 @@ let () = output_string out ""; close_out out; ) else ( - run_qtest !target + run_qtest !target !dirs ) diff --git a/src/threads/dune b/src/threads/dune index 4df73ac3..34ac97f9 100644 --- a/src/threads/dune +++ b/src/threads/dune @@ -1,10 +1,10 @@ (library (name containers_thread) - (public_name containers.thread) + (public_name containers-thread) (wrapped false) (optional) - (flags :standard -w +a-4-42-44-48-50-58-32-60@8 -safe-string -open CCShims_) + (flags :standard -warn-error -a+8 -safe-string -open CCShims_) (ocamlopt_flags :standard (:include ../flambda.flags)) (libraries containers threads))