Skip to content

Commit 527c60a

Browse files
committed
Test ext-uv on Windows
1 parent 06ecbb7 commit 527c60a

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ matrix:
5151
- php -r "file_put_contents(php_ini_loaded_file(),'extension=event'.PHP_EOL,FILE_APPEND);"
5252
install:
5353
- composer install
54+
- name: "Windows PHP 7.4 with ext-uv"
55+
os: windows
56+
language: shell # no built-in php support
57+
before_install:
58+
- curl -OL https://windows.php.net/downloads/pecl/releases/uv/0.2.4/php_uv-0.2.4-7.4-nts-vc15-x64.zip # latest version as of 2019-12-23
59+
- choco install php --version=7.4.0 # latest version supported by ext-uv as of 2019-12-23
60+
- choco install composer
61+
- export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')"
62+
- php -r "\$z=new ZipArchive();\$z->open(glob('php_uv*.zip')[0]);\$z->extractTo(dirname(php_ini_loaded_file()).'/ext','php_uv.dll');\$z->extractTo(dirname(php_ini_loaded_file()),'libuv.dll');"
63+
- php -r "file_put_contents(php_ini_loaded_file(),'extension_dir=ext'.PHP_EOL,FILE_APPEND);"
64+
- php -r "file_put_contents(php_ini_loaded_file(),'extension=sockets'.PHP_EOL,FILE_APPEND);" # ext-sockets needs to be loaded before ext-uv
65+
- php -r "file_put_contents(php_ini_loaded_file(),'extension=uv'.PHP_EOL,FILE_APPEND);"
66+
install:
67+
- composer install
5468
allow_failures:
5569
- php: hhvm
5670
- os: windows

tests/AbstractLoopTest.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace React\Tests\EventLoop;
44

55
use React\EventLoop\StreamSelectLoop;
6+
use React\EventLoop\ExtUvLoop;
67

78
abstract class AbstractLoopTest extends TestCase
89
{
@@ -144,6 +145,10 @@ public function testAddWriteStreamTriggersWhenSocketConnectionRefused()
144145

145146
public function testAddReadStream()
146147
{
148+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
149+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
150+
}
151+
147152
list ($input, $output) = $this->createSocketPair();
148153

149154
$this->loop->addReadStream($input, $this->expectCallableExactly(2));
@@ -157,6 +162,10 @@ public function testAddReadStream()
157162

158163
public function testAddReadStreamIgnoresSecondCallable()
159164
{
165+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
166+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
167+
}
168+
160169
list ($input, $output) = $this->createSocketPair();
161170

162171
$this->loop->addReadStream($input, $this->expectCallableExactly(2));
@@ -206,6 +215,10 @@ private function subAddReadStreamReceivesDataFromStreamReference()
206215

207216
public function testAddWriteStream()
208217
{
218+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
219+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
220+
}
221+
209222
list ($input) = $this->createSocketPair();
210223

211224
$this->loop->addWriteStream($input, $this->expectCallableExactly(2));
@@ -215,6 +228,10 @@ public function testAddWriteStream()
215228

216229
public function testAddWriteStreamIgnoresSecondCallable()
217230
{
231+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
232+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
233+
}
234+
218235
list ($input) = $this->createSocketPair();
219236

220237
$this->loop->addWriteStream($input, $this->expectCallableExactly(2));
@@ -225,6 +242,10 @@ public function testAddWriteStreamIgnoresSecondCallable()
225242

226243
public function testRemoveReadStreamInstantly()
227244
{
245+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
246+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
247+
}
248+
228249
list ($input, $output) = $this->createSocketPair();
229250

230251
$this->loop->addReadStream($input, $this->expectCallableNever());
@@ -236,6 +257,10 @@ public function testRemoveReadStreamInstantly()
236257

237258
public function testRemoveReadStreamAfterReading()
238259
{
260+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
261+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
262+
}
263+
239264
list ($input, $output) = $this->createSocketPair();
240265

241266
$this->loop->addReadStream($input, $this->expectCallableOnce());
@@ -251,6 +276,10 @@ public function testRemoveReadStreamAfterReading()
251276

252277
public function testRemoveWriteStreamInstantly()
253278
{
279+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
280+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
281+
}
282+
254283
list ($input) = $this->createSocketPair();
255284

256285
$this->loop->addWriteStream($input, $this->expectCallableNever());
@@ -260,6 +289,10 @@ public function testRemoveWriteStreamInstantly()
260289

261290
public function testRemoveWriteStreamAfterWriting()
262291
{
292+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
293+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
294+
}
295+
263296
list ($input) = $this->createSocketPair();
264297

265298
$this->loop->addWriteStream($input, $this->expectCallableOnce());
@@ -271,6 +304,10 @@ public function testRemoveWriteStreamAfterWriting()
271304

272305
public function testRemoveStreamForReadOnly()
273306
{
307+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
308+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
309+
}
310+
274311
list ($input, $output) = $this->createSocketPair();
275312

276313
$this->loop->addReadStream($input, $this->expectCallableNever());
@@ -283,6 +320,10 @@ public function testRemoveStreamForReadOnly()
283320

284321
public function testRemoveStreamForWriteOnly()
285322
{
323+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
324+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
325+
}
326+
286327
list ($input, $output) = $this->createSocketPair();
287328

288329
fwrite($output, "foo\n");
@@ -505,6 +546,10 @@ public function testFutureTick()
505546

506547
public function testFutureTickFiresBeforeIO()
507548
{
549+
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
550+
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
551+
}
552+
508553
list ($stream) = $this->createSocketPair();
509554

510555
$this->loop->addWriteStream(
@@ -525,6 +570,9 @@ function () {
525570
$this->tickLoop($this->loop);
526571
}
527572

573+
/**
574+
* @depends testFutureTickFiresBeforeIO
575+
*/
528576
public function testRecursiveFutureTick()
529577
{
530578
list ($stream) = $this->createSocketPair();

0 commit comments

Comments
 (0)