amphp / process

An async process dispatcher for Amp.
MIT License
233 stars 30 forks source link

Not running at windows #39

Closed Thomblin closed 3 years ago

Thomblin commented 5 years ago

I try to run the tests at windows 10 with virtualbox. What do I need to do to fix these errors?

php -v
PHP 7.3.6 (cli) (built: May 29 2019 12:11:00) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.6, Copyright (c) 1998-2018 Zend Technologies
.\vendor\bin\phpunit
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

....S.......................................FEF                   47 / 47 (100%)

Time: 1.23 minutes, Memory: 6.00MB

There was 1 error:

1) Amp\Process\Test\ProcessTest::testSignal
Error: Undefined constant 'SIGTERM'

F:\windows\process\test\ProcessTest.php:384
F:\windows\process\vendor\amphp\amp\lib\Coroutine.php:76
F:\windows\process\vendor\amphp\amp\lib\Internal\Placeholder.php:130
F:\windows\process\vendor\amphp\amp\lib\Delayed.php:22
F:\windows\process\vendor\amphp\amp\lib\Loop\NativeDriver.php:130
F:\windows\process\vendor\amphp\amp\lib\Loop\Driver.php:134
F:\windows\process\vendor\amphp\amp\lib\Loop\Driver.php:72
F:\windows\process\vendor\amphp\amp\lib\Loop.php:84
F:\windows\process\test\ProcessTest.php:386

--

There were 2 failures:

1) Amp\Process\Test\ProcessTest::testKillPHPImmediatly
Failed asserting that a string is empty.

F:\windows\process\test\ProcessTest.php:374
F:\windows\process\vendor\amphp\amp\lib\Coroutine.php:76
F:\windows\process\vendor\amphp\amp\lib\Internal\Placeholder.php:130
F:\windows\process\vendor\amphp\amp\lib\Coroutine.php:81
F:\windows\process\vendor\amphp\amp\lib\Internal\Placeholder.php:130
F:\windows\process\vendor\amphp\amp\lib\Deferred.php:45
F:\windows\process\lib\Internal\Windows\SocketConnector.php:270
F:\windows\process\vendor\amphp\amp\lib\Loop\NativeDriver.php:206
F:\windows\process\vendor\amphp\amp\lib\Loop\NativeDriver.php:97
F:\windows\process\vendor\amphp\amp\lib\Loop\Driver.php:134
F:\windows\process\vendor\amphp\amp\lib\Loop\Driver.php:72
F:\windows\process\vendor\amphp\amp\lib\Loop.php:84
F:\windows\process\test\ProcessTest.php:375

2) Amp\Process\Test\ProcessTest::testDebugInfo
Failed asserting that Array &0 (
    'command' => '"php" "F:\windows\process\test/bin/worker.php"'
    'cwd' => 'F:\windows\process\test'
    'env' => Array &1 ()
    'options' => Array &2 ()
    'pid' => null
    'status' => -1
) is identical to Array &0 (
    'command' => ''php' 'F:\windows\process\test/bin/worker.php''
    'cwd' => 'F:\windows\process\test'
    'env' => Array &1 ()
    'options' => Array &2 ()
    'pid' => null
    'status' => -1
).

F:\windows\process\test\ProcessTest.php:401
F:\windows\process\vendor\amphp\amp\lib\Coroutine.php:41
F:\windows\process\vendor\amphp\amp\lib\Loop\Driver.php:123
F:\windows\process\vendor\amphp\amp\lib\Loop\Driver.php:72
F:\windows\process\vendor\amphp\amp\lib\Loop.php:84
F:\windows\process\test\ProcessTest.php:409

ERRORS!
Tests: 47, Assertions: 64, Errors: 1, Failures: 2, Skipped: 1.
kelunik commented 5 years ago

For error (1) we need to skip the test on Windows, as signals aren't supported there. For failure (2) we have to adjust the expected value, as escaping on Windows works differently. I'm not sure what's wrong with failure (1), could you dump the value there that is not empty?

Thomblin commented 5 years ago

The result of \fread($conn, 3) at testKillPHPImmediatly is the string end

kelunik commented 3 years ago

This has been fixed now.