ProjectExplorer: Remove some Qt-specific parser tests

Warnings from uic and moc should be caught by the QtParser, not by the
LdParser, as they currently are.
We move the uic test case to QtSupport, and we remove the three
identical moc test cases, as the exact same output is already checked in
QtSupport.

Task-number: QTCREATORBUG-25677
Change-Id: Iec0203c2be60a80bd6ef0a090a9828f59ae6b482
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2021-05-06 16:29:42 +02:00
parent bcb3efb3c6
commit ef21aacf1f
5 changed files with 31 additions and 40 deletions

View File

@@ -281,16 +281,6 @@ void ProjectExplorerPlugin::testClangOutputParser_data()
<< CompileTask(Task::Error, << CompileTask(Task::Error,
"code signing is required for product type 'Application' in SDK 'iOS 7.0'")) "code signing is required for product type 'Application' in SDK 'iOS 7.0'"))
<< QString(); << QString();
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< CompileTask(Task::Unknown,
"Note: No relevant classes found. No output generated.",
FilePath::fromUserInput("/home/qtwebkithelpviewer.h")))
<< QString();
} }
void ProjectExplorerPlugin::testClangOutputParser() void ProjectExplorerPlugin::testClangOutputParser()

View File

@@ -883,16 +883,6 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
FilePath::fromUserInput("cns5k_ins_parser_tests.cpp"))) FilePath::fromUserInput("cns5k_ins_parser_tests.cpp")))
<< QString(); << QString();
QTest::newRow("uic warning")
<< QString::fromLatin1("mainwindow.ui: Warning: The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< CompileTask(Task::Warning,
"The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.",
FilePath::fromUserInput("mainwindow.ui")))
<< QString();
QTest::newRow("libimf warning") QTest::newRow("libimf warning")
<< QString::fromLatin1("libimf.so: warning: warning: feupdateenv is not implemented and will always fail") << QString::fromLatin1("libimf.so: warning: warning: feupdateenv is not implemented and will always fail")
<< OutputParserTester::STDERR << OutputParserTester::STDERR
@@ -1169,16 +1159,6 @@ void ProjectExplorerPlugin::testGccOutputParsers_data()
"file: lib/libtest.a(Test0.cpp.o) has no symbols")) "file: lib/libtest.a(Test0.cpp.o) has no symbols"))
<< QString(); << QString();
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< CompileTask(Task::Unknown,
"Note: No relevant classes found. No output generated.",
FilePath::fromUserInput("/home/qtwebkithelpviewer.h")))
<< QString();
QTest::newRow("GCC 9 output") QTest::newRow("GCC 9 output")
<< QString("In file included from /usr/include/qt/QtCore/qlocale.h:43,\n" << QString("In file included from /usr/include/qt/QtCore/qlocale.h:43,\n"
" from /usr/include/qt/QtCore/qtextstream.h:46,\n" " from /usr/include/qt/QtCore/qtextstream.h:46,\n"

View File

@@ -217,16 +217,6 @@ void ProjectExplorerPlugin::testLinuxIccOutputParsers_data()
"use of \"=\" where \"==\" may have been intended\nwhile (a = true)", "use of \"=\" where \"==\" may have been intended\nwhile (a = true)",
FilePath::fromUserInput("main.cpp"), 41)) FilePath::fromUserInput("main.cpp"), 41))
<< QString(); << QString();
QTest::newRow("moc note")
<< QString::fromLatin1("/home/qtwebkithelpviewer.h:0: Note: No relevant classes found. No output generated.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< CompileTask(Task::Unknown,
"Note: No relevant classes found. No output generated.",
FilePath::fromUserInput("/home/qtwebkithelpviewer.h"), -1))
<< QString();
} }
void ProjectExplorerPlugin::testLinuxIccOutputParsers() void ProjectExplorerPlugin::testLinuxIccOutputParsers()

View File

@@ -45,6 +45,7 @@ namespace QtSupport {
QtParser::QtParser() : QtParser::QtParser() :
m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+?)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+?)$")), m_mocRegExp(QLatin1String(FILE_PATTERN"[:\\(](\\d+?)\\)?:\\s([Ww]arning|[Ee]rror|[Nn]ote):\\s(.+?)$")),
m_uicRegExp(QLatin1String(FILE_PATTERN": Warning:\\s(?<msg>.+?)$")),
m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*?) in '(.*?)'$")) m_translationRegExp(QLatin1String("^([Ww]arning|[Ee]rror):\\s+(.*?) in '(.*?)'$"))
{ {
setObjectName(QLatin1String("QtParser")); setObjectName(QLatin1String("QtParser"));
@@ -76,6 +77,26 @@ Utils::OutputLineParser::Result QtParser::handleLine(const QString &line, Utils:
scheduleTask(task, 1); scheduleTask(task, 1);
return {Status::Done, linkSpecs}; return {Status::Done, linkSpecs};
} }
match = m_uicRegExp.match(lne);
if (match.hasMatch()) {
const QString fileName = match.captured(1);
QString message = match.captured("msg").trimmed();
Utils::FilePath filePath;
LinkSpecs linkSpecs;
bool isUicMessage = true;
if (fileName == "uic" || fileName == "stdin") {
message.prepend(": ").prepend(fileName);
} else if (fileName.endsWith(".ui")) {
filePath = absoluteFilePath(Utils::FilePath::fromUserInput(fileName));
addLinkSpecForAbsoluteFilePath(linkSpecs, filePath, -1, match, 1);
} else {
isUicMessage = false;
}
if (isUicMessage) {
scheduleTask(CompileTask(Task::Warning, message, filePath), 1);
return {Status::Done, linkSpecs};
}
}
match = m_translationRegExp.match(line); match = m_translationRegExp.match(line);
if (match.hasMatch()) { if (match.hasMatch()) {
Task::TaskType type = Task::Warning; Task::TaskType type = Task::Warning;
@@ -172,6 +193,15 @@ void QtSupportPlugin::testQtOutputParser_data()
QLatin1String("Undefined interface"), QLatin1String("Undefined interface"),
Utils::FilePath::fromUserInput(QLatin1String("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h")), 54)) Utils::FilePath::fromUserInput(QLatin1String("E:/sandbox/creator/loaden/src/libs/utils/iwelcomepage.h")), 54))
<< QString(); << QString();
QTest::newRow("uic warning")
<< QString::fromLatin1("mainwindow.ui: Warning: The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.")
<< OutputParserTester::STDERR
<< QString() << QString()
<< (Tasks()
<< CompileTask(Task::Warning,
"The name 'pushButton' (QPushButton) is already in use, defaulting to 'pushButton1'.",
Utils::FilePath::fromUserInput("mainwindow.ui")))
<< QString();
QTest::newRow("translation") QTest::newRow("translation")
<< QString::fromLatin1("Warning: dropping duplicate messages in '/some/place/qtcreator_fr.qm'") << QString::fromLatin1("Warning: dropping duplicate messages in '/some/place/qtcreator_fr.qm'")
<< OutputParserTester::STDERR << OutputParserTester::STDERR

View File

@@ -45,6 +45,7 @@ private:
Result handleLine(const QString &line, Utils::OutputFormat type) override; Result handleLine(const QString &line, Utils::OutputFormat type) override;
QRegularExpression m_mocRegExp; QRegularExpression m_mocRegExp;
QRegularExpression m_uicRegExp;
QRegularExpression m_translationRegExp; QRegularExpression m_translationRegExp;
}; };