Re: run-tests.php and dynamic extension dependencies

From: Date: Mon, 28 Nov 2011 15:48:34 +0000
Subject: Re: run-tests.php and dynamic extension dependencies
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-56655@lists.php.net to get a copy of this message
On Mon, 28 Nov 2011, Ferenc Kovacs wrote: > thanks for the answer, in this case I think this would be a worthwhile > improvement. > > + foreach ($extensions as $req_ext) { > + $loaded = $php -n -r 'echo (int) > extension_loaded("$req_ext");'; > + if ($loaded == '0') { > > it would be more efficient to get all the loaded modules at > once(get_loaded_extensions or php -m) Yup, good catch. Patch attached again. 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'])); + $loaded = explode(",", `$php -n -r 'echo join(",", get_loaded_extensions());'`); + foreach ($extensions as $req_ext) { + if (!in_array($req_ext, $loaded)) { + $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'])); + $loaded = explode(",", `$php -n -r 'echo join(",", get_loaded_extensions());'`); + foreach ($extensions as $req_ext) { + if (!in_array($req_ext, $loaded)) { + $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'])); + $loaded = explode(",", `$php -n -r 'echo join(",", get_loaded_extensions());'`); + foreach ($extensions as $req_ext) { + if (!in_array($req_ext, $loaded)) { + $ini_settings['extension'][] = $ext_dir . DIRECTORY_SEPARATOR . $req_ext . '.' . PHP_SHLIB_SUFFIX; + } + } + } + settings2params($ini_settings); // Check if test should be skipped.
« previous php.internals (#56655) next »