Skip to content

Use GitHub actions for continuous integration (CI) #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix failing test cases due to inaccurate timers
  • Loading branch information
clue committed Jun 29, 2021
commit 129d9963d549fdbbad7680e128cf6d9e409fecb9
2 changes: 1 addition & 1 deletion tests/AbstractLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,7 +727,7 @@ public function testSignalsKeepTheLoopRunning()
$loop->stop();
});

$this->assertRunSlowerThan(1.5);
$this->assertRunSlowerThan(1.4);
}

/**
Expand Down
10 changes: 5 additions & 5 deletions tests/Timer/AbstractTimerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ public function testAddTimerWillBeInvokedOnceAndBlocksLoopWhenRunning()
{
$loop = $this->createLoop();

$loop->addTimer(0.002, $this->expectCallableOnce());
$loop->addTimer(0.005, $this->expectCallableOnce());

$start = microtime(true);
$loop->run();
$end = microtime(true);

// 1 invocation should take 2ms1ms due to timer inaccuracies)
// 1 invocation should take 5msa few milliseconds due to timer inaccuracies)
// make no strict assumptions about time interval, must at least take 1ms
// and should not take longer than 0.1s for slower loops.
$this->assertGreaterThanOrEqual(0.001, $end - $start);
Expand All @@ -57,7 +57,7 @@ public function testAddPeriodicTimerWillBeInvokedUntilItIsCancelled()

// make no strict assumptions about actual time interval.
// leave some room to ensure this ticks exactly 3 times.
$loop->addTimer(0.399, function () use ($loop, $periodic) {
$loop->addTimer(0.350, function () use ($loop, $periodic) {
$loop->cancelTimer($periodic);
});

Expand Down Expand Up @@ -135,7 +135,7 @@ function () use (&$start) {
$loop->run();
$end = \microtime(true);

// 1ms should be enough even on slow machines
$this->assertLessThan(0.001, $end - $start);
// 1ms should be enough even on slow machines (± 1ms due to timer inaccuracies)
$this->assertLessThan(0.002, $end - $start);
}
}
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy