summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2020-01-09 17:03:49 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-01-10 10:20:31 +0000
commitf4a630588f9c2947e28f65f07b9f4beb69330602 (patch)
treef963f837f97f1ebc3a81b01a1cc53e35b62db81b /tests/auto/corelib/global
parent87622512f1c3fa7fb1ae885bd92b270cb4aabe1a (diff)
Fix tst_qlogging
Pass in the QT_CMAKE_BUILD define to change the expected executable name in the tests. Add special cases for missing compile flags that cause the collection of backtraces to fail otherwise. Change-Id: I53c44f7e4c6d597f941e4dd8173b3a39a615339c Reviewed-by: Qt CMake Build Bot Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r--tests/auto/corelib/global/qlogging/CMakeLists.txt10
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp11
2 files changed, 19 insertions, 2 deletions
diff --git a/tests/auto/corelib/global/qlogging/CMakeLists.txt b/tests/auto/corelib/global/qlogging/CMakeLists.txt
index a83ebab98a..bd0ab6aeca 100644
--- a/tests/auto/corelib/global/qlogging/CMakeLists.txt
+++ b/tests/auto/corelib/global/qlogging/CMakeLists.txt
@@ -5,6 +5,14 @@ if(NOT WINRT)
SOURCES app/main.cpp
DEFINES QT_MESSAGELOGCONTEXT
LIBRARIES Qt::Core)
+
+ #special case begin
+ # Fixes required for the backtrace stack to be correct
+ if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
+ target_link_options(qlogging_helper PRIVATE -rdynamic)
+ endif()
+ set_target_properties(qlogging_helper PROPERTIES CXX_VISIBILITY_PRESET default)
+ # special case end
endif()
add_qt_test(tst_qlogging SOURCES tst_qlogging.cpp
@@ -13,3 +21,5 @@ add_qt_test(tst_qlogging SOURCES tst_qlogging.cpp
QT_DISABLE_DEPRECATED_BEFORE=0
HELPER_BINARY="${CMAKE_CURRENT_BINARY_DIR}/qlogging_helper" # special case
)
+
+target_compile_definitions(tst_qlogging PRIVATE QT_CMAKE_BUILD) # special case # to fix the binary name
diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
index 84e5ccce49..6c0470c8fe 100644
--- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
+++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp
@@ -792,10 +792,17 @@ void tst_qmessagehandler::qMessagePattern_data()
#define QT_NAMESPACE_STR ""
#endif
+
+#ifdef QT_CMAKE_BUILD
+#define BACKTRACE_HELPER_NAME "qlogging_helper"
+#else
+#define BACKTRACE_HELPER_NAME "helper"
+#endif
+
#ifndef QT_NO_DEBUG
QTest::newRow("backtrace") << "[%{backtrace}] %{message}" << true << (QList<QByteArray>()
// MyClass::qt_static_metacall is explicitly marked as hidden in the Q_OBJECT macro
- << "[MyClass::myFunction|MyClass::mySlot1|?helper?|" QT_NAMESPACE_STR "QMetaMethod::invoke|" QT_NAMESPACE_STR "QMetaObject::invokeMethod] from_a_function 34");
+ << "[MyClass::myFunction|MyClass::mySlot1|?" BACKTRACE_HELPER_NAME "?|" QT_NAMESPACE_STR "QMetaMethod::invoke|" QT_NAMESPACE_STR "QMetaObject::invokeMethod] from_a_function 34");
#endif
QTest::newRow("backtrace depth,separator") << "[%{backtrace depth=2 separator=\"\n\"}] %{message}" << true << (QList<QByteArray>()
@@ -822,7 +829,7 @@ void tst_qmessagehandler::qMessagePattern()
#ifndef Q_OS_ANDROID
const QString appExe(QLatin1String(HELPER_BINARY));
#else
- const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/libhelper.so"));
+ const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/lib" BACKTRACE_HELPER_NAME ".so"));
#endif
//