Skip to content

Commit

Permalink
Update BUILD.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Bronek committed Dec 18, 2023
1 parent 5ea5fbe commit a31ccff
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@ It patches their CMake to correctly import its dependencies.
### Coverage report
Coverage report is an additional feature intended for compilers GCC and Clang
(including Apple Clang). It is generated by the build target `coverage_report`,
Coverage report is intended for the developers working on unit tests and using compilers GCC
or Clang (including Apple Clang). It is generated by the build target `coverage_report`,
which is only enabled when `coverage` option is set, e.g. with
`--options coverage=True` in `conan` or `-Dcoverage=ON` variable in `cmake`
Prerequisites for coverage report are:
Prerequisites for the coverage report:
- [gcovr tool][5] (can be installed e.g. with [pip][6])
- `gcov` for GCC (installed with compiler by default) or
- `llvm-cov` for Clang (installed with compiler by default)
- `gcov` for GCC (installed with the compiler by default) or
- `llvm-cov` for Clang (installed with the compiler by default)
- `Debug` build type
Coverage report is created when the following steps are completed, in order:
Expand All @@ -282,7 +282,7 @@ Coverage report is created when the following steps are completed, in order:
option mentioned above
2. completed run of unit tests, which populates coverage capture data
3. completed run of `gcovr` tool (which internally invokes either `gcov` or `llvm-cov`)
to assemble both instrumentation data and coverage capture data into a single report
to assemble both instrumentation data and coverage capture data into a coverage report
Above steps are automated into a single target `coverage_report`. The instrumented
`rippled` binary can be also used for regular development or testing work, at
Expand All @@ -295,28 +295,28 @@ The default coverage report format is Cobertura XML (used in CI), but the user
can override it to any of the formats listed in `Builds/CMake/CodeCoverage.cmake`
by setting `CODE_COVERAGE_REPORT_FORMAT` variable in `cmake`. It is also possible
to generate more than one format at a time by setting `CODE_COVERAGE_EXTRA_ARGS`
variable in `cmake`. The specific command line used to run `gcovr` tool will be
variable in `cmake`. The specific command line used to run the `gcovr` tool will be
displayed if `CODE_COVERAGE_VERBOSE` variable is set.
The code coverage tool by default runs parallel unit tests with `--unittest-jobs`
parameter set to the number of available CPU cores. This may cause spurious test
errors on Apple. User can override unit test parallelism with
By default, the code coverage tool runs parallel unit tests with `--unittest-jobs`
set to the number of available CPU cores. This may cause spurious test
errors on Apple. Developers can override the number of unit test jobs with
`CODE_COVERAGE_TEST_PARALLELISM` variable in `cmake`.
Example with all the cmake variables:
Example use with all cmake variables set:
```
cd .build
conan install .. --output-folder . --build missing --settings build_type=Debug
cmake -DCMAKE_BUILD_TYPE=Debug -Dcoverage=ON -DCODE_COVERAGE_REPORT_FORMAT=html-details -DCODE_COVERAGE_EXTRA_ARGS="--json coverage_report.json --json-pretty" -DCODE_COVERAGE_VERBOSE=ON -DCODE_COVERAGE_TEST_PARALLELISM=2 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake ..
cmake -DCMAKE_BUILD_TYPE=Debug -Dcoverage=ON -DCODE_COVERAGE_REPORT_FORMAT=html-details -DCODE_COVERAGE_EXTRA_ARGS="--json coverage_report.json --json-pretty --txt coverage_report.txt" -DCODE_COVERAGE_VERBOSE=ON -DCODE_COVERAGE_TEST_PARALLELISM=2 -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake ..
cmake --build . --target coverage_report
```
After `coverage_report` target is completed, the generated coverage report will be
stored inside the build directory, as either of:
- file named `coverage_report` and a suitable extension for the report format, or
- directory named `coverage_report` for `html-details` or `html-nested` report format.
- file named `coverage_report.*`, with a suitable extension for the report format, or
- directory named `coverage_report`, with `index.html` and other files inside, for `html-details` or `html-nested` report formats.
## Options
Expand Down

0 comments on commit a31ccff

Please sign in to comment.