diff options
author | Miguel Costa <miguel.costa@qt.io> | 2019-04-29 17:40:09 +0200 |
---|---|---|
committer | Miguel Costa <miguel.costa@qt.io> | 2019-05-08 10:59:06 +0000 |
commit | 4a42f89d9635ee7191a663973af59e7fe923a178 (patch) | |
tree | 619e2c753e8c0925758f7d8ef139ed28950d59fd | |
parent | 2477d3ae97a6fffea1569dc3a1ccbdaa98731f4f (diff) |
Allow VS process to remain running after test
After running all tests, the test application will no longer forceably
kill the Visual Studio process. This will allow the VS process to keep
running after testing is complete (e.g. to allow manual analysis of
side-effects of long running tests). To ensure VS is closed, the 'quit'
macro command should be sent when the test application is shutting down.
Change-Id: I860d10c9e08d64f316a90400745305ce8b10ec7e
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r-- | src/qtvstest/MacroClient.h | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/src/qtvstest/MacroClient.h b/src/qtvstest/MacroClient.h index d13db926..b86a1af0 100644 --- a/src/qtvstest/MacroClient.h +++ b/src/qtvstest/MacroClient.h @@ -34,8 +34,9 @@ #include <QString> #include <QElapsedTimer> -#include <QtNetwork> +#include <QLocalSocket> #include <QProcess> +#include <QThread> #define MACRO_OK QStringLiteral("(ok)") #define MACRO_ERROR QStringLiteral("(error)") @@ -56,10 +57,6 @@ inline bool macroResultError(QString result) class MacroClient { -private: - QProcess vsProcess; - QLocalSocket socket; - public: MacroClient() { @@ -70,6 +67,7 @@ public: ~MacroClient() { + disconnectFromServer(false); } bool connectToServer() @@ -106,6 +104,8 @@ public: if (closeVs) return terminateServerProcess(); + else + vsProcess.detach(); return true; } @@ -187,6 +187,22 @@ public: return runMacro(macroCode); } +private: + class QDetachableProcess : public QProcess + { + public: + QDetachableProcess(QObject *parent = 0) : QProcess(parent) + { } + void detach() + { + waitForStarted(); + setProcessState(QProcess::NotRunning); + } + }; + + QDetachableProcess vsProcess; + QLocalSocket socket; + }; // class MacroClient #endif // MACROCLIENT_H |