CTest: fix usage of memory checker with spaces in path

The filename was escaped in cmCTestMemCheckHandler::InitializeMemoryChecking()
and again before it was written to output in
cmCTestRunTest::ComputeArguments().

Once someone uses e.g. a valgrind path with spaces this leads to double escaping
making the memory checker fail completely because of the invalid path.
This commit is contained in:
Rolf Eike Beer 2012-09-30 20:25:20 +02:00
parent 554d4ed584
commit 95bc8aa6c4
1 changed files with 6 additions and 9 deletions

View File

@ -247,7 +247,8 @@ void cmCTestMemCheckHandler::GenerateTestCommand(
{ {
std::vector<cmStdString>::size_type pp; std::vector<cmStdString>::size_type pp;
std::string memcheckcommand = ""; std::string memcheckcommand = "";
memcheckcommand = this->MemoryTester; memcheckcommand
= cmSystemTools::ConvertToOutputPath(this->MemoryTester.c_str());
for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
{ {
args.push_back(this->MemoryTesterOptions[pp]); args.push_back(this->MemoryTesterOptions[pp]);
@ -410,29 +411,25 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking()
"MemoryCheckCommand").c_str()) ) "MemoryCheckCommand").c_str()) )
{ {
this->MemoryTester this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( = this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
"MemoryCheckCommand").c_str());
} }
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"PurifyCommand").c_str()) ) "PurifyCommand").c_str()) )
{ {
this->MemoryTester this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( = this->CTest->GetCTestConfiguration("PurifyCommand").c_str();
"PurifyCommand").c_str());
} }
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"ValgrindCommand").c_str()) ) "ValgrindCommand").c_str()) )
{ {
this->MemoryTester this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( = this->CTest->GetCTestConfiguration("ValgrindCommand").c_str();
"ValgrindCommand").c_str());
} }
else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration( else if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
"BoundsCheckerCommand").c_str()) ) "BoundsCheckerCommand").c_str()) )
{ {
this->MemoryTester this->MemoryTester
= cmSystemTools::ConvertToOutputPath(this->CTest->GetCTestConfiguration( = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
"BoundsCheckerCommand").c_str());
} }
else else
{ {