From d622c09d09094eba49f6e219c81059ee0be548c2 Mon Sep 17 00:00:00 2001 From: ArchSav <96357545+ArchSav@users.noreply.github.com> Date: Wed, 31 Dec 2025 23:08:40 +1100 Subject: tester: fix sleeps waiting for too long (#12774) --- hyprtester/src/tests/clients/pointer-scroll.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'hyprtester/src/tests/clients/pointer-scroll.cpp') diff --git a/hyprtester/src/tests/clients/pointer-scroll.cpp b/hyprtester/src/tests/clients/pointer-scroll.cpp index 2ea93a14..d54d82de 100644 --- a/hyprtester/src/tests/clients/pointer-scroll.cpp +++ b/hyprtester/src/tests/clients/pointer-scroll.cpp @@ -42,6 +42,7 @@ static bool startClient(SClient& client) { client.readFd = CFileDescriptor(pipeFds2[0]); client.proc->setStdoutFD(pipeFds2[1]); + const int COUNT_BEFORE = Tests::windowCount(); client.proc->runAsync(); close(pipeFds1[0]); @@ -62,7 +63,16 @@ static bool startClient(SClient& client) { } // wait for window to appear - std::this_thread::sleep_for(std::chrono::milliseconds(5000)); + int counter = 0; + while (Tests::processAlive(client.proc->pid()) && Tests::windowCount() == COUNT_BEFORE) { + counter++; + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + + if (counter > 50) { + NLog::log("{}pointer-scroll client took too long to open", Colors::RED); + return false; + } + } if (getFromSocket(std::format("/dispatch setprop pid:{} no_anim 1", client.proc->pid())) != "ok") { NLog::log("{}Failed to disable animations for client window", Colors::RED, ret); -- cgit v1.2.3