phpUnderControl 和 PHPUnit 总是构建失败,代码为 255

发布于 2024-09-11 07:27:16 字数 1215 浏览 3 评论 0原文

我在 phpUnderControl 中有以下 build.xml 文件设置。

    <target name="phpunit">
    <exec executable="phpunit" dir="${basedir}/httpdocs" failonerror="on">
        <arg line="--log-junit ${basedir}/build/logs/phpunit.xml
                --coverage-clover ${basedir}/build/logs/phpunit.coverage.xml
                --coverage-html ${basedir}/build/coverage
                --colors
                ${basedir}/httpdocs/qc/unit/CalculatorTest.php" />
    </exec>
</target>

由于某些未知的原因,构建总是失败并显示以下消息。

phpunit:
 [exec] PHPUnit 3.4.15 by Sebastian Bergmann.
 [exec] 

BUILD FAILED
/opt/cruisecontrol-bin-2.8.3/projects/citest.local/build.xml:30: exec returned: 255

我已在单元目录中手动运行非常简单的单元测试,并且 PHPUnit 返回。

PHPUnit 3.4.15 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 5.25Mb

OK (1 test, 1 assertion)

有谁知道为什么在所有测试都正常的情况下构建仍然失败?

我的构建脚本确实有一个干净的方法来删除和记录文件,所以它不是那样的。我还手动删除了日志文件,以防万一是该脚本。并更改了日志目录的所有者,以便它们可写。

如果有什么区别的话,PHPUnit 运行后 phpunit.xml 为空。

谢谢。

更新:顺便说一句,如果我删除 failonerror="on" 它显然可以工作,但 PHPUnit 仍然返回 255 并且我确实希望它在任何错误上失败,问题是还没有任何错误还是失败了!

I have the following build.xml file setup in phpUnderControl.

    <target name="phpunit">
    <exec executable="phpunit" dir="${basedir}/httpdocs" failonerror="on">
        <arg line="--log-junit ${basedir}/build/logs/phpunit.xml
                --coverage-clover ${basedir}/build/logs/phpunit.coverage.xml
                --coverage-html ${basedir}/build/coverage
                --colors
                ${basedir}/httpdocs/qc/unit/CalculatorTest.php" />
    </exec>
</target>

For some unkown reason the build always fails with the below message.

phpunit:
 [exec] PHPUnit 3.4.15 by Sebastian Bergmann.
 [exec] 

BUILD FAILED
/opt/cruisecontrol-bin-2.8.3/projects/citest.local/build.xml:30: exec returned: 255

I have run the very simple unit test manually within the unit directory and PHPUnit returns.

PHPUnit 3.4.15 by Sebastian Bergmann.

.

Time: 0 seconds, Memory: 5.25Mb

OK (1 test, 1 assertion)

Does anyone know why it keeps failing the build, when all the tests are fine?

My build script does have a clean method which removes and log files, so its not that. I have also manually removed the log files, just in case it's that script. And changed the owner of the log directories so they are writable.

If it makes any difference the phpunit.xml is empty after PHPUnit is run.

Thanks.

UPDATE: Incidentally if I remove failonerror="on" it works, obviously, but PHPUnit still returns 255 and I do want it to fail on any errors, the issue is there isn't any errors yet it still fails!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

一场春暖 2024-09-18 07:27:17

'exec returned: 255' 可能是由 CodeCoverage 报告的内存消耗引起的,如 Pekka 提到的,启用 error_reporting(E_ALL) 后将显示该报告。也尝试 init_set('display_errors','on'); 。通常你会面临“内存大小...耗尽”的致命错误。

Probably the 'exec returned: 255' is caused by the memory consumption of the CodeCoverage report, which will be displayed after enabling error_reporting(E_ALL) like Pekka mentioned. Try init_set('display_errors','on'); also. Usualy you will face a 'memory size ...exhaused' fatal.

百善笑为先 2024-09-18 07:27:17

就我而言,结果是我没有安装网络服务器。安装 nginx 并将其设置为网络服务器(即使我没有使用它)解决了这个问题。

In my case, it turned out to be that I didn't have a webserver installed. Installing nginx and setting it up as a webserver (even if I'm not using it) fixed the problem.

甜宝宝 2024-09-18 07:27:17

可能是由于phpunit.xml中的一些空测试套件引起的,即测试代码中没有assertXXX

it might be caused by some empty testsuite in phpunit.xml, that is, no assertXXX in test code

谈场末日恋爱 2024-09-18 07:27:17

我让 Selenium、PHPUnit、PHPUnderControl 和 CruiseControl 一起工作(此处 http:// www.siteconsortium.com/h/p1.php?id=php002

只是一个非常基本的示例,但我能够让它像这样工作。从简单的事情开始,然后将其他内容复制回来。

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="build" basedir=".">

<target name="build">
  <exec executable="C:\\PHP\\phpunit.bat" dir="C:\\workspace\\proj\\phpunit" failonerror="on">
     <arg line="--log-junit C:\\workspace\\proj\\build\\logs\\phpunit.xml
           --configuration C:\\workspace\\proj\\phpunit.xml
           --include-path C:\\trunk\\includes C:\\workspace\\proj\\includes" />
     </exec>
  </target>
</project>

I got Selenium, PHPUnit, PHPUnderControl, and CruiseControl all working together (here http://www.siteconsortium.com/h/p1.php?id=php002)

Just a very basic example but I was able to get it to work like this. Start from something simple and copy the other stuff back in.

<?xml version="1.0" encoding="UTF-8"?>
<project name="test" default="build" basedir=".">

<target name="build">
  <exec executable="C:\\PHP\\phpunit.bat" dir="C:\\workspace\\proj\\phpunit" failonerror="on">
     <arg line="--log-junit C:\\workspace\\proj\\build\\logs\\phpunit.xml
           --configuration C:\\workspace\\proj\\phpunit.xml
           --include-path C:\\trunk\\includes C:\\workspace\\proj\\includes" />
     </exec>
  </target>
</project>
始于初秋 2024-09-18 07:27:16

255 是 PHP 在致命错误和(我认为)解析错误时抛出的错误代码。

脚本执行中是否可能存在致命或解析错误(也许是在测试运行之后)?

有 PHP 错误吗?如果添加 error_reporting(E_ALL); 会发生什么?

255 is the error code that PHP throws on fatal and (I think) parse errors.

Could there be a fatal or parse error in the script execution, maybe after the tests have run?

Any PHP errors? What happens if you add error_reporting(E_ALL); ?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文