ENH: Add support for SourceFile and LineNumber
This commit is contained in:
parent
5bf55d1590
commit
cbab381bda
|
@ -37,13 +37,6 @@
|
|||
#include <float.h>
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
cmCTestBuildHandler::cmCTestBuildHandler()
|
||||
{
|
||||
m_Verbose = false;
|
||||
m_CTest = 0;
|
||||
}
|
||||
|
||||
static const char* cmCTestErrorMatches[] = {
|
||||
"^[Bb]us [Ee]rror",
|
||||
"^[Ss]egmentation [Vv]iolation",
|
||||
|
@ -138,6 +131,34 @@ static const char* cmCTestWarningExceptions[] = {
|
|||
0
|
||||
};
|
||||
|
||||
static cmCTestBuildHandler::cmCTestCompileErrorWarningRex
|
||||
cmCTestWarningErrorFileLine[] = {
|
||||
{ "^Warning W[0-9]+ ([a-zA-Z.\\:/0-9_+ ~-]+) ([0-9]+):", 1, 2, 0 },
|
||||
{ "^([a-zA-Z./0-9_+ ~-]+):([0-9]+):", 1, 2, 0 },
|
||||
{ "^([a-zA-Z.\\:/0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2, 0 },
|
||||
{ "^([a-zA-Z./0-9_+ ~-]+)\\(([0-9]+)\\)", 1, 2, 0 },
|
||||
{ "\"([a-zA-Z./0-9_+ ~-]+)\", line ([0-9]+)", 1, 2, 0 },
|
||||
{ "File = ([a-zA-Z./0-9_+ ~-]+), Line = ([0-9]+)", 1, 2, 0 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
cmCTestBuildHandler::cmCTestBuildHandler()
|
||||
{
|
||||
m_Verbose = false;
|
||||
m_CTest = 0;
|
||||
int cc;
|
||||
for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc )
|
||||
{
|
||||
if ( !cmCTestWarningErrorFileLine[cc].m_RegularExpression.compile(
|
||||
cmCTestWarningErrorFileLine[cc].m_RegularExpressionString) )
|
||||
{
|
||||
std::cout << "Problem Compiling regular expression: "
|
||||
<< cmCTestWarningErrorFileLine[cc].m_RegularExpressionString << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
void cmCTestBuildHandler::PopulateCustomVectors(cmMakefile *mf)
|
||||
|
@ -421,6 +442,17 @@ void cmCTestBuildHandler::GenerateDartBuildOutput(
|
|||
<< "\t\t<BuildLogLine>" << cm->m_LogLine << "</BuildLogLine>\n"
|
||||
<< "\t\t<Text>" << m_CTest->MakeXMLSafe(cm->m_Text)
|
||||
<< "\n</Text>" << std::endl;
|
||||
int cc;
|
||||
for ( cc = 0; cmCTestWarningErrorFileLine[cc].m_RegularExpressionString; ++ cc )
|
||||
{
|
||||
cmsys::RegularExpression* re = &cmCTestWarningErrorFileLine[cc].m_RegularExpression;
|
||||
if ( re->find(cm->m_Text.c_str() ) )
|
||||
{
|
||||
cm->m_SourceFile = re->match(cmCTestWarningErrorFileLine[cc].m_FileIndex);
|
||||
cm->m_LineNumber = atoi(re->match(cmCTestWarningErrorFileLine[cc].m_LineIndex).c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( cm->m_SourceFile.size() > 0 )
|
||||
{
|
||||
os << "\t\t<SourceFile>" << cm->m_SourceFile << "</SourceFile>"
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "cmStandardIncludes.h"
|
||||
#include "cmListFileCache.h"
|
||||
|
||||
#include <cmsys/RegularExpression.hxx>
|
||||
|
||||
class cmCTest;
|
||||
class cmMakefile;
|
||||
|
||||
|
@ -60,6 +62,14 @@ private:
|
|||
std::string m_PostContext;
|
||||
};
|
||||
|
||||
struct cmCTestCompileErrorWarningRex
|
||||
{
|
||||
char* m_RegularExpressionString;
|
||||
int m_FileIndex;
|
||||
int m_LineIndex;
|
||||
cmsys::RegularExpression m_RegularExpression;
|
||||
};
|
||||
|
||||
// generate the XML output
|
||||
void GenerateDartBuildOutput(std::ostream& os,
|
||||
std::vector<cmCTestBuildErrorWarning>,
|
||||
|
|
Loading…
Reference in New Issue