Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Process] Some tests fail on Windows #22556

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

Closed
maryo opened this issue Apr 27, 2017 · 5 comments
Closed

[Process] Some tests fail on Windows #22556

maryo opened this issue Apr 27, 2017 · 5 comments

Comments

@maryo
Copy link
Contributor

maryo commented Apr 27, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version master

Some tests of the process component fail on my machine - x64 Windows 10, PHP 7.1.4

D:\Www\symfony>php ./phpunit src/Symfony/Component/Process/
#!/usr/bin/env php
INFO: Could not find files for the given pattern(s).
PHPUnit 6.0.13 by Sebastian Bergmann and contributors.

Testing src/Symfony/Component/Process/
...SS.S.FF..................S...S..............................  63 / 161 ( 39%)
......SSS..S..............SSSS............SS..........SS....... 126 / 161 ( 78%)
....................E..............                             161 / 161 (100%)

Time: 23.04 seconds, Memory: 4.00MB

There was 1 error:

1) Symfony\Component\Process\Tests\ProcessTest::testInheritEnvDisabled
array_intersect_key(): Argument #1 is not an array

D:\Www\symfony\src\Symfony\Component\Process\Tests\ProcessTest.php:1443
D:\Www\symfony\.phpunit\phpunit-6.0\phpunit:5

--

There were 2 failures:

1) Symfony\Component\Process\Tests\PhpProcessTest::testNonBlockingWorks
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'hello world!'
+''

D:\Www\symfony\src\Symfony\Component\Process\Tests\PhpProcessTest.php:28
D:\Www\symfony\.phpunit\phpunit-6.0\phpunit:5

2) Symfony\Component\Process\Tests\PhpProcessTest::testCommandLine
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-7.1.4cli
+

D:\Www\symfony\src\Symfony\Component\Process\Tests\PhpProcessTest.php:46
D:\Www\symfony\.phpunit\phpunit-6.0\phpunit:5

ERRORS!
Tests: 161, Assertions: 252, Errors: 1, Failures: 2, Skipped: 17.

Legacy deprecation notices (12)
@nicolas-grekas
Copy link
Member

I can't reproduce on appveyor, see https://ci.appveyor.com/project/fabpot/symfony/build/1.0.21543: this doesn't fail for the Process component. Are these errors predictable on your machine? Can you please try to investigate a bit further where this might come from?

nicolas-grekas added a commit that referenced this issue May 2, 2017
…rekas)

This PR was merged into the 3.2 branch.

Discussion
----------

[appveyor][3.x] Run the test suite on PHP 7.1

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | let's see
| Fixed tickets | #22556
| License       | MIT
| Doc PR        | -

Commits
-------

51b82f5 [appveyor][3.x] Run the test suite on PHP 7.1
@maryo
Copy link
Contributor Author

maryo commented May 2, 2017

@nicolas-grekas
The main problem was #22613. And I don't know why but the first errored test was still causing an error 1) Symfony\Component\Process\Tests\ProcessTest::testInheritEnvDisabled array_intersect_key(): Argument #1 is not an array
So I was looking into why it happens and then somehow the error magically disappeared and the suite run successfully. But I encountered another issue while investigating described in #22614 so maybe it's related

@maryo
Copy link
Contributor Author

maryo commented May 7, 2017

@nicolas-grekas
I've found sime time to look at it again primarily because of #22614 (I've updated the PR to include a fix) but I've run the tests on my home PC (also Windows 10 x64, PHP 7.1 x64) and even more of them failed regardless my modifications :-/.

1) Symfony\Component\Process\Tests\ProcessTest::testIteratorInput
Symfony\Component\Process\Exception\ProcessTimedOutException: The process ""D:\Program Files\PHP\php.exe" -r "stream_copy_to_stream(STDIN, STDOUT);"" exceeded the timeout of 60 seconds.

D:\www\symfony\src\Symfony\Component\Process\Process.php:1332
D:\www\symfony\src\Symfony\Component\Process\Process.php:421
D:\www\symfony\src\Symfony\Component\Process\Process.php:216
D:\www\symfony\src\Symfony\Component\Process\Tests\ProcessTest.php:1214
D:\www\symfony\.phpunit\phpunit-6.0\phpunit:5

