Unit tests, CI
| From: | Daniel O'Connor | Date: | Fri, 12 Feb 2010 03:36:01 +0000 |
| Subject: | Unit tests, CI | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-53266@lists.php.net to get a copy of this message | ||
I've set up:
http://test.pear.php.net/unit-test-results/
Its quick, its dirty, and it runs every hour - PHPUnit and PHPT tests. It's
certainly not cruise control and doesn't pretend to be.
If interest is high enough, small features can be added to it; or we can
invest the time to look at cruise control or other CI environments which
already do Neat Things.
In lieu of spamming package authors with failures, or some other fancy
notification system; my recommendation is that you add the page as one of
your homepages.
The test environment is PHP 5.3.1 and PHPUnit 3.4.
Of particular interest:
http://test.pear.php.net/unit-test-results/phpunit_results.txt
This also means that http://lauken.com/doconnor/ is pretty
much dead as of
now - not that it wasn't before :)
Some stuff to take note of:
1) Errors like:
php -c ../php.ini -f
/home/clockwerx/packages-all/HTTP_Session/tests/AllTests.php
Fatal error: Cannot redeclare class PHPUnit_Framework_TestSuite in
/usr/local/lib/php/pear/PHPUnit/Framework/TestSuite.php on line 94
This is simply PHPUnit 3.4 compatibility.
The fix?
http://svn.php.net/viewvc/pear/packages/Services_YouTube/trunk/tests/AllTests.php?r1=294914&r2=294913&pathrev=294914
This will still work happily with PHPUnit 3.3, and probably lower versioins
too.
2) Other errors like:
php -c ../php.ini -f /home/clockwerx/packages-all/Auth/tests/AllTests.php
Warning: require_once(Net/POP3.php): failed to open stream: No such
file or directory in
/home/clockwerx/packages-all/Auth/Auth/Container/POP3.php on line 39
Fatal error: require_once(): Failed opening required 'Net/POP3.php'
(include_path='.:/usr/local/lib/php/pear/') in
/home/clockwerx/packages-all/Auth/Auth/Container/POP3.php on line 39
This is just because the host environment hasn't installed that dependency -
I'm happy to do it on request; just be sure to check your package.xml first
:)
3) Errors caused by requiring special setup:
php -c ../php.ini -f
/home/clockwerx/packages-all/PhpDocumentor/tests/AllTests.php
Warning: require_once(PhpDocumentor/phpDocumentor/Setup.inc.php):
failed to open stream: No such file or directory in
/home/clockwerx/packages-all/PhpDocumentor/tests/phpDocumentorSetupCleanConverterNamePieceTests.php
on line 51
Fatal error: require_once(): Failed opening required
'PhpDocumentor/phpDocumentor/Setup.inc.php'
(include_path='.:/usr/local/lib/php/pear/') in
/home/clockwerx/packages-all/PhpDocumentor/tests/phpDocumentorSetupCleanConverterNamePieceTests.php
on line 51
Normally, the tests should skip if a precondition cannot be met.
I'm also happy to set up any requirements on a case by case basis.
4) All of the tests run from the top level of trunk directory.
IE:
cd packages-all/Foo_Bar/
php tests/AllTests.php
pear run-tests -r tests
That means your svn structure should look like
packages-all/Foo_Bar/Foo.php
packages-all/Foo_Bar/Foo/Bar.php
packages-all/Foo_Bar/Foo/Bar/Whee.php
... the same as what the package would install like.
If it's not; since the SVN migration, it's really easy to fix:
svn mkdir Foo
svn mv Bar.php Foo/
svn mv Bar Foo/
php tests/AllTests.php
pfm # regenerate your package.xml however you like.
svn commit -m "Fixed SVN layout, package.xml"