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>bb10
parent
87622512f1
commit
f4a630588f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
//
|
||||
|
|
|
|||
Loading…
Reference in New Issue