[PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
mike Wed, 25 Jan 2012 19:36:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=322758 Log: find a php-cgi which is a sibling of the php executable Changed paths: U php/php-src/trunk/run-tests.php Modified: php/php-src/trunk/run-tests.php === --- php/php-src/trunk/run-tests.php 2012-01-25 19:32:58 UTC (rev 322757) +++ php/php-src/trunk/run-tests.php 2012-01-25 19:36:36 UTC (rev 322758) @@ -1357,6 +1357,9 @@ } else if (file_exists(./sapi/cgi/php-cgi)) { $old_php = $php; $php = realpath(./sapi/cgi/php-cgi) . ' -C '; + } else if (file_exists(dirname($php) . /php-cgi)) { + $old_php = $php; + $php = realpath(dirname($php) . /php-cgi) . ' -C '; } else { show_result('SKIP', $tested, $tested_file, reason: CGI not available); if ($JUNIT) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
derick Fri, 15 Oct 2010 12:56:45 + Revision: http://svn.php.net/viewvc?view=revisionrevision=304415 Log: - Added the writing of .sh files so that we can run the tests (including all INI settings) in one go. Changed paths: U php/php-src/trunk/run-tests.php Modified: php/php-src/trunk/run-tests.php === --- php/php-src/trunk/run-tests.php 2010-10-15 12:50:56 UTC (rev 304414) +++ php/php-src/trunk/run-tests.php 2010-10-15 12:56:45 UTC (rev 304415) @@ -197,7 +197,7 @@ if (getenv('TEST_PHP_LOG_FORMAT')) { $log_format = strtoupper(getenv('TEST_PHP_LOG_FORMAT')); } else { - $log_format = 'LEOD'; + $log_format = 'LEODS'; } // Check whether a detailed log is wanted. @@ -1352,6 +1352,7 @@ $exp_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'exp'; $output_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'out'; $memcheck_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'mem'; + $sh_filename = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'sh'; $temp_file = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'php'; $test_file = $test_dir . DIRECTORY_SEPARATOR . $main_file_name . 'php'; $temp_skipif = $temp_dir . DIRECTORY_SEPARATOR . $main_file_name . 'skip.php'; @@ -1382,6 +1383,7 @@ 'exp' = $exp_filename, 'out' = $output_filename, 'mem' = $memcheck_filename, + 'sh' = $sh_filename, 'php' = $temp_file, 'skip' = $temp_skipif, 'clean'= $temp_clean); @@ -1398,6 +1400,7 @@ @unlink($exp_filename); @unlink($output_filename); @unlink($memcheck_filename); + @unlink($sh_filename); @unlink($temp_file); @unlink($test_file); @unlink($temp_skipif); @@ -1959,6 +1962,15 @@ error(Cannot create test diff - $diff_filename); } + // write .sh + if (strpos($log_format, 'S') !== false file_put_contents($sh_filename, b#!/bin/sh + +{$cmd} +, FILE_BINARY) === false) { + error(Cannot create test shell script - $sh_filename); + } + chmod($sh_filename, 0755); + // write .log if (strpos($log_format, 'L') !== false file_put_contents($log_filename, b EXPECTED OUTPUT -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
dmitry Wed, 16 Dec 2009 11:16:03 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292196 Log: Fixed test engine to support non utf-8 tests Changed paths: U php/php-src/trunk/run-tests.php Modified: php/php-src/trunk/run-tests.php === --- php/php-src/trunk/run-tests.php 2009-12-16 11:15:22 UTC (rev 292195) +++ php/php-src/trunk/run-tests.php 2009-12-16 11:16:03 UTC (rev 292196) @@ -1130,6 +1130,17 @@ } } +function binary_section($section) { + return ($section == 'FILE' || + $section == 'FILEEOF' || + $section == 'EXPECT' || + $section == 'EXPECTF' || + $section == 'EXPECTREGEX' || + $section == 'EXPECTHEADERS' || + $section == 'SKIPIF' || + $section == 'CLEAN'); +} + // // Run an individual test case. // @@ -1159,7 +1170,7 @@ // Load the sections of the test file. $section_text = array('TEST' = ''); - $fp = fopen($file, rt) or error(Cannot open test file: $file); + $fp = fopen($file, rb) or error(Cannot open test file: $file); $borked = false; $bork_info = ''; @@ -1187,28 +1198,41 @@ while (!feof($fp)) { $line = fgets($fp); + if ($line === false) { + break; + } + // Match the beginning of a section. - if (preg_match('/^--([_A-Z]+)--/', $line, $r)) { - $section = $r[1]; + if (preg_match(b'/^--([_A-Z]+)--/', $line, $r)) { + $section = (unicode)$r[1]; if (isset($section_text[$section])) { $bork_info = duplicated $section section; $borked= true; } - $section_text[$section] = ''; + $section_text[$section] = binary_section($section) ? b'' : ''; $secfile = $section == 'FILE' || $section == 'FILEEOF' || $section == 'FILE_EXTERNAL'; $secdone = false; continue; } + if (!binary_section($section)) { + $line = unicode_decode($line, utf-8); + if ($line == false) { + $bork_info = cannot read test; + $borked = true; + break; + } + } + // Add to the section text. if (!$secdone) { $section_text[$section] .= $line; } // End of actual test? - if ($secfile preg_match('/^===DONE===\s*$/', $line)) { + if ($secfile preg_match(b'/^===DONE===\s*$/', $line)) { $secdone = true; } } @@ -1233,7 +1257,7 @@ } if (@count($section_text['FILEEOF']) == 1) { - $section_text['FILE'] = preg_replace(/[\r\n]+$/, '', $section_text['FILEEOF']); + $section_text['FILE'] = preg_replace(b/[\r\n]+$/, b'', $section_text['FILEEOF']); unset($section_text['FILEEOF']); } @@ -1776,7 +1800,9 @@ // quote a non re portion of the string $temp = $temp . preg_quote(substr($wanted_re, $startOffset, ($start - $startOffset)), b'/'); // add the re unquoted. - $temp = $temp . b'(' . substr($wanted_re, $start+2, ($end - $start-2)). b')'; + if ($end $start) { + $temp = $temp . b'(' . substr($wanted_re, $start+2, ($end - $start-2)). b')'; + } $startOffset = $end + 2; } $wanted_re = $temp; @@ -1956,7 +1982,7 @@ function comp_line($l1, $l2, $is_reg) { if ($is_reg) { - return preg_match((binary) /^$l1$/s, (binary) $l2); + return preg_match(b'/^'. (binary) $l1 . b'$/s', (binary) $l2); } else { return !strcmp((binary) $l1, (binary) $l2); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
Why didn't you merge this to all branches? The run-test.php has so far been same in all of them. Can't really do regression testing if you change how tests are run for one branch..:) --Jani On 12/16/2009 01:16 PM, Dmitry Stogov wrote: dmitry Wed, 16 Dec 2009 11:16:03 + Revision: http://svn.php.net/viewvc?view=revisionrevision=292196 Log: Fixed test engine to support non utf-8 tests Changed paths: U php/php-src/trunk/run-tests.php Modified: php/php-src/trunk/run-tests.php === --- php/php-src/trunk/run-tests.php 2009-12-16 11:15:22 UTC (rev 292195) +++ php/php-src/trunk/run-tests.php 2009-12-16 11:16:03 UTC (rev 292196) @@ -1130,6 +1130,17 @@ } } +function binary_section($section) { + return ($section == 'FILE' || + $section == 'FILEEOF' || + $section == 'EXPECT' || + $section == 'EXPECTF' || + $section == 'EXPECTREGEX' || + $section == 'EXPECTHEADERS' || + $section == 'SKIPIF' || + $section == 'CLEAN'); +} + // // Run an individual test case. // @@ -1159,7 +1170,7 @@ // Load the sections of the test file. $section_text = array('TEST' = ''); - $fp = fopen($file, rt) or error(Cannot open test file: $file); + $fp = fopen($file, rb) or error(Cannot open test file: $file); $borked = false; $bork_info = ''; @@ -1187,28 +1198,41 @@ while (!feof($fp)) { $line = fgets($fp); + if ($line === false) { + break; + } + // Match the beginning of a section. - if (preg_match('/^--([_A-Z]+)--/', $line, $r)) { - $section = $r[1]; + if (preg_match(b'/^--([_A-Z]+)--/', $line, $r)) { + $section = (unicode)$r[1]; if (isset($section_text[$section])) { $bork_info = duplicated $section section; $borked= true; } - $section_text[$section] = ''; + $section_text[$section] = binary_section($section) ? b'' : ''; $secfile = $section == 'FILE' || $section == 'FILEEOF' || $section == 'FILE_EXTERNAL'; $secdone = false; continue; } + if (!binary_section($section)) { + $line = unicode_decode($line, utf-8); + if ($line == false) { + $bork_info = cannot read test; + $borked = true; + break; + } + } + // Add to the section text. if (!$secdone) { $section_text[$section] .= $line; } // End of actual test? - if ($secfile preg_match('/^===DONE===\s*$/', $line)) { + if ($secfile preg_match(b'/^===DONE===\s*$/', $line)) { $secdone = true; } } @@ -1233,7 +1257,7 @@ } if (@count($section_text['FILEEOF']) == 1) { - $section_text['FILE'] = preg_replace(/[\r\n]+$/, '', $section_text['FILEEOF']); + $section_text['FILE'] = preg_replace(b/[\r\n]+$/, b'', $section_text['FILEEOF']); unset($section_text['FILEEOF']); } @@ -1776,7 +1800,9 @@ // quote a non re portion of the string $temp = $temp . preg_quote(substr($wanted_re, $startOffset, ($start - $startOffset)), b'/'); // add the re unquoted. - $temp = $temp . b'(' . substr($wanted_re, $start+2, ($end - $start-2)). b')'; + if ($end $start) { + $temp = $temp . b'(' . substr($wanted_re, $start+2, ($end - $start-2)). b')'; + } $startOffset = $end + 2; } $wanted_re = $temp; @@ -1956,7 +1982,7 @@ function comp_line($l1, $l2, $is_reg) { if ($is_reg) { - return preg_match((binary) /^$l1$/s, (binary) $l2); + return preg_match(b'/^'. (binary) $l1 . b'$/s', (binary) $l2); } else { return !strcmp((binary) $l1, (binary) $l2); } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
cellog Wed, 29 Jul 2009 09:22:57 + Revision: http://svn.php.net/viewvc?view=revisionrevision=286499 Log: fix EXPECTF tests that have binary in their output by always processing output and expected output as binary Changed paths: U php/php-src/trunk/run-tests.php Modified: php/php-src/trunk/run-tests.php === --- php/php-src/trunk/run-tests.php 2009-07-29 09:10:52 UTC (rev 286498) +++ php/php-src/trunk/run-tests.php 2009-07-29 09:22:57 UTC (rev 286499) @@ -1023,7 +1023,7 @@ { global $leak_check, $cwd; - $data = ''; + $data = b''; $bin_env = array(); foreach((array)$env as $key = $value) { @@ -1059,23 +1059,23 @@ break; } else if ($n === 0) { /* timed out */ - $data .= \n ** ERROR: process timed out **\n; + $data .= b\n ** ERROR: process timed out **\n; proc_terminate($proc); return $data; } else if ($n 0) { - $line = fread($pipes[1], 8192); + $line = (binary) fread($pipes[1], 8192); if (strlen($line) == 0) { /* EOF */ break; } - $data .= (binary) $line; + $data .= $line; } } $stat = proc_get_status($proc); if ($stat['signaled']) { - $data .= \nTermsig= . $stat['stopsig']; + $data .= b\nTermsig= . $stat['stopsig']; } $code = proc_close($proc); @@ -1649,7 +1649,7 @@ COMMAND $cmd ; - $out = system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null); + $out = (binary) system_with_timeout($cmd, $env, isset($section_text['STDIN']) ? $section_text['STDIN'] : null); if (array_key_exists('CLEAN', $section_text) (!$no_clean || $cfg['keep']['clean'])) { @@ -1686,19 +1686,19 @@ } // Does the output match what is expected? - $output = preg_replace(/\r\n/, \n, trim($out)); + $output = preg_replace(b/\r\n/, b\n, trim($out)); /* when using CGI, strip the headers from the output */ - $headers = ; + $headers = b; - if (isset($old_php) preg_match(/^(.*?)\r?\n\r?\n(.*)/s, $out, $match)) { + if (isset($old_php) preg_match(b/^(.*?)\r?\n\r?\n(.*)/s, $out, $match)) { $output = trim($match[2]); - $rh = preg_split(/[\n\r]+/, $match[1]); + $rh = preg_split(b/[\n\r]+/, $match[1]); $headers = array(); foreach ($rh as $line) { - if (strpos($line, ':') !== false) { -$line = explode(':', $line, 2); + if (strpos($line, b':') !== false) { +$line = explode(b':', $line, 2); $headers[trim($line[0])] = trim($line[1]); } } @@ -1709,13 +1709,13 @@ if (isset($section_text['EXPECTHEADERS'])) { $want = array(); $wanted_headers = array(); - $lines = preg_split(/[\n\r]+/, $section_text['EXPECTHEADERS']); + $lines = preg_split(b/[\n\r]+/, (binary) $section_text['EXPECTHEADERS']); foreach($lines as $line) { - if (strpos($line, ':') !== false) { -$line = explode(':', $line, 2); + if (strpos($line, b':') !== false) { +$line = explode(b':', $line, 2); $want[trim($line[0])] = trim($line[1]); -$wanted_headers[] = trim($line[0]) . ': ' . trim($line[1]); +$wanted_headers[] = trim($line[0]) . b': ' . trim($line[1]); } } @@ -1727,7 +1727,7 @@ if (isset($org_headers[$k])) { $headers = $org_headers[$k]; -$output_headers[] = $k . ': ' . $org_headers[$k]; +$output_headers[] = $k . b': ' . $org_headers[$k]; } if (!isset($org_headers[$k]) || $org_headers[$k] != $v) { @@ -1736,9 +1736,9 @@ } ksort($wanted_headers); - $wanted_headers = join(\n, $wanted_headers); + $wanted_headers = join(b\n, $wanted_headers); ksort($output_headers); - $output_headers = join(\n, $output_headers); + $output_headers = join(b\n, $output_headers); } show_file_block('out', $output); @@ -1752,13 +1752,13 @@ } show_file_block('exp', $wanted); - $wanted_re = preg_replace('/\r\n/', \n, $wanted); + $wanted_re = preg_replace(b'/\r\n/', b\n, $wanted); if (isset($section_text['EXPECTF'])) { // do preg_quote, but miss out any %r delimited sections - $temp = ; - $r = %r; + $temp = b; + $r = b%r; $startOffset = 0; $length = strlen($wanted_re); while($startOffset $length) { @@ -1775,45 +1775,45 @@ $start = $end = $length; } // quote a non re portion of the string -$temp = $temp . preg_quote(substr($wanted_re, $startOffset, ($start - $startOffset)), '/'); +$temp = $temp . preg_quote(substr($wanted_re, $startOffset, ($start - $startOffset)), b'/'); // add the re unquoted. -$temp = $temp . '(' . substr($wanted_re, $start+2, ($end - $start-2)). ')'; +$temp = $temp . b'(' . substr($wanted_re, $start+2, ($end - $start-2)). b')'; $startOffset = $end + 2; } $wanted_re = $temp; $wanted_re = str_replace( -array('%binary_string_optional%'), -version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? 'string' : 'binary string', +array(b'%binary_string_optional%'), +version_compare(PHP_VERSION, '6.0.0-dev') == -1 ? b'string' : b'binary string',
Re: [PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
On 07/29/2009 12:22 PM, Greg Beaver wrote: cellog Wed, 29 Jul 2009 09:22:57 + Revision: http://svn.php.net/viewvc?view=revisionrevision=286499 Log: fix EXPECTF tests that have binary in their output by always processing output and expected output as binary Changed paths: U php/php-src/trunk/run-tests.php This file should be same in all branches. Please sync it with the others too. --Jani -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/trunk/ run-tests.php
cellog Wed, 29 Jul 2009 16:14:07 + Revision: http://svn.php.net/viewvc?view=revisionrevision=286517 Log: restore removed line (thanks Jani) Changed paths: U php/php-src/trunk/run-tests.php Modified: php/php-src/trunk/run-tests.php === --- php/php-src/trunk/run-tests.php 2009-07-29 15:41:21 UTC (rev 286516) +++ php/php-src/trunk/run-tests.php 2009-07-29 16:14:07 UTC (rev 286517) @@ -1140,6 +1140,7 @@ global $leak_check, $temp_source, $temp_target, $cfg, $environment; global $no_clean; global $valgrind_version; + $temp_filenames = null; $org_file = $file; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php