]> granicus.if.org Git - php/commitdiff
Improve dba tests: check in both modes external and database locking.
authorMarcus Boerger <helly@php.net>
Thu, 18 Dec 2003 20:10:24 +0000 (20:10 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 18 Dec 2003 20:10:24 +0000 (20:10 +0000)
ext/dba/tests/dba_cdb.phpt
ext/dba/tests/dba_db2.phpt
ext/dba/tests/dba_db3.phpt
ext/dba/tests/dba_db4.phpt
ext/dba/tests/dba_dbm.phpt
ext/dba/tests/dba_flatfile.phpt
ext/dba/tests/dba_gdbm.phpt
ext/dba/tests/dba_handler.inc
ext/dba/tests/dba_inifile.phpt
ext/dba/tests/dba_ndbm.phpt

index af64dae5a64ca8a56eb8a4762f0f2826f6eac151..f3bf7975ea06c0989386da5c53b9f6e8e5202ba2 100644 (file)
@@ -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===
index 2e93b785d390f3f53f5d5270719ac092a7e78676..bcc5a9479306c89452d1216e5901e14165736a23 100644 (file)
@@ -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===
index aa389d5f267e99b014cc834f16410bc6ac1efa87..c6d04cf02d084395664f4bd094efe384484315e3 100644 (file)
@@ -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===
index fc5b3171f8f221bd5083ebbb4638e9705c176f93..fcf089a1e90b017113f6ed991302c630027eb571 100644 (file)
@@ -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===
index e751cf60cf3254f899f13aab280521e1ea5afafa..fdd7b375f445737c27a9197303fcce4805ad034c 100644 (file)
@@ -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===
index 8e259cb965a89f2aca4b53aa8331f2824ca4aaf3..2e32b8a3278152d5907fc71517a0e0f2568e7ce0 100644 (file)
@@ -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===
index b5d3c19ccd6bae491b6fd6497e5905efb4bff09b..f9b3e3c6067add06475f1ff08ed237bdf496fb89 100644 (file)
@@ -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===
index 674fd9f46328ee7a62b9b4537f69b92854b0a6fe..9a25316f27a29873940728b67069a1b0fcd8574f 100644 (file)
@@ -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);
                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
index 11ca19e3b659a58db1a628439a8215f6a65bd80c..9511a8bb49b5f8f1a524e1919db6da72ba271e12 100644 (file)
@@ -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===
index 537f025564aa31350aff96b5588da65fe2a7a1fc..f7955c5813ecd5882b3c864fa5f80234f3304428 100644 (file)
@@ -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===