tst_QXmlStream::tokenErrorHandling() - register test directory in CMake
Register the directory tokenError in the build system to expose it to embedded devices / for cross compiling. Do not fail the test function, when a test file isn't found. The tested functionality is platform independent and will be tested on other platforms. Task-number: QTBUG-92113 Task-number: QTBUG-95188 Change-Id: I885d8fdfbbf8ec60e6326bfd871fa85a4390247d Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io> (cherry picked from commit b476570932dcfc1b32e8405bcdd219c2dcc421f7) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
477ecafaee
commit
4f89eb5a7a
@ -10,11 +10,17 @@ file(GLOB_RECURSE test_data
|
|||||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
data/* XML-Test-Suite/*)
|
data/* XML-Test-Suite/*)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE tokenError
|
||||||
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
tokenError/* XML-token-error/*)
|
||||||
|
|
||||||
qt_internal_add_test(tst_qxmlstream
|
qt_internal_add_test(tst_qxmlstream
|
||||||
SOURCES
|
SOURCES
|
||||||
tst_qxmlstream.cpp
|
tst_qxmlstream.cpp
|
||||||
LIBRARIES
|
LIBRARIES
|
||||||
Qt::Network
|
Qt::Network
|
||||||
Qt::CorePrivate
|
Qt::CorePrivate
|
||||||
TESTDATA ${test_data}
|
TESTDATA
|
||||||
|
${test_data}
|
||||||
|
${tokenError}
|
||||||
)
|
)
|
||||||
|
@ -1892,9 +1892,10 @@ void tst_QXmlStream::tokenErrorHandling() const
|
|||||||
const QDir dir(QFINDTESTDATA("tokenError"));
|
const QDir dir(QFINDTESTDATA("tokenError"));
|
||||||
QFile file(dir.absoluteFilePath(fileName));
|
QFile file(dir.absoluteFilePath(fileName));
|
||||||
|
|
||||||
// Cross-compiling: File will be on host only
|
// Cross-compiling: Files may not be found when running test standalone
|
||||||
|
// QSKIP in that case, because the tested functionality is platform independent.
|
||||||
if (!file.exists())
|
if (!file.exists())
|
||||||
QSKIP("Testfile not found.");
|
QSKIP(QObject::tr("Testfile %1 not found.").arg(fileName).toUtf8().constData());
|
||||||
|
|
||||||
file.open(QIODevice::ReadOnly);
|
file.open(QIODevice::ReadOnly);
|
||||||
QXmlStreamReader reader(&file);
|
QXmlStreamReader reader(&file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user