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>
This commit is contained in:
parent
58c988e090
commit
b98af3e0f3
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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
|
||||
|
|
@ -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);
|
|
@ -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
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -141,4 +141,6 @@ private:
|
|||
bool m_othersAsExpected = false;
|
||||
};
|
||||
|
||||
QString debugJsServerPath(const QString &selfPath);
|
||||
|
||||
#endif // DEBUGUTIL_P_H
|
||||
|
|
Loading…
Reference in New Issue