2) Symfony\Component\Process\Tests\ProcessTest::testSimpleInputStream
Symfony\Component\Process\Exception\ProcessTimedOutException: The process ""D:\Program Files\PHP\php.exe" -r "echo 'ping'; stream_copy_to_stream(STDIN, STDOUT);"" exceeded the timeout of 60 seconds.

D:\www\symfony\src\Symfony\Component\Process\Process.php:1332
D:\www\symfony\src\Symfony\Component\Process\Process.php:421
D:\www\symfony\src\Symfony\Component\Process\Tests\ProcessTest.php:1234
D:\www\symfony\.phpunit\phpunit-6.0\phpunit:5

3) Symfony\Component\Process\Tests\ProcessTest::testInputStreamWithGenerator
Symfony\Component\Process\Exception\ProcessTimedOutException: The process ""D:\Program Files\PHP\php.exe" -r "stream_copy_to_stream(STDIN, STDOUT);"" exceeded the timeout of 60 seconds.

D:\www\symfony\src\Symfony\Component\Process\Process.php:1332
D:\www\symfony\src\Symfony\Component\Process\Process.php:421
D:\www\symfony\src\Symfony\Component\Process\Tests\ProcessTest.php:1278
D:\www\symfony\.phpunit\phpunit-6.0\phpunit:5

--

There was 1 failure:

1) Symfony\Component\Process\Tests\ProcessTest::testInputStreamWithCallable
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-123
+1

D:\www\symfony\src\Symfony\Component\Process\Tests\ProcessTest.php:1263
D:\www\symfony\.phpunit\phpunit-6.0\phpunit:5

ERRORS!
Tests: 135, Assertions: 217, Errors: 3, Failures: 1, Skipped: 14.

Legacy deprecation notices (17)

All of them pass when I comment the whole condition here https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Process/Pipes/AbstractPipes.php#L123
But I guess that's not a solution. I spent a lot of time trying to fix it but I was not successful. I don't know how exactly stream_select works. I tried to call it only once before writing to standard input (It's called even when there's nothing to write) which fixed all except testInputStreamWithCallable but it's all related.

Also 1) Symfony\Component\Process\Tests\ProcessTest::testInheritEnvDisabled array_intersect_key(): Argument #1 is not an array failed many times, the stdout stream was empty but then it somehow started to work without any modification.

PhpProcessTest was also failing but I already fixed it inside #22613 as I mentioned.

nicolas-grekas added a commit that referenced this issue May 15, 2017
…ntains space (maryo)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[Process] Fix incorrectly calling PHP process when path contains space

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #22556
| License       | MIT

I have PHP installed at "D:\Program Files\PHP" which contains a space. `PhpExecutableFinder` found it but then `PhpProcess` splitted the path by space. This PR fixes it. I wanted to write a test but I don't know ho to do it properly since it is dependent on the location where PHP is installed and I can't even mock `PhpExecutableFinder` because it is hardcoded dependency and an implementation detail.

Commits
-------

9c08109 Fix incorrectly calling PHP process on Windows when path contains space
@ChadSikorra
Copy link
Contributor

@maryo Is that the correct spot in AbstractPipes you are commenting? Doing that seems to make no difference on my machine. I can confirm the same test failures for me in PhpProcess on Windows 10 with PHP 7.1.

I can get mine to work slightly further by modifying Process to use powershell.exe instead of cmd.exe. This results in slightly garbled output (probably need to futz with powershell params). Another thing that makes it pass is setting bypass_shell to false and then adjusting the quotes for the command (Though this causes all sorts of other failures elsewhere and obviously isn't a solution, lack of PID, etc). Though that may help provide hints about what's going wrong.

@nicolas-grekas
Copy link
Member

I'm closing because this is transient, thus impossible to fix.
@maryo of course if you can debug that and find the root cause, that'd be awesome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants