From be16b95dcd545610711918615b39871a3e8374bf Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Tue, 11 Jul 2023 13:51:44 +0200 Subject: [PATCH] tst_QXmlStream::tokenErrorHandling() - register test directory in CMake MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit b476570932dcfc1b32e8405bcdd219c2dcc421f7) Reviewed-by: Qt CI Bot --- .../auto/corelib/serialization/qxmlstream/CMakeLists.txt | 8 +++++++- .../corelib/serialization/qxmlstream/tst_qxmlstream.cpp | 5 +++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt b/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt index 3304097d4b7..e01292bc0f6 100644 --- a/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt +++ b/tests/auto/corelib/serialization/qxmlstream/CMakeLists.txt @@ -10,11 +10,17 @@ file(GLOB_RECURSE test_data RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} data/* XML-Test-Suite/*) +file(GLOB_RECURSE tokenError + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + tokenError/* XML-token-error/*) + qt_internal_add_test(tst_qxmlstream SOURCES tst_qxmlstream.cpp LIBRARIES Qt::Network Qt::GuiPrivate - TESTDATA ${test_data} + TESTDATA + ${test_data} + ${tokenError} ) diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index 30f54999e7c..14616e10d52 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -1880,9 +1880,10 @@ void tst_QXmlStream::tokenErrorHandling() const const QDir dir(QFINDTESTDATA("tokenError")); 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()) - QSKIP("Testfile not found."); + QSKIP(QObject::tr("Testfile %1 not found.").arg(fileName).toUtf8().constData()); file.open(QIODevice::ReadOnly); QXmlStreamReader reader(&file);