summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-12-18 20:10:24 +0000
committerMarcus Boerger <helly@php.net>2003-12-18 20:10:24 +0000
commita6dd097484bf5ced360ddfb81306fe477286fab9 (patch)
tree262558cc5829d76368b87e2e41f9a3fc0caf1ee3
parent49efcd4f276262d4a99c1deafc1375ec35c7b29b (diff)
downloadphp-git-a6dd097484bf5ced360ddfb81306fe477286fab9.tar.gz
Improve dba tests: check in both modes external and database locking.
-rw-r--r--ext/dba/tests/dba_cdb.phpt17
-rw-r--r--ext/dba/tests/dba_db2.phpt19
-rw-r--r--ext/dba/tests/dba_db3.phpt19
-rw-r--r--ext/dba/tests/dba_db4.phpt17
-rw-r--r--ext/dba/tests/dba_dbm.phpt17
-rw-r--r--ext/dba/tests/dba_flatfile.phpt19
-rw-r--r--ext/dba/tests/dba_gdbm.phpt4
-rw-r--r--ext/dba/tests/dba_handler.inc16
-rw-r--r--ext/dba/tests/dba_inifile.phpt19
-rw-r--r--ext/dba/tests/dba_ndbm.phpt19
10 files changed, 158 insertions, 8 deletions
diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt
index af64dae5a6..f3bf7975ea 100644
--- a/ext/dba/tests/dba_cdb.phpt
+++ b/ext/dba/tests/dba_cdb.phpt
@@ -12,6 +12,7 @@ DBA CDB handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: cdb
5YYYYY
@@ -28,3 +29,19 @@ array(5) {
["key5"]=>
string(23) "The last content string"
}
+--NO-LOCK--
+5YYYYY
+Content String 2
+array(5) {
+ ["key1"]=>
+ string(16) "Content String 1"
+ ["key2"]=>
+ string(16) "Content String 2"
+ ["key3"]=>
+ string(20) "Third Content String"
+ ["key4"]=>
+ string(22) "Another Content String"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt
index 2e93b785d3..bcc5a94793 100644
--- a/ext/dba/tests/dba_db2.phpt
+++ b/ext/dba/tests/dba_db2.phpt
@@ -11,6 +11,7 @@ DBA DB2 handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: db2
3NYNYY
@@ -26,4 +27,20 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt
index aa389d5f26..c6d04cf02d 100644
--- a/ext/dba/tests/dba_db3.phpt
+++ b/ext/dba/tests/dba_db3.phpt
@@ -11,6 +11,7 @@ DBA DB3 handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: db3
3NYNYY
@@ -26,4 +27,20 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_db4.phpt b/ext/dba/tests/dba_db4.phpt
index fc5b3171f8..fcf089a1e9 100644
--- a/ext/dba/tests/dba_db4.phpt
+++ b/ext/dba/tests/dba_db4.phpt
@@ -11,6 +11,7 @@ DBA DB4 handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: db4
3NYNYY
@@ -27,3 +28,19 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt
index e751cf60cf..fdd7b375f4 100644
--- a/ext/dba/tests/dba_dbm.phpt
+++ b/ext/dba/tests/dba_dbm.phpt
@@ -11,6 +11,7 @@ DBA DBM handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: dbm
3NYNYY
@@ -27,3 +28,19 @@ array(3) {
["key5"]=>
string(23) "The last content string"
}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt
index 8e259cb965..2e32b8a327 100644
--- a/ext/dba/tests/dba_flatfile.phpt
+++ b/ext/dba/tests/dba_flatfile.phpt
@@ -11,6 +11,7 @@ DBA FlatFile handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: flatfile
3NYNYY
@@ -26,4 +27,20 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt
index b5d3c19ccd..f9b3e3c606 100644
--- a/ext/dba/tests/dba_gdbm.phpt
+++ b/ext/dba/tests/dba_gdbm.phpt
@@ -14,6 +14,7 @@ DBA GDBM handler test
// Read during write is system dependant. Important is that there is no deadlock
?>
+===DONE===
--EXPECTF--
database handler: gdbm
3NYNYY
@@ -29,4 +30,5 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
+===DONE===
diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc
index 674fd9f463..9a25316f27 100644
--- a/ext/dba/tests/dba_handler.inc
+++ b/ext/dba/tests/dba_handler.inc
@@ -1,5 +1,8 @@
<?php
- echo "database handler: $handler\n";
+
+echo "database handler: $handler\n";
+
+do {
if (($db_file = dba_open($db_filename, 'n'.$lock_flag, $handler))!==FALSE) {
dba_insert("key1", "Content String 1", $db_file);
dba_insert("key2", "Content String 2", $db_file);
@@ -71,5 +74,14 @@
dba_close($dba_reader);
}
if (($db_file = dba_popen($db_filename, 'r'.($handler!='gdbm'?'-':''), $handler))!==FALSE) {
- }
+ }
+
+ if ($lock_flag == '') {
+ break;
+ } else {
+ echo "--NO-LOCK--\n";
+ $lock_flag = '';
+ }
+} while(1);
+
?> \ No newline at end of file
diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt
index 11ca19e3b6..9511a8bb49 100644
--- a/ext/dba/tests/dba_inifile.phpt
+++ b/ext/dba/tests/dba_inifile.phpt
@@ -11,6 +11,7 @@ DBA INIFILE handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: inifile
3NYNYY
@@ -26,4 +27,20 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===
diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt
index 537f025564..f7955c5813 100644
--- a/ext/dba/tests/dba_ndbm.phpt
+++ b/ext/dba/tests/dba_ndbm.phpt
@@ -11,6 +11,7 @@ DBA NDBM handler test
require_once('test.inc');
require_once('dba_handler.inc');
?>
+===DONE===
--EXPECT--
database handler: ndbm
3NYNYY
@@ -26,4 +27,20 @@ array(3) {
string(27) "Content 2 replaced 2nd time"
["key5"]=>
string(23) "The last content string"
-} \ No newline at end of file
+}
+--NO-LOCK--
+3NYNYY
+Content String 2
+Content 2 replaced
+Read during write: not allowed
+Content 2 replaced 2nd time
+The 6th value
+array(3) {
+ ["key number 6"]=>
+ string(13) "The 6th value"
+ ["key2"]=>
+ string(27) "Content 2 replaced 2nd time"
+ ["key5"]=>
+ string(23) "The last content string"
+}
+===DONE===