From 231cbbef80210da31385427b45361f76d81ee294 Mon Sep 17 00:00:00 2001 From: Zach Mullen Date: Fri, 7 May 2010 11:00:21 -0400 Subject: [PATCH] Change coverage globbing mechanism to resolve paths earlier --- Source/CTest/cmCTestCoverageHandler.cxx | 27 ++++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx index a5b6caffd..e66af2472 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -583,17 +583,17 @@ int cmCTestCoverageHandler::ProcessHandler() i != uncovered.end(); ++i) { std::string fileName = cmSystemTools::GetFilenameName(*i); - std::string shortFileName = this->CTest->GetShortPathToFile(i->c_str()); + std::string fullPath = cont.SourceDir + "/" + *i; covLogFile << "\t\n" + << "\" FullPath=\"" << cmXMLSafe(*i) << "\">\n" << "\t\t" << std::endl; - std::ifstream ifs(i->c_str()); + std::ifstream ifs(fullPath.c_str()); if (!ifs) { cmOStringStream ostr; - ostr << "Cannot open source file: " << i->c_str(); + ostr << "Cannot open source file: " << fullPath.c_str(); errorsWhileAccumulating.push_back(ostr.str()); error ++; continue; @@ -611,14 +611,14 @@ int cmCTestCoverageHandler::ProcessHandler() covLogFile << "\t\t\n\t" << std::endl; total_untested += untested; - covSumFile << "\tc_str()) - << "\" FullPath=\"" << cmXMLSafe(shortFileName.c_str()) + covSumFile << "\tc_str()) << "\" Covered=\"true\">\n" << "\t\t0\n" << "\t\t" << untested << "\n" << "\t\t0\n" << "\t\t0\n"; - this->WriteXMLLabels(covSumFile, shortFileName); + this->WriteXMLLabels(covSumFile, *i); covSumFile << "\t" << std::endl; } @@ -628,7 +628,7 @@ int cmCTestCoverageHandler::ProcessHandler() { cmCTestLog(this->CTest, ERROR_MESSAGE, std::endl); cmCTestLog(this->CTest, ERROR_MESSAGE, - "Error(s) while acumulating results:" << std::endl); + "Error(s) while accumulating results:" << std::endl); std::vector::iterator erIt; for ( erIt = errorsWhileAccumulating.begin(); erIt != errorsWhileAccumulating.end(); @@ -2031,7 +2031,12 @@ std::set cmCTestCoverageHandler::FindUncoveredFiles( std::string glob = cont->SourceDir + "/" + *i; gl.FindFiles(glob); std::vector files = gl.GetFiles(); - extraMatches.insert(files.begin(), files.end()); + for(std::vector::iterator i = files.begin(); + i != files.end(); ++i) + { + extraMatches.insert(this->CTest->GetShortPathToFile( + i->c_str())); + } } if(extraMatches.size()) @@ -2041,9 +2046,7 @@ std::set cmCTestCoverageHandler::FindUncoveredFiles( { std::string shortPath = this->CTest->GetShortPathToFile( i->first.c_str()); - shortPath= shortPath.substr(2, shortPath.length() - 1); - std::string fullPath = cont->SourceDir + "/" + shortPath; - extraMatches.erase(fullPath); + extraMatches.erase(shortPath); } } return extraMatches;