tester: fix sleeps waiting for too long (#12774)
This commit is contained in:
parent
529559712b
commit
d622c09d09
2 changed files with 22 additions and 2 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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-warp 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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue