cvs: php4 / run-tests.php /ext/db/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt /tests/lang 022.phpt 023-1.inc 024.phpt
| From: | Hartmut Holzgraefe | Date: | Mon, 23 Oct 2000 07:40:06 +0000 |
| Subject: | cvs: php4 / run-tests.php /ext/db/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt 006.phpt /tests/lang 022.phpt 023-1.inc 024.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-2241@lists.php.net to get a copy of this message | ||
hholzgra Mon Oct 23 00:40:06 2000 EDT
Modified files:
/php4 run-tests.php
/php4/tests/lang 022.phpt 023-1.inc 024.phpt
/php4/ext/db/tests 001.phpt 002.phpt 003.phpt 004.phpt 005.phpt
006.phpt
Log:
have you ever tried to run the regression tests with error_reporting=E_ALL ?
now it will run smoothly without all theese 'undefined ...' warnings
Index: php4/run-tests.php
diff -u php4/run-tests.php:1.5 php4/run-tests.php:1.6
--- php4/run-tests.php:1.5 Fri Sep 8 17:37:39 2000
+++ php4/run-tests.php Mon Oct 23 00:40:05 2000
@@ -18,6 +18,7 @@
+----------------------------------------------------------------------+
*/
+ob_implicit_flush();
define('TEST_PASSED', 0);
define('TEST_FAILED', -1);
@@ -191,7 +192,7 @@
}
while ($ent = readdir($dp)) {
$path = "$dir/$ent";
- if ($skip[$ent] || substr($ent, 0, 1) == "." || !is_dir($path)) {
+ if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." ||
!is_dir($path)) {
continue;
}
if (strstr("/$path/", "/tests/")) {
@@ -211,14 +212,14 @@
}
$testfiles = array();
while ($ent = readdir($dp)) {
- if ($skip[$ent] || substr($ent, 0, 1) == "." || substr($ent, -5) != ".phpt") {
+ if ((isset($skip[$ent]) && $skip[$ent]) || substr($ent, 0, 1) == "." ||
substr($ent, -5) != ".phpt") {
continue;
}
$testfiles[] = "$dir/$ent";
- $tests_in_dir[$dir]++;
+ if(isset($tests_in_dir[$dir])) $tests_in_dir[$dir]++; else $tests_in_dir[$dir]=1;
}
closedir($dp);
- if ($tests_in_dir[$dir] == 0) {
+ if (isset($tests_in_dir[$dir]) && ($tests_in_dir[$dir] == 0)) {
return true;
}
$oskipped = $skipped;
@@ -240,7 +241,7 @@
}
$total++;
}
- if ($oskipped + $tests_in_dir[$dir] == $skipped) {
+ if ($oskipped + (isset($tests_in_dir[$dir])?$tests_in_dir[$dir]:0) == $skipped) {
writeln("(all skipped)");
}
writeln("");
@@ -275,6 +276,7 @@
* @return bool whether the files were "equal"
*/
function compare_results($file1, $file2) {
+ $data1 = $data2 = "";
if (!($fp1 = @fopen($file1, "r")) || !($fp2 = @fopen($file2, "r"))) {
return false;
}
@@ -318,17 +320,17 @@
while ($line = fgets($fp, 4096)) {
if (preg_match('/^--([A-Z]+)--$/', $line, $matches)) {
$var = $matches[1];
- if ($tmpfile[$var]) {
+ if (isset($tmpfile[$var]) && $tmpfile[$var]) {
$fps[$var] = @fopen($tmpfile[$var], "w");
} else {
$$var = '';
}
} else {
- if ($var) {
+ if (isset($var) && $var) {
if ($var == "POST") {
$line = trim($line);
}
- if ($fps[$var]) {
+ if (isset($fps[$var]) && $fps[$var]) {
fwrite($fps[$var], $line);
} else {
$$var .= $line;
@@ -336,16 +338,18 @@
}
}
}
- reset($fps);
- while (list($k, $v) = each($fps)) {
- if (is_resource($v)) {
- fclose($v);
- }
+ if(isset($fps) && is_array($fps)) {
+ reset($fps);
+ while (list($k, $v) = each($fps)) {
+ if (is_resource($v)) {
+ fclose($v);
+ }
+ }
}
putenv("PHP_TEST=1");
putenv("REDIRECT_STATUS=1");
putenv("CONTENT_LENGTH=");
- putenv("QUERY_STRING=$GET");
+ putenv("QUERY_STRING=".(isset($GET)?$GET:""));
if (isset($fps["SKIPIF"])) {
$tmpfile["SKIPIF_OUTPUT"] = tempnam($tmpdir, $tmpfix);
putenv("REQUEST_METHOD=GET");
@@ -403,7 +407,7 @@
}
fclose($ofp);
pclose($cp);
- $desc = trim($TEST);
+ $desc = isset($test)?trim($TEST):"";
$outfile = preg_replace('/\.phpt$/', '.out', $file);
$expectfile = preg_replace('/\.phpt$/', '.exp', $file);
$phpfile = preg_replace('/\.phpt$/', '.php', $file);
Index: php4/tests/lang/022.phpt
diff -u php4/tests/lang/022.phpt:1.1 php4/tests/lang/022.phpt:1.2
--- php4/tests/lang/022.phpt:1.1 Sun Aug 27 12:46:05 2000
+++ php4/tests/lang/022.phpt Mon Oct 23 00:40:05 2000
@@ -11,10 +11,10 @@
case 0:
switch($j) {
case 0:
- echo zero;
+ echo "zero";
break;
case 1:
- echo one;
+ echo "one";
break;
default:
echo $j;
Index: php4/tests/lang/023-1.inc
diff -u php4/tests/lang/023-1.inc:1.1 php4/tests/lang/023-1.inc:1.2
--- php4/tests/lang/023-1.inc:1.1 Sun Aug 27 12:46:05 2000
+++ php4/tests/lang/023-1.inc Mon Oct 23 00:40:05 2000
@@ -226,7 +226,7 @@
while ($j<$arr_len) {
$k=0;
while ($k<$arr_len) {
- ${test.$i.$j}[$k] = $i+$j+$k;
+ ${"test$i$j"}[$k] = $i+$j+$k;
$k++;
}
$j++;
@@ -275,17 +275,17 @@
*** Hash resizing test ***<br>
<?php
$i = 10;
-$a = b;
+$a = 'b';
while ($i > 0) {
- $a = $a . a;
+ $a = $a . 'a';
echo "$a<br>\n";
$resize[$a] = $i;
$i--;
}
$i = 10;
-$a = b;
+$a = 'b';
while ($i > 0) {
- $a = $a . a;
+ $a = $a . 'a';
echo "$a<br>\n";
echo $resize[$a]."<br>\n";
$i--;
Index: php4/tests/lang/024.phpt
diff -u php4/tests/lang/024.phpt:1.2 php4/tests/lang/024.phpt:1.3
--- php4/tests/lang/024.phpt:1.2 Thu Aug 31 15:21:47 2000
+++ php4/tests/lang/024.phpt Mon Oct 23 00:40:05 2000
@@ -245,7 +245,7 @@
while ($j<$arr_len) {
$k=0;
while ($k<$arr_len) {
- ${test.$i.$j}[$k] = $i+$j+$k;
+ ${"test$i$j"}[$k] = $i+$j+$k;
$k++;
}
$j++;
@@ -294,17 +294,17 @@
*** Hash resizing test ***
<?php
$i = 10;
-$a = b;
+$a = "b";
while ($i > 0) {
- $a = $a . a;
+ $a = $a . "a";
echo "$a\n";
$resize[$a] = $i;
$i--;
}
$i = 10;
-$a = b;
+$a = "b";
while ($i > 0) {
- $a = $a . a;
+ $a = $a . "a";
echo "$a\n";
echo $resize[$a]."\n";
$i--;
Index: php4/ext/db/tests/001.phpt
diff -u php4/ext/db/tests/001.phpt:1.1 php4/ext/db/tests/001.phpt:1.2
--- php4/ext/db/tests/001.phpt:1.1 Sun Aug 27 12:45:58 2000
+++ php4/ext/db/tests/001.phpt Mon Oct 23 00:40:05 2000
@@ -1,5 +1,7 @@
--TEST--
DBM File Creation Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
--POST--
--GET--
--FILE--
Index: php4/ext/db/tests/002.phpt
diff -u php4/ext/db/tests/002.phpt:1.1 php4/ext/db/tests/002.phpt:1.2
--- php4/ext/db/tests/002.phpt:1.1 Sun Aug 27 12:45:58 2000
+++ php4/ext/db/tests/002.phpt Mon Oct 23 00:40:05 2000
@@ -1,5 +1,7 @@
--TEST--
DBM Insert/Fetch Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
--POST--
--GET--
--FILE--
Index: php4/ext/db/tests/003.phpt
diff -u php4/ext/db/tests/003.phpt:1.1 php4/ext/db/tests/003.phpt:1.2
--- php4/ext/db/tests/003.phpt:1.1 Sun Aug 27 12:45:58 2000
+++ php4/ext/db/tests/003.phpt Mon Oct 23 00:40:05 2000
@@ -1,5 +1,7 @@
--TEST--
DBM Insert/Replace/Fetch Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
--POST--
--GET--
--FILE--
Index: php4/ext/db/tests/004.phpt
diff -u php4/ext/db/tests/004.phpt:1.1 php4/ext/db/tests/004.phpt:1.2
--- php4/ext/db/tests/004.phpt:1.1 Sun Aug 27 12:45:58 2000
+++ php4/ext/db/tests/004.phpt Mon Oct 23 00:40:05 2000
@@ -1,5 +1,7 @@
--TEST--
DBM Multiple Insert/Fetch Test
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
--POST--
--GET--
--FILE--
Index: php4/ext/db/tests/005.phpt
diff -u php4/ext/db/tests/005.phpt:1.1 php4/ext/db/tests/005.phpt:1.2
--- php4/ext/db/tests/005.phpt:1.1 Sun Aug 27 12:45:58 2000
+++ php4/ext/db/tests/005.phpt Mon Oct 23 00:40:05 2000
@@ -1,5 +1,7 @@
--TEST--
DBM FirstKey/NextKey Loop Test With 5 Items
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
--POST--
--GET--
--FILE--
Index: php4/ext/db/tests/006.phpt
diff -u php4/ext/db/tests/006.phpt:1.1 php4/ext/db/tests/006.phpt:1.2
--- php4/ext/db/tests/006.phpt:1.1 Sun Aug 27 12:45:58 2000
+++ php4/ext/db/tests/006.phpt Mon Oct 23 00:40:05 2000
@@ -1,5 +1,7 @@
--TEST--
DBM FirstKey/NextKey with 2 deletes
+--SKIPIF--
+<?php if (!extension_loaded("db")) print "skip"; ?>
--POST--
--GET--
--FILE--