php-src icon indicating copy to clipboard operation
php-src copied to clipboard

run-tests.php should generate code that has code line numbers equal to the original ones

Open mvorisek opened this issue 4 years ago • 4 comments

Description

For example this test:

https://github.com/php/php-src/blob/PHP-8.0/ext/sockets/tests/socket_send.phpt#L26

fails on MacOS with the following result:

========DIFF========
002+ 
003+ Warning: socket_send(): Unable to write to socket [22]: Invalid argument in /Users/runner/work/php-src/php-src/ext/sockets/tests/socket_send.php on line 14
     okey
     okey
004- okey
========DONE========
FAIL int socket_send ( resource $socket , string $buf , int $len , int $flags ); [ext/sockets/tests/socket_send.phpt] 

I expect the run-tests.php script to prepend:

<?php











?>

(and possible remove the ?><?php if the code to be run starts with <?php)

so the original line numbers equal to the original ones, eg. the testing output is:

002+ 
003+ Warning: socket_send(): Unable to write to socket [22]: Invalid argument in /Users/runner/work/php-src/php-src/ext/sockets/tests/socket_send.php on line 26
     okey
     okey
004- okey
========DONE========
FAIL int socket_send ( resource $socket , string $buf , int $len , int $flags ); [ext/sockets/tests/socket_send.phpt] 

mvorisek avatar Apr 20 '22 11:04 mvorisek

While some diffs are hard to interpret (and this would make alleviate this), it seems to me the root cause of this issue are to many expections (i.e. a too large --EXPECT-- section). It might be better to rewrite respective tests in the long run.

cmb69 avatar Apr 20 '22 13:04 cmb69

This would also break declares.

https://3v4l.org/3A0Xm#v8.1.5

<?php

?><?php

declare(strict_types=1);

Fatal error: strict_types declaration must be the very first statement in the script

iluuu1994 avatar Apr 21 '22 10:04 iluuu1994

so

(and possible remove the ?><?php if the code to be run starts with <?php)

is needed :)

mvorisek avatar Apr 21 '22 10:04 mvorisek

Since the PR has been categorically rejected, I'm closing this ticket as WONTFIX accordingly.

cmb69 avatar Apr 22 '22 15:04 cmb69