helly Wed Dec 21 22:23:55 2005 EDT Modified files: (Branch: PHP_5_1) /php-src run-tests.php Log: - MFH Add --[keep|show]-[all|skip|php] switches http://cvs.php.net/viewcvs.cgi/php-src/run-tests.php?r1=1.226.2.18&r2=1.226.2.19&diff_format=u Index: php-src/run-tests.php diff -u php-src/run-tests.php:1.226.2.18 php-src/run-tests.php:1.226.2.19 --- php-src/run-tests.php:1.226.2.18 Tue Dec 20 16:17:30 2005 +++ php-src/run-tests.php Wed Dec 21 22:23:55 2005 @@ -23,7 +23,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: run-tests.php,v 1.226.2.18 2005/12/20 16:17:30 tony2001 Exp $ */ +/* $Id: run-tests.php,v 1.226.2.19 2005/12/21 22:23:55 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 @@ -236,6 +236,16 @@ $temp_target = null; $temp_urlbase = null; +$cfgtypes = array('show', 'keep'); +$cfgfiles = array('skip', 'php'); +$cfg = array(); +foreach($cfgtypes as $type) { + $cfg[$type] = array(); + foreach($cfgfiles as $file) { + $cfg[$type][$file] = false; + } +} + if (getenv('TEST_PHP_ARGS')) { if (!isset($argc) || !$argc || !isset($argv)) @@ -286,6 +296,17 @@ $ini_overwrites[] = $argv[++$i]; break; //case 'h' + case '--keep-all': + foreach($cfgfiles as $file) { + $cfg['keep'][$file] = true; + } + break; + case '--keep-skip': + $cfg['keep']['skip'] = true; + break; + case '--keep-php': + $cfg['keep']['php'] = true; + break; //case 'l' case 'm': $leak_check = true; @@ -304,6 +325,17 @@ $output_file = $argv[++$i]; $just_save_results = true; break; + case '--show-all': + foreach($cfgfiles as $file) { + $cfg['show'][$file] = true; + } + break; + case '--show-skip': + $cfg['show']['skip'] = true; + break; + case '--show-php': + $cfg['show']['php'] = true; + break; case '--temp-source': $temp_source = $argv[++$i]; break; @@ -333,7 +365,7 @@ $html_output = is_resource($html_file); break; case '--version': - echo '$Revision: 1.226.2.18 $'."\n"; + echo '$Revision: 1.226.2.19 $'."\n"; exit(1); default: echo "Illegal switch '$switch' specified!\n"; @@ -387,6 +419,12 @@ 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. + + --show-[all|php|skip] + Show 'all' files, 'php' test file, 'skip' file. + HELP; exit(1); } @@ -831,7 +869,7 @@ // function run_test($php, $file) { - global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS, $pass_options, $DETAILED, $IN_REDIRECT, $test_cnt, $test_idx, $leak_check, $temp_source, $temp_target; + global $log_format, $info_params, $ini_overwrites, $cwd, $PHP_FAILED_TESTS, $pass_options, $DETAILED, $IN_REDIRECT, $test_cnt, $test_idx, $leak_check, $temp_source, $temp_target, $cfg; $temp_filenames = null; $org_file = $file; @@ -1024,6 +1062,11 @@ settings2array($ini_overwrites,$skipif_params); settings2params($skipif_params); + if ($cfg['show']['skip']) { + echo "\n========SKIP========\n"; + echo $section_text['SKIPIF']; + echo "========DONE========\n"; + } save_text($test_skipif, $section_text['SKIPIF'], $temp_skipif); $extra = substr(PHP_OS, 0, 3) !== "WIN" ? "unset REQUEST_METHOD; unset QUERY_STRING; unset PATH_TRANSLATED; unset SCRIPT_FILENAME; unset REQUEST_METHOD;": ""; @@ -1039,7 +1082,9 @@ if (isset($old_php)) { $php = $old_php; } - @unlink($test_skipif); + if (!$cfg['keep']['skip']) { + @unlink($test_skipif); + } return 'SKIPPED'; } if (!strncasecmp('info', trim($output), 4)) { @@ -1135,6 +1180,11 @@ settings2params($ini_settings); // We've satisfied the preconditions - run the test! + if ($cfg['show']['php']) { + echo "\n========TEST========\n"; + echo $section_text['FILE']; + echo "========DONE========\n"; + } save_text($test_file, $section_text['FILE'], $temp_file); if (array_key_exists('GET', $section_text)) { $query_string = trim($section_text['GET']); @@ -1252,7 +1302,9 @@ */ if (preg_match("/^$wanted_re\$/s", $output)) { $passed = true; - @unlink($test_file); + if (!$cfg['keep']['php']) { + @unlink($test_file); + } if (isset($old_php)) { $php = $old_php; } @@ -1267,7 +1319,9 @@ // compare and leave on success if (!strcmp($output, $wanted)) { $passed = true; - @unlink($test_file); + if (!$cfg['keep']['php']) { + @unlink($test_file); + } if (isset($old_php)) { $php = $old_php; }
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php