2016-09-27 19:01:08 +00:00
|
|
|
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
2005-06-14 18:00:45 +00:00
|
|
|
#include "cmCTestMemCheckCommand.h"
|
|
|
|
|
2016-11-25 21:10:40 +00:00
|
|
|
#include <sstream>
|
|
|
|
#include <vector>
|
|
|
|
|
2005-06-14 18:00:45 +00:00
|
|
|
#include "cmCTest.h"
|
|
|
|
#include "cmCTestGenericHandler.h"
|
2016-11-04 20:51:42 +00:00
|
|
|
#include "cmCTestMemCheckHandler.h"
|
|
|
|
#include "cmMakefile.h"
|
|
|
|
|
|
|
|
cmCTestMemCheckCommand::cmCTestMemCheckCommand()
|
|
|
|
{
|
|
|
|
this->Arguments[ctm_DEFECT_COUNT] = "DEFECT_COUNT";
|
|
|
|
this->Arguments[ctm_LAST] = CM_NULLPTR;
|
|
|
|
this->Last = ctm_LAST;
|
|
|
|
}
|
2005-06-14 18:00:45 +00:00
|
|
|
|
2005-06-23 17:04:18 +00:00
|
|
|
cmCTestGenericHandler* cmCTestMemCheckCommand::InitializeActualHandler()
|
|
|
|
{
|
2016-05-16 14:34:04 +00:00
|
|
|
cmCTestGenericHandler* handler =
|
|
|
|
this->CTest->GetInitializedHandler("memcheck");
|
|
|
|
|
|
|
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
|
|
|
this->Makefile, "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE", this->Quiet);
|
|
|
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
|
|
|
this->Makefile, "MemoryCheckSanitizerOptions",
|
|
|
|
"CTEST_MEMORYCHECK_SANITIZER_OPTIONS", this->Quiet);
|
|
|
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
|
|
|
this->Makefile, "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND",
|
2015-02-17 22:15:00 +00:00
|
|
|
this->Quiet);
|
2016-05-16 14:34:04 +00:00
|
|
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
|
|
|
this->Makefile, "MemoryCheckCommandOptions",
|
|
|
|
"CTEST_MEMORYCHECK_COMMAND_OPTIONS", this->Quiet);
|
|
|
|
this->CTest->SetCTestConfigurationFromCMakeVariable(
|
|
|
|
this->Makefile, "MemoryCheckSuppressionFile",
|
|
|
|
"CTEST_MEMORYCHECK_SUPPRESSIONS_FILE", this->Quiet);
|
2005-06-15 14:53:49 +00:00
|
|
|
|
2015-02-17 22:15:00 +00:00
|
|
|
handler->SetQuiet(this->Quiet);
|
2005-06-23 17:04:18 +00:00
|
|
|
return handler;
|
2005-06-14 18:00:45 +00:00
|
|
|
}
|
2016-11-04 20:51:42 +00:00
|
|
|
|
|
|
|
void cmCTestMemCheckCommand::ProcessAdditionalValues(
|
|
|
|
cmCTestGenericHandler* handler)
|
|
|
|
{
|
|
|
|
if (this->Values[ctm_DEFECT_COUNT] && *this->Values[ctm_DEFECT_COUNT]) {
|
|
|
|
std::ostringstream str;
|
|
|
|
str << static_cast<cmCTestMemCheckHandler*>(handler)->GetDefectCount();
|
|
|
|
this->Makefile->AddDefinition(this->Values[ctm_DEFECT_COUNT],
|
|
|
|
str.str().c_str());
|
|
|
|
}
|
|
|
|
}
|