Skip to content
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
Test ext-uv on Windows
  • Loading branch information
clue committed Dec 30, 2019
commit 527c60af4d4fbd9fc76a6a227ed18dbd264ef9fd
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,20 @@ matrix:
- php -r "file_put_contents(php_ini_loaded_file(),'extension=event'.PHP_EOL,FILE_APPEND);"
install:
- composer install
- name: "Windows PHP 7.4 with ext-uv"
os: windows
language: shell # no built-in php support
before_install:
- 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
- choco install php --version=7.4.0 # latest version supported by ext-uv as of 2019-12-23
- choco install composer
- export PATH="$(powershell -Command '("Process", "Machine" | % { [Environment]::GetEnvironmentVariable("PATH", $_) -Split ";" -Replace "\\$", "" } | Select -Unique | % { cygpath $_ }) -Join ":"')"
- 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');"
- php -r "file_put_contents(php_ini_loaded_file(),'extension_dir=ext'.PHP_EOL,FILE_APPEND);"
- php -r "file_put_contents(php_ini_loaded_file(),'extension=sockets'.PHP_EOL,FILE_APPEND);" # ext-sockets needs to be loaded before ext-uv
- php -r "file_put_contents(php_ini_loaded_file(),'extension=uv'.PHP_EOL,FILE_APPEND);"
install:
- composer install
allow_failures:
- php: hhvm
- os: windows
Expand Down
48 changes: 48 additions & 0 deletions tests/AbstractLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace React\Tests\EventLoop;

use React\EventLoop\StreamSelectLoop;
use React\EventLoop\ExtUvLoop;

abstract class AbstractLoopTest extends TestCase
{
Expand Down Expand Up @@ -144,6 +145,10 @@ public function testAddWriteStreamTriggersWhenSocketConnectionRefused()

public function testAddReadStream()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input, $output) = $this->createSocketPair();

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

public function testAddReadStreamIgnoresSecondCallable()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input, $output) = $this->createSocketPair();

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

public function testAddWriteStream()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input) = $this->createSocketPair();

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

public function testAddWriteStreamIgnoresSecondCallable()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input) = $this->createSocketPair();

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

public function testRemoveReadStreamInstantly()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input, $output) = $this->createSocketPair();

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

public function testRemoveReadStreamAfterReading()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input, $output) = $this->createSocketPair();

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

public function testRemoveWriteStreamInstantly()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input) = $this->createSocketPair();

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

public function testRemoveWriteStreamAfterWriting()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input) = $this->createSocketPair();

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

public function testRemoveStreamForReadOnly()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input, $output) = $this->createSocketPair();

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

public function testRemoveStreamForWriteOnly()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($input, $output) = $this->createSocketPair();

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

public function testFutureTickFiresBeforeIO()
{
if ($this->loop instanceof ExtUvLoop && DIRECTORY_SEPARATOR === '\\') {
$this->markTestIncomplete('Ticking ExtUvLoop not supported on Windows');
}

list ($stream) = $this->createSocketPair();

$this->loop->addWriteStream(
Expand All @@ -525,6 +570,9 @@ function () {
$this->tickLoop($this->loop);
}

/**
* @depends testFutureTickFiresBeforeIO
*/
public function testRecursiveFutureTick()
{
list ($stream) = $this->createSocketPair();
Expand Down