ENH: Add custom supression regular expressions
This commit is contained in:
parent
b7b35d2c5a
commit
c7de609a37
@ -40,6 +40,7 @@ cmCTestCoverageHandler::cmCTestCoverageHandler()
|
|||||||
void cmCTestCoverageHandler::Initialize()
|
void cmCTestCoverageHandler::Initialize()
|
||||||
{
|
{
|
||||||
this->Superclass::Initialize();
|
this->Superclass::Initialize();
|
||||||
|
m_CustomCoverageExclude.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
@ -77,6 +78,18 @@ void cmCTestCoverageHandler::EndCoverageLogFile(cmGeneratedFileStream& ostr, int
|
|||||||
bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* srcDir,
|
bool cmCTestCoverageHandler::ShouldIDoCoverage(const char* file, const char* srcDir,
|
||||||
const char* binDir)
|
const char* binDir)
|
||||||
{
|
{
|
||||||
|
std::vector<cmsys::RegularExpression>::iterator sit;
|
||||||
|
for ( sit = m_CustomCoverageExcludeRegex.begin();
|
||||||
|
sit != m_CustomCoverageExcludeRegex.end(); ++ sit )
|
||||||
|
{
|
||||||
|
if ( sit->find(file) )
|
||||||
|
{
|
||||||
|
cmCTestLog(m_CTest, HANDLER_VERBOSE_OUTPUT, " File " << file
|
||||||
|
<< " is excluded in CTestCustom.ctest" << std::endl;);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string fSrcDir = cmSystemTools::CollapseFullPath(srcDir);
|
std::string fSrcDir = cmSystemTools::CollapseFullPath(srcDir);
|
||||||
std::string fBinDir = cmSystemTools::CollapseFullPath(binDir);
|
std::string fBinDir = cmSystemTools::CollapseFullPath(binDir);
|
||||||
std::string fFile = cmSystemTools::CollapseFullPath(file);
|
std::string fFile = cmSystemTools::CollapseFullPath(file);
|
||||||
@ -219,6 +232,15 @@ int cmCTestCoverageHandler::ProcessHandler()
|
|||||||
// 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
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_CustomCoverageExcludeRegex.empty();
|
||||||
|
std::vector<cmStdString>::iterator rexIt;
|
||||||
|
for ( rexIt = m_CustomCoverageExclude.begin();
|
||||||
|
rexIt != m_CustomCoverageExclude.end();
|
||||||
|
++ rexIt )
|
||||||
|
{
|
||||||
|
m_CustomCoverageExcludeRegex.push_back(cmsys::RegularExpression(rexIt->c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
typedef std::vector<int> singleFileCoverageVector;
|
typedef std::vector<int> singleFileCoverageVector;
|
||||||
typedef std::map<std::string, singleFileCoverageVector> totalCoverageMap;
|
typedef std::map<std::string, singleFileCoverageVector> totalCoverageMap;
|
||||||
@ -697,3 +719,10 @@ int cmCTestCoverageHandler::ProcessHandler()
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------
|
||||||
|
void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
|
||||||
|
{
|
||||||
|
cmCTest::PopulateCustomVector(mf, "CTEST_CUSTOM_COVERAGE_EXCLUDE",
|
||||||
|
m_CustomCoverageExclude);
|
||||||
|
}
|
||||||
|
@ -22,6 +22,8 @@
|
|||||||
#include "cmCTestGenericHandler.h"
|
#include "cmCTestGenericHandler.h"
|
||||||
#include "cmListFileCache.h"
|
#include "cmListFileCache.h"
|
||||||
|
|
||||||
|
#include <cmsys/RegularExpression.hxx>
|
||||||
|
|
||||||
class cmGeneratedFileStream;
|
class cmGeneratedFileStream;
|
||||||
|
|
||||||
/** \class cmCTestCoverageHandler
|
/** \class cmCTestCoverageHandler
|
||||||
@ -42,6 +44,11 @@ public:
|
|||||||
|
|
||||||
virtual void Initialize();
|
virtual void Initialize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is called when reading CTest custom file
|
||||||
|
*/
|
||||||
|
void PopulateCustomVectors(cmMakefile *mf);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool ShouldIDoCoverage(const char* file, const char* srcDir,
|
bool ShouldIDoCoverage(const char* file, const char* srcDir,
|
||||||
const char* binDir);
|
const char* binDir);
|
||||||
@ -90,6 +97,9 @@ private:
|
|||||||
bool m_Show;
|
bool m_Show;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
std::vector<cmStdString> m_CustomCoverageExclude;
|
||||||
|
std::vector<cmsys::RegularExpression> m_CustomCoverageExcludeRegex;
|
||||||
|
|
||||||
typedef std::map<std::string, cmCTestCoverage> tm_CoverageMap;
|
typedef std::map<std::string, cmCTestCoverage> tm_CoverageMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user