CVS update: php3/tests
| From: | sas | Date: | Tue, 08 Jun 1999 14:33:27 +0000 |
| Subject: | CVS update: php3/tests | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-6716@lists.php.net to get a copy of this message | ||
Date: Tuesday June 8, 1999 @ 10:33
Author: sas
Update of /repository/php3/tests
In directory php:/tmp/cvs-serv23174
Modified Files:
dba.php dbase.phtml sock_io.php3
Log Message:
some updates
Index: php3/tests/dba.php
diff -u php3/tests/dba.php:1.2 php3/tests/dba.php:1.3
--- php3/tests/dba.php:1.2 Tue May 18 09:33:16 1999
+++ php3/tests/dba.php Tue Jun 8 10:33:27 1999
@@ -2,14 +2,18 @@
error_reporting(15);
-function dba_test($handler) {
+function dba_test($handler, $readonly = false) {
echo "testing with $handler\n";
$count = 100;
- $h = dba_open("test.$handler", "n", $handler, 0600);
+ if($readonly)
+ $h = dba_open("test.$handler", "r", $handler, 0600);
+ else
+ $h = dba_open("test.$handler", "n", $handler, 0600);
if(!$h)
die("cannot open db\n");
-
+
+ if(!$readonly) {
echo "replacing\n";
for($i = 0; $i < $count; $i++)
if(!dba_replace($i, "test$i.val", $h))
@@ -18,6 +22,7 @@
echo "optimizing\n";
if(!dba_optimize($h))
die( "dba_optimize failed\n");
+ }
echo "fetching\n";
for($i = 0; $i < $count; $i++)
@@ -38,14 +43,17 @@
die("dba_exists failed for $i\n");
+ if(!$readonly) {
echo "deleting\n";
for($i = 0; $i < $count; $i++)
if(!dba_delete($i, $h))
die ("dba_delete failed for $i\n");
+ }
dba_close($h);
echo "passed\n\n";
}
+dba_test("cdb", true);
# cdb only supports reading and is not tested as such
$dbs = array("dbm", "gdbm", "ndbm", "db2");
Index: php3/tests/dbase.phtml
diff -u php3/tests/dbase.phtml:1.2 php3/tests/dbase.phtml:1.3
--- php3/tests/dbase.phtml:1.2 Sat Jun 27 21:15:59 1998
+++ php3/tests/dbase.phtml Tue Jun 8 10:33:27 1999
@@ -14,11 +14,11 @@
$id = dbase_create($fn, &$db_struct);
echo "dbase has " . dbase_numfields($id) . " fields\n";
- dbase_add_record($id, ({"test", 10, 200.02, 1, "19970404"}));
- dbase_add_record($id, ({"test", 10, 200.02, 1, "19970404"}));
- dbase_add_record($id, ({"test", 10, 200.02, 1, "19970404"}));
- dbase_add_record($id, ({"test", 10, 200.02, 1, "19970404"}));
- dbase_add_record($id, ({"test", 10, 200.02, 1, "19970404"}));
+ dbase_add_record($id, array("test", 10, 200.02, 1, "19970404"));
+ dbase_add_record($id, array("test", 10, 200.02, 1, "19970404"));
+ dbase_add_record($id, array("test", 10, 200.02, 1, "19970404"));
+ dbase_add_record($id, array("test", 10, 200.02, 1, "19970404"));
+ dbase_add_record($id, array("test", 10, 200.02, 1, "19970404"));
echo "done adding records\n";
Index: php3/tests/sock_io.php3
diff -u php3/tests/sock_io.php3:1.2 php3/tests/sock_io.php3:1.3
--- php3/tests/sock_io.php3:1.2 Thu May 27 09:53:23 1999
+++ php3/tests/sock_io.php3 Tue Jun 8 10:33:27 1999
@@ -5,23 +5,27 @@
# fetches one file and prints out how many bytes it has retrieve
-$host = "guerilla";
-$port = 8080;
-$req = "GET /abc2 HTTP/1.0\r\n\r\n";
+$host = "sockratte.schell.de";
+$port = 8081;
+$req = "GET /test.php3 HTTP/1.0\r\n\r\n";
+
function get_request() {
global $host, $port, $allbuf, $req, $block;
$allbuf = "";
- $fp = fsockopen($host, $port, &$a, &$b, 5);
- if(!$fp) die("fsck\n");
- set_socket_blocking($fp, $block);
+ if($block > 2)
+ $fp = pfsockopen($host, $port, &$a, &$b, 30);
+ else
+ $fp = fsockopen($host, $port, &$a, &$b, 30);
+ if(!$fp) die("connection timed out\n");
+ set_socket_blocking($fp, $block % 2);
fputs($fp, $req);
return $fp;
}
-for($block = 0; $block < 2; $block++) {
+for($block = 0; $block < 4; $block++) {
#
# this does not work in non-blocking mode
@@ -29,6 +33,7 @@
# (expect a too low value, if the server is slower than loopback)
$fp = get_request();
+sleep(1);
while(($buf = fgets($fp, 256)) != false) $allbuf .= $buf;
echo strlen($allbuf)."\n";