Fix working dir issue for ctest show only mode (-N)

This commit is contained in:
Zach Mullen 2009-10-27 10:16:01 -04:00
parent 6bf98dba01
commit e2b63e473d
1 changed files with 5 additions and 0 deletions

View File

@ -344,6 +344,9 @@ void cmCTestMultiProcessHandler::PrintTestList()
{ {
count++; count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second; cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
//push working dir
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(p.Directory.c_str());
cmCTestRunTest testRun(this->TestHandler); cmCTestRunTest testRun(this->TestHandler);
testRun.SetIndex(p.Index); testRun.SetIndex(p.Index);
@ -365,6 +368,8 @@ void cmCTestMultiProcessHandler::PrintTestList()
<< indexStr.str().c_str()); << indexStr.str().c_str());
cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl);
//pop working dir
cmSystemTools::ChangeDirectory(current_dir.c_str());
} }
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
<< this->Total << std::endl); << this->Total << std::endl);