This example uses C/C++test CT coverage plugin for Bazel.

  1. Move <INSTALL_DIR>/integration/bazel/WORKSPACE.bazel and <INSTALL_DIR>/integration/bazel/BUILD.bazel into the C/C++test CT installation directory. 
    Note: Make sure the files are moved and no copy remains in the integration/bazel directory.
  2. Go to <INSTALL_DIR>/examples/CovApplication
  3. Build the project with coverage enabled.
    bazel run --config=cpptest_coverage
  4. Execute the instrumented application.
    bazel-bin/Timer.elf
  5. Generate coverage data files into .coverage.
    cpptestcov compute -map .cpptest -clog cpptest_results.clog -out .coverage
  6. Report coverage statistics for .coverage.
    cpptestcov report text .coverage

See <INSTALL_DIR>/integration/bazel/README.txt for more details.

  • No labels