views:

57

answers:

1

I'm currently using Zend Framework in conjunction with PHPUnit to conduct unit testing on an application. When Hudson executes the PHPUnit shell command, the maximum PHP memory limit is reached sometime during code coverage generation. I currently have a total of 41 tests with 334 assertions.

I have successfully eliminated this error by raising the memory_limit setting to 768M using the -d memory_limit=768M switch; however, I am worried that as the complexity increases along with the total number of tests/assertions, I will not have enough memory to generate the HTML for code coverage statistics.

OS: CentOS 5.5
Control Panel: WHM/cPanel
CI Server: Hudson

/usr/local/bin/phpunit 
  --verbose  
  -d memory_limit=512M  
  --log-junit ../../build/logs/phpunit.xml   
  --coverage-clover ../../build/logs/coverage/clover.xml   
  --coverage-html ../../build/logs/coverage-html/  

Fatal error: Allowed memory size of 536870912 bytes exhausted

Before committing my changes and letting Hudson handle the rest, I use Windows 7 for development. The memory usage never exceeded 340MB while running the same command within W7.

A: 

Do you have xdebug profiling enabled, if so try disabling it. I've experienced this problem before, and it came down to extensions in php (specifically xdebug profiling and/or Inclued heirarchy viewer)

Kayla Rose
I just checked, and I was hoping that was the issue, but profiling is turned off. Thanks for your response. Any other ideas?
webjawns.com
It's hard to tell without knowing the codebase. I would just keep an eye out for red flags (e.g. exhaustive __autoloading, caching stuff in memory, etc.) that are not normally a problem, but could cause issues during testing because of high number of instantiations etc. Also take advantage of tearDown() if possible.
Kayla Rose