aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/debugger/shared
diff options
context:
space:
mode:
authorAurindam Jana <aurindam.jana@digia.com>2013-03-18 17:17:52 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-02 13:26:03 +0200
commitf15595901b645fc3c168ef18f81ae4617b439e92 (patch)
treeedcb11ea4a7ee984a0e66b1b1f94fbdf1b08dd2f /tests/auto/qml/debugger/shared
parent3e0bcbff98346385ec32bc951cd958d1c1bfb371 (diff)
Debugger: Accepts port range as arguments
Allow a port range to pass on command line, and try to listen on any of the ports in the range. (Re)using the ',' separator allows for backwards compatibility, that is, also Qt 4 will accept a -qmljsdebugger=port:1000,1010 argument, but will only try to listen on port 1000. Change-Id: Ic03fe20e4aee9ecdea86651f46f1df5cb19bd75c Reviewed-by: Kai Koehne <kai.koehne@digia.com>
Diffstat (limited to 'tests/auto/qml/debugger/shared')
-rw-r--r--tests/auto/qml/debugger/shared/debugutil.cpp11
-rw-r--r--tests/auto/qml/debugger/shared/debugutil_p.h2
2 files changed, 12 insertions, 1 deletions
diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp
index 7df753df03..6585f7eca2 100644
--- a/tests/auto/qml/debugger/shared/debugutil.cpp
+++ b/tests/auto/qml/debugger/shared/debugutil.cpp
@@ -89,6 +89,7 @@ QQmlDebugProcess::QQmlDebugProcess(const QString &executable, QObject *parent)
: QObject(parent)
, m_executable(executable)
, m_started(false)
+ , m_port(0)
{
m_process.setProcessChannelMode(QProcess::MergedChannels);
m_timer.setSingleShot(true);
@@ -123,6 +124,7 @@ QString QQmlDebugProcess::state()
void QQmlDebugProcess::start(const QStringList &arguments)
{
m_mutex.lock();
+ m_port = 0;
m_process.setEnvironment(m_environment);
m_process.start(m_executable, arguments);
if (!m_process.waitForStarted()) {
@@ -161,6 +163,11 @@ bool QQmlDebugProcess::waitForSessionStart()
return m_started;
}
+int QQmlDebugProcess::debugPort() const
+{
+ return m_port;
+}
+
void QQmlDebugProcess::setEnvironment(const QStringList &environment)
{
m_environment = environment;
@@ -187,7 +194,9 @@ void QQmlDebugProcess::processAppOutput()
m_outputBuffer = m_outputBuffer.right(m_outputBuffer.size() - nlIndex - 1);
if (line.contains("QML Debugger:")) {
- if (line.contains("Waiting for connection ")) {
+ const QRegExp portRx("Waiting for connection on port (\\d+)");
+ if (portRx.indexIn(line) != -1) {
+ m_port = portRx.cap(1).toInt();
m_timer.stop();
m_started = true;
m_eventLoop.quit();
diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h
index 5b272749ae..363aabbf39 100644
--- a/tests/auto/qml/debugger/shared/debugutil_p.h
+++ b/tests/auto/qml/debugger/shared/debugutil_p.h
@@ -93,6 +93,7 @@ public:
void start(const QStringList &arguments);
bool waitForSessionStart();
+ int debugPort() const;
QString output() const;
void stop();
@@ -111,6 +112,7 @@ private:
QMutex m_mutex;
bool m_started;
QStringList m_environment;
+ int m_port;
};
#endif // DEBUGUTIL_H