BUG: Never return a string containing a ":" from cmCTest::GetShortPathToFile - replace them with "_". DART cannot construct valid file names during dashboard rollup with ":" in the short path. Also, fix the Bullseye coverage handler so that the file names and paths match in both the coverage summary and the individual coverage logs.
This commit is contained in:
parent
422dc631b6
commit
ed1a04360a
|
@ -1288,7 +1288,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
// start the file output
|
// start the file output
|
||||||
covLogFile << "\t<File Name=\""
|
covLogFile << "\t<File Name=\""
|
||||||
<< this->CTest->MakeXMLSafe(file.c_str())
|
<< this->CTest->MakeXMLSafe(i->first.c_str())
|
||||||
<< "\" FullPath=\"" << this->CTest->MakeXMLSafe(
|
<< "\" FullPath=\"" << this->CTest->MakeXMLSafe(
|
||||||
this->CTest->GetShortPathToFile(
|
this->CTest->GetShortPathToFile(
|
||||||
i->second.c_str())) << "\">" << std::endl
|
i->second.c_str())) << "\">" << std::endl
|
||||||
|
@ -1478,21 +1478,22 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
"Doing coverage for: "
|
"Doing coverage for: "
|
||||||
<< file.c_str()
|
<< file.c_str()
|
||||||
<< std::endl);
|
<< std::endl);
|
||||||
|
|
||||||
coveredFiles.push_back(sourceFile);
|
coveredFiles.push_back(sourceFile);
|
||||||
|
coveredFilesFullPath.push_back(file);
|
||||||
|
|
||||||
number_files++;
|
number_files++;
|
||||||
total_functions += totalFunctions;
|
total_functions += totalFunctions;
|
||||||
total_tested += functionsCalled;
|
total_tested += functionsCalled;
|
||||||
total_untested += (totalFunctions - functionsCalled);
|
total_untested += (totalFunctions - functionsCalled);
|
||||||
|
|
||||||
std::string fileName = cmSystemTools::GetFilenameName(file.c_str());
|
std::string fileName = cmSystemTools::GetFilenameName(file.c_str());
|
||||||
// get file relative to the source dir
|
|
||||||
file = cmSystemTools::RelativePath(cont->SourceDir.c_str(),
|
|
||||||
file.c_str());
|
|
||||||
coveredFilesFullPath.push_back(file);
|
|
||||||
float cper = percentBranch + percentFunction;
|
float cper = percentBranch + percentFunction;
|
||||||
if(totalBranches > 0)
|
if(totalBranches > 0)
|
||||||
{
|
{
|
||||||
|
@ -1519,7 +1520,7 @@ int cmCTestCoverageHandler::RunBullseyeSourceSummary(
|
||||||
tmpLog << "percentBranch: " << percentBranch << "\n";
|
tmpLog << "percentBranch: " << percentBranch << "\n";
|
||||||
tmpLog << "percentCoverage: " << percent_coverage << "\n";
|
tmpLog << "percentCoverage: " << percent_coverage << "\n";
|
||||||
tmpLog << "coverage metric: " << cmet << "\n";
|
tmpLog << "coverage metric: " << cmet << "\n";
|
||||||
covSumFile << "\t<File Name=\"" << this->CTest->MakeXMLSafe(fileName)
|
covSumFile << "\t<File Name=\"" << this->CTest->MakeXMLSafe(sourceFile)
|
||||||
<< "\" FullPath=\"" << this->CTest->MakeXMLSafe(
|
<< "\" FullPath=\"" << this->CTest->MakeXMLSafe(
|
||||||
this->CTest->GetShortPathToFile(file.c_str()))
|
this->CTest->GetShortPathToFile(file.c_str()))
|
||||||
<< "\" Covered=\"" << (cmet>0?"true":"false") << "\">\n"
|
<< "\" Covered=\"" << (cmet>0?"true":"false") << "\">\n"
|
||||||
|
|
|
@ -2204,17 +2204,25 @@ std::string cmCTest::GetShortPathToFile(const char* cfname)
|
||||||
{
|
{
|
||||||
res = &bldRelpath;
|
res = &bldRelpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string path;
|
||||||
|
|
||||||
if ( !res )
|
if ( !res )
|
||||||
{
|
{
|
||||||
return fname;
|
path = fname;
|
||||||
}
|
}
|
||||||
cmSystemTools::ConvertToUnixSlashes(*res);
|
else
|
||||||
|
|
||||||
std::string path = "./" + *res;
|
|
||||||
if ( path[path.size()-1] == '/' )
|
|
||||||
{
|
{
|
||||||
path = path.substr(0, path.size()-1);
|
cmSystemTools::ConvertToUnixSlashes(*res);
|
||||||
|
|
||||||
|
path = "./" + *res;
|
||||||
|
if ( path[path.size()-1] == '/' )
|
||||||
|
{
|
||||||
|
path = path.substr(0, path.size()-1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cmsys::SystemTools::ReplaceString(path, ":", "_");
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue