Debugger: Run js autotests with QML_DISABLE_OPTIMIZER
authorKai Koehne <kai.koehne@nokia.com>
Wed, 30 Nov 2011 16:16:42 +0000 (17:16 +0100)
committerQt by Nokia <qt-info@nokia.com>
Wed, 7 Dec 2011 23:03:43 +0000 (00:03 +0100)
That's how you'd usually debug your app too.

Change-Id: I5acbf2fea0db3cb8593d690638f90ec849cf316a
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
tests/auto/declarative/debugger/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
tests/auto/declarative/debugger/shared/debugutil.cpp
tests/auto/declarative/debugger/shared/debugutil_p.h

index 8967b84..aa50d64 100644 (file)
@@ -972,6 +972,9 @@ bool tst_QDeclarativeDebugJS::init(const QString &qmlFile, bool blockMode)
     process = new QDeclarativeDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene");
     client = new QJSDebugClient(connection);
 
+    QStringList systemEnvironment = QProcess::systemEnvironment();
+    systemEnvironment << "QML_DISABLE_OPTIMIZER=1";
+    process->setEnvironment(systemEnvironment);
     if (blockMode)
         process->start(QStringList() << QLatin1String(BLOCKMODE) << TESTDATA(qmlFile));
     else
index 04770a9..c259ac9 100644 (file)
@@ -122,6 +122,7 @@ QDeclarativeDebugProcess::~QDeclarativeDebugProcess()
 void QDeclarativeDebugProcess::start(const QStringList &arguments)
 {
     m_mutex.lock();
+    m_process.setEnvironment(m_environment);
     m_process.start(m_executable, arguments);
     m_process.waitForStarted();
     m_timer.start();
@@ -147,6 +148,11 @@ bool QDeclarativeDebugProcess::waitForSessionStart()
     return m_started;
 }
 
+void QDeclarativeDebugProcess::setEnvironment(const QStringList &environment)
+{
+    m_environment = environment;
+}
+
 QString QDeclarativeDebugProcess::output() const
 {
     return m_output;
index cb0e10c..4d2ee16 100644 (file)
@@ -101,6 +101,8 @@ public:
     QDeclarativeDebugProcess(const QString &executable);
     ~QDeclarativeDebugProcess();
 
+    void setEnvironment(const QStringList &environment);
+
     void start(const QStringList &arguments);
     bool waitForSessionStart();
 
@@ -119,6 +121,7 @@ private:
     QEventLoop m_eventLoop;
     QMutex m_mutex;
     bool m_started;
+    QStringList m_environment;
 };
 
 #endif // DEBUGUTIL_H