[CMake] Simplify code coverage CMake configuration#4793
Merged
llvm-beanz merged 2 commits intomicrosoft:mainfrom Nov 17, 2022
Merged
[CMake] Simplify code coverage CMake configuration#4793llvm-beanz merged 2 commits intomicrosoft:mainfrom
llvm-beanz merged 2 commits intomicrosoft:mainfrom
Conversation
This just addes an option processed by the CMake cache file to configure code coverage for DXC. With this patch you can generate a coverage report locally if you build with Clang using the following commnads: cmake -G Ninja -DDXC_COVERAGE=On <other options> -C <path to dxc>/cmake/caches/PredefinedParams.cmake <path to dxc> ninja ctest ninja generate-coverage-report
|
❌ Build DirectXShaderCompiler 1.0.2228 failed (commit a5bce1b961 by @llvm-beanz) |
dmpots
approved these changes
Nov 17, 2022
Contributor
dmpots
left a comment
There was a problem hiding this comment.
Might be worth a short comment in the commit message about how its better than before (e.g. what did you have to do before to get code coverage).
| @@ -1,3 +1,9 @@ | |||
| if (DXC_COVERAGE) | |||
Contributor
There was a problem hiding this comment.
Should this have the HLSL change marker comment too?
Collaborator
Author
There was a problem hiding this comment.
That file is HLSL-only.
Collaborator
Author
There was a problem hiding this comment.
I updated the file with a comment at the top making clear it is an HLSL-only file and describing how CMake cache scripts are used.
CMake cache scripts aren't super common, but are very useful. Adding a comment to explain how they work is probably generally valuable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This just adds an option processed by the CMake cache file to configure code coverage for DXC. With this patch you can generate a coverage report locally if you build with Clang using the following commnads:
This removes the need to separately specify
LLVM_BUILD_INSTRUMENTED_COVERAGE,LLVM_PROFILE_DATA_DIR, andLLVM_CODE_COVERAGE_TARGETSmanually as well as increases the robustness of detectingllvm-covandllvm-profdataon Linux.