CTest: improve memory checker type detection
If the checker was explicitely set with a "TypeCommand" variable (e.g. ValgrindCommand) then we now just believe that this is valgrind, even if nothing in the path matches "valgrind". Only when "MemoryCheckCommand" was used we still scan the path to find out what checker we have.
This commit is contained in:
parent
fcae1dacea
commit
d26c9b69c5
|
@ -412,24 +412,45 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
{
|
{
|
||||||
this->MemoryTester
|
this->MemoryTester
|
||||||
= this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
|
= this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
|
||||||
|
|
||||||
|
// determine the checker type
|
||||||
|
if ( this->MemoryTester.find("valgrind") != std::string::npos )
|
||||||
|
{
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
|
||||||
|
}
|
||||||
|
else if ( this->MemoryTester.find("purify") != std::string::npos )
|
||||||
|
{
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
|
||||||
|
}
|
||||||
|
else if ( this->MemoryTester.find("BC") != std::string::npos )
|
||||||
|
{
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
|
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
|
||||||
"PurifyCommand").c_str()) )
|
"PurifyCommand").c_str()) )
|
||||||
{
|
{
|
||||||
this->MemoryTester
|
this->MemoryTester
|
||||||
= this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
|
= this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
|
||||||
}
|
}
|
||||||
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
|
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
|
||||||
"ValgrindCommand").c_str()) )
|
"ValgrindCommand").c_str()) )
|
||||||
{
|
{
|
||||||
this->MemoryTester
|
this->MemoryTester
|
||||||
= this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
|
= this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
|
||||||
}
|
}
|
||||||
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
|
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
|
||||||
"BoundsCheckerCommand").c_str()) )
|
"BoundsCheckerCommand").c_str()) )
|
||||||
{
|
{
|
||||||
this->MemoryTester
|
this->MemoryTester
|
||||||
= this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
|
= this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
|
||||||
|
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -467,9 +488,9 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
this->MemoryTesterOutputFile
|
this->MemoryTesterOutputFile
|
||||||
= this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
|
= this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log";
|
||||||
|
|
||||||
if ( this->MemoryTester.find("valgrind") != std::string::npos )
|
switch ( this->MemoryTesterStyle )
|
||||||
{
|
{
|
||||||
this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
|
case cmCTestMemCheckHandler::VALGRIND:
|
||||||
if ( this->MemoryTesterOptions.empty() )
|
if ( this->MemoryTesterOptions.empty() )
|
||||||
{
|
{
|
||||||
this->MemoryTesterOptions.push_back("-q");
|
this->MemoryTesterOptions.push_back("-q");
|
||||||
|
@ -495,10 +516,9 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
+ this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
|
+ this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile");
|
||||||
this->MemoryTesterOptions.push_back(suppressions);
|
this->MemoryTesterOptions.push_back(suppressions);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
else if ( this->MemoryTester.find("purify") != std::string::npos )
|
case cmCTestMemCheckHandler::PURIFY:
|
||||||
{
|
{
|
||||||
this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
|
|
||||||
std::string outputFile;
|
std::string outputFile;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if( this->CTest->GetCTestConfiguration(
|
if( this->CTest->GetCTestConfiguration(
|
||||||
|
@ -523,22 +543,22 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
|
||||||
#endif
|
#endif
|
||||||
outputFile += this->MemoryTesterOutputFile;
|
outputFile += this->MemoryTesterOutputFile;
|
||||||
this->MemoryTesterOptions.push_back(outputFile);
|
this->MemoryTesterOptions.push_back(outputFile);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if ( this->MemoryTester.find("BC") != std::string::npos )
|
case cmCTestMemCheckHandler::BOUNDS_CHECKER:
|
||||||
{
|
{
|
||||||
this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile;
|
this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile;
|
||||||
std::string dpbdFile = this->CTest->GetBinaryDir()
|
std::string dpbdFile = this->CTest->GetBinaryDir()
|
||||||
+ "/Testing/Temporary/MemoryChecker.DPbd";
|
+ "/Testing/Temporary/MemoryChecker.DPbd";
|
||||||
this->BoundsCheckerDPBDFile = dpbdFile;
|
this->BoundsCheckerDPBDFile = dpbdFile;
|
||||||
this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
|
|
||||||
this->MemoryTesterOptions.push_back("/B");
|
this->MemoryTesterOptions.push_back("/B");
|
||||||
this->MemoryTesterOptions.push_back(dpbdFile);
|
this->MemoryTesterOptions.push_back(dpbdFile);
|
||||||
this->MemoryTesterOptions.push_back("/X");
|
this->MemoryTesterOptions.push_back("/X");
|
||||||
this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile);
|
this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile);
|
||||||
this->MemoryTesterOptions.push_back("/M");
|
this->MemoryTesterOptions.push_back("/M");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else
|
default:
|
||||||
{
|
|
||||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||||
"Do not understand memory checker: " << this->MemoryTester.c_str()
|
"Do not understand memory checker: " << this->MemoryTester.c_str()
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
|
|
Loading…
Reference in New Issue