diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index 30187e898..55a259e38 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -253,7 +253,8 @@ int cmCTestCoverageHandler::ProcessHandler() { cmCTestLog(this->CTest, ERROR_MESSAGE, " Cannot find any coverage files." << std::endl); - // No coverage files is a valid thing, so the exit code is 0 + // No coverage files is a valid thing, so the exit code is 0 + cmSystemTools::ChangeDirectory(currentDirectory.c_str()); return 0; } @@ -602,7 +603,7 @@ int cmCTestCoverageHandler::ProcessHandler() { cmCTestLog(this->CTest, ERROR_MESSAGE, "Cannot open coverage summary file." << std::endl); - + cmSystemTools::ChangeDirectory(currentDirectory.c_str()); return -1; } @@ -615,6 +616,7 @@ int cmCTestCoverageHandler::ProcessHandler() int logFileCount = 0; if ( !this->StartCoverageLogFile(covLogFile, logFileCount) ) { + cmSystemTools::ChangeDirectory(currentDirectory.c_str()); return -1; } totalCoverageMap::iterator fileIterator; @@ -650,6 +652,7 @@ int cmCTestCoverageHandler::ProcessHandler() logFileCount ++; if ( !this->StartCoverageLogFile(covLogFile, logFileCount) ) { + cmSystemTools::ChangeDirectory(currentDirectory.c_str()); return -1; } } diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a8c286111..ffa79c3c4 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -446,12 +446,13 @@ int cmCTestTestHandler::ProcessHandler() this->UseExcludeRegExp(); this->SetExcludeRegExp(val); } - + this->TestResults.clear(); cmCTestLog(this->CTest, HANDLER_OUTPUT, (this->MemCheck ? "Memory check" : "Test") - << " project" << std::endl); + << " project " << cmSystemTools::GetCurrentWorkingDirectory() + << std::endl); if ( ! this->PreProcessHandler() ) { return -1;