views:

638

answers:

3

So I have a set of unit/integration tests and a set of selenium rc tests as part of my suite. When I run them together using PHPUnit I get a Segmentation fault error message at the very end of the run when, during normal operation, it starts to generate log files. The interesting part is, if I run just the unit tests, or just the selenium rc tests everything works fine. I'm reasonably certain it's not a problem with my code-base because I can visually see all my tests passing. As I said, the error occurs during the results generation phase.

I'm using code-coverage for the unit tests but NOT for the selenium tests (by leaving the $coverageScriptUrl property empty in my selenium objects).

I'm really grasping at straws here because I've never had to diagnose an error with no file or line number. Is there some place I check for some more information? Can someone point me in the right direction? The php error log is empty.

Any ideas?

A: 

Segfaults in PHP can definitely be tricky.

As a wild guess, are you running PHPUnit 3.4? It looks like there's a bug reported with Selenium integration just a few weeks ago when using the $this->selectWindow() call and a null parameter.

zombat
Thanks for the response. I'm actually using 3.3 of PHPUnit and am not using selectWindow() anywhere.
Mike B
+3  A: 

I've run into the same kind of trouble, at work, with a colleague : one day, we started having a segfault, with apparently no reason, as the same code was running fine on another machine :-(

We ended up removing code coverage (as it was not that useful to us ; was too low anyway)

Couple of things you could try :

  • try with the latest version of Xdebug (sometimes, those are supposed to correct stuff like that)
  • try with an older version Xdebug (why not ? )
  • think about splitting your test suite in two executions on PHPUnit :
    • one execution with code coverage, for unit-tests
    • one execution without code coverage (as you don't use it anyway), for functional-tests

Another thng might be to try with a CVS version of Xdebug 2.1, instead of the the stable 2.0.x ; but not sure that'll help (see http://www.phpunit.de/ticket/513 for instance)

There are a couple of bug reports related to segfaults on Xdebug's Mantis BT ; some of those are not solved.
For instance :

Anyway, good luck...

<(And if you ever find what was causing the problem, I'm interested ;-) )

Pascal MARTIN
I upgraded my version of xdebug from 2.0.5 to 2.1 and the segfault disappeared. Thanks for the pointers!
Mike B
You're welcome :-) thanks for the info !
Pascal MARTIN
A: 

If xdebug is causing segfaults, you can switch to using a test coverage tool that doesn't use xdebug at all, just a standard PHP server:

Semantic Designs PHP Test Coverage

Ira Baxter