Skip to content

coverage is only being applied by running specific .exe test files #432

@midorishibukawa

Description

@midorishibukawa

hello!

I'm trying to get test coverage for a project of mine using bisect_ppx, but unfortunately I haven't been successful yet.

in order to figure out whether it's a problem with my project/system or with bisect_ppx itself, I followed the dune starter instructions, and managed to make it work by explicitly running the tester executable with the following command:

dune exec --instrument-with bisect_ppx ./tester.exe

however, when I try to run tests by using dune's runtest command as provided by the readme, no coverage file is generated. for the sake of completeness, the command I'm trying to run is as follows:

dune runtest --instrument-with bisect_ppx --force

on my actual project, I'm using ppx_inline_test, so I tried adding a simple inline test to the starter project to see if that would work, but to no avail. I forked the starter project and added my changes to it in case anyone wants to try to reproduce the problem.

the inline test file is composed of a single line:

let%test "inline" = Hello.run (); true

and the following lines were added to the dune file:

(library
 (name inline_tester)
 (modules inline_tester)
 (inline_tests)
 (libraries hello)
 (preprocess (pps ppx_inline_test))
 (instrumentation (backend bisect_ppx)))

I wasn't quite sure of whether I should add the instrumentation stanza to the testing library or not, but I tried both ways with no apparent changes in behavior.

I'm running nixos, and all dependencies are provided by opam-nix, as the nix package manager doesn't really play well with opam, so I suspect that might have something to do with it.

any help would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions