mirror of
https://github.com/php/php-src.git
synced 2026-03-26 01:02:25 +01:00
Improve dba tests: check in both modes external and database locking.
This commit is contained in:
@@ -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===
|
||||
|
||||
@@ -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-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===
|
||||
|
||||
@@ -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-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===
|
||||
|
||||
@@ -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===
|
||||
|
||||
@@ -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===
|
||||
|
||||
@@ -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-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===
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
===DONE===
|
||||
|
||||
@@ -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);
|
||||
|
||||
?>
|
||||
@@ -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-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===
|
||||
|
||||
@@ -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-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===
|
||||
|
||||
Reference in New Issue
Block a user