OCaml Notes

Stack traces

https://ocaml.org/docs/error-handling#stack-traces

OCAMLRUNPARAM=b ./myprogram [args]

And you will get a stack trace. Alternatively, you can call, from within the program,

let () = Printexc.record_backtrace true

Coverage

of binary

dune build --instrument-with bisect_ppx

Coverage of dune cram tests with bisect_ppx

Sandboxing of cram tests deletes the .coverage files, thus the following workaround:

BISECT_FILE=$(pwd)/bisect dune runtest --force --instrument-with bisect_ppx