// Check whether a detailed log is wanted.
if (getenv('TEST_PHP_DETAILED')) {
- define('DETAILED', getenv('TEST_PHP_DETAILED'));
+ $DETAILED = getenv('TEST_PHP_DETAILED');
} else {
- define('DETAILED', 0);
+ $DETAILED = 0;
}
// Check whether user test dirs are requested.
save_text($info_file, $php_info);
$ini_overwrites = array(
'output_handler=',
- 'zlib.output_compression=Off',
'open_basedir=',
'safe_mode=0',
'disable_functions=',
'auto_prepend_file=',
'auto_append_file=',
'magic_quotes_runtime=0',
- 'xdebug.default_enable=0',
- 'session.auto_start=0'
);
$info_params = array();
settings2array($ini_overwrites,$info_params);
@unlink($info_file);
define('TESTED_PHP_VERSION', `$php -r 'echo PHP_VERSION;'`);
+// check for extensions that need special handling and regenerate
+$php_extenions = '<?php echo join(",",get_loaded_extensions()); ?>';
+save_text($info_file, $php_extenions);
+$php_extenions = explode(',',`$php $info_params $info_file`);
+$info_params_ex = array(
+ 'session' => array('session.auto_start=0'),
+ 'zlib' => array('zlib.output_compression=Off'),
+ 'xdebug' => array('xdebug.default_enable=0'),
+ );
+foreach($info_params_ex as $ext => $ini_overwrites_ex) {
+ if (in_array($ext, $php_extenions)) {
+ $ini_overwrites = array_merge($ini_overwrites, $ini_overwrites_ex);
+ }
+}
+@unlink($info_file);
+
// Write test context information.
function write_information()
{
break;
}
$i--;
+ case 'v':
+ $DETAILED = true;
+ break;
case 'w':
$failed_tests_file = fopen($argv[++$i], 'w+t');
break;
-d foo=bar Pass -d option to the php binary (Define INI entry foo
with value 'bar')
+ -v Verbose mode.
+
-h <file> This Help.
HELP;
function save_text($filename,$text)
{
+ global $DETAILED;
+
$fp = @fopen($filename,'w') or error("Cannot open file '" . $filename . "' (save_text)");
fwrite($fp,$text);
fclose($fp);
- if (1 < DETAILED) echo "
+ if (1 < $DETAILED) echo "
FILE $filename {{{
$text
}}}
function run_test($php, $file, $test_cnt, $test_idx)
{
- global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS, $pass_options;
+ global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS, $pass_options, $DETAILED;
- if (DETAILED) echo "
+ if ($DETAILED) echo "
=================
TEST $file
";
$cmd = "$php$pass_options$ini_settings -f \"$tmp_file\" $args 2>&1";
}
- if (DETAILED) echo "
+ if ($DETAILED) echo "
CONTENT_LENGTH = " . getenv("CONTENT_LENGTH") . "
CONTENT_TYPE = " . getenv("CONTENT_TYPE") . "
PATH_TRANSLATED = " . getenv("PATH_TRANSLATED") . "