From feb1d443f170d1b8b2483ec629be2895dd4dc426 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sun, 23 Dec 2018 07:58:29 +0100 Subject: [PATCH] Try to make TestShellClient::testUnresponsiveWindow more robust Summary: When looking at the test results on build.kde.org we see this is the test which fails most often and it's always at the same line of code. So I just had a look with the thought: "what's special about this code, why could it fail?" Looking at it we start an external process which is supposed to connect to KWin. We wait for the process to start and then wait for the shell client added. This assumes that at the time we handle the wait for started the connection of the window has not happened yet. Waiting for the process in a blocking way, might make the process fail to connect to the Wayland session, so this is changed to not block and instead use a signal. Reviewers: #kwin Subscribers: kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D17748 --- autotests/integration/shell_client_test.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autotests/integration/shell_client_test.cpp b/autotests/integration/shell_client_test.cpp index a6ab4431fd..59d0202b9a 100644 --- a/autotests/integration/shell_client_test.cpp +++ b/autotests/integration/shell_client_test.cpp @@ -982,11 +982,15 @@ void TestShellClient::testUnresponsiveWindow() process->setProcessEnvironment(env); process->setProcessChannelMode(QProcess::ForwardedChannels); process->setProgram(kill); + QSignalSpy processStartedSpy{process.data(), &QProcess::started}; + QVERIFY(processStartedSpy.isValid()); process->start(); - QVERIFY(process->waitForStarted()); + QVERIFY(processStartedSpy.wait()); AbstractClient *killClient = nullptr; - QVERIFY(shellClientAddedSpy.wait()); + if (shellClientAddedSpy.isEmpty()) { + QVERIFY(shellClientAddedSpy.wait()); + } killClient = shellClientAddedSpy.first().first().value(); QSignalSpy unresponsiveSpy(killClient, &AbstractClient::unresponsiveChanged); QSignalSpy killedSpy(process.data(), static_cast(&QProcess::finished));