diff options
author | Brad King <brad.king@kitware.com> | 2009-03-02 20:33:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-03-02 20:33:18 (GMT) |
commit | 91a8569648aba920a4b168eb25e946ca012a93ba (patch) | |
tree | 722c768d8d402479d1c44ee205cd3a63f2d0faad /Source/CTest/cmCTestCoverageCommand.cxx | |
parent | 3078fef81c9f6d00aceba5ca16435ba37f1cdf03 (diff) | |
download | CMake-91a8569648aba920a4b168eb25e946ca012a93ba.zip CMake-91a8569648aba920a4b168eb25e946ca012a93ba.tar.gz CMake-91a8569648aba920a4b168eb25e946ca012a93ba.tar.bz2 |
ENH: Teach ctest_coverage to filter with LABELS
This teaches ctest_coverage() to report only coverage of files labeled
with at least one label given by a new LABELS option.
Diffstat (limited to 'Source/CTest/cmCTestCoverageCommand.cxx')
-rw-r--r-- | Source/CTest/cmCTestCoverageCommand.cxx | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/Source/CTest/cmCTestCoverageCommand.cxx b/Source/CTest/cmCTestCoverageCommand.cxx index bf64afc..067a4e9 100644 --- a/Source/CTest/cmCTestCoverageCommand.cxx +++ b/Source/CTest/cmCTestCoverageCommand.cxx @@ -17,22 +17,55 @@ #include "cmCTestCoverageCommand.h" #include "cmCTest.h" -#include "cmCTestGenericHandler.h" +#include "cmCTestCoverageHandler.h" cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler() { this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND"); - cmCTestGenericHandler* handler - = this->CTest->GetInitializedHandler("coverage"); + cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>( + this->CTest->GetInitializedHandler("coverage")); if ( !handler ) { this->SetError("internal CTest error. Cannot instantiate test handler"); return 0; } + + // If a LABELS option was given, select only files with the labels. + if(this->LabelsMentioned) + { + handler->SetLabelFilter(this->Labels); + } + return handler; } +//---------------------------------------------------------------------------- +bool cmCTestCoverageCommand::CheckArgumentKeyword(std::string const& arg) +{ + // Look for arguments specific to this command. + if(arg == "LABELS") + { + this->ArgumentDoing = ArgumentDoingLabels; + this->LabelsMentioned = true; + return true; + } + // Look for other arguments. + return this->Superclass::CheckArgumentKeyword(arg); +} + +//---------------------------------------------------------------------------- +bool cmCTestCoverageCommand::CheckArgumentValue(std::string const& arg) +{ + // Handle states specific to this command. + if(this->ArgumentDoing == ArgumentDoingLabels) + { + this->Labels.insert(arg); + return true; + } + // Look for other arguments. + return this->Superclass::CheckArgumentValue(arg); +} |