Skip to content

Commit b946301

Browse files
committed
Increase test timeouts for HHVM and unify timeout handling
1 parent c3653ae commit b946301

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

tests/AbstractLoopTest.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,12 @@ abstract class AbstractLoopTest extends TestCase
99
*/
1010
protected $loop;
1111

12+
private $tickTimeout;
13+
1214
public function setUp()
1315
{
16+
// HHVM is a bit slow, so give it more time
17+
$this->tickTimeout = defined('HHVM_VERSION') ? 0.02 : 0.005;
1418
$this->loop = $this->createLoop();
1519
}
1620

@@ -161,7 +165,7 @@ public function testRemoveInvalid()
161165
/** @test */
162166
public function emptyRunShouldSimplyReturn()
163167
{
164-
$this->assertRunFasterThan(0.005);
168+
$this->assertRunFasterThan($this->tickTimeout);
165169
}
166170

167171
/** @test */
@@ -176,7 +180,7 @@ public function runShouldReturnWhenNoMoreFds()
176180

177181
$this->writeToStream($input, "foo\n");
178182

179-
$this->assertRunFasterThan(0.015);
183+
$this->assertRunFasterThan($this->tickTimeout * 2);
180184
}
181185

182186
/** @test */
@@ -191,10 +195,10 @@ public function stopShouldStopRunningLoop()
191195

192196
$this->writeToStream($input, "foo\n");
193197

194-
$this->assertRunFasterThan(0.005);
198+
$this->assertRunFasterThan($this->tickTimeout * 2);
195199
}
196200

197-
public function testStopShouldPreventRunFromBlocking($timeLimit = 0.005)
201+
public function testStopShouldPreventRunFromBlocking()
198202
{
199203
$this->loop->addTimer(
200204
1,
@@ -209,7 +213,7 @@ function () {
209213
}
210214
);
211215

212-
$this->assertRunFasterThan($timeLimit);
216+
$this->assertRunFasterThan($this->tickTimeout * 2);
213217
}
214218

215219
public function testIgnoreRemovedCallback()

tests/StreamSelectLoopTest.php

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,6 @@ public function testStreamSelectTimeoutEmulation()
3737
$this->assertGreaterThan(0.04, $interval);
3838
}
3939

40-
public function testStopShouldPreventRunFromBlocking($timeLimit = 0.005)
41-
{
42-
if (defined('HHVM_VERSION')) {
43-
// HHVM is a bit slow, so give it more time
44-
parent::testStopShouldPreventRunFromBlocking(0.5);
45-
} else {
46-
parent::testStopShouldPreventRunFromBlocking($timeLimit);
47-
}
48-
}
49-
50-
5140
public function signalProvider()
5241
{
5342
return [

0 commit comments

Comments
 (0)