diff --git a/tests/auto/utils/process/processtestapp/processtestapp.cpp b/tests/auto/utils/process/processtestapp/processtestapp.cpp index 6cf7510eb78..77f36a362ec 100644 --- a/tests/auto/utils/process/processtestapp/processtestapp.cpp +++ b/tests/auto/utils/process/processtestapp/processtestapp.cpp @@ -161,10 +161,16 @@ int ProcessTestApp::BlockingProcess::main() { std::cout << "Blocking process successfully executed." << std::endl; const BlockType blockType = BlockType(qEnvironmentVariableIntValue(envVar())); + bool dummy = true; switch (blockType) { case BlockType::EndlessLoop: - while (true) - ; + while (true) { + if (dummy) { + // Note: Keep these lines, otherwise the compiler may optimize out the empty loop. + std::cout << "EndlessLoop started" << std::endl; + dummy = false; + } + } break; case BlockType::InfiniteSleep: QThread::sleep(INT_MAX); diff --git a/tests/auto/utils/process/tst_process.cpp b/tests/auto/utils/process/tst_process.cpp index 589adbb6fa8..52e4658778f 100644 --- a/tests/auto/utils/process/tst_process.cpp +++ b/tests/auto/utils/process/tst_process.cpp @@ -1216,7 +1216,6 @@ void tst_Process::mergedChannels_data() << false << false << false << true; QTest::newRow("ForwardedErrorChannel") << QProcess::ForwardedErrorChannel << true << false << false << false; - } void tst_Process::mergedChannels() @@ -1265,6 +1264,7 @@ void tst_Process::destroyBlockingProcess() subConfig.setupSubProcess(&process); process.start(); QVERIFY(process.waitForStarted()); + QVERIFY(process.isRunning()); QVERIFY(!process.waitForFinished(1000)); }