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
|
||||
# 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.
|
||||
# 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
|
||||
|
@ -5606,11 +5606,11 @@
|
||||
on the command-line:
|
||||
|
||||
\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
|
||||
# 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.
|
||||
make check TESTRUNNER="test-wrapper --timeout 120" TESTARGS="-o result.xml,xunitxml"
|
||||
# The "-o result.xml,junitxml" options are interpreted by QTestLib.
|
||||
make check TESTRUNNER="test-wrapper --timeout 120" TESTARGS="-o result.xml,junitxml"
|
||||
\endcode
|
||||
|
||||
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;
|
||||
} else if (strcmp(argv[i], "-csv") == 0) {
|
||||
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;
|
||||
} else if (strcmp(argv[i], "-xml") == 0) {
|
||||
logFormat = QTestLog::XML;
|
||||
@ -678,9 +681,12 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
||||
logFormat = QTestLog::LightXML;
|
||||
else if (strcmp(format, "xml") == 0)
|
||||
logFormat = QTestLog::XML;
|
||||
else if (strcmp(format, "junitxml") == 0 || strcmp(format, "xunitxml") == 0)
|
||||
else if (strcmp(format, "junitxml") == 0)
|
||||
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;
|
||||
else if (strcmp(format, "tap") == 0)
|
||||
logFormat = QTestLog::TAP;
|
||||
|
@ -47,6 +47,18 @@
|
||||
#define QT_POPEN_READ "r"
|
||||
#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
|
||||
{
|
||||
bool helpRequested = false;
|
||||
@ -84,17 +96,8 @@ struct Options
|
||||
{QStringLiteral("lightxml"), [](const QByteArray &data) -> bool {
|
||||
return data.indexOf("\n<Incident type=\"fail\" ") < 0;
|
||||
}},
|
||||
{QStringLiteral("xunitxml"), [](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;
|
||||
}},
|
||||
{QStringLiteral("xunitxml"), junitChecker},
|
||||
{QStringLiteral("junitxml"), junitChecker},
|
||||
{QStringLiteral("teamcity"), [](const QByteArray &data) -> bool {
|
||||
return data.indexOf("' message='Failure! |[Loc: ") < 0;
|
||||
}},
|
||||
@ -335,8 +338,8 @@ static void setOutputFile(QString file, QString format)
|
||||
|
||||
static bool parseTestArgs()
|
||||
{
|
||||
QRegularExpression oldFormats{QStringLiteral("^-(txt|csv|xunitxml|xml|lightxml|teamcity|tap)$")};
|
||||
QRegularExpression newLoggingFormat{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|junitxml|xml|lightxml|teamcity|tap)$")};
|
||||
|
||||
QString file;
|
||||
QString logType;
|
||||
|
Loading…
x
Reference in New Issue
Block a user