diff --git a/tests/auto/utils/process/tst_process.cpp b/tests/auto/utils/process/tst_process.cpp index a1e92edfe28..d6e283e4f9a 100644 --- a/tests/auto/utils/process/tst_process.cpp +++ b/tests/auto/utils/process/tst_process.cpp @@ -5,6 +5,7 @@ #include +#include #include #include #include @@ -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("processChannel");