testlib: Update a few remaining instances of the deprecated -xunitxml format
The format was renamed in 27db9e458cef512fca3a6b5c9ebbcda7a8172428. Pick-to: 6.2 Change-Id: I53975c7467d8768dc9dc9ac2d89c42eefa12e22f Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
cba2adb195
commit
7c14223b1e
@ -170,7 +170,7 @@ endfunction()
|
|||||||
#
|
#
|
||||||
# All tests are wrapped with cmake script that supports TESTARGS and TESTRUNNER environment
|
# All tests are wrapped with cmake script that supports TESTARGS and TESTRUNNER environment
|
||||||
# variables handling. Endpoint wrapper may be used standalone as cmake script to run tests e.g.:
|
# variables handling. Endpoint wrapper may be used standalone as cmake script to run tests e.g.:
|
||||||
# TESTARGS="-o result.xml,xunitxml" TESTRUNNER="testrunner --arg" ./tst_simpleTestWrapper.cmake
|
# TESTARGS="-o result.xml,junitxml" TESTRUNNER="testrunner --arg" ./tst_simpleTestWrapper.cmake
|
||||||
# On non-UNIX machine you may need to use 'cmake -P' explicitly to execute wrapper.
|
# On non-UNIX machine you may need to use 'cmake -P' explicitly to execute wrapper.
|
||||||
# You may avoid test wrapping by either passing NO_WRAPPER option or switching QT_NO_TEST_WRAPPERS
|
# You may avoid test wrapping by either passing NO_WRAPPER option or switching QT_NO_TEST_WRAPPERS
|
||||||
# to ON. This is helpful if you want to use internal CMake tools within tests, like memory or
|
# to ON. This is helpful if you want to use internal CMake tools within tests, like memory or
|
||||||
|
@ -5606,11 +5606,11 @@
|
|||||||
on the command-line:
|
on the command-line:
|
||||||
|
|
||||||
\code
|
\code
|
||||||
# Run tests through test-wrapper and use xunitxml output format.
|
# Run tests through test-wrapper and use JUnit XML output format.
|
||||||
# In this example, test-wrapper is a fictional wrapper script which terminates
|
# In this example, test-wrapper is a fictional wrapper script which terminates
|
||||||
# a test if it does not complete within the amount of seconds set by "--timeout".
|
# a test if it does not complete within the amount of seconds set by "--timeout".
|
||||||
# The "-o result.xml,xunitxml" options are interpreted by QTestLib.
|
# The "-o result.xml,junitxml" options are interpreted by QTestLib.
|
||||||
make check TESTRUNNER="test-wrapper --timeout 120" TESTARGS="-o result.xml,xunitxml"
|
make check TESTRUNNER="test-wrapper --timeout 120" TESTARGS="-o result.xml,junitxml"
|
||||||
\endcode
|
\endcode
|
||||||
|
|
||||||
Testcase projects may be further customized with the following \c CONFIG options:
|
Testcase projects may be further customized with the following \c CONFIG options:
|
||||||
|
@ -638,7 +638,10 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
|||||||
logFormat = QTestLog::Plain;
|
logFormat = QTestLog::Plain;
|
||||||
} else if (strcmp(argv[i], "-csv") == 0) {
|
} else if (strcmp(argv[i], "-csv") == 0) {
|
||||||
logFormat = QTestLog::CSV;
|
logFormat = QTestLog::CSV;
|
||||||
} else if (strcmp(argv[i], "-junitxml") == 0 || strcmp(argv[i], "-xunitxml") == 0) {
|
} else if (strcmp(argv[i], "-junitxml") == 0) {
|
||||||
|
logFormat = QTestLog::JUnitXML;
|
||||||
|
} else if (strcmp(argv[i], "-xunitxml") == 0) {
|
||||||
|
fprintf(stderr, "WARNING: xunitxml is deprecated. Please use junitxml.\n");
|
||||||
logFormat = QTestLog::JUnitXML;
|
logFormat = QTestLog::JUnitXML;
|
||||||
} else if (strcmp(argv[i], "-xml") == 0) {
|
} else if (strcmp(argv[i], "-xml") == 0) {
|
||||||
logFormat = QTestLog::XML;
|
logFormat = QTestLog::XML;
|
||||||
@ -678,9 +681,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
|||||||
logFormat = QTestLog::LightXML;
|
logFormat = QTestLog::LightXML;
|
||||||
else if (strcmp(format, "xml") == 0)
|
else if (strcmp(format, "xml") == 0)
|
||||||
logFormat = QTestLog::XML;
|
logFormat = QTestLog::XML;
|
||||||
else if (strcmp(format, "junitxml") == 0 || strcmp(format, "xunitxml") == 0)
|
else if (strcmp(format, "junitxml") == 0)
|
||||||
logFormat = QTestLog::JUnitXML;
|
logFormat = QTestLog::JUnitXML;
|
||||||
else if (strcmp(format, "teamcity") == 0)
|
else if (strcmp(format, "xunitxml") == 0) {
|
||||||
|
fprintf(stderr, "WARNING: xunitxml is deprecated. Please use junitxml.\n");
|
||||||
|
logFormat = QTestLog::JUnitXML;
|
||||||
|
} else if (strcmp(format, "teamcity") == 0)
|
||||||
logFormat = QTestLog::TeamCity;
|
logFormat = QTestLog::TeamCity;
|
||||||
else if (strcmp(format, "tap") == 0)
|
else if (strcmp(format, "tap") == 0)
|
||||||
logFormat = QTestLog::TAP;
|
logFormat = QTestLog::TAP;
|
||||||
|
@ -47,6 +47,18 @@
|
|||||||
#define QT_POPEN_READ "r"
|
#define QT_POPEN_READ "r"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static auto junitChecker = [](const QByteArray &data) -> bool {
|
||||||
|
QXmlStreamReader reader{data};
|
||||||
|
while (!reader.atEnd()) {
|
||||||
|
reader.readNext();
|
||||||
|
if (reader.isStartElement() && reader.name() == QStringLiteral("testcase") &&
|
||||||
|
reader.attributes().value(QStringLiteral("result")).toString() == QStringLiteral("fail")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
struct Options
|
struct Options
|
||||||
{
|
{
|
||||||
bool helpRequested = false;
|
bool helpRequested = false;
|
||||||
@ -84,17 +96,8 @@ struct Options
|
|||||||
{QStringLiteral("lightxml"), [](const QByteArray &data) -> bool {
|
{QStringLiteral("lightxml"), [](const QByteArray &data) -> bool {
|
||||||
return data.indexOf("\n<Incident type=\"fail\" ") < 0;
|
return data.indexOf("\n<Incident type=\"fail\" ") < 0;
|
||||||
}},
|
}},
|
||||||
{QStringLiteral("xunitxml"), [](const QByteArray &data) -> bool {
|
{QStringLiteral("xunitxml"), junitChecker},
|
||||||
QXmlStreamReader reader{data};
|
{QStringLiteral("junitxml"), junitChecker},
|
||||||
while (!reader.atEnd()) {
|
|
||||||
reader.readNext();
|
|
||||||
if (reader.isStartElement() && reader.name() == QStringLiteral("testcase") &&
|
|
||||||
reader.attributes().value(QStringLiteral("result")).toString() == QStringLiteral("fail")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}},
|
|
||||||
{QStringLiteral("teamcity"), [](const QByteArray &data) -> bool {
|
{QStringLiteral("teamcity"), [](const QByteArray &data) -> bool {
|
||||||
return data.indexOf("' message='Failure! |[Loc: ") < 0;
|
return data.indexOf("' message='Failure! |[Loc: ") < 0;
|
||||||
}},
|
}},
|
||||||
@ -335,8 +338,8 @@ static void setOutputFile(QString file, QString format)
|
|||||||
|
|
||||||
static bool parseTestArgs()
|
static bool parseTestArgs()
|
||||||
{
|
{
|
||||||
QRegularExpression oldFormats{QStringLiteral("^-(txt|csv|xunitxml|xml|lightxml|teamcity|tap)$")};
|
QRegularExpression oldFormats{QStringLiteral("^-(txt|csv|xunitxml|junitxml|xml|lightxml|teamcity|tap)$")};
|
||||||
QRegularExpression newLoggingFormat{QStringLiteral("^(.*),(txt|csv|xunitxml|xml|lightxml|teamcity|tap)$")};
|
QRegularExpression newLoggingFormat{QStringLiteral("^(.*),(txt|csv|xunitxml|junitxml|xml|lightxml|teamcity|tap)$")};
|
||||||
|
|
||||||
QString file;
|
QString file;
|
||||||
QString logType;
|
QString logType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user