caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Coverage profiling with bisect_ppx, Oasis, and OCamlbuild - best practice?
@ 2016-05-19 18:46 Christian Lindig
  2016-05-19 19:03 ` Gabriel Scherer
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Lindig @ 2016-05-19 18:46 UTC (permalink / raw)
  To: caml-list; +Cc: antonbachin, Gabriel Scherer


Bisect_ppx (https://github.com/aantron/bisect_ppx) is a great tool for instrument code for coverage profiling. I’d like to explore the best way to use this in a bigger project that is built with Oasis/OCamlbuild. In particular, I’d like to find a high-level way to specify that I want variants of binaries produced, analogous to 

	binary.native
	binary.byte
	binary.coverage (say, for native binary with coverage instrumentation)

without duplicating too much code in the _oasis file. It is my goal to produce such binaries for installation and hence would like to avoid doing this sequentially like in 

	make opt; make clean; make byte; make clean 

but rather have one target that produces all variants. If this is impossible, I’d revert to building variants sequentially. The reason I expect this to be difficult is that an object file produced with and without instrumentation looks the same and thus it might be difficult for the build system to understand that these need the be rebuilt. 

Code instrumented for coverage needs to be compiled with the corresponding PPX. OCamlfind and OCamlbuild abstracts this nicely. For compiling example.ml it’s enough to say:

	ocamlbuild —use-ocamlfind -pkg bisect_ppx example.native

It is less obvious how to organise this in a bigger project. (For now I add rules 

	<**/*.ml{,i,y}>: pkg_bisect_ppx 
	<**/*.native>: pkg_bisect_ppx 

to the _tags file generated by Oasis.) I believe the problem already arises with profiling and debugging builds and I would be happy to learn how OCamlbuild can be directed via myocamlbuild.ml to do this. 

— Christian


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-19 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 18:46 [Caml-list] Coverage profiling with bisect_ppx, Oasis, and OCamlbuild - best practice? Christian Lindig
2016-05-19 19:03 ` Gabriel Scherer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).