When running paratest from PhpStorm, the reporting shows a wrong count of tests, and the run appears as "stopped". Plus, the run output show pieces of the teamcity log.
Current behavior
When launching paratest with:
a suite of 10.000 tests,
8 processes,
all tests passing
Some lines with ##teamcity are appearing in the output of the PhpStorm run, and the total count of executed tests is wrong:
I added the option --log-teamcity to inspect the teamcity log, and this is what I see in the sections corresponding to the output:
This issues are appearing randomly in terms of number of issues and line of logs involved.
The issue is not happening when I run with only 1 process.
How to reproduce: command, code and error stack trace
I expect PhpStorm to show the correct number of tests as executed, and the operation as successful.
I expect no lines with ##teamcity in the output.
Analysis
My understanding is that the logic that is consolidating the teamcity logs from each process is sometimes reading incomplete lines, as the phpunit process is concurrently writing them.
Before paratest is reading the last part of the line, lines from other processes are meanwhile read and added to the consolidated log.
Broken lines can't be interpreted by PhpStorm, so they are left in the output and the corresponding tests are not marked as finished.
As a result, for PhpStorm the run appears as stopped.
As a POC, I could fix the error working on the logic of ResultPrinter.php:
Summary
When running paratest from PhpStorm, the reporting shows a wrong count of tests, and the run appears as "stopped". Plus, the run output show pieces of the teamcity log.
Current behavior
When launching paratest with:
Some lines with
##teamcity
are appearing in the output of the PhpStorm run, and the total count of executed tests is wrong:I added the option
--log-teamcity
to inspect the teamcity log, and this is what I see in the sections corresponding to the output:This issues are appearing randomly in terms of number of issues and line of logs involved. The issue is not happening when I run with only 1 process.
How to reproduce: command, code and error stack trace
The PhpStorm run:
Expected behavior
I expect PhpStorm to show the correct number of tests as executed, and the operation as successful. I expect no lines with
##teamcity
in the output.Analysis
My understanding is that the logic that is consolidating the teamcity logs from each process is sometimes reading incomplete lines, as the phpunit process is concurrently writing them. Before paratest is reading the last part of the line, lines from other processes are meanwhile read and added to the consolidated log. Broken lines can't be interpreted by PhpStorm, so they are left in the output and the corresponding tests are not marked as finished. As a result, for PhpStorm the run appears as stopped.
As a POC, I could fix the error working on the logic of ResultPrinter.php:
https://github.com/paratestphp/paratest/blob/b2c11a045db098881bbde638a040029b5c2700ad/src/WrapperRunner/ResultPrinter.php#L312C5-L334C6
making sure that
tail()
only reads complete log lines. I could submit a PR, if appreciated.