cmake/Source/CTest/cmCTestCoverageCommand.cxx

62 lines
1.8 KiB
C++
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmCTestCoverageCommand.h"
#include "cmCTest.h"
2009-10-04 10:30:41 +03:00
#include "cmCTestCoverageHandler.h"
2016-10-30 18:24:19 +01:00
class cmCTestGenericHandler;
2009-10-04 10:30:41 +03:00
cmCTestCoverageCommand::cmCTestCoverageCommand()
{
this->LabelsMentioned = false;
}
cmCTestGenericHandler* cmCTestCoverageCommand::InitializeHandler()
{
2016-07-09 11:21:54 +02:00
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CoverageCommand", "CTEST_COVERAGE_COMMAND", this->Quiet);
this->CTest->SetCTestConfigurationFromCMakeVariable(
this->Makefile, "CoverageExtraFlags", "CTEST_COVERAGE_EXTRA_FLAGS",
this->Quiet);
2009-10-04 10:30:41 +03:00
cmCTestCoverageHandler* handler = static_cast<cmCTestCoverageHandler*>(
this->CTest->GetInitializedHandler("coverage"));
2016-07-09 11:21:54 +02:00
if (!handler) {
this->SetError("internal CTest error. Cannot instantiate test handler");
2016-10-30 18:24:19 +01:00
return CM_NULLPTR;
2016-07-09 11:21:54 +02:00
}
2009-10-04 10:30:41 +03:00
// If a LABELS option was given, select only files with the labels.
2016-07-09 11:21:54 +02:00
if (this->LabelsMentioned) {
2009-10-04 10:30:41 +03:00
handler->SetLabelFilter(this->Labels);
2016-07-09 11:21:54 +02:00
}
2009-10-04 10:30:41 +03:00
2015-08-17 11:37:30 +02:00
handler->SetQuiet(this->Quiet);
return handler;
}
2009-10-04 10:30:41 +03:00
bool cmCTestCoverageCommand::CheckArgumentKeyword(std::string const& arg)
{
// Look for arguments specific to this command.
2016-07-09 11:21:54 +02:00
if (arg == "LABELS") {
2009-10-04 10:30:41 +03:00
this->ArgumentDoing = ArgumentDoingLabels;
this->LabelsMentioned = true;
return true;
2016-07-09 11:21:54 +02:00
}
2009-10-04 10:30:41 +03:00
// Look for other arguments.
return this->Superclass::CheckArgumentKeyword(arg);
}
2009-10-04 10:30:41 +03:00
bool cmCTestCoverageCommand::CheckArgumentValue(std::string const& arg)
{
// Handle states specific to this command.
2016-07-09 11:21:54 +02:00
if (this->ArgumentDoing == ArgumentDoingLabels) {
2009-10-04 10:30:41 +03:00
this->Labels.insert(arg);
return true;
2016-07-09 11:21:54 +02:00
}
2009-10-04 10:30:41 +03:00
// Look for other arguments.
return this->Superclass::CheckArgumentValue(arg);
}