diff options
Diffstat (limited to 'tests/auto/corelib/global')
-rw-r--r-- | tests/auto/corelib/global/qlogging/app/app.pro | 6 | ||||
-rw-r--r-- | tests/auto/corelib/global/qlogging/tst_qlogging.cpp | 32 |
2 files changed, 26 insertions, 12 deletions
diff --git a/tests/auto/corelib/global/qlogging/app/app.pro b/tests/auto/corelib/global/qlogging/app/app.pro index a167cc45cd..1088d08a58 100644 --- a/tests/auto/corelib/global/qlogging/app/app.pro +++ b/tests/auto/corelib/global/qlogging/app/app.pro @@ -3,7 +3,9 @@ TEMPLATE = app TARGET = app QT = core -CONFIG -= debug_and_release app_bundle -CONFIG += debug console +DESTDIR = ./ + +CONFIG -= app_bundle +CONFIG += console SOURCES += main.cpp diff --git a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp index 11949cf1db..aaec46fe64 100644 --- a/tests/auto/corelib/global/qlogging/tst_qlogging.cpp +++ b/tests/auto/corelib/global/qlogging/tst_qlogging.cpp @@ -47,6 +47,9 @@ class tst_qmessagehandler : public QObject { Q_OBJECT +public slots: + void initTestCase(); + private slots: void cleanup(); @@ -59,6 +62,9 @@ private slots: void cleanupFuncinfo(); void qMessagePattern(); + +private: + QString m_appDir; }; static QtMsgType s_type; @@ -85,6 +91,13 @@ void customMsgHandler(QtMsgType type, const char *msg) s_message = QString::fromLocal8Bit(msg); } +void tst_qmessagehandler::initTestCase() +{ + m_appDir = QFINDTESTDATA("app"); + QVERIFY2(!m_appDir.isEmpty(), qPrintable( + QString::fromLatin1("Couldn't find helper app dir starting from %1.").arg(QDir::currentPath()))); +} + void tst_qmessagehandler::cleanup() { qInstallMsgHandler(0); @@ -622,11 +635,11 @@ void tst_qmessagehandler::qMessagePattern() // %{file} is tricky because of shadow builds environment.prepend("QT_MESSAGE_PATTERN=\"%{type} %{appname} %{line} %{function} %{message}\""); process.setEnvironment(environment); -#ifdef Q_OS_WIN - process.start("app/app.exe"); -#else - process.start("app/app"); -#endif + + QString appExe = m_appDir + "/app"; + process.start(appExe); + QVERIFY2(process.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(appExe, process.errorString()))); process.waitForFinished(); QByteArray output = process.readAllStandardError(); @@ -643,11 +656,10 @@ void tst_qmessagehandler::qMessagePattern() environment = QProcess::systemEnvironment(); environment.prepend("QT_MESSAGE_PATTERN=\"PREFIX: %{unknown} %{message}\""); process.setEnvironment(environment); -#ifdef Q_OS_WIN - process.start("app/app.exe"); -#else - process.start("app/app"); -#endif + + process.start(appExe); + QVERIFY2(process.waitForStarted(), qPrintable( + QString::fromLatin1("Could not start %1: %2").arg(appExe, process.errorString()))); process.waitForFinished(); output = process.readAllStandardError(); |