cvs: php4 / run-tests.php
| From: | Stig Bakken | Date: | Wed, 13 Dec 2000 14:24:15 +0000 |
| Subject: | cvs: php4 / run-tests.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-3123@lists.php.net to get a copy of this message | ||
ssb Wed Dec 13 06:24:15 2000 EDT
Modified files:
/php4 run-tests.php
Log:
* rename write* to dowrite* to avoid clash with ext/sockets
* sapi/cgi seems to ignore command-line options when running in "real"
CGI mode, need to find a way to pass include_path to it...
Index: php4/run-tests.php
diff -u php4/run-tests.php:1.11 php4/run-tests.php:1.12
--- php4/run-tests.php:1.11 Fri Dec 8 04:57:11 2000
+++ php4/run-tests.php Wed Dec 13 06:24:15 2000
@@ -54,7 +54,7 @@
* This makes it easier to convert to HTML output later.
*/
-function write($str)
+function dowrite($str)
{
global $term_bold, $term_norm;
$str = str_replace("%b", $term_bold, $str);
@@ -62,9 +62,9 @@
print $str;
}
-function writeln($str)
+function dowriteln($str)
{
- write("$str\n");
+ dowrite("$str\n");
}
function initialize()
@@ -99,8 +99,8 @@
}
if (!is_executable($php)) {
- writeln("PHP CGI binary ($php) not executable.");
- writeln("Please compile PHP as a CGI executable and try again.");
+ dowriteln("PHP CGI binary ($php) not executable.");
+ dowriteln("Please compile PHP as a CGI executable and try again.");
exit;
}
@@ -175,7 +175,7 @@
$counting = $total - $skipped;
if ($counting <= 0) {
- writeln("No tests were run.");
+ dowriteln("No tests were run.");
return;
}
@@ -188,12 +188,12 @@
$failed_pstr = sprintf($failed_p < 10.0 ? "%1.1f" : "%3.0f", $failed_p);
$skipped_pstr = sprintf($skipped_p < 10.0 ? "%1.1f" : "%3.0f",
$skipped_p);
- writeln("TEST RESULT SUMMARY");
- writeln("=============================");
- writeln(sprintf("Number of tests: %4d", $total));
- writeln(sprintf("Tests skipped: %4d (%s%%)", $skipped, $skipped_pstr));
- writeln(sprintf("Tests failed: %4d (%s%%)", $failed, $failed_pstr));
- writeln(sprintf("Tests passed: %4d (%s%%)", $passed, $passed_pstr));
+ dowriteln("TEST RESULT SUMMARY");
+ dowriteln("=============================");
+ dowriteln(sprintf("Number of tests: %4d", $total));
+ dowriteln(sprintf("Tests skipped: %4d (%s%%)", $skipped, $skipped_pstr));
+ dowriteln(sprintf("Tests failed: %4d (%s%%)", $failed, $failed_pstr));
+ dowriteln(sprintf("Tests passed: %4d (%s%%)", $passed, $passed_pstr));
}
function find_testdirs($dir = '.', $first_pass = true)
@@ -245,8 +245,8 @@
if (sizeof($testfiles) == 0) {
return;
}
- writeln("%bRunning tests in $dir%B");
- writeln("=================".str_repeat("=", strlen($dir)));
+ dowriteln("%bRunning tests in $dir%B");
+ dowriteln("=================".str_repeat("=", strlen($dir)));
sort($testfiles);
for ($i = 0; $i < sizeof($testfiles); $i++) {
switch (run_test($testfiles[$i])) {
@@ -264,9 +264,9 @@
$total++;
}
if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) {
- writeln("[all $skipped test(s) skipped]");
+ dowriteln("[all $skipped test(s) skipped]");
}
- writeln("");
+ dowriteln("");
return true;
}
@@ -376,6 +376,7 @@
putenv("REDIRECT_STATUS=1");
putenv("CONTENT_LENGTH=");
putenv("QUERY_STRING=".(isset($GET)?$GET:""));
+ $include_path = ini_get("include_path");
if (isset($fps["SKIPIF"])) {
$tmpfile["SKIPIF_OUTPUT"] = tempnam($tmpdir, $tmpfix);
putenv("REQUEST_METHOD=GET");
@@ -411,9 +412,9 @@
putenv("c=");
putenv("d=");
if (isset($fps["POST"])) {
- $cmd = "$php -f $tmpfile[FILE] < $tmpfile[POST]";
+ $cmd = "$php -q $tmpfile[FILE] < $tmpfile[POST]";
} else {
- $cmd = "$php -f $tmpfile[FILE]";
+ $cmd = "$php -q $tmpfile[FILE]";
}
$ofp = @fopen($tmpfile["OUTPUT"], "w");
if (!$ofp) {
@@ -464,7 +465,7 @@
copy($tmpfile["EXPECT"], $expectfile);
copy($tmpfile["FILE"], $phpfile);
}
- writeln(sprintf("%s%-68s ... %s%s", $pre, substr($desc, 0, 68),
+ dowriteln(sprintf("%s%-68s ... %s%s", $pre, substr($desc, 0, 68),
$text, $post));
// if ($status == TEST_FAILED) {
// for ($i = 0; $i < sizeof($variables); $i++) {