Hi,

I'm currently writing a shared extension thta depends on another shared 
extension (igbinary). "make test" doesn't handle this at the moment, 
because it removes every extension= line from it's temporary php.ini.
This means that the dependent extension (igbinary) now isn't loaded, 
which means my extension doesn't load either and obviously all the tests 
fail.

I've attached a patch that adds a new --EXTENSIONS-- section to the PHPT 
format. The run-tests.php script makes sure that all extensions in that 
last are added to the PHP command with -dextension=... , but only if 
they're not build in (or already loaded in some other way).

The patch is simple, and it doesn't touch any other section or 
functionality so I'm suggesting to commit it to PHP 5.3/5.4 and trunk 
some time soon.

cheers,
Derick

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug
Index: branches/PHP_5_3/run-tests.php
===================================================================
--- branches/PHP_5_3/run-tests.php      (revision 319744)
+++ branches/PHP_5_3/run-tests.php      (working copy)
@@ -1470,6 +1470,18 @@
                settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), 
$ini_settings);
        }
 
+       // Additional required extensions
+       if (array_key_exists('EXTENSIONS', $section_text)) {
+               $ext_dir=`$php -r 'echo ini_get("extension_dir");'`;
+               $extensions = preg_split("/[\n\r]+/", 
trim($section_text['EXTENSIONS']));
+               foreach ($extensions as $req_ext) {
+                       $loaded = `$php -n -r 'echo (int) 
extension_loaded("$req_ext");'`;
+                       if ($loaded == '0') {
+                               $ini_settings['extension'][] = $ext_dir . 
DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
+                       }
+               }
+       }
+
        settings2params($ini_settings);
 
        // Check if test should be skipped.
Index: branches/PHP_5_4/run-tests.php
===================================================================
--- branches/PHP_5_4/run-tests.php      (revision 319744)
+++ branches/PHP_5_4/run-tests.php      (working copy)
@@ -1470,6 +1470,18 @@
                settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), 
$ini_settings);
        }
 
+       // Additional required extensions
+       if (array_key_exists('EXTENSIONS', $section_text)) {
+               $ext_dir=`$php -r 'echo ini_get("extension_dir");'`;
+               $extensions = preg_split("/[\n\r]+/", 
trim($section_text['EXTENSIONS']));
+               foreach ($extensions as $req_ext) {
+                       $loaded = `$php -n -r 'echo (int) 
extension_loaded("$req_ext");'`;
+                       if ($loaded == '0') {
+                               $ini_settings['extension'][] = $ext_dir . 
DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
+                       }
+               }
+       }
+
        settings2params($ini_settings);
 
        // Check if test should be skipped.
Index: trunk/run-tests.php
===================================================================
--- trunk/run-tests.php (revision 319765)
+++ trunk/run-tests.php (working copy)
@@ -1470,6 +1470,18 @@
                settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), 
$ini_settings);
        }
 
+       // Additional required extensions
+       if (array_key_exists('EXTENSIONS', $section_text)) {
+               $ext_dir=`$php -r 'echo ini_get("extension_dir");'`;
+               $extensions = preg_split("/[\n\r]+/", 
trim($section_text['EXTENSIONS']));
+               foreach ($extensions as $req_ext) {
+                       $loaded = `$php -n -r 'echo (int) 
extension_loaded("$req_ext");'`;
+                       if ($loaded == '0') {
+                               $ini_settings['extension'][] = $ext_dir . 
DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX;
+                       }
+               }
+       }
+
        settings2params($ini_settings);
 
        // Check if test should be skipped.
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to