You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Building the Coverage Variant](#building-the-coverage-variant)
9
+
-[Running Tests and Getting Raw Coverage Information](#running-tests-and-getting-raw-coverage-information)
10
+
-[Parsing Coverage Information and Generating a Report](#parsing-coverage-information-and-generating-a-report)
11
+
-[Viewing Results](#viewing-results)
12
+
13
+
## Introduction
14
+
15
+
maya-hydra has support for obtaining code coverage on Windows platforms.
16
+
17
+
The support uses two main tools: Clang for the compilation of maya-hydra and the LLVM toolset for the parsing of code coverage information and the generation of a code coverage report.
7
18
8
19
## Prerequisites
9
20
10
-
To install Clang and the LLVM toolset, you can install an optional module with Visual Studio. Refer to these instructions: [Install Clang and LLVM Toolset](https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170)
21
+
To install Clang and the LLVM toolset, you can install an optional module with Visual Studio. Refer to these instructions: [Install Clang and LLVM Toolset](https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170)
11
22
12
23
> Note: On Windows, all commands must be executed in a `x64 Native Tools Command Prompt for VS 2022` command line
13
24
@@ -17,9 +28,9 @@ To install Clang and the LLVM toolset, you can install an optional module with V
17
28
18
29
## Building the Coverage Variant
19
30
20
-
The maya-hydra build has a Coverage variant that can be used with the following stages: clean,build,install,test (note that the test stage depends on the install stage). Clang is used with code coverage instrumentation flags enabled (-fprofile-instr-generate -fcoverage-mapping) so that when tests are run after a successful install stage, code coverage data files will be generated. Refer to the [build documentation](./build.md) for more details.
31
+
The maya-hydra build has a Coverage variant that can be used with the following stages: `clean,build,install,test` (note that the `test` stage depends on the `install` stage). Clang is used with code coverage instrumentation flags enabled (`-fprofile-instr-generate -fcoverage-mapping`) so that when tests are run after a successful `install` stage, code coverage data files will be generated. Refer to the [build documentation](./build.md) for more details.
21
32
22
-
To build the coverage variant you can run:
33
+
Here is the command to build the Coverage variant:
The `--build-coverage` flag indicates that the variant to be built is the Coverage variant.
37
47
38
48
At time of writing (February 26th, 2024), only the Ninja code generator is supported. In particular, the Visual Studio generator is known not to output code coverage data.
39
49
40
50
## Running Tests and Getting Raw Coverage Information
41
51
42
-
To run tests and generate code coverage information using the Coverage build, run the same command as in [the previous section](#building-the-coverage-variant), but replace `--stages=clean,configure,build,install` with `--stages=test`.
52
+
To run tests and generate code coverage information using the Coverage build, run the same `build.py`command as in [the previous section](#building-the-coverage-variant), but replace `--stages=clean,configure,build,install` with `--stages=test`.
43
53
44
54
After running tests, the raw coverage information files will be generated in `<workspace_location>\build\Coverage\test\lib\mayaUsd\render\mayaToHydra\<test_subfolders>`. These files have a `.profraw` file extension.
45
55
46
-
## Parsing Coverage Information and Report
56
+
## Parsing Coverage Information and Generating a Report
47
57
48
58
To parse the coverage information, two tools from the LLVM toolset are used: `llvm-profdata merge` and `llvm-cov show`.
49
59
-`llvm-profdata merge`: Parses and merges all of the raw coverage information files (`.profraw`) into a single file with a `.profdata` extension.
0 commit comments