Search code examples
phpunitcruisecontrolphpundercontrol

phpUnderControl and PHPUnit always failing build with code 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!


Solution

  • 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); ?