ctest_coverage: Search for Jacoco files in the binary directory
Search for Jacoco coverage files in both the source directory and the binary directory.
This commit is contained in:
parent
4f9a02db41
commit
1db32ffe98
|
@ -913,16 +913,33 @@ int cmCTestCoverageHandler::HandleJacocoCoverage(
|
||||||
{
|
{
|
||||||
cmParseJacocoCoverage cov =
|
cmParseJacocoCoverage cov =
|
||||||
cmParseJacocoCoverage(*cont, this->CTest);
|
cmParseJacocoCoverage(*cont, this->CTest);
|
||||||
cmsys::Glob g;
|
|
||||||
|
// Search in the source directory.
|
||||||
|
cmsys::Glob g1;
|
||||||
std::vector<std::string> files;
|
std::vector<std::string> files;
|
||||||
g.SetRecurse(true);
|
g1.SetRecurse(true);
|
||||||
|
|
||||||
std::string SourceDir
|
std::string SourceDir
|
||||||
= this->CTest->GetCTestConfiguration("SourceDirectory");
|
= this->CTest->GetCTestConfiguration("SourceDirectory");
|
||||||
std::string coverageFile = SourceDir+ "/*jacoco.xml";
|
std::string coverageFile = SourceDir+ "/*jacoco.xml";
|
||||||
|
|
||||||
g.FindFiles(coverageFile);
|
g1.FindFiles(coverageFile);
|
||||||
files=g.GetFiles();
|
files = g1.GetFiles();
|
||||||
|
|
||||||
|
// ...and in the binary directory.
|
||||||
|
cmsys::Glob g2;
|
||||||
|
std::vector<std::string> binFiles;
|
||||||
|
g2.SetRecurse(true);
|
||||||
|
std::string binaryDir
|
||||||
|
= this->CTest->GetCTestConfiguration("BuildDirectory");
|
||||||
|
std::string binCoverageFile = binaryDir+ "/*jacoco.xml";
|
||||||
|
g2.FindFiles(binCoverageFile);
|
||||||
|
binFiles = g2.GetFiles();
|
||||||
|
if (!binFiles.empty())
|
||||||
|
{
|
||||||
|
files.insert(files.end(), binFiles.begin(), binFiles.end());
|
||||||
|
}
|
||||||
|
|
||||||
if (!files.empty())
|
if (!files.empty())
|
||||||
{
|
{
|
||||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||||
|
|
Loading…
Reference in New Issue