zoe Thu, 10 May 2012 15:17:46 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=325643
Log: change to use a single configuration file for testing Changed paths: U php/phpruntests/trunk/build.xml A php/phpruntests/trunk/phpdefinitions.txt U php/phpruntests/trunk/tests/rtTestBootstrap.php U php/phpruntests/trunk/tests/testcase/rtCleanExecutionTest.php Modified: php/phpruntests/trunk/build.xml =================================================================== --- php/phpruntests/trunk/build.xml 2012-05-10 14:47:02 UTC (rev 325642) +++ php/phpruntests/trunk/build.xml 2012-05-10 15:17:46 UTC (rev 325643) @@ -1,6 +1,7 @@ <?xml version="1.0"?> <project name="runtests" default="qa" basedir="."> +<property file="phpdefinitions.txt" /> <target name="clean"> <delete dir="_compare" /> @@ -51,7 +52,8 @@ <target name="compare" description="Old/New comparison of phpt results."> <fail unless="php" message="Path to standard PHP executable not defined, use -Dphp=/path/to/php" /> - <fail unless="php_to_test" message="Path to test PHP source dir not defined, use -Dphp_to_test=/path/to/php_source_dir" /> + <fail unless="php_to_test" message="Path to test PHP source dir not defined, use -Dphp_to_test=/path/to/php/to/test" /> + <fail unless="php_source" message="Path to test PHP source dir not defined, use -Dphp_to_test=/path/to/php_source_dir" /> <delete dir="_compare" /> @@ -64,8 +66,8 @@ <exec command="tar xfz QATESTS.tgz" dir="/tmp/phpruntests" /> - <exec command="${php} -n ${php_to_test}/run-tests.php -n -p ${php_to_test}/sapi/cli/php /tmp/phpruntests/Zend /tmp/phpruntests/ext /tmp/phpruntests/sapi /tmp/phpruntests/tests > ${project.basedir}/_compare/old.out" dir="/tmp/phpruntests" passthru="true" checkReturn="true"/> - <exec command="${php} -n ${project.basedir}/src/run-tests.php -n -p ${php_to_test}/sapi/cli/php -o csv -s ${project.basedir}/_compare/new.out /tmp/phpruntests" dir="/tmp/phpruntests" passthru="true" checkReturn="true" /> + <exec command="${php} -n ${php_source}/run-tests.php -n -p ${php_to_test} /tmp/phpruntests/Zend /tmp/phpruntests/ext /tmp/phpruntests/sapi /tmp/phpruntests/tests > ${project.basedir}/_compare/old.out" dir="/tmp/phpruntests" passthru="true" checkReturn="true"/> + <exec command="${php} -n ${project.basedir}/src/run-tests.php -n -p ${php_to_test} -o csv -s ${project.basedir}/_compare/new.out /tmp/phpruntests" dir="/tmp/phpruntests" passthru="true" checkReturn="true" /> <exec command="${php} -n QA/compareNewOld.php ${project.basedir}/_compare/new.out ${project.basedir}/_compare/old.out phpruntests > ${project.basedir}/_compare/compare_new_old.out" dir="${project.basedir}" passthru="true" checkReturn="true"/> Added: php/phpruntests/trunk/phpdefinitions.txt =================================================================== --- php/phpruntests/trunk/phpdefinitions.txt (rev 0) +++ php/phpruntests/trunk/phpdefinitions.txt 2012-05-10 15:17:46 UTC (rev 325643) @@ -0,0 +1,9 @@ +# This file is used as a phing property file and is also read by rtTestBoootstrap.php to determine which +# PHP exectables to use in running unit tests + +#These are example settings, you will need to unomment and change them to the right paths on your system +# +#php=/usr/bin/php +#php_to_test=/usr/local/php540/bin/php +#php_cgi_to_test=/usr/local/php540/bin/php-cgi +#php_source=/Users/zoe/Applications/PHP/php-5.4.0 Modified: php/phpruntests/trunk/tests/rtTestBootstrap.php =================================================================== --- php/phpruntests/trunk/tests/rtTestBootstrap.php 2012-05-10 14:47:02 UTC (rev 325642) +++ php/phpruntests/trunk/tests/rtTestBootstrap.php 2012-05-10 15:17:46 UTC (rev 325643) @@ -3,14 +3,31 @@ require_once __DIR__ . '/../src/rtAutoload.php'; /** - * Define the Path to the PHP executable + * Check to see if the PHP and CGI executables are in a config file */ +if(file_exists(__DIR__ . '/../phpdefinitions.txt')) { + $phpdefs=file(__DIR__ . '/../phpdefinitions.txt'); + foreach($phpdefs as $line) { + if(preg_match('/^php_to_test=(.*)/', $line, $matches)) { + define('RT_PHP_PATH', trim($matches[1])); + } + if(preg_match('/^php_cgi_to_test=(.*)/', $line, $matches)) { + define('RT_PHP_CGI_PATH', trim($matches[1])); + } + } +} + + +/** + * Fall back definition of Path to the PHPexecutable + */ + if (!defined('RT_PHP_PATH')) { define('RT_PHP_PATH', trim(shell_exec("which php"))); } /** - * Define the Path to the PHP CGI executable + * Fall back definition of Path to the PHP CGI executable */ if (!defined('RT_PHP_CGI_PATH')) { define('RT_PHP_CGI_PATH', trim(shell_exec("which php-cgi"))); Modified: php/phpruntests/trunk/tests/testcase/rtCleanExecutionTest.php =================================================================== --- php/phpruntests/trunk/tests/testcase/rtCleanExecutionTest.php 2012-05-10 14:47:02 UTC (rev 325642) +++ php/phpruntests/trunk/tests/testcase/rtCleanExecutionTest.php 2012-05-10 15:17:46 UTC (rev 325643) @@ -8,6 +8,7 @@ private $path_to_tests; private $sample_test; private $sample_fail; + public function setUp() { @@ -25,7 +26,7 @@ public function testFileRun() { - //Create a new test configuration + //Create a new test configuration $config = rtRuntestsConfiguration::getInstance(array('run-tests.php', '-p', RT_PHP_PATH, $this->sample_test)); $config->configure();
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php