From 5170574532c8f739f8218748cc09bd1b3dc71afa Mon Sep 17 00:00:00 2001 From: Janne Juntunen Date: Fri, 14 Jan 2022 10:01:20 +0200 Subject: tst_qlogging: use correct qlogging_helper path on webOS Switched to use runtime path instead of compile time path for the helper executable. Some tests cases were failing on webOS because of wrong path. Fixes: QTBUG-99846 Pick-to: 6.3 Change-Id: I566bc04bdb96ac6e7dd0a875eadb50685aef8282 Reviewed-by: Edward Welbourne --- .../auto/corelib/global/qlogging/tst_qlogging.cpp | 28 +++++++++++++--------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'tests/auto/corelib/global') diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index af4a5989d8..a6a2c1d139 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Copyright (C) 2014 Olivier Goffart ** Contact: https://www.qt.io/licensing/ ** @@ -62,6 +62,7 @@ private slots: void formatLogMessage(); private: + QString backtraceHelperPath(); QStringList m_baseEnvironment; }; @@ -777,11 +778,7 @@ void tst_qmessagehandler::qMessagePattern() QFETCH(QList, expected); QProcess process; -#ifndef Q_OS_ANDROID - const QString appExe(QLatin1String(HELPER_BINARY)); -#else - const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/lib" BACKTRACE_HELPER_NAME ".so")); -#endif + const QString appExe(backtraceHelperPath()); // // test QT_MESSAGE_PATTERN @@ -827,11 +824,7 @@ void tst_qmessagehandler::setMessagePattern() // QProcess process; -#ifndef Q_OS_ANDROID - const QString appExe(QLatin1String(HELPER_BINARY)); -#else - const QString appExe(QCoreApplication::applicationDirPath() + QLatin1String("/libhelper.so")); -#endif + const QString appExe(backtraceHelperPath()); // make sure there is no QT_MESSAGE_PATTERN in the environment QStringList environment; @@ -928,6 +921,19 @@ void tst_qmessagehandler::formatLogMessage() QCOMPARE(r, result); } +QString tst_qmessagehandler::backtraceHelperPath() +{ +#ifdef Q_OS_ANDROID + QString appExe(QCoreApplication::applicationDirPath() + + QLatin1String("/lib" BACKTRACE_HELPER_NAME ".so")); +#elif defined(Q_OS_WEBOS) + QString appExe(QCoreApplication::applicationDirPath() + + QLatin1String("/" BACKTRACE_HELPER_NAME)); +#else + QString appExe(QLatin1String(HELPER_BINARY)); +#endif + return appExe; +} QTEST_MAIN(tst_qmessagehandler) #include "tst_qlogging.moc" -- cgit v1.2.3