diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-30 20:20:23 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-09-30 20:20:23 (GMT) |
commit | cbab381bda49638e424e4ea079e90a700f4898ae (patch) | |
tree | 0739adede65efa155176d88d0f134fc07dd05451 | |
parent | 5bf55d1590d2e92180b51c82b397cac8dd4c6d64 (diff) | |
download | CMake-cbab381bda49638e424e4ea079e90a700f4898ae.zip CMake-cbab381bda49638e424e4ea079e90a700f4898ae.tar.gz CMake-cbab381bda49638e424e4ea079e90a700f4898ae.tar.bz2 |
ENH: Add support for SourceFile and LineNumber
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.cxx | 46 | ||||
-rw-r--r-- | Source/CTest/cmCTestBuildHandler.h | 10 |
2 files changed, 49 insertions, 7 deletions
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx index 3cebbb8..a6f1525 100644 --- a/Source/CTest/cmCTestBuildHandler.cxx +++ b/Source/CTest/cmCTestBuildHandler.cxx @@ -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>" diff --git a/Source/CTest/cmCTestBuildHandler.h b/Source/CTest/cmCTestBuildHandler.h index ec4c14f..2f63957 100644 --- a/Source/CTest/cmCTestBuildHandler.h +++ b/Source/CTest/cmCTestBuildHandler.h @@ -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>, |