testlib: Rename QAbstractTestLogger::QSystem to QCritical

It's used to handle qCritical() messages, and corresponds to QtMsgType's
QtCriticalMsg, so change its name to reflect what it really is.

In the process, reclassify the -maxwarnings overflow message as a warning,
rather than a critical message.

Pick-to: 6.2
Change-Id: I87626117a547ae4498d5dc352b93bd6db8bfb332
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-08-03 13:58:17 +02:00
parent 308280e7a9
commit ca15cc0049
13 changed files with 19 additions and 21 deletions

View File

@ -135,7 +135,7 @@ void QAbstractTestLogger::addMessage(QtMsgType type, const QMessageLogContext &c
switch (type) { switch (type) {
case QtDebugMsg: return QAbstractTestLogger::QDebug; case QtDebugMsg: return QAbstractTestLogger::QDebug;
case QtInfoMsg: return QAbstractTestLogger::QInfo; case QtInfoMsg: return QAbstractTestLogger::QInfo;
case QtCriticalMsg: return QAbstractTestLogger::QSystem; case QtCriticalMsg: return QAbstractTestLogger::QCritical;
case QtWarningMsg: return QAbstractTestLogger::QWarning; case QtWarningMsg: return QAbstractTestLogger::QWarning;
case QtFatalMsg: return QAbstractTestLogger::QFatal; case QtFatalMsg: return QAbstractTestLogger::QFatal;
} }

View File

@ -79,7 +79,7 @@ public:
Warn, Warn,
QWarning, QWarning,
QDebug, QDebug,
QSystem, QCritical,
QFatal, QFatal,
Skip, Skip,
Info, Info,

View File

@ -149,8 +149,8 @@ void QAppleTestLogger::addMessage(MessageTypes type, const QString &message, con
return MessageData{QtWarningMsg, nullptr}; return MessageData{QtWarningMsg, nullptr};
case QAbstractTestLogger::QDebug: case QAbstractTestLogger::QDebug:
return MessageData{QtDebugMsg, nullptr}; return MessageData{QtDebugMsg, nullptr};
case QAbstractTestLogger::QSystem: case QAbstractTestLogger::QCritical:
return MessageData{QtWarningMsg, "system"}; return MessageData{QtWarningMsg, "critical"};
case QAbstractTestLogger::QFatal: case QAbstractTestLogger::QFatal:
return MessageData{QtFatalMsg, nullptr}; return MessageData{QtFatalMsg, nullptr};
case QAbstractTestLogger::Skip: case QAbstractTestLogger::Skip:

View File

@ -304,8 +304,8 @@ void QJUnitTestLogger::addMessage(MessageTypes type, const QString &message, con
systemLogElement = systemErrorElement; systemLogElement = systemErrorElement;
typeBuf = "warn"; typeBuf = "warn";
break; break;
case QAbstractTestLogger::QSystem: case QAbstractTestLogger::QCritical:
typeBuf = "system"; typeBuf = "qcritical";
break; break;
case QAbstractTestLogger::QDebug: case QAbstractTestLogger::QDebug:
typeBuf = "qdebug"; typeBuf = "qdebug";

View File

@ -115,8 +115,8 @@ namespace QTest {
return "QDEBUG "; return "QDEBUG ";
case QAbstractTestLogger::QInfo: case QAbstractTestLogger::QInfo:
return "QINFO "; return "QINFO ";
case QAbstractTestLogger::QSystem: case QAbstractTestLogger::QCritical:
return "QSYSTEM"; return "QCRITICAL";
case QAbstractTestLogger::QFatal: case QAbstractTestLogger::QFatal:
return "QFATAL "; return "QFATAL ";
case QAbstractTestLogger::Info: case QAbstractTestLogger::Info:

View File

@ -87,8 +87,8 @@ namespace QTest {
return "QDEBUG"; return "QDEBUG";
case QAbstractTestLogger::QInfo: case QAbstractTestLogger::QInfo:
return "QINFO"; return "QINFO";
case QAbstractTestLogger::QSystem: case QAbstractTestLogger::QCritical:
return "QSYSTEM"; return "QCRITICAL";
case QAbstractTestLogger::QFatal: case QAbstractTestLogger::QFatal:
return "QFATAL"; return "QFATAL";
case QAbstractTestLogger::Info: case QAbstractTestLogger::Info:

View File

@ -223,7 +223,7 @@ namespace QTest {
if (!counter.deref()) { if (!counter.deref()) {
FOREACH_TEST_LOGGER { FOREACH_TEST_LOGGER {
logger->addMessage(QAbstractTestLogger::QSystem, logger->addMessage(QAbstractTestLogger::Warn,
QStringLiteral("Maximum amount of warnings exceeded. Use -maxwarnings to override.")); QStringLiteral("Maximum amount of warnings exceeded. Use -maxwarnings to override."));
} }
return; return;

View File

@ -58,8 +58,8 @@ namespace QTest {
switch (type) { switch (type) {
case QAbstractTestLogger::Warn: case QAbstractTestLogger::Warn:
return "warn"; return "warn";
case QAbstractTestLogger::QSystem: case QAbstractTestLogger::QCritical:
return "system"; return "qcritical";
case QAbstractTestLogger::QDebug: case QAbstractTestLogger::QDebug:
return "qdebug"; return "qdebug";
case QAbstractTestLogger::QInfo: case QAbstractTestLogger::QInfo:

View File

@ -2008,10 +2008,7 @@
<!-- type="qwarn" message="1998" --> <!-- type="qwarn" message="1998" -->
<!-- type="qwarn" message="1999" --> <!-- type="qwarn" message="1999" -->
<!-- type="qwarn" message="2000" --> <!-- type="qwarn" message="2000" -->
<!-- type="system" message="Maximum amount of warnings exceeded. Use &#x002D;maxwarnings to override." --> <!-- type="warn" message="Maximum amount of warnings exceeded. Use &#x002D;maxwarnings to override." -->
<system-out>
<![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]>
</system-out>
<system-err> <system-err>
<![CDATA[0]]> <![CDATA[0]]>
<![CDATA[1]]> <![CDATA[1]]>
@ -4014,6 +4011,7 @@
<![CDATA[1998]]> <![CDATA[1998]]>
<![CDATA[1999]]> <![CDATA[1999]]>
<![CDATA[2000]]> <![CDATA[2000]]>
<![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]>
</system-err> </system-err>
</testcase> </testcase>
<testcase name="cleanupTestCase" classname="MaxWarnings" time="@TEST_DURATION@"/> <testcase name="cleanupTestCase" classname="MaxWarnings" time="@TEST_DURATION@"/>

View File

@ -6011,7 +6011,7 @@
<Message type="qwarn" file="" line="0"> <Message type="qwarn" file="" line="0">
<Description><![CDATA[2000]]></Description> <Description><![CDATA[2000]]></Description>
</Message> </Message>
<Message type="system" file="" line="0"> <Message type="warn" file="" line="0">
<Description><![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]></Description> <Description><![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]></Description>
</Message> </Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />

File diff suppressed because one or more lines are too long

View File

@ -2002,7 +2002,7 @@ QWARN : MaxWarnings::warn() 1997
QWARN : MaxWarnings::warn() 1998 QWARN : MaxWarnings::warn() 1998
QWARN : MaxWarnings::warn() 1999 QWARN : MaxWarnings::warn() 1999
QWARN : MaxWarnings::warn() 2000 QWARN : MaxWarnings::warn() 2000
QSYSTEM: MaxWarnings::warn() Maximum amount of warnings exceeded. Use -maxwarnings to override. WARNING: MaxWarnings::warn() Maximum amount of warnings exceeded. Use -maxwarnings to override.
PASS : MaxWarnings::warn() PASS : MaxWarnings::warn()
PASS : MaxWarnings::cleanupTestCase() PASS : MaxWarnings::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 0ms Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted, 0ms

View File

@ -6013,7 +6013,7 @@
<Message type="qwarn" file="" line="0"> <Message type="qwarn" file="" line="0">
<Description><![CDATA[2000]]></Description> <Description><![CDATA[2000]]></Description>
</Message> </Message>
<Message type="system" file="" line="0"> <Message type="warn" file="" line="0">
<Description><![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]></Description> <Description><![CDATA[Maximum amount of warnings exceeded. Use -maxwarnings to override.]]></Description>
</Message> </Message>
<Incident type="pass" file="" line="0" /> <Incident type="pass" file="" line="0" />