diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2018-01-15 13:41:01 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2018-07-10 16:35:48 +0000 |
commit | b98af3e0f3bfdc0187d7955683f90a7012a2d133 (patch) | |
tree | 682d7be57ef07cb73f4b568743b9c86bd3deb313 | |
parent | 58c988e090bac094e8c2e8b77975c1c720725a6e (diff) | |
download | qtdeclarative-b98af3e0f3bfdc0187d7955683f90a7012a2d133.tar.gz |
QML Profiler: Test that only one Complete message is sent per session
Task-number: QTBUG-65767
Change-Id: I0485092f9a36da73e9e86ef8216be736b6560ec1
Reviewed-by: Michael Brasser <michael.brasser@live.com>
-rw-r--r-- | tests/auto/qml/debugger/debugger.pro | 5 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/condition.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/encodeQmlScope.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/exception.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/quit.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/test.js (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/test.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/data/timer.qml (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro | 26 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro | 24 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro | 12 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp) | 6 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.cpp (renamed from tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp) | 0 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.pro | 9 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml | 40 | ||||
-rw-r--r-- | tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qml/debugger/shared/debugutil.cpp | 9 | ||||
-rw-r--r-- | tests/auto/qml/debugger/shared/debugutil_p.h | 2 |
24 files changed, 114 insertions, 45 deletions
diff --git a/tests/auto/qml/debugger/debugger.pro b/tests/auto/qml/debugger/debugger.pro index 63721cc575..9ee778bc2c 100644 --- a/tests/auto/qml/debugger/debugger.pro +++ b/tests/auto/qml/debugger/debugger.pro @@ -1,5 +1,7 @@ TEMPLATE = subdirs +SUBDIRS += qqmldebugjsserver + PUBLICTESTS += \ qdebugmessageservice \ qqmlenginedebugservice \ @@ -21,6 +23,9 @@ PRIVATETESTS += \ SUBDIRS += $$PUBLICTESTS +qqmldebugjs.depends = qqmldebugjsserver +qqmlprofilerservice.depends = qqmldebugjsserver + qtConfig(private_tests): \ SUBDIRS += $$PRIVATETESTS diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml index 06aabc94f9..06aabc94f9 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/breakpointRelocation.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/breakpointRelocation.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml b/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml index 00a85e56ac..00a85e56ac 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/changeBreakpoint.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/changeBreakpoint.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml b/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml index 3a50ba2eb7..3a50ba2eb7 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/condition.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/condition.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml b/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml index 089cc03733..089cc03733 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/createComponent.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/createComponent.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml b/tests/auto/qml/debugger/qqmldebugjs/data/encodeQmlScope.qml index 7ea048044f..7ea048044f 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/encodeQmlScope.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/encodeQmlScope.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml b/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml index 06f11fa016..06f11fa016 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/exception.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/exception.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml b/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml index 088c1b19fd..088c1b19fd 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/loadjsfile.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/loadjsfile.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml b/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml index deba24cf91..deba24cf91 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/oncompleted.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/oncompleted.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml b/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml index bc8c2b90ae..bc8c2b90ae 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/quit.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/quit.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml b/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml index fb0b6c401c..fb0b6c401c 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/stepAction.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/stepAction.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js b/tests/auto/qml/debugger/qqmldebugjs/data/test.js index 92e61d103c..92e61d103c 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.js +++ b/tests/auto/qml/debugger/qqmldebugjs/data/test.js diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml b/tests/auto/qml/debugger/qqmldebugjs/data/test.qml index a36d0cae91..a36d0cae91 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/test.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/test.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml b/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml index 66e6b96e18..66e6b96e18 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/data/timer.qml +++ b/tests/auto/qml/debugger/qqmldebugjs/data/timer.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro index bd6debcea1..b9d5f116dc 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro +++ b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs.pro @@ -1,4 +1,24 @@ -TEMPLATE = subdirs -SUBDIRS = qqmldebugjs qqmldebugjsserver +CONFIG += testcase +TARGET = tst_qqmldebugjs +QT += qml testlib gui-private core-private +macos:CONFIG -= app_bundle -qqmldebugjs.depends = qqmldebugjsserver +SOURCES += tst_qqmldebugjs.cpp + +INCLUDEPATH += ../shared +include(../shared/debugutil.pri) +include(../shared/qqmlenginedebugclient.pri) + +TESTDATA = data/* + +OTHER_FILES += data/test.qml data/test.js \ + data/timer.qml \ + data/exception.qml \ + data/oncompleted.qml \ + data/loadjsfile.qml \ + data/condition.qml \ + data/changeBreakpoint.qml \ + data/stepAction.qml \ + data/breakpointRelocation.qml \ + data/createComponent.qml \ + data/encodeQmlScope.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro deleted file mode 100644 index 52d70bd1b1..0000000000 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/qqmldebugjs.pro +++ /dev/null @@ -1,24 +0,0 @@ -CONFIG += testcase -TARGET = tst_qqmldebugjs -QT += qml testlib gui-private core-private -CONFIG -= debug_and_release_target -osx:CONFIG -= app_bundle - -SOURCES += tst_qqmldebugjs.cpp - -include(../../shared/debugutil.pri) -include(../../shared/qqmlenginedebugclient.pri) - -TESTDATA = data/* - -OTHER_FILES += data/test.qml data/test.js \ - data/timer.qml \ - data/exception.qml \ - data/oncompleted.qml \ - data/loadjsfile.qml \ - data/condition.qml \ - data/changeBreakpoint.qml \ - data/stepAction.qml \ - data/breakpointRelocation.qml \ - data/createComponent.qml \ - data/encodeQmlScope.qml diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro b/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro deleted file mode 100644 index 837eaed9f1..0000000000 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.pro +++ /dev/null @@ -1,12 +0,0 @@ -QT += qml testlib -osx:CONFIG -= app_bundle -CONFIG -= debug_and_release_target -INCLUDEPATH += ../../shared -SOURCES += qqmldebugjsserver.cpp -DEFINES += QT_QML_DEBUG_NO_WARNING - -DESTDIR = ../qqmldebugjs - -target.path = $$[QT_INSTALL_TESTS]/tst_qqmldebugjs -INSTALLS += target - diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index b36e576320..35df46d73c 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -28,8 +28,8 @@ #include "debugutil_p.h" #include "qqmldebugprocess_p.h" -#include "../../shared/qqmlenginedebugclient.h" -#include "../../../../shared/util.h" +#include "../shared/qqmlenginedebugclient.h" +#include "../../../shared/util.h" #include <private/qqmldebugclient_p.h> #include <private/qqmldebugconnection_p.h> @@ -770,7 +770,7 @@ QQmlDebugTest::ConnectResult tst_QQmlDebugJS::init(bool qmlscene, const QString { const QString executable = qmlscene ? QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene" - : QCoreApplication::applicationDirPath() + QLatin1String("/qqmldebugjsserver"); + : debugJsServerPath("qqmldebugjs"); return QQmlDebugTest::connect( executable, restrictServices ? QStringLiteral("V8Debugger") : QString(), testFile(qmlFile), blockMode); diff --git a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp b/tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.cpp index 6a4ec5cc75..6a4ec5cc75 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/qqmldebugjsserver/qqmldebugjsserver.cpp +++ b/tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.cpp diff --git a/tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.pro b/tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.pro new file mode 100644 index 0000000000..a31da57054 --- /dev/null +++ b/tests/auto/qml/debugger/qqmldebugjsserver/qqmldebugjsserver.pro @@ -0,0 +1,9 @@ +QT += qml testlib +macos:CONFIG -= app_bundle +INCLUDEPATH += ../shared +SOURCES += qqmldebugjsserver.cpp +DEFINES += QT_QML_DEBUG_NO_WARNING + +target.path = $$[QT_INSTALL_TESTS]/qqmldebugjsserver +INSTALLS += target + diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml b/tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml new file mode 100644 index 0000000000..bc8c2b90ae --- /dev/null +++ b/tests/auto/qml/debugger/qqmlprofilerservice/data/quit.qml @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +//DO NOT CHANGE + +Item { + Timer { + running: true + triggeredOnStart: true + onTriggered: Qt.quit(); + } +} + diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index 323048f7d8..eb0b0c2fe2 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -34,6 +34,7 @@ #include <private/qqmldebugconnection_p.h> #include <QtTest/qtest.h> +#include <QtTest/qsignalspy.h> #include <QtCore/qlibraryinfo.h> #include <QtGui/private/qguiapplication_p.h> @@ -195,7 +196,9 @@ private: }; ConnectResult connect(bool block, const QString &testFile, bool recordFromStart = true, - uint flushInterval = 0, bool restrictServices = true); + uint flushInterval = 0, bool restrictServices = true, + const QString &executable + = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"); void checkProcessTerminated(); void checkTraceReceived(); void checkJsHeap(); @@ -221,6 +224,7 @@ private slots: void translationBinding(); void memory(); void compile(); + void multiEngine(); private: bool m_recordFromStart = true; @@ -237,7 +241,7 @@ private: QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect( bool block, const QString &file, bool recordFromStart, uint flushInterval, - bool restrictServices) + bool restrictServices, const QString &executable) { m_recordFromStart = recordFromStart; m_flushInterval = flushInterval; @@ -245,7 +249,7 @@ QQmlDebugTest::ConnectResult tst_QQmlProfilerService::connect( // ### Still using qmlscene due to QTBUG-33377 return QQmlDebugTest::connect( - QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", + executable, restrictServices ? "CanvasFrameRate,EngineControl,DebugMessages" : QString(), testFile(file), block); } @@ -806,6 +810,22 @@ void tst_QQmlProfilerService::compile() QCOMPARE(rangeStage, RangeEnd); } +void tst_QQmlProfilerService::multiEngine() +{ + QCOMPARE(connect(true, "quit.qml", true, 0, false, debugJsServerPath("qqmlprofilerservice")), + ConnectSuccess); + + QSignalSpy spy(m_client->client, SIGNAL(complete(qint64))); + + checkTraceReceived(); + checkJsHeap(); + + QTRY_COMPARE(m_process->state(), QProcess::NotRunning); + QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); + + QCOMPARE(spy.count(), 1); +} + QTEST_MAIN(tst_QQmlProfilerService) #include "tst_qqmlprofilerservice.moc" diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp index 602e533388..68446b53a4 100644 --- a/tests/auto/qml/debugger/shared/debugutil.cpp +++ b/tests/auto/qml/debugger/shared/debugutil.cpp @@ -252,3 +252,12 @@ void ClientStateHandler::checkStates() m_othersAsExpected = true; emit allOk(); } + +QString debugJsServerPath(const QString &selfPath) +{ + static const char *debugserver = "qqmldebugjsserver"; + QString appPath = QCoreApplication::applicationDirPath(); + const int position = appPath.lastIndexOf(selfPath); + return (position == -1 ? appPath : appPath.replace(position, selfPath.length(), debugserver)) + + "/" + debugserver; +} diff --git a/tests/auto/qml/debugger/shared/debugutil_p.h b/tests/auto/qml/debugger/shared/debugutil_p.h index cc7c9bd19d..1c32590305 100644 --- a/tests/auto/qml/debugger/shared/debugutil_p.h +++ b/tests/auto/qml/debugger/shared/debugutil_p.h @@ -141,4 +141,6 @@ private: bool m_othersAsExpected = false; }; +QString debugJsServerPath(const QString &selfPath); + #endif // DEBUGUTIL_P_H |