Commit 0204ef21 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Parser debugging/testing improvements

 * Set objectname on all parsers to be able to distinguish between
   them more easily when debugging
 * Add some unit tests about pass-through of data we need in the
   gcc parser to the parsers that enhd up in front of the gcc parser
   This is to address QTCREATORBUG-1917.
parent 49d6fc27
......@@ -46,6 +46,7 @@ GnuMakeParser::GnuMakeParser(const QString &dir) :
m_suppressIssues(false),
m_fatalErrorCount(0)
{
setObjectName(QLatin1String("GnuMakeParser"));
m_makeDir.setPattern(QLatin1String(MAKE_PATTERN) +
QLatin1String("(\\w+) directory .(.+).$"));
m_makeDir.setMinimal(true);
......@@ -206,6 +207,24 @@ void ProjectExplorerPlugin::testGnuMakeParserParsing_data()
<< QList<Task>()
<< QString()
<< QStringList();
QTest::newRow("pass-through gcc infos")
<< QStringList()
<< QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
"../../scriptbug/main.cpp: At global scope:\n"
"../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
"../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
"../../scriptbug/main.cpp:22: instantiated from here\n")
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
"../../scriptbug/main.cpp: At global scope:\n"
"../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
"../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
"../../scriptbug/main.cpp:22: instantiated from here\n")
<< QList<ProjectExplorer::Task>()
<< QString()
<< QStringList();
// make sure adding directories works (once;-)
QTest::newRow("entering directory")
<< (QStringList() << QString::fromLatin1("/test/dir") )
......
......@@ -43,6 +43,7 @@ namespace {
LdParser::LdParser()
{
setObjectName(QLatin1String("LdParser"));
m_regExpLinker.setPattern(QString::fromLatin1(FILE_PATTERN) + '(' + QLatin1String(POSITION_PATTERN) + ")?\\s(.+)$");
m_regExpLinker.setMinimal(true);
......
......@@ -38,6 +38,7 @@ using namespace ProjectExplorer;
LinuxIccParser::LinuxIccParser()
: m_expectFirstLine(true), m_indent(0), m_temporary(Task())
{
setObjectName(QLatin1String("LinuxIccParser"));
// main.cpp(53): error #308: function \"AClass::privatefunc\" (declared at line 4 of \"main.h\") is inaccessible
m_firstLine.setPattern("^([^\\(\\)]+)" // filename (cap 1)
......
......@@ -39,6 +39,7 @@ using namespace ProjectExplorer;
MsvcParser::MsvcParser()
{
setObjectName(QLatin1String("MavcParser"));
m_compileRegExp.setPattern(QString::fromLatin1("^") + QLatin1String(FILE_POS_PATTERN)
+ QLatin1String(" : .*(warning|error) (")
+ QLatin1String(ERROR_PATTERN) + QLatin1String(".*)$"));
......
......@@ -40,6 +40,7 @@ using ProjectExplorer::Task;
QMakeParser::QMakeParser()
{
setObjectName(QLatin1String("QMakeParser"));
}
void QMakeParser::stdError(const QString &line)
......
......@@ -39,6 +39,7 @@ RvctParser::RvctParser() :
m_additionalInfo(false),
m_lastLine(0)
{
setObjectName(QLatin1String("RvctParser"));
// Start of a error or warning:
m_warningOrError.setPattern("^\"([^\\(\\)]+[^\\d])\", line (\\d+):(\\s(Warning|Error):)\\s(.+)$");
m_warningOrError.setMinimal(true);
......
......@@ -37,6 +37,7 @@ using namespace ProjectExplorer::Constants;
WinscwParser::WinscwParser()
{
setObjectName(QLatin1String("WinscwParser"));
// linker problems:
m_linkerProblem.setPattern("^(\\S*)\\(\\S+\\):\\s(.+)$");
m_linkerProblem.setMinimal(true);
......
......@@ -45,6 +45,7 @@ namespace {
QtParser::QtParser()
{
setObjectName(QLatin1String("QtParser"));
m_mocRegExp.setPattern(QString::fromLatin1(FILE_PATTERN) + "(\\d+):\\s(Warning|Error):\\s(.+)$");
m_mocRegExp.setMinimal(true);
}
......@@ -102,7 +103,21 @@ void Qt4ProjectManagerPlugin::testQtOutputParser_data()
<< QString() << QString::fromLatin1("Sometext")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("pass-through gcc infos")
<< QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
"../../scriptbug/main.cpp: At global scope:\n"
"../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
"../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
"../../scriptbug/main.cpp:22: instantiated from here\n")
<< OutputParserTester::STDERR
<< QString()
<< QString::fromLatin1("/temp/test/untitled8/main.cpp: In function `int main(int, char**)':\n"
"../../scriptbug/main.cpp: At global scope:\n"
"../../scriptbug/main.cpp: In instantiation of void bar(i) [with i = double]:\n"
"../../scriptbug/main.cpp:8: instantiated from void foo(i) [with i = double]\n"
"../../scriptbug/main.cpp:22: instantiated from here\n")
<< QList<ProjectExplorer::Task>()
<< QString();
QTest::newRow("moc warning")
<< QString::fromLatin1("..\\untitled\\errorfile.h:0: Warning: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment