summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBrett Stottlemyer <bstottle@ford.com>2019-04-27 09:34:44 -0400
committerMichael Brasser <michael.brasser@live.com>2019-05-01 17:11:10 +0000
commit539a087eb099181630b5f5bd20d41a7b4bd45b66 (patch)
tree876590b25647c8a2b5004daaaf9077d858fb96cc /tests
parentc4e5f629c09d197c49fd1be59a8fdfeaba064c15 (diff)
Fix registration for dynamic Replicas
This adds new tests for checking that the proxy (which uses dynamic replicas to avoid needing to include headers for all proxied types) works correctly over multiple processes. This found several edge cases not seen in the earlier (single process) proxy auto tests. 1) When sending a new sub class to a dynamic replica, the properties need to be stored in a separate QByteArray and extracted after the metatype info (for both classes and gadgets) is processed. 2) When the templated acquire is used, the metatype information needs to be added to the dynamicTypeManager. 3) There is an edge case where the DynamicApiMap for a null object could not be built correctly. In this case, it needed to be regenerated once a valid object was available for the Replica sub-class. 4) There were several edge cases where the typeName needed to be updated. [ChangeLog][Important Behavior Changes] Qt Remote Objects uses an internal protocol to pass data between processes and/or devices. The same protocol version needs to be used on all sides. The version was bumped from 1.2 to 1.3 in this release, fixing potential crashes (see QTBUG-75017). If there is a mismatch, the connecting node will output a warning and the host node will not send any data. Change-Id: I7af50f16ed370351eb0692d5f4b983848846b504 Fixes: QTBUG-75017 Reviewed-by: Michael Brasser <michael.brasser@live.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/proxy_multiprocess/client/client.pro16
-rw-r--r--tests/auto/proxy_multiprocess/client/main.cpp93
-rw-r--r--tests/auto/proxy_multiprocess/proxy/main.cpp53
-rw-r--r--tests/auto/proxy_multiprocess/proxy/proxy.pro14
-rw-r--r--tests/auto/proxy_multiprocess/proxy_multiprocess.pro2
-rw-r--r--tests/auto/proxy_multiprocess/server/main.cpp99
-rw-r--r--tests/auto/proxy_multiprocess/server/mytestserver.cpp55
-rw-r--r--tests/auto/proxy_multiprocess/server/mytestserver.h55
-rw-r--r--tests/auto/proxy_multiprocess/server/server.pro19
-rw-r--r--tests/auto/proxy_multiprocess/shared.h5
-rw-r--r--tests/auto/proxy_multiprocess/subclass.rep20
-rw-r--r--tests/auto/proxy_multiprocess/tst/tst.pro8
-rw-r--r--tests/auto/proxy_multiprocess/tst/tst_proxy_multiprocess.cpp138
14 files changed, 578 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 28ee54f..69ca9f1 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -24,4 +24,4 @@ SUBDIRS += \
contains(QT_CONFIG, ssl): SUBDIRS += external_IODevice
qtHaveModule(qml): SUBDIRS += qml
-qtConfig(process): SUBDIRS += integration_multiprocess integration_external restart
+qtConfig(process): SUBDIRS += integration_multiprocess proxy_multiprocess integration_external restart
diff --git a/tests/auto/proxy_multiprocess/client/client.pro b/tests/auto/proxy_multiprocess/client/client.pro
new file mode 100644
index 0000000..ce435c2
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/client/client.pro
@@ -0,0 +1,16 @@
+TEMPLATE = app
+QT += remoteobjects core testlib
+QT -= gui
+
+TARGET = client
+DESTDIR = ./
+CONFIG += c++11
+CONFIG -= app_bundle
+
+REPC_REPLICA = ../subclass.rep
+
+SOURCES += main.cpp \
+
+HEADERS += \
+
+INCLUDEPATH += $$PWD
diff --git a/tests/auto/proxy_multiprocess/client/main.cpp b/tests/auto/proxy_multiprocess/client/main.cpp
new file mode 100644
index 0000000..05f31ea
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/client/main.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module 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$
+**
+****************************************************************************/
+
+#include "rep_subclass_replica.h"
+#include "../shared.h"
+
+#include <QCoreApplication>
+#include <QtRemoteObjects/qremoteobjectnode.h>
+#include <QtTest/QtTest>
+
+class tst_Client_Process : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void initTestCase()
+ {
+ m_repNode.reset(new QRemoteObjectNode);
+ m_repNode->connectToNode(QUrl(QStringLiteral("tcp://127.0.0.1:65213")));
+ m_rep.reset(m_repNode->acquire<ParentClassReplica>());
+ const auto objectMode = qEnvironmentVariable("ObjectMode");
+ qDebug() << "Waiting to connect, mode =" << objectMode;
+ QVERIFY(m_rep->waitForSource());
+ }
+
+ void testSubClass()
+ {
+ const auto objectMode = qEnvironmentVariable("ObjectMode");
+
+ qDebug() << "Starting test" << objectMode;
+ if (objectMode == QLatin1Literal("ObjectPointer")) {
+ QSignalSpy tracksSpy(m_rep->tracks(), &QAbstractItemModelReplica::initialized);
+ QVERIFY(m_rep->subClass() != nullptr);
+ QCOMPARE(m_rep->subClass()->myPOD(), initialValue);
+ QCOMPARE(m_rep->subClass()->i(), initialI);
+ QVERIFY(m_rep->tracks() != nullptr);
+ QVERIFY(tracksSpy.count() || tracksSpy.wait());
+ } else {
+ QVERIFY(m_rep->subClass() == nullptr);
+ QVERIFY(m_rep->tracks() == nullptr);
+ }
+ qDebug() << "Verified expected initial states, sending start.";
+ auto reply = m_rep->start();
+ QVERIFY(reply.waitForFinished());
+
+ QSignalSpy advanceSpy(m_rep.data(), SIGNAL(advance()));
+ QVERIFY(advanceSpy.wait());
+ QVERIFY(m_rep->subClass() != nullptr);
+ QCOMPARE(m_rep->subClass()->myPOD(), updatedValue);
+ QCOMPARE(m_rep->subClass()->i(), updatedI);
+ QVERIFY(m_rep->tracks() != nullptr);
+ qDebug() << "Verified expected final states, cleaning up.";
+ }
+
+ void cleanupTestCase()
+ {
+ auto reply = m_rep->quit();
+ QVERIFY(reply.waitForFinished());
+ }
+
+private:
+ QScopedPointer<QRemoteObjectNode> m_repNode;
+ QScopedPointer<ParentClassReplica> m_rep;
+};
+
+QTEST_MAIN(tst_Client_Process)
+
+#include "main.moc"
diff --git a/tests/auto/proxy_multiprocess/proxy/main.cpp b/tests/auto/proxy_multiprocess/proxy/main.cpp
new file mode 100644
index 0000000..46a73a8
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/proxy/main.cpp
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module 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$
+**
+****************************************************************************/
+
+#include <QCoreApplication>
+#include <QtRemoteObjects/qremoteobjectnode.h>
+#include <QtTest/QtTest>
+
+class tst_Proxy_Process : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void testRun()
+ {
+ m_hostNode.reset(new QRemoteObjectHost);
+ m_hostNode->setHostUrl(QUrl(QStringLiteral("tcp://127.0.0.1:65213")));
+ m_hostNode->proxy(QUrl("local:testRegistry"));
+
+ QTest::qWait(500);
+ }
+
+private:
+ QScopedPointer<QRemoteObjectHost> m_hostNode;
+};
+
+QTEST_MAIN(tst_Proxy_Process)
+
+#include "main.moc"
diff --git a/tests/auto/proxy_multiprocess/proxy/proxy.pro b/tests/auto/proxy_multiprocess/proxy/proxy.pro
new file mode 100644
index 0000000..7065ecf
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/proxy/proxy.pro
@@ -0,0 +1,14 @@
+TEMPLATE = app
+QT += remoteobjects core testlib
+QT -= gui
+
+TARGET = proxy
+DESTDIR = ./
+CONFIG += c++11
+CONFIG -= app_bundle
+
+SOURCES += main.cpp \
+
+HEADERS += \
+
+INCLUDEPATH += $$PWD
diff --git a/tests/auto/proxy_multiprocess/proxy_multiprocess.pro b/tests/auto/proxy_multiprocess/proxy_multiprocess.pro
new file mode 100644
index 0000000..075bc00
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/proxy_multiprocess.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = client server proxy tst
diff --git a/tests/auto/proxy_multiprocess/server/main.cpp b/tests/auto/proxy_multiprocess/server/main.cpp
new file mode 100644
index 0000000..af94879
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/server/main.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module 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$
+**
+****************************************************************************/
+
+#include "mytestserver.h"
+#include "rep_subclass_source.h"
+#include "../shared.h"
+
+#include <QCoreApplication>
+#include <QtTest/QtTest>
+
+class tst_Server_Process : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void testRun()
+ {
+ const auto objectMode = qEnvironmentVariable("ObjectMode");
+ bool templated = qEnvironmentVariableIsSet("TEMPLATED_REMOTING");
+
+ qDebug() << "Starting tests:" << objectMode << "templated =" << templated;
+ QRemoteObjectRegistryHost srcNode(QUrl(QStringLiteral("local:testRegistry")));
+
+ MyTestServer parent;
+ SubClassSimpleSource subclass;
+ subclass.setMyPOD(initialValue);
+ subclass.setI(initialI);
+ QStringListModel model;
+ model.setStringList(QStringList() << "Track1" << "Track2" << "Track3");
+ if (objectMode == QLatin1Literal("ObjectPointer")) {
+ parent.setSubClass(&subclass);
+ parent.setTracks(&model);
+ }
+
+ if (templated)
+ srcNode.enableRemoting<ParentClassSourceAPI>(&parent);
+ else
+ srcNode.enableRemoting(&parent);
+
+ qDebug() << "Waiting for incoming connections";
+
+ QSignalSpy waitForStartedSpy(&parent, SIGNAL(startedChanged(bool)));
+ QVERIFY(waitForStartedSpy.isValid());
+ QVERIFY(waitForStartedSpy.wait());
+ QCOMPARE(waitForStartedSpy.value(0).value(0).toBool(), true);
+
+ // wait for delivery of events
+ QTest::qWait(200);
+
+ //Change SubClass and make sure change propagates
+ SubClassSimpleSource updatedSubclass;
+ updatedSubclass.setMyPOD(updatedValue);
+ updatedSubclass.setI(updatedI);
+ parent.setSubClass(&updatedSubclass);
+ if (objectMode == QLatin1Literal("NullPointer"))
+ parent.setTracks(&model);
+
+ emit parent.advance();
+
+ // wait for quit
+ bool quit = false;
+ connect(&parent, &MyTestServer::quitApp, [&quit]{quit = true;});
+ QTRY_VERIFY_WITH_TIMEOUT(quit, 5000);
+
+ // wait for delivery of events
+ QTest::qWait(200);
+
+ qDebug() << "Done. Shutting down.";
+ }
+};
+
+QTEST_MAIN(tst_Server_Process)
+
+#include "main.moc"
diff --git a/tests/auto/proxy_multiprocess/server/mytestserver.cpp b/tests/auto/proxy_multiprocess/server/mytestserver.cpp
new file mode 100644
index 0000000..b0c75ab
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/server/mytestserver.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module 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$
+**
+****************************************************************************/
+
+#include <qdebug.h>
+
+#include "mytestserver.h"
+#include "rep_subclass_source.h"
+
+MyTestServer::MyTestServer(QObject *parent)
+ : ParentClassSimpleSource(parent)
+{
+ qDebug() << "Server started";
+}
+
+MyTestServer::~MyTestServer()
+{
+ qDebug() << "Server stopped";
+}
+
+bool MyTestServer::start()
+{
+ setStarted(true);
+ return true;
+}
+
+bool MyTestServer::quit()
+{
+ emit quitApp();
+ return true;
+}
diff --git a/tests/auto/proxy_multiprocess/server/mytestserver.h b/tests/auto/proxy_multiprocess/server/mytestserver.h
new file mode 100644
index 0000000..df044c1
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/server/mytestserver.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module 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$
+**
+****************************************************************************/
+
+#ifndef MYTESTSERVER_H
+#define MYTESTSERVER_H
+
+#include <QTimer>
+
+#include <QtRemoteObjects/qremoteobjectnode.h>
+#include <QtRemoteObjects/qremoteobjectsource.h>
+
+#include "rep_subclass_source.h"
+
+class MyTestServer : public ParentClassSimpleSource
+{
+ Q_OBJECT
+
+public:
+ MyTestServer(QObject *parent = nullptr);
+ ~MyTestServer() override;
+
+public Q_SLOTS:
+ bool start() override;
+ bool quit() override;
+
+Q_SIGNALS:
+ void quitApp();
+};
+
+#endif // MYTESTSERVER_H
diff --git a/tests/auto/proxy_multiprocess/server/server.pro b/tests/auto/proxy_multiprocess/server/server.pro
new file mode 100644
index 0000000..7167fda
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/server/server.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+QT += remoteobjects core testlib
+QT -= gui
+
+TARGET = server
+DESTDIR = ./
+CONFIG += c++11
+CONFIG -= app_bundle
+
+REPC_SOURCE = $$PWD/../subclass.rep
+
+SOURCES += main.cpp \
+ mytestserver.cpp
+
+HEADERS += \
+ mytestserver.h \
+ $$OUT_PWD/rep_subclass_source.h
+
+INCLUDEPATH += $$PWD
diff --git a/tests/auto/proxy_multiprocess/shared.h b/tests/auto/proxy_multiprocess/shared.h
new file mode 100644
index 0000000..8aa2dfe
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/shared.h
@@ -0,0 +1,5 @@
+const MyPOD initialValue(42, 3.14, QStringLiteral("SubClass"));
+const MyPOD updatedValue(-1, 123.456, QStringLiteral("Updated"));
+const int initialI = 100;
+const int updatedI = 200;
+
diff --git a/tests/auto/proxy_multiprocess/subclass.rep b/tests/auto/proxy_multiprocess/subclass.rep
new file mode 100644
index 0000000..5d3f9e9
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/subclass.rep
@@ -0,0 +1,20 @@
+POD MyPOD(int i, float f, QString s)
+
+class SubClass
+{
+ PROP(MyPOD myPOD)
+ PROP(int i)
+}
+
+class ParentClass
+{
+ PROP(bool started = false)
+
+ SLOT(bool start())
+ SLOT(bool quit())
+ SIGNAL(advance())
+
+ CLASS subClass(SubClass)
+ MODEL tracks(display)
+}
+
diff --git a/tests/auto/proxy_multiprocess/tst/tst.pro b/tests/auto/proxy_multiprocess/tst/tst.pro
new file mode 100644
index 0000000..954ebdb
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/tst/tst.pro
@@ -0,0 +1,8 @@
+CONFIG += testcase c++11
+CONFIG -= app_bundle
+TARGET = tst_proxy_multiprocess
+DESTDIR = ./
+QT += testlib remoteobjects
+QT -= gui
+
+SOURCES += tst_proxy_multiprocess.cpp
diff --git a/tests/auto/proxy_multiprocess/tst/tst_proxy_multiprocess.cpp b/tests/auto/proxy_multiprocess/tst/tst_proxy_multiprocess.cpp
new file mode 100644
index 0000000..e7f382b
--- /dev/null
+++ b/tests/auto/proxy_multiprocess/tst/tst_proxy_multiprocess.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 Ford Motor Company
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtRemoteObjects module 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$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QMetaType>
+#include <QProcess>
+#include <QStandardPaths>
+
+namespace {
+
+QString findExecutable(const QString &executableName, const QStringList &paths)
+{
+ const auto path = QStandardPaths::findExecutable(executableName, paths);
+ if (!path.isEmpty()) {
+ return path;
+ }
+
+ qWarning() << "Could not find executable:" << executableName << "in any of" << paths;
+ return QString();
+}
+
+}
+
+class tst_Proxy_MultiProcess: public QObject
+{
+ Q_OBJECT
+
+public:
+ enum ObjectMode { NullPointer, ObjectPointer };
+ Q_ENUM(ObjectMode)
+
+private slots:
+ void initTestCase()
+ {
+ }
+
+ void cleanup()
+ {
+ // wait for delivery of RemoveObject events to the source
+ QTest::qWait(200);
+ }
+
+ void testRun_data()
+ {
+ QTest::addColumn<bool>("templated");
+ QTest::addColumn<ObjectMode>("objectMode");
+ QTest::newRow("non-templated, subobject") << false << ObjectPointer;
+ QTest::newRow("templated, subobject") << true << ObjectPointer;
+ QTest::newRow("non-templated, nullptr") << false << NullPointer;
+ QTest::newRow("templated, nullptr") << true << NullPointer;
+ }
+
+ void testRun()
+ {
+ QFETCH(bool, templated);
+ QFETCH(ObjectMode, objectMode);
+
+ qDebug() << "Starting server process";
+ QProcess serverProc;
+ serverProc.setProcessChannelMode(QProcess::ForwardedChannels);
+ QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
+ env.insert("ObjectMode", QVariant::fromValue(objectMode).toString());
+ if (templated) {
+ env.insert("TEMPLATED_REMOTING", "true");
+ }
+ serverProc.setProcessEnvironment(env);
+ serverProc.start(findExecutable("server", {
+ QCoreApplication::applicationDirPath() + "/../server/"
+ }));
+ QVERIFY(serverProc.waitForStarted());
+
+ // wait for server start
+ QTest::qWait(200);
+
+
+ qDebug() << "Starting client process";
+ QProcess clientProc;
+ clientProc.setProcessChannelMode(QProcess::ForwardedChannels);
+ clientProc.setProcessEnvironment(env);
+ clientProc.start(findExecutable("client", {
+ QCoreApplication::applicationDirPath() + "/../client/"
+ }));
+ QVERIFY(clientProc.waitForStarted());
+
+ // wait for client start
+ QTest::qWait(200);
+
+
+ qDebug() << "Starting proxy process";
+ QProcess proxyProc;
+ proxyProc.setProcessChannelMode(QProcess::ForwardedChannels);
+ proxyProc.start(findExecutable("proxy", {
+ QCoreApplication::applicationDirPath() + "/../proxy/"
+ }));
+ QVERIFY(proxyProc.waitForStarted());
+
+ // wait for proxy start
+ QTest::qWait(200);
+
+
+ QVERIFY(clientProc.waitForFinished());
+ QVERIFY(proxyProc.waitForFinished());
+ QVERIFY(serverProc.waitForFinished());
+
+ QCOMPARE(serverProc.exitCode(), 0);
+ QCOMPARE(proxyProc.exitCode(), 0);
+ QCOMPARE(clientProc.exitCode(), 0);
+ }
+};
+
+QTEST_MAIN(tst_Proxy_MultiProcess)
+
+#include "tst_proxy_multiprocess.moc"