Presentation
mlcov is a coverage tool for Objective Caml with MC/DC.
mlcov is available as a patch for the version 3.09.3 of the
Objective Caml compiler sources.
It is distributed under the CeCILL-B License and is copyrighted by
Esterel Technologies.
Building
In this guide, we will assume that the user has access to a unix
shell providing the wget, patch and make tools.
We also assume that you have ocaml 3.09.3 installed, as it may not build with an other version of ocaml.
- The first step is to download and unpack the compiler :
wget http://caml.inria.fr/pub/distrib/ocaml-3.09/ocaml-3.09.3.tar.bz2
tar xjf ocaml-3.09.3.tar.bz2
- Then we download the patch and apply it :
wget http://mlcov.ortsa.com/mlcov.patch.gz
gzip -d mlcov.patch.gz
cd ocaml-3.09.3
patch -p1 < ../mlcov.patch
- Finally, we build the tool :
touch .depend
make depend
make
Testing
Now that we have compiled mlcov, let's try it on a little
example. We will use for instance a little solver for the n
queens problem written by Pierre Weis.
- We download the original source :
wget http://mlcov.ortsa.com/queens.ml
- Then we instrument it and compile the instrumented source :
./mlcov queens.ml
ocamlopt -I cov cov/mlcovTrace.cmx queens_instr.ml -o queens_instr
- Finally, we can run the program, process the trace and examine the results :
./queens_instr
./mlcov queens.mlcov
firefox queens_annot.html queens_summary.html
Download
Contacts
FAQ
Q : I can't build the tool
A : You need to use ocamlopt 3.09.3 (it won't work with ocamlopt 3.10)