使用PHPUnit的Selenium RC测试+单元测试会引发Seg Fault

时间:2022-10-15 22:14:14

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.

所以我有一套单元/集成测试和一组selenium rc测试作为我的套件的一部分。当我使用PHPUnit一起运行它时,我在运行结束时收到Segmentation fault错误消息,在正常操作期间,它开始生成日志文件。有趣的是,如果我只运行单元测试,或者仅仅是selenium rc测试,一切正常。我有理由相信我的代码库不是问题,因为我可以直观地看到我的所有测试都通过了。正如我所说,错误发生在结果生成阶段。

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).

我正在使用代码覆盖进行单元测试,但不使用selenium测试(通过在我的selenium对象中保留$ coverageScriptUrl属性为空)。

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.

我真的很喜欢这里的稻草,因为我从来没有必要诊断没有文件或行号的错误。我有什么地方可以查看更多信息吗?有人能指出我正确的方向吗? php错误日志为空。

Any ideas?

3 个解决方案

#1


3  

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)
  • 尝试使用最新版本的Xdebug(有时,那些应该纠正这样的东西)

  • try with an older version Xdebug (why not ? )
  • 试试旧版Xdebug(为什么不呢?)

  • 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
    • 一个没有代码覆盖的执行(因为你还没有使用它),用于功能测试

  • 考虑在PHPUnit的两次执行中拆分测试套件:一次执行代码覆盖,单元测试一次执行没有代码覆盖(因为你还没有使用它),用于功能测试

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)

另一个可能是尝试使用CVS版本的Xdebug 2.1,而不是稳定的2.0.x;但不确定那会有所帮助(例如见http://www.phpunit.de/ticket/513)

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

在Xdebug的Mantis BT上有一些关于段错误的错误报告;其中一些没有解决。例如 :

Anyway, good luck...

祝你好运......

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

<(如果你发现造成问题的原因,我很感兴趣;-))

#2


0  

Segfaults in PHP can definitely be tricky.

PHP中的Segfaults肯定是棘手的。

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.

作为一个疯狂的猜测,你运行PHPUnit 3.4?几周前,当使用$ this-> selectWindow()调用和null参数时,看起来有一个关于Selenium集成的错误报告。

#3


0  

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:

如果xdebug导致段错误,您可以切换到使用完全不使用xdebug的测试覆盖工具,只需使用标准的PHP服务器:

Semantic Designs PHP Test Coverage

语义设计PHP测试覆盖率

#1


3  

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)
  • 尝试使用最新版本的Xdebug(有时,那些应该纠正这样的东西)

  • try with an older version Xdebug (why not ? )
  • 试试旧版Xdebug(为什么不呢?)

  • 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
    • 一个没有代码覆盖的执行(因为你还没有使用它),用于功能测试

  • 考虑在PHPUnit的两次执行中拆分测试套件:一次执行代码覆盖,单元测试一次执行没有代码覆盖(因为你还没有使用它),用于功能测试

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)

另一个可能是尝试使用CVS版本的Xdebug 2.1,而不是稳定的2.0.x;但不确定那会有所帮助(例如见http://www.phpunit.de/ticket/513)

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

在Xdebug的Mantis BT上有一些关于段错误的错误报告;其中一些没有解决。例如 :

Anyway, good luck...

祝你好运......

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

<(如果你发现造成问题的原因,我很感兴趣;-))

#2


0  

Segfaults in PHP can definitely be tricky.

PHP中的Segfaults肯定是棘手的。

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.

作为一个疯狂的猜测,你运行PHPUnit 3.4?几周前,当使用$ this-> selectWindow()调用和null参数时,看起来有一个关于Selenium集成的错误报告。

#3


0  

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:

如果xdebug导致段错误,您可以切换到使用完全不使用xdebug的测试覆盖工具,只需使用标准的PHP服务器:

Semantic Designs PHP Test Coverage

语义设计PHP测试覆盖率