forked from qt-creator/qt-creator
Process: Add a test which creates process reaper in non-main thread
Change-Id: I17ef75f42cd855b47f385dfbb3bac955eb7e0998 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
#include <app/app_version.h>
|
||||
|
||||
#include <utils/async.h>
|
||||
#include <utils/environment.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
#include <utils/launcherinterface.h>
|
||||
@@ -98,6 +99,9 @@ class tst_Process : public QObject
|
||||
private slots:
|
||||
void initTestCase();
|
||||
|
||||
// Keep me as a first test to ensure that all singletons are working OK
|
||||
// when being instantiated from the non-main thread.
|
||||
void processReaperCreatedInNonMainThread();
|
||||
void testEnv()
|
||||
{
|
||||
if (HostOsInfo::isWindowsHost())
|
||||
@@ -250,6 +254,27 @@ Q_DECLARE_METATYPE(ProcessArgs::SplitError)
|
||||
Q_DECLARE_METATYPE(OsType)
|
||||
Q_DECLARE_METATYPE(ProcessResult)
|
||||
|
||||
static bool deleteRunningProcess()
|
||||
{
|
||||
SubProcessConfig subConfig(ProcessTestApp::SimpleTest::envVar(), {});
|
||||
Process process;
|
||||
subConfig.setupSubProcess(&process);
|
||||
process.start();
|
||||
process.waitForStarted();
|
||||
return process.isRunning();
|
||||
}
|
||||
|
||||
void tst_Process::processReaperCreatedInNonMainThread()
|
||||
{
|
||||
Singleton::deleteAll();
|
||||
|
||||
auto future = Utils::asyncRun(deleteRunningProcess);
|
||||
future.waitForFinished();
|
||||
QVERIFY(future.result());
|
||||
|
||||
Singleton::deleteAll();
|
||||
}
|
||||
|
||||
void tst_Process::multiRead_data()
|
||||
{
|
||||
QTest::addColumn<QProcess::ProcessChannel>("processChannel");
|
||||
|
Reference in New Issue
Block a user