Skip to content

Commit

Permalink
Generate dune files to support coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
aantron committed Mar 23, 2020
1 parent b9f29d3 commit 7baf8b9
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 16 deletions.
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ ppx_let-test-deps :
opam install --yes --unset-root ppx_let

.PHONY: clean
clean:
clean :
dune clean
find . -name '.merlin' | xargs rm -f
rm -fr docs/api
rm -f src/unix/discover_arguments
for TEST in `ls -d test/packaging/*/*` ; \
Expand All @@ -102,11 +101,9 @@ EXPECTED_FILES := \
--do-not-expect src/unix/unix_c/

.PHONY: coverage
coverage: clean coverage-only

.PHONY : coverage-only
coverage-only :
BISECT_ENABLE=yes $(MAKE) build
coverage :
rm -rf _build/default/test/ppx_expect
find _build -name '*.coverage' | xargs rm
BISECT_ENABLE=yes dune runtest --force
bisect-ppx-report html $(EXPECTED_FILES)
bisect-ppx-report summary
Expand Down
13 changes: 12 additions & 1 deletion src/core/dune
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
(* -*- tuareg -*- *)

let preprocess =
match Sys.getenv "BISECT_ENABLE" with
| "yes" -> "(preprocess (pps bisect_ppx))"
| _ | exception _ -> ""

let () = Jbuild_plugin.V1.send @@ {|

(library
(public_name lwt)
(synopsis "Monadic promises and concurrent I/O")
(wrapped false)
(preprocess (pps bisect_ppx --conditional))
|} ^ preprocess ^ {|
(libraries bytes result seq)
(flags (:standard -w +A-29)))

(documentation
(package lwt))

|}
13 changes: 12 additions & 1 deletion src/ppx/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* -*- tuareg -*- *)

let bisect_ppx =
match Sys.getenv "BISECT_ENABLE" with
| "yes" -> "bisect_ppx"
| _ | exception _ -> ""

let () = Jbuild_plugin.V1.send @@ {|

(library
(name ppx_lwt)
(public_name lwt_ppx)
Expand All @@ -6,5 +15,7 @@
(libraries compiler-libs.common ocaml-migrate-parsetree ppx_tools_versioned)
(ppx_runtime_libraries lwt)
(kind ppx_rewriter)
(preprocess (pps ppx_tools_versioned.metaquot_410 bisect_ppx --conditional))
(preprocess (pps ppx_tools_versioned.metaquot_410 |} ^ bisect_ppx ^ {|))
(flags (:standard -w +A-4)))

|}
13 changes: 12 additions & 1 deletion src/react/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* -*- tuareg -*- *)

let preprocess =
match Sys.getenv "BISECT_ENABLE" with
| "yes" -> "(preprocess (pps bisect_ppx))"
| _ | exception _ -> ""

let () = Jbuild_plugin.V1.send @@ {|

(rule
(targets lwt_react.ml)
(deps (:ml lwt_react.cppo.ml))
Expand All @@ -10,5 +19,7 @@
(synopsis "Reactive programming helpers for Lwt")
(wrapped false)
(libraries lwt react)
(preprocess (pps bisect_ppx --conditional))
|} ^ preprocess ^ {|
(flags (:standard -w +A)))

|}
13 changes: 12 additions & 1 deletion src/unix/dune
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
(* -*- tuareg -*- *)

let preprocess =
match Sys.getenv "BISECT_ENABLE" with
| "yes" -> "(preprocess (pps bisect_ppx))"
| _ | exception _ -> ""

let () = Jbuild_plugin.V1.send @@ {|

(rule
(targets lwt_unix.ml)
(deps (:ml lwt_unix.cppo.ml))
Expand Down Expand Up @@ -33,7 +42,7 @@
(optional)
(wrapped false)
(libraries bigarray lwt mmap ocplib-endian.bigstring threads unix)
(preprocess (pps bisect_ppx --conditional))
|} ^ preprocess ^ {|
(c_names
lwt_unix_stubs
lwt_libev_stubs
Expand Down Expand Up @@ -167,3 +176,5 @@
(install_c_headers lwt_features lwt_config lwt_unix)
(c_flags -I. (:include unix_c_flags.sexp))
(c_library_flags (:include unix_c_library_flags.sexp)))

|}
10 changes: 5 additions & 5 deletions test/ppx_expect/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
(name main)
(libraries lwttester))

(alias
(name runtest)
(package lwt_ppx)
(deps (source_tree cases))
(action (run %{exe:main.exe})))
; (alias
; (name runtest)
; (package lwt_ppx)
; (deps (source_tree cases))
; (action (run %{exe:main.exe})))

0 comments on commit 7baf8b9

Please sign in to comment.