php tests run on clean build

This commit is contained in:
Meredith L. Patterson 2013-11-23 16:07:19 -06:00
parent da33c86898
commit 4c58a0bcb2
3 changed files with 21 additions and 8 deletions

View file

@ -93,9 +93,9 @@ env["ENV"].update(x for x in os.environ.items() if x[0].startswith("CCC_"))
#rootpath = env['ROOTPATH'] = os.path.abspath('.') #rootpath = env['ROOTPATH'] = os.path.abspath('.')
#env.Append(CPPPATH=os.path.join('#', "hammer")) #env.Append(CPPPATH=os.path.join('#', "hammer"))
env['testruns'] = []
testruns = [] testruns = []
targets = ["$libpath", targets = ["$libpath",
"$incpath", "$incpath",
"$parsersincpath", "$parsersincpath",

View file

@ -1,12 +1,18 @@
Installing Building
========== ========
Requirements: Requirements:
* SWIG 2.0 * SWIG 2.0
* A properly configured [phpenv](https://github.com/CHH/phpenv) * A properly configured [phpenv](https://github.com/CHH/phpenv)
SCons finds your PHP include path from `php-config`, so if you don't have that working, you're going to have a bad time.
If you want to run the tests, you will also need to install PHPUnit. Do this with pyrus and save yourself some hell. If you want to run the tests, you will also need to install PHPUnit. Do this with pyrus and save yourself some hell.
pyrus channel-discover pear.phpunit.de pyrus channel-discover pear.phpunit.de
pyrus channel-discover pear.symfony.com pyrus channel-discover pear.symfony.com
pyrus channel-discover pear.symfony-project.com pyrus channel-discover pear.symfony-project.com
pyrus install --optionaldeps phpunit/PHPUnit pyrus install --optionaldeps phpunit/PHPUnit
Installing
==========
We're not building a proper package yet, but you can copy `build/$VARIANT/src/bindings/php/hammer.so` to your PHP extension directory (`scons test` will do this for you if you're using phpenv; for a system-wide php you'll probably have to use sudo) and add "extension=hammer.so" to your php.ini. There is a "hammer.ini" in src/bindings/php for your convenience; you can put it in the `conf.d` directory where PHP expects to find its configuration. `scons test` will do this for you too.

View file

@ -1,6 +1,6 @@
# -*- python -*- # -*- python -*-
import os, os.path import os, os.path
Import('env libhammer_shared') Import('env libhammer_shared testruns')
phpenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0) phpenv = env.Clone(IMPLICIT_COMMAND_DEPENDENCIES = 0)
@ -17,8 +17,15 @@ Default(swig_src, bindings_src, libhammer_php)
phptestenv = phpenv.Clone() phptestenv = phpenv.Clone()
phptestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0])) phptestenv['ENV']['LD_LIBRARY_PATH'] = os.path.dirname(str(libhammer_shared[0]))
phptests = ['Tests'] phptests = ('Tests')
testphp = phptestenv.Alias("testphp", phptestenv.Command(phptests, [libhammer_php], "phpenv exec phpunit -v --include-path "+os.getcwd()+" $TARGET")) phpextprefix = os.popen("php-config --extension-dir").read().rstrip()
env['testruns'].append(testphp) phplib = phptestenv.Command(os.path.join(phpextprefix, "hammer.so"), libhammer_php, Copy("$TARGET", "$SOURCE"))
print "Testing: " + str([str(x[0]) for x in env['testruns']]) phpprefix = os.popen("php-config --prefix").read().rstrip()
phpincl = phptestenv.Command(os.path.join(phpprefix, "hammer.ini"), "hammer.ini", Copy("$TARGET", "$SOURCE"))
phptestexec = phptestenv.Command(phptests, [phplib, phpincl], "phpenv exec phpunit -v --include-path " + os.path.dirname(libhammer_php[0].path) +" src/bindings/php/Tests")
print "phptestexec path: " + phptestexec[0].path
phptest = Alias("testphp", [phptestexec], phptestexec)
AlwaysBuild(phptest)
testruns.append(phptest)
print "Testing: " + str([str(x[0]) for x in testruns])