PHP C Code Coverage

I want to increase the code coverage for the php source, but I don’t know how this works. Specifically what interested me was unreached coverage on files which have around 99% coveraged. My goal was to go through the c source code and figure out if I could write a PHP test case which would cover the missed lines of code. Most of the uncovered lines are specific edge cases like when zend args aren’t matched, which rarely happens because of how many checks are done, but I wanted to try.

After many days, I have decided to postpone this task for another time. I was writing down what I was doing so I can post about it, but I had so many problems and my list kept getting longer and eventually unorganized.

I will say I didn’t give up easy, I tried the scripts on a couple servers, manually compiled libraries, read through many man pages, rewrote PHP’s code coverage scripts, and on and on. I was able to get code coverage data generated but it was never the same as PHP’s code coverage, and how was I able to know if I’m improving the coverage?

Issues I encountered which deterred me:

  • Mavericks update
    • Changed my apache conf and php ini files
  • Quickly learning apache’s new syntax
  • lcov not available on systems
  • lcov compiled with errors
  • lcov (after fixing errors) installs incorrectly from ./make install
  • gcov from Apple not having -v flag, but lcov require it
    • Fixed by changing gcov’s name to gcov.org, and overwriting /usr/bin/gcov with a bash script to correctly call gcov.orig
    • I believe I also tried modifiying lcovs source
  • time, soooo much time was required
    • PHP Build: 20mins each time
    • PHP Tests:  Up to a few hours per build
  • school, the ultimate decider to put this project aside

Leave a Reply

Your email address will not be published. Required fields are marked *