From 4f89eb5a7a5e25888b2f0a79f0dfd5dad4defef1 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 Cherry-pick 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 e7dd05944ea..f4bc7c22627 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::CorePrivate - 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 75edda97e0c..75fa7c66c1e 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -1892,9 +1892,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);