if (ob_get_level()) echo "Not all buffers were deleted.\n";
error_reporting(E_ALL);
-ini_set('magic_quotes_runtime',0); // this would break tests by modifying EXPECT sections
-
-if (ini_get("unicode.semantics")) {
- error("It is currently not possible to use run-tests.php with unicode.semantics=On. Please turn it Off and re-run the tests.");
-}
$environment = isset($_ENV) ? $_ENV : array();
'error_append_string=',
'auto_prepend_file=',
'auto_append_file=',
- 'magic_quotes_runtime=0',
'ignore_repeated_errors=0',
+ 'unicode.runtime_encoding=ISO-8859-1',
+ 'unicode.script_encoding=UTF-8',
+ 'unicode.output_encoding=UTF-8',
+ 'unicode.from_error_mode=U_INVALID_SUBSTITUTE',
);
function write_information($show_html)
@unlink($info_file);
- $unicode = 1;
- define('TESTED_UNICODE', 1);
-
// load list of enabled extensions
save_text($info_file, '<?php echo join(",", get_loaded_extensions()); ?>');
$exts_to_test = explode(', ',`$php $pass_options $info_params "$info_file"`);
$just_save_results = false;
$leak_check = false;
-$unicode_and_native = false;
-$unicode_testing = false;
$html_output = false;
$html_file = null;
$temp_source = null;
}
$pass_option_n = true;
break;
- case 'N':
- $unicode_and_native = false;
- $unicode_testing = false;
- $ini_overwrites[] = 'unicode.semantics=0';
- break;
case '--no-clean':
$no_clean = true;
break;
case '--temp-urlbase':
$temp_urlbase = $argv[++$i];
break;
- case 'U':
- $unicode_and_native = true;
- // break;
- case 'u':
- $unicode_testing = true;
- $ini_overwrites[] = 'unicode.semantics=1';
- $ini_overwrites[] = 'unicode.runtime_encoding=iso-8859-1';
- $ini_overwrites[] = 'unicode.script_encoding=utf-8';
- $ini_overwrites[] = 'unicode.output_encoding=utf-8';
- $ini_overwrites[] = 'unicode.from_error_mode=U_INVALID_SUBSTITUTE';
- break;
case 'v':
case '--verbose':
$DETAILED = true;
-d foo=bar Pass -d option to the php binary (Define INI entry foo
with value 'bar').
- -u Test with unicode.semantics set on.
-
- -U Test in unicode and non unicode mode.
-
-m Test for memory leaks with Valgrind.
- -N Test with unicode.semantics set off.
-
-p <php> Specify PHP executable to run.
-q Quiet, no user interaction (same as environment NO_INTERACTION).
if ($sum_results['FAILED']) {
foreach ($PHP_FAILED_TESTS['FAILED'] as $test_info) {
- $failed_tests_data .= $sep . ($test_info['unicode']?'U:':'N:') . $test_info['name'] . $test_info['info'];
+ $failed_tests_data .= $sep . $test_info['name'] . $test_info['info'];
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['output']));
$failed_tests_data .= $sep . file_get_contents(realpath($test_info['diff']));
$failed_tests_data .= $sep . "\n\n";
function run_all_tests($test_files, $env, $redir_tested = null)
{
- global $test_results, $failed_tests_file, $php, $test_cnt, $test_idx, $unicode_and_native, $unicode_testing;
-
- if ($unicode_and_native && is_null($redir_tested)) {
- $test_cnt *= 2;
- }
+ global $test_results, $failed_tests_file, $php, $test_cnt, $test_idx;
foreach($test_files as $name) {
$index = $name;
}
- $unicode_semantics = $unicode_and_native ? 0 : ($unicode_testing ? 1 : 0);
- for(; $unicode_semantics < ($unicode_testing ? 2 : 1); $unicode_semantics++) {
+ $test_idx++;
+ $result = run_test($php, $name, $env);
- $test_idx++;
- $result = run_test($php, $name, $env, $unicode_semantics);
+ if (!is_array($name) && $result != 'REDIR') {
+ $test_results[$index] = $result;
- if (!is_array($name) && $result != 'REDIR') {
- $pu = $unicode_and_native && $unicode_semantics ? '.u' : '';
- $test_results[$index.$pu] = $result;
-
- if ($failed_tests_file && ($result== 'XFAILED' || $result == 'FAILED' || $result == 'WARNED' || $result == 'LEAKED')) {
- fwrite($failed_tests_file, "$index\n");
- }
- }
-
- if ($result == 'REDIR') {
- $unicode_semantics = 2;
+ if ($failed_tests_file && ($result== 'XFAILED' || $result == 'FAILED' || $result == 'WARNED' || $result == 'LEAKED')) {
+ fwrite($failed_tests_file, "$index\n");
}
}
}
//
// Run an individual test case.
//
-function run_test($php, $file, $env, $unicode_semantics)
+function run_test($php, $file, $env)
{
global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS;
global $pass_options, $DETAILED, $IN_REDIRECT, $test_cnt, $test_idx;
global $leak_check, $temp_source, $temp_target, $cfg, $environment;
global $no_clean;
- global $unicode_and_native;
global $valgrind_version;
$temp_filenames = null;
$bork_info = "missing section --EXPECT--, --EXPECTF-- or --EXPECTREGEX--";
$borked = true;
}
-
- if ((@count($section_text['UEXPECT']) + @count($section_text['UEXPECTF']) + @count($section_text['UEXPECTREGEX'])) > 1) {
- $bork_info = "missing section --UEXPECT--, --UEXPECTF-- or --UEXPECTREGEX--";
- $borked = true;
- }
}
}
-
fclose($fp);
$shortname = str_replace($cwd.'/', '', $file);
$tested_file = $shortname;
if ($borked) {
- show_result("BORK", $bork_info, $tested_file, $unicode_semantics);
+ show_result("BORK", $bork_info, $tested_file);
$PHP_FAILED_TESTS['BORKED'][] = array (
'name' => $file,
'test_name' => '',
'output' => '',
'diff' => '',
'info' => "$bork_info [$file]",
- 'unicode' => $unicode_semantics,
);
return 'BORKED';
}
}
}
- show_test($test_idx, $shortname, $unicode_semantics);
+ show_test($test_idx, $shortname);
if (is_array($IN_REDIRECT)) {
$temp_dir = $test_dir = $IN_REDIRECT['dir'];
$temp_dir = str_replace($temp_source, $temp_target, $temp_dir);
}
- $pu = $unicode_semantics ? 'u.' : '';
-
- $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'diff';
- $log_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'log';
- $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'exp';
- $output_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'out';
- $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'mem';
- $temp_file = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt')/*.$pu*/.'php';
- $test_file = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt')/*.$pu*/.'php';
- $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'skip.php';
- $test_skipif = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'skip.php';
- $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'clean.php';
- $test_clean = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').$pu.'clean.php';
+ $diff_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'diff';
+ $log_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'log';
+ $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'exp';
+ $output_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'out';
+ $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'mem';
+ $temp_file = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'php';
+ $test_file = $test_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'php';
+ $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'skip.php';
+ $test_skipif = $test_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'skip.php';
+ $temp_clean = $temp_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'clean.php';
+ $test_clean = $test_dir . DIRECTORY_SEPARATOR . basename($file, 'phpt') . 'clean.php';
$tmp_post = $temp_dir . DIRECTORY_SEPARATOR . uniqid('/phpt.');
$tmp_relative_file = str_replace(__DIR__ . DIRECTORY_SEPARATOR, '', $test_file) . 't';
// additional ini overwrites
//$ini_overwrites[] = 'setting=value';
settings2array($ini_overwrites, $ini_settings);
- // is this unicode/native per run-tests.php switch?
- if ($unicode_and_native) {
- $ini_settings["unicode.semantics"] = $unicode_semantics ? '1' : '0';
- }
// Any special ini settings
// these may overwrite the test defaults...
if (array_key_exists('INI', $section_text)) {
$section_text['INI'] = str_replace('{PWD}', dirname($file), $section_text['INI']);
}
settings2array(preg_split( "/[\n\r]+/", $section_text['INI']), $ini_settings);
- if (isset($ini_settings["unicode.semantics"])) {
- $unicode_test = strcasecmp($ini_settings["unicode.semantics"],"on") == 0 || $ini_settings["unicode.semantics"] == 1;
- } else {
- $unicode_test = TESTED_UNICODE;
- }
- } else {
- $unicode_test = $unicode_and_native ? $unicode_semantics : TESTED_UNICODE;
}
settings2params($ini_settings);
$extra = substr(PHP_OS, 0, 3) !== "WIN" ?
"unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;": "";
- $ini_settings .= " -dunicode.semantics=" . (int)$unicode_test;
-
if ($leak_check) {
$env['USE_ZEND_ALLOC'] = '0';
} else {
if (!strncasecmp('skip', ltrim($output), 4)) {
if (preg_match('/^\s*skip\s*(.+)\s*/i', $output, $m)) {
- show_result("SKIP", $tested, $tested_file, $unicode_semantics, "reason: $m[1]", $temp_filenames);
+ show_result("SKIP", $tested, $tested_file, "reason: $m[1]", $temp_filenames);
} else {
- show_result("SKIP", $tested, $tested_file, $unicode_semantics, '', $temp_filenames);
+ show_result("SKIP", $tested, $tested_file, '', $temp_filenames);
}
if (isset($old_php)) {
}
}
- $test_cnt += (count($test_files) - 1) * ($unicode_and_native ? 2 : 1);
+ $test_cnt += (count($test_files) - 1);
$test_idx--;
show_redirect_start($IN_REDIRECT['TESTS'], $tested, $tested_file);
} else {
$bork_info = "Redirect info must contain exactly one TEST string to be used as redirect directory.";
- show_result("BORK", $bork_info, '', $unicode_semantics, $temp_filenames);
+ show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array (
'name' => $file,
'test_name' => '',
'output' => '',
'diff' => '',
'info' => "$bork_info [$file]",
- 'unicode'=> $unicode_semantics,
);
}
}
}
$bork_info = "Redirected test did not contain redirection info";
- show_result("BORK", $bork_info, '', $unicode_semantics, $temp_filenames);
+ show_result("BORK", $bork_info, '', $temp_filenames);
$PHP_FAILED_TESTS['BORKED'][] = array (
'name' => $file,
'test_name' => '',
'output' => '',
'diff' => '',
'info' => "$bork_info [$file]",
- 'unicode'=> $unicode_semantics,
);
return 'BORKED';
}
- if ($unicode_test) {
- if (isset($section_text['UEXPECT'])) {
- unset($section_text['EXPECT']);
- unset($section_text['EXPECTF']);
- unset($section_text['EXPECTREGEX']);
- $section_text['EXPECT'] = $section_text['UEXPECT'];
- unset($section_text['UEXPECT']);
- } else if (isset($section_text['UEXPECTF'])) {
- unset($section_text['EXPECT']);
- unset($section_text['EXPECTF']);
- unset($section_text['EXPECTREGEX']);
- $section_text['EXPECTF'] = $section_text['UEXPECTF'];
- unset($section_text['UEXPECTF']);
- } else if (isset($section_text['UEXPECTREGEX'])) {
- unset($section_text['EXPECT']);
- unset($section_text['EXPECTF']);
- unset($section_text['EXPECTREGEX']);
- $section_text['EXPECTREGEX'] = $section_text['UEXPECTREGEX'];
- unset($section_text['UEXPECTREGEX']);
- }
- }
-
// We've satisfied the preconditions - run the test!
show_file_block('php', $section_text['FILE'], 'TEST');
save_text($test_file, $section_text['FILE'], $temp_file);
}
if (!$leaked && !$failed_headers) {
- show_result("PASS", $tested, $tested_file, $unicode_semantics, '', $temp_filenames);
+ show_result("PASS", $tested, $tested_file, '', $temp_filenames);
return 'PASSED';
}
}
$wanted = trim($section_text['EXPECT']);
- if ($unicode_semantics && is_unicode($wanted)) {
+ if (is_unicode($wanted)) {
/* workaround until preg_replace() or str_replace() are upgraded */
$wanted = unicode_encode($wanted, ini_get('unicode.output_encoding') ?: 'utf-8');
}
- $wanted = preg_replace('/\r\n/',"\n",$wanted);
+ $wanted = preg_replace('/\r\n/', "\n", $wanted);
+
show_file_block('exp', $wanted);
// compare and leave on success
}
if (!$leaked && !$failed_headers) {
- show_result("PASS", $tested, $tested_file, $unicode_semantics, '', $temp_filenames);
+ show_result("PASS", $tested, $tested_file, '', $temp_filenames);
return 'PASSED';
}
}
}
}
- show_result(implode('&', $restype), $tested, $tested_file, $unicode_semantics, $info, $temp_filenames);
+ show_result(implode('&', $restype), $tested, $tested_file, $info, $temp_filenames);
foreach ($restype as $type) {
$PHP_FAILED_TESTS[$type.'ED'][] = array (
'output' => $output_filename,
'diff' => $diff_filename,
'info' => $info,
- 'unicode' => $unicode_semantics,
);
}
---------------------------------------------------------------------
";
foreach ($PHP_FAILED_TESTS['BORKED'] as $test_data) {
- $failed_test_summary .= ($test_data['unicode']?'U:':'N:') . $test_data['info'] . "\n";
+ $failed_test_summary .= $test_data['info'] . "\n";
}
$failed_test_summary .= "=====================================================================\n";
---------------------------------------------------------------------
";
foreach ($PHP_FAILED_TESTS['FAILED'] as $test_data) {
- $failed_test_summary .= ($test_data['unicode']?'U:':'N:') . $test_data['test_name'] . $test_data['info'] . "\n";
+ $failed_test_summary .= $test_data['test_name'] . $test_data['info'] . "\n";
}
$failed_test_summary .= "=====================================================================\n";
---------------------------------------------------------------------
";
foreach ($PHP_FAILED_TESTS['XFAILED'] as $test_data) {
- $failed_test_summary .= ($test_data['unicode']?'U:':'N:') . $test_data['test_name'] . $test_data['info'] . "\n";
+ $failed_test_summary .= $test_data['test_name'] . $test_data['info'] . "\n";
}
$failed_test_summary .= "=====================================================================\n";
---------------------------------------------------------------------
";
foreach ($PHP_FAILED_TESTS['LEAKED'] as $test_data) {
- $failed_test_summary .= ($test_data['unicode']?'U:':'N:') . $test_data['test_name'] . $test_data['info'] . "\n";
+ $failed_test_summary .= $test_data['test_name'] . $test_data['info'] . "\n";
}
$failed_test_summary .= "=====================================================================\n";
echo "---> $tests ($tested [$tested_file]) done\n";
}
-function show_test($test_idx, $shortname, $unicode_semantics)
+function show_test($test_idx, $shortname)
{
global $test_cnt;
- $kind = $unicode_semantics ? ':U' : ':N';
- echo "TEST$kind $test_idx/$test_cnt [$shortname]\r";
+ echo "TEST $test_idx/$test_cnt [$shortname]\r";
flush();
}
-function show_result($result, $tested, $tested_file, $unicode_semantics, $extra = '', $temp_filenames = null)
+function show_result($result, $tested, $tested_file, $extra = '', $temp_filenames = null)
{
- global $html_output, $html_file, $temp_target, $temp_urlbase, $unicode_and_native;
-
- $kind = $unicode_semantics ? ':U' : ':N';
+ global $html_output, $html_file, $temp_target, $temp_urlbase;
- echo "$result$kind $tested [$tested_file] $extra\n";
+ echo "$result $tested [$tested_file] $extra\n";
if ($html_output) {