summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/global/qlogging
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-02-16 14:20:57 +0200
committerQt by Nokia <qt-info@nokia.com>2012-02-17 05:26:58 +0100
commit7c081ba94239e26f4e5c8b8c8a8c3486d1a8c76e (patch)
tree094ed6518ad4c2222ce6dd07d2a63ed3e55b3f11 /tests/auto/corelib/global/qlogging
parent3b5f6f76471118e60ee9c9b8536d6b4fba1e785d (diff)
Fix qlogging test for release configuration
The helper process 'app' wasn't built in release configuration. Also improved finding the helper executable to utilize QFINDTESTDATA and print out a proper errors if it could not be found or started. Note that adding ".exe" to process name in Windows is unnecessary as QProcess already does that for you, so removed the ifdeffing. Task-number: QTBUG-24330 Change-Id: Ibe75e0ecd24181ab623d0a60f17ecaf92052b0dd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'tests/auto/corelib/global/qlogging')
-rw-r--r--tests/auto/corelib/global/qlogging/app/app.pro6
-rw-r--r--tests/auto/corelib/global/qlogging/tst_qlogging.cpp32
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();