[wp-unit-tests] [WordPress Unit Tests] #105: Prevent deadlock when debugging with xDebug
WordPress Trac
wp-trac at lists.automattic.com
Thu Jul 12 21:10:34 UTC 2012
#105: Prevent deadlock when debugging with xDebug
--------------------------+---------------------------------------
Reporter: scribu | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Implement New Test Runner
Component: Admin Screen | Keywords:
--------------------------+---------------------------------------
Originally reported here: https://github.com/nb/wordpress-tests/issues/27
In `wordpress-tests/init.php`, there's a `system(php ...)` call. When I
remote-debug my unit test suite, the external PHP process that's created
by that `system(php ...)` call attempts to connect to the debugger. But
the debugger is blocked — the parent PHP process is already open in the
debugger (executing the `system` call).
So both PHP processes hangs / deadlocks forever.
A solution, that works for me anyway (with Ubuntu Linux), is to prepend
'XDEBUG_CONFIG="remote_enable=Off" ' to the PHP command. That is, change
from:
```
system( WP_PHP_BINARY . ' ' . escapeshellarg( dirname( __FILE__ ) .
'/bin/install.php' ) . ' ' . escapeshellarg( $config_file_path ) );
```
to:
```
$install_blog_cmd =
'XDEBUG_CONFIG="remote_enable=Off" ' .
WP_PHP_BINARY .
' ' . escapeshellarg( dirname( __FILE__ ) . '/bin/install.php' ) .
' ' . escapeshellarg( $config_file_path );
system( $install_blog_cmd );
```
But I don't know what MS Windows would think about that. Perhaps it'd be
possible to invoke a shell script or a .bat script that work on both
Linux/Mac and Windows.
Thanks for building wordpress-test by the way, it seems really useful! :-)
Best regards, KajMagnus
(PS. Here is a wordpress.stackexchange.com question about this, that I've
marked as solved. http://wordpress.stackexchange.com/q/58294/4211 )
--
Ticket URL: <https://unit-test.trac.wordpress.org/ticket/105>
WordPress Unit Tests <https://unit-test.trac.wordpress.org>
My example project
More information about the wp-unit-tests
mailing list