helly Wed Jan 4 15:08:02 2006 UTC Modified files: (Branch: PHP_5_1) /php-src run-tests.php Log: - MFH http://cvs.php.net/viewcvs.cgi/php-src/run-tests.php?r1=1.226.2.25&r2=1.226.2.26&diff_format=u Index: php-src/run-tests.php diff -u php-src/run-tests.php:1.226.2.25 php-src/run-tests.php:1.226.2.26 --- php-src/run-tests.php:1.226.2.25 Sun Jan 1 12:50:00 2006 +++ php-src/run-tests.php Wed Jan 4 15:08:02 2006 @@ -23,7 +23,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: run-tests.php,v 1.226.2.25 2006/01/01 12:50:00 sniper Exp $ */ +/* $Id: run-tests.php,v 1.226.2.26 2006/01/04 15:08:02 helly Exp $ */ /* Sanity check to ensure that pcre extension needed by this script is available. * In the event it is not, print a nice error message indicating that this script will @@ -241,9 +241,10 @@ $temp_target = null; $temp_urlbase = null; $conf_passed = null; +$no_clean = false; $cfgtypes = array('show', 'keep'); -$cfgfiles = array('skip', 'php'); +$cfgfiles = array('skip', 'php', 'clean'); $cfg = array(); foreach($cfgtypes as $type) { $cfg[$type] = array(); @@ -316,6 +317,9 @@ case '--keep-php': $cfg['keep']['php'] = true; break; + case '--keep-clean': + $cfg['keep']['clean'] = true; + break; //case 'l' case 'm': $leak_check = true; @@ -326,6 +330,9 @@ } $pass_option_n = true; break; + case '--no-clean': + $no_clean = true; + break; case 'q': putenv('NO_INTERACTION=1'); break; @@ -345,6 +352,9 @@ case '--show-php': $cfg['show']['php'] = true; break; + case '--show-clean': + $cfg['show']['clean'] = true; + break; case '--temp-source': $temp_source = $argv[++$i]; break; @@ -374,7 +384,7 @@ $html_output = is_resource($html_file); break; case '--version': - echo '$Revision: 1.226.2.25 $'."\n"; + echo '$Revision: 1.226.2.26 $'."\n"; exit(1); default: echo "Illegal switch '$switch' specified!\n"; @@ -430,11 +440,14 @@ to your source files and <tdir> some pach in your web page hierarchy with <url> pointing to <tdir>. - --keep-[all|php|skip] - Do not delete 'all' files, 'php' test file, 'skip' file. + --keep-[all|php|skip|clean] + Do not delete 'all' files, 'php' test file, 'skip' or 'clean' + file. - --show-[all|php|skip] - Show 'all' files, 'php' test file, 'skip' file. + --show-[all|php|skip|clean] + Show 'all' files, 'php' test file, 'skip' or 'clean' file. + + --no-clean Do not execute clean section if any. HELP; exit(1); @@ -887,6 +900,7 @@ 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; $temp_filenames = null; $org_file = $file; @@ -1018,14 +1032,17 @@ $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'; - $test_skipif = $test_dir . DIRECTORY_SEPARATOR . basename($file,'phpt').'skip'; + $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(dirname(__FILE__).DIRECTORY_SEPARATOR, '', $test_file) . 't'; if ($temp_source && $temp_target) { - $temp_skipif .= '.phps'; - $temp_file .= '.phps'; + $temp_skipif .= 's'; + $temp_file .= 's'; + $temp_clean .= 's'; $copy_file = $temp_dir . DIRECTORY_SEPARATOR . basename(is_array($file) ? $file[1] : $file).'.phps'; if (!is_dir(dirname($copy_file))) { @mkdir(dirname($copy_file), 0777, true) or error("Cannot create output directory - " . dirname($copy_file)); @@ -1041,7 +1058,8 @@ 'out' => $output_filename, 'mem' => $memcheck_filename, 'php' => $temp_file, - 'skip' => $temp_skipif); + 'skip' => $temp_skipif, + 'clean'=> $temp_clean); } if (is_array($IN_REDIRECT)) { @@ -1061,6 +1079,8 @@ @unlink($temp_skipif); @unlink($test_skipif); @unlink($tmp_post); + @unlink($temp_clean); + @unlink($test_clean); // Reset environment from any previous test. $env['REDIRECT_STATUS']=''; @@ -1097,7 +1117,9 @@ $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;": ""; $output = system_with_timeout("$extra $php -q $skipif_params $test_skipif", $env); - @unlink($test_skipif); + if (!$cfg['keep']['skip']) { + @unlink($test_skipif); + } if (!strncasecmp('skip', trim($output), 4)) { $reason = (eregi("^skip[[:space:]]*(.+)\$", trim($output))) ? eregi_replace("^skip[[:space:]]*(.+)\$", "\\1", trim($output)) : FALSE; if ($reason) { @@ -1255,6 +1277,28 @@ $out = system_with_timeout($cmd, $env); + if (array_key_exists('CLEAN', $section_text) && (!$no_clean || $cfg['keep']['clean'])) { + if (trim($section_text['CLEAN'])) { + if ($cfg['show']['clean']) { + echo "\n========CLEAN=======\n"; + echo $section_text['CLEAN']; + echo "========DONE========\n"; + } + save_text($test_clean, trim($section_text['CLEAN']), $temp_clean); + if (!$no_clean) { + $clean_params = array(); + settings2array($ini_overwrites,$clean_params); + settings2params($clean_params); + $extra = substr(PHP_OS, 0, 3) !== "WIN" ? + "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;": ""; + system_with_timeout("$extra $php -q $clean_params $clean_skipif", $env); + } + if (!$cfg['keep']['clean']) { + @unlink($test_clean); + } + } + } + @unlink($tmp_post); $leaked = false;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php