package bisect_ppx

  1. Overview
  2. Docs
Code coverage for OCaml

Install

Dune Dependency

Authors

Maintainers

Sources

1.3.4.tar.gz
sha256=705506c70031ead84a3a3f22d61725f37be750518b13420b0c472e48bc07221a
md5=7371bd9a98c43b952bfa1ae2d374af3d

doc/bisect_ppx.runtime/Bisect/Runtime/index.html

Module Bisect.Runtime

This module provides runtime support for Bisect. Instrumented programs should hence be linked with this module.

Each instrumented file creates an array of counters, one for each point in that file. It then registers the array with this runtime module. Upon program exit (using at_exit), this module dumps the accumulated counts from all the arrays into an output file.

The default base name for the output file is bisect in the current directory, but another base name can be specified using the BISECT_FILE environment variable. The actual file name is the first non-existing <base><n>.out file where base is the base name and n a natural number value padded with zeroes to 4 digits (i.e. "0001", "0002", and so on).

Another environment variable can be used to customize the behaviour of Bisect: BISECT_SILENT. If this variable is set to YES or ON (ignoring case), then Bisect will not output any message. Otherwise, Bisect will output a message in two situations:

  • when the output file cannot be created at program termination;
  • when the data cannot be written at program termination. If BISECT_SILENT is set to ERR (ignoring case), these error messages are routed to stderr, otherwise BISECT_SILENT is used to determine a filename for this output. The default value is bisect.log.

Because instrumented modules refer to Bisect, one is advised to link this module as one of the first ones of the program.

Since the counts output file and log file are, by default, relative to the current working directory, an instrumented process should be careful about changing its working directory, or else BISECT_FILE and BISECT_SILENT should be specified with absolute paths.

val register_file : string -> point_count:int -> point_definitions:string -> [ `Staged of int -> unit ]

register_file file ~point_count ~point_definitions indicates that the file file is part of the application that has been instrumented. point_definitions is a serialized Common.point_definition list giving the locations of all points in the file. The returned callback is used to increment visitation counts.

val dump_counters_exn : out_channel -> unit

dump_counters_exn channel dumps the runtime coverage counters to the specified channel.

An exception is raised if writing is not successful

val reset_counters : unit -> unit

reset_counters () will reset the runtime coverage counters.

OCaml

Innovation. Community. Security.