From 3ec5ba93d38ea3c0ce8a8696a3f6a5a3292bfa10 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 30 Jun 2022 17:49:00 +0100 Subject: [PATCH 01/12] Rework DBA tests Improve testing, remove redundant ones Preliminary support for parallel runs --- ext/dba/tests/bug36436.phpt | 26 ++- ext/dba/tests/bug48240.phpt | 28 --- ext/dba/tests/bug49125.phpt | 32 --- ext/dba/tests/bug62490.phpt | 43 ---- ext/dba/tests/bug65708.phpt | 15 +- ext/dba/tests/bug72885.phpt | 28 --- ext/dba/tests/bug78808.phpt | 15 +- ext/dba/tests/dba001.phpt | 27 --- ext/dba/tests/dba002.phpt | 28 --- ext/dba/tests/dba003.phpt | 30 --- ext/dba/tests/dba004.phpt | 34 ---- ext/dba/tests/dba005.phpt | 41 ---- ext/dba/tests/dba006.phpt | 43 ---- ext/dba/tests/dba010.phpt | 46 ----- ext/dba/tests/dba013.phpt | 33 ---- ext/dba/tests/dba014.phpt | 33 ---- ext/dba/tests/dba_array_keys.phpt | 34 ++-- ext/dba/tests/dba_array_keys_errors.phpt | 54 +++++ ...dba_array_keys_not_string_convertable.phpt | 41 ---- .../tests/dba_array_keys_var_non_string.phpt | 22 +-- ext/dba/tests/dba_cdb.phpt | 48 +++-- ext/dba/tests/dba_cdb_make.phpt | 13 +- ext/dba/tests/dba_cdb_read.phpt | 6 +- ext/dba/tests/dba_db1.phpt | 81 ++++++-- ext/dba/tests/dba_db2.phpt | 81 ++++++-- ext/dba/tests/dba_db3.phpt | 81 ++++++-- ext/dba/tests/dba_db4_000.phpt | 99 ++++++++-- ext/dba/tests/dba_dbm.phpt | 56 +++--- ext/dba/tests/dba_fetch_legacy_signature.phpt | 22 +-- ext/dba/tests/dba_flatfile.phpt | 101 ++++++++-- ext/dba/tests/dba_gdbm.phpt | 67 +++++-- ext/dba/tests/dba_handler.inc | 98 --------- ext/dba/tests/dba_inifile.phpt | 114 +++++++++-- ext/dba/tests/dba_lmdb.phpt | 65 ++++-- ext/dba/tests/dba_ndbm.phpt | 79 +++++--- ext/dba/tests/dba_qdbm.phpt | 65 ++++-- ext/dba/tests/dba_split.phpt | 5 - ext/dba/tests/dba_tcadb.phpt | 106 +++++++--- .../{dba012.phpt => default_handler_ini.phpt} | 14 +- ext/dba/tests/setup/setup_dba_tests.inc | 186 ++++++++++++++++++ .../{dba011.phpt => value_errors_open.phpt} | 4 +- 41 files changed, 1106 insertions(+), 938 deletions(-) delete mode 100644 ext/dba/tests/bug48240.phpt delete mode 100644 ext/dba/tests/bug49125.phpt delete mode 100644 ext/dba/tests/bug62490.phpt delete mode 100644 ext/dba/tests/bug72885.phpt delete mode 100644 ext/dba/tests/dba001.phpt delete mode 100644 ext/dba/tests/dba002.phpt delete mode 100644 ext/dba/tests/dba003.phpt delete mode 100644 ext/dba/tests/dba004.phpt delete mode 100644 ext/dba/tests/dba005.phpt delete mode 100644 ext/dba/tests/dba006.phpt delete mode 100644 ext/dba/tests/dba010.phpt delete mode 100644 ext/dba/tests/dba013.phpt delete mode 100644 ext/dba/tests/dba014.phpt create mode 100644 ext/dba/tests/dba_array_keys_errors.phpt delete mode 100644 ext/dba/tests/dba_array_keys_not_string_convertable.phpt delete mode 100644 ext/dba/tests/dba_handler.inc rename ext/dba/tests/{dba012.phpt => default_handler_ini.phpt} (57%) create mode 100644 ext/dba/tests/setup/setup_dba_tests.inc rename ext/dba/tests/{dba011.phpt => value_errors_open.phpt} (95%) diff --git a/ext/dba/tests/bug36436.phpt b/ext/dba/tests/bug36436.phpt index d101c44272e4e..386a71cb5c5b9 100644 --- a/ext/dba/tests/bug36436.phpt +++ b/ext/dba/tests/bug36436.phpt @@ -4,21 +4,17 @@ Bug #36436 (DBA problem with Berkeley DB4) dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECTF-- resource(%d) of type (dba persistent) -string(3) "XYZ" -string(1) "X" -string(1) "Y" +string(16) "Content String 1" +string(13) "[key10]name10" +string(13) "[key30]name30" diff --git a/ext/dba/tests/bug48240.phpt b/ext/dba/tests/bug48240.phpt deleted file mode 100644 index 1c8a9b3c42f5a..0000000000000 --- a/ext/dba/tests/bug48240.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #48240 (DBA Segmentation fault dba_nextkey) ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -bool(false) diff --git a/ext/dba/tests/bug49125.phpt b/ext/dba/tests/bug49125.phpt deleted file mode 100644 index 3228da5b5d083..0000000000000 --- a/ext/dba/tests/bug49125.phpt +++ /dev/null @@ -1,32 +0,0 @@ ---TEST-- -Bug #49125 (Error in dba_exists C code) ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -bool(true) diff --git a/ext/dba/tests/bug62490.phpt b/ext/dba/tests/bug62490.phpt deleted file mode 100644 index 6646b27f97d2d..0000000000000 --- a/ext/dba/tests/bug62490.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -Bug #62490 (dba_delete returns true on missing item (inifile)) ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -insert 0:bool(true) -insert 1:bool(true) -insert 2:bool(true) -exists:bool(true) -delete:bool(true) -exists:bool(false) -delete:bool(false) diff --git a/ext/dba/tests/bug65708.phpt b/ext/dba/tests/bug65708.phpt index b821d2b8ad879..365e4f308fb10 100644 --- a/ext/dba/tests/bug65708.phpt +++ b/ext/dba/tests/bug65708.phpt @@ -4,16 +4,15 @@ Bug #65708 (dba functions cast $key param to string in-place, bypassing copy on dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- integer diff --git a/ext/dba/tests/bug72885.phpt b/ext/dba/tests/bug72885.phpt deleted file mode 100644 index 9cfb244be864e..0000000000000 --- a/ext/dba/tests/bug72885.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #72885 flatfile: dba_fetch() fails to read replaced entry ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -bool(true) -string(3) "baz" diff --git a/ext/dba/tests/bug78808.phpt b/ext/dba/tests/bug78808.phpt index 329e0db542702..be25a85d3f582 100644 --- a/ext/dba/tests/bug78808.phpt +++ b/ext/dba/tests/bug78808.phpt @@ -4,15 +4,16 @@ Bug #78808 ([LMDB] MDB_MAP_FULL: Environment mapsize limit reached) dba --SKIPIF-- --FILE-- diff --git a/ext/dba/tests/dba001.phpt b/ext/dba/tests/dba001.phpt deleted file mode 100644 index f0adebe0c0603..0000000000000 --- a/ext/dba/tests/dba001.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -DBA File Creation Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -database file created diff --git a/ext/dba/tests/dba002.phpt b/ext/dba/tests/dba002.phpt deleted file mode 100644 index 771dea122f082..0000000000000 --- a/ext/dba/tests/dba002.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -DBA Insert/Fetch Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -This is a test insert diff --git a/ext/dba/tests/dba003.phpt b/ext/dba/tests/dba003.phpt deleted file mode 100644 index 2f15eca226029..0000000000000 --- a/ext/dba/tests/dba003.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -DBA Insert/Replace/Fetch Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -This is the replacement text diff --git a/ext/dba/tests/dba004.phpt b/ext/dba/tests/dba004.phpt deleted file mode 100644 index 3e7247ae65ab9..0000000000000 --- a/ext/dba/tests/dba004.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -DBA Multiple Insert/Fetch Test ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -Another Content String Content String 2 diff --git a/ext/dba/tests/dba005.phpt b/ext/dba/tests/dba005.phpt deleted file mode 100644 index 9871901c2da43..0000000000000 --- a/ext/dba/tests/dba005.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA FirstKey/NextKey Loop Test With 5 Items ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -5YYYYY diff --git a/ext/dba/tests/dba006.phpt b/ext/dba/tests/dba006.phpt deleted file mode 100644 index 2e70c984aec92..0000000000000 --- a/ext/dba/tests/dba006.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -DBA FirstKey/NextKey with 2 deletes ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -3NYNYY diff --git a/ext/dba/tests/dba010.phpt b/ext/dba/tests/dba010.phpt deleted file mode 100644 index e61f310d4f9ef..0000000000000 --- a/ext/dba/tests/dba010.phpt +++ /dev/null @@ -1,46 +0,0 @@ ---TEST-- -DBA with array keys ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s -6YYYYYY diff --git a/ext/dba/tests/dba013.phpt b/ext/dba/tests/dba013.phpt deleted file mode 100644 index 0d41341b040db..0000000000000 --- a/ext/dba/tests/dba013.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -DBA with array key with empty array ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s - -Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" in %s.php:%d -Stack trace: -#0 %sdba013.php(6): dba_insert(Array, '%s', Resource id #%d) -#1 {main} - thrown in %sdba013.php on line 6 diff --git a/ext/dba/tests/dba014.phpt b/ext/dba/tests/dba014.phpt deleted file mode 100644 index 1ed6d061118fb..0000000000000 --- a/ext/dba/tests/dba014.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -DBA with array key with array containing too many elements ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: %s - -Fatal error: Uncaught Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" in %s.php:%d -Stack trace: -#0 %sdba014.php(6): dba_insert(Array, '%s', Resource id #%d) -#1 {main} - thrown in %sdba014.php on line 6 diff --git a/ext/dba/tests/dba_array_keys.phpt b/ext/dba/tests/dba_array_keys.phpt index 7f2654186e209..6b8a36c9e7c85 100644 --- a/ext/dba/tests/dba_array_keys.phpt +++ b/ext/dba/tests/dba_array_keys.phpt @@ -4,32 +4,32 @@ DBA check behaviour of array keys dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- bool(true) diff --git a/ext/dba/tests/dba_array_keys_errors.phpt b/ext/dba/tests/dba_array_keys_errors.phpt new file mode 100644 index 0000000000000..db0e470bbd24b --- /dev/null +++ b/ext/dba/tests/dba_array_keys_errors.phpt @@ -0,0 +1,54 @@ +--TEST-- +DBA with invalid array key +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- +getMessage(), \PHP_EOL; +} +try { + dba_insert(["a", "b", "c"], "Content String 2", $db); +} catch (\Error $e) { + echo $e::class, ': ', $e->getMessage(), \PHP_EOL; +} + +/* Use an object */ +$o = new stdClass(); +try { + var_dump(dba_insert([$o, 'obj'], 'Test', $db)); +} catch (\Error $e) { + echo $e::class, ': ', $e->getMessage(), \PHP_EOL; +} +try { + var_dump(dba_insert(['group', $o], 'Test', $db)); +} catch (\Error $e) { + echo $e::class, ': ', $e->getMessage(), \PHP_EOL; +} + +dba_close($db); + +?> +--CLEAN-- + +--EXPECT-- +Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" +Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" +Error: Object of class stdClass could not be converted to string +Error: Object of class stdClass could not be converted to string diff --git a/ext/dba/tests/dba_array_keys_not_string_convertable.phpt b/ext/dba/tests/dba_array_keys_not_string_convertable.phpt deleted file mode 100644 index e89eed33d1d9c..0000000000000 --- a/ext/dba/tests/dba_array_keys_not_string_convertable.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA check behaviour of key as an array with elements not convertable to string ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- -getMessage(), \PHP_EOL; -} -try { - var_dump(dba_insert(['group', $o], 'Test', $db_file)); -} catch (\Error $e) { - echo $e::class, ': ', $e->getMessage(), \PHP_EOL; -} - -dba_close($db_file); - -?> ---CLEAN-- - ---EXPECT-- -Error: Object of class stdClass could not be converted to string -Error: Object of class stdClass could not be converted to string diff --git a/ext/dba/tests/dba_array_keys_var_non_string.phpt b/ext/dba/tests/dba_array_keys_var_non_string.phpt index f6a92cc74f6cb..a746ed827b91a 100644 --- a/ext/dba/tests/dba_array_keys_var_non_string.phpt +++ b/ext/dba/tests/dba_array_keys_var_non_string.phpt @@ -4,32 +4,32 @@ DBA check behaviour of key as an array with non string elements dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- array(2) { diff --git a/ext/dba/tests/dba_cdb.phpt b/ext/dba/tests/dba_cdb.phpt index 0cdbea3f91662..6b0c7c6649f08 100644 --- a/ext/dba/tests/dba_cdb.phpt +++ b/ext/dba/tests/dba_cdb.phpt @@ -4,25 +4,34 @@ DBA CDB handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: cdb -5YYYYY -Content String 2 -array(5) { +Key 1 exists? Y +Key 2 exists? Y +Key 3 exists? Y +Key 4 exists? Y +Key 5 exists? Y +array(8) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key1"]=> string(16) "Content String 1" ["key2"]=> @@ -33,11 +42,20 @@ array(5) { string(22) "Another Content String" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } --NO-LOCK-- -5YYYYY -Content String 2 -array(5) { +Key 1 exists? Y +Key 2 exists? Y +Key 3 exists? Y +Key 4 exists? Y +Key 5 exists? Y +array(8) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key1"]=> string(16) "Content String 1" ["key2"]=> @@ -48,4 +66,6 @@ array(5) { string(22) "Another Content String" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_cdb_make.phpt b/ext/dba/tests/dba_cdb_make.phpt index 8063d079455e9..447daf309a5a8 100644 --- a/ext/dba/tests/dba_cdb_make.phpt +++ b/ext/dba/tests/dba_cdb_make.phpt @@ -4,14 +4,15 @@ DBA CDB_MAKE handler test dba --SKIPIF-- +--CONFLICTS-- +test.cdb --FILE-- --CLEAN-- --EXPECT-- database handler: cdb_make diff --git a/ext/dba/tests/dba_cdb_read.phpt b/ext/dba/tests/dba_cdb_read.phpt index 40a7dc9187206..9d67e17072103 100644 --- a/ext/dba/tests/dba_cdb_read.phpt +++ b/ext/dba/tests/dba_cdb_read.phpt @@ -4,9 +4,11 @@ DBA CDB handler test (read only) dba --SKIPIF-- +--CONFLICTS-- +test.cdb --FILE-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: db1 -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" @@ -32,14 +59,32 @@ array(3) { string(23) "The last content string" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt index 792c745aa2e8b..2504e075fec0d 100644 --- a/ext/dba/tests/dba_db2.phpt +++ b/ext/dba/tests/dba_db2.phpt @@ -4,25 +4,52 @@ DBA DB2 handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: db2 -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" @@ -32,14 +59,32 @@ array(3) { string(23) "The last content string" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt index 4f3e54723e6ff..6fad23523b2e4 100644 --- a/ext/dba/tests/dba_db3.phpt +++ b/ext/dba/tests/dba_db3.phpt @@ -4,25 +4,52 @@ DBA DB3 handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: db3 -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" @@ -32,14 +59,32 @@ array(3) { string(23) "The last content string" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" diff --git a/ext/dba/tests/dba_db4_000.phpt b/ext/dba/tests/dba_db4_000.phpt index 872a0fca718f1..19079bbfa716b 100644 --- a/ext/dba/tests/dba_db4_000.phpt +++ b/ext/dba/tests/dba_db4_000.phpt @@ -4,51 +4,110 @@ DBA DB4 handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: db4 -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_dbm.phpt b/ext/dba/tests/dba_dbm.phpt index 17e3d7a9ffa93..38403593430f1 100644 --- a/ext/dba/tests/dba_dbm.phpt +++ b/ext/dba/tests/dba_dbm.phpt @@ -4,46 +4,42 @@ DBA DBM handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: dbm -3NYNYY -Content String 2 +key4: Another Content String +key2: Content String 2 +key5: The last content string +Total keys: 3 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -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" -} ---NO-LOCK-- -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Delete "key4" +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value array(3) { ["key number 6"]=> string(13) "The 6th value" diff --git a/ext/dba/tests/dba_fetch_legacy_signature.phpt b/ext/dba/tests/dba_fetch_legacy_signature.phpt index 847c191612c73..65edab28e1842 100644 --- a/ext/dba/tests/dba_fetch_legacy_signature.phpt +++ b/ext/dba/tests/dba_fetch_legacy_signature.phpt @@ -4,26 +4,26 @@ dba_fetch() legacy signature dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- This is a test insert diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt index 955df6d1bf678..d4d6d63bd5af5 100644 --- a/ext/dba/tests/dba_flatfile.phpt +++ b/ext/dba/tests/dba_flatfile.phpt @@ -4,51 +4,110 @@ DBA FlatFile handler test dba --SKIPIF-- --FILE-- --CLEAN-- --EXPECT-- -database handler: flatfile -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index 4752b4bbc43cc..87ff628b03de4 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -4,33 +4,66 @@ DBA GDBM handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + ---EXPECTF-- -database handler: gdbm -3NYNYY -Content String 2 +--EXPECT-- +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_handler.inc b/ext/dba/tests/dba_handler.inc deleted file mode 100644 index 9b9d030c39b9f..0000000000000 --- a/ext/dba/tests/dba_handler.inc +++ /dev/null @@ -1,98 +0,0 @@ - diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt index c85732a02ea0d..91a62a44b7aac 100644 --- a/ext/dba/tests/dba_inifile.phpt +++ b/ext/dba/tests/dba_inifile.phpt @@ -4,51 +4,123 @@ DBA INIFILE handler test dba --SKIPIF-- --FILE-- --CLEAN-- +--WHITESPACE_SENSITIVE-- --EXPECT-- -database handler: inifile -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]: +[key10]name10: Content String 10 +[key30]: +[key30]name30: Content String 30 +Total keys: 8 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -"key number 6" written 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Unexpected: Wrote data to already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(8) { + ["[key10]"]=> + string(0) "" + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]"]=> + string(0) "" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]: +[key10]name10: Content String 10 +[key30]: +[key30]name30: Content String 30 +Total keys: 8 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -"key number 6" written 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Unexpected: Wrote data to already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(8) { + ["[key10]"]=> + string(0) "" + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]"]=> + string(0) "" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt index d119d2d59b0da..93757b0d387c0 100644 --- a/ext/dba/tests/dba_lmdb.phpt +++ b/ext/dba/tests/dba_lmdb.phpt @@ -4,35 +4,66 @@ DBA LMDB handler test dba --SKIPIF-- --FILE-- --CLEAN-- ---EXPECTF-- -database handler: lmdb -3NYNYY -Content String 2 +--EXPECT-- +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +TODO Fix über slow LMDB on deletion of non existent key +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt index ec3df0dcd26f1..96b8f0e603303 100644 --- a/ext/dba/tests/dba_ndbm.phpt +++ b/ext/dba/tests/dba_ndbm.phpt @@ -4,47 +4,66 @@ DBA NDBM handler test dba --SKIPIF-- --FILE-- +--CLEAN-- + --EXPECT-- -database handler: ndbm -3NYNYY -Content String 2 -Content 2 replaced -Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -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" -} ---NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_qdbm.phpt b/ext/dba/tests/dba_qdbm.phpt index 300ca514bdacc..5403673e44074 100644 --- a/ext/dba/tests/dba_qdbm.phpt +++ b/ext/dba/tests/dba_qdbm.phpt @@ -4,35 +4,66 @@ DBA QDBM handler test dba --SKIPIF-- --FILE-- --CLEAN-- ---EXPECTF-- -database handler: qdbm -3NYNYY -Content String 2 +--EXPECT-- +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt index 1f9f3125105bd..70cbe14caee59 100644 --- a/ext/dba/tests/dba_split.phpt +++ b/ext/dba/tests/dba_split.phpt @@ -2,11 +2,6 @@ DBA Split Test --EXTENSIONS-- dba ---SKIPIF-- - --FILE-- --FILE-- --CLEAN-- --EXPECT-- -database handler: tcadb -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } --NO-LOCK-- -3NYNYY -Content String 2 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } diff --git a/ext/dba/tests/dba012.phpt b/ext/dba/tests/default_handler_ini.phpt similarity index 57% rename from ext/dba/tests/dba012.phpt rename to ext/dba/tests/default_handler_ini.phpt index 9ef0f329ccd43..ba115f76e2037 100644 --- a/ext/dba/tests/dba012.phpt +++ b/ext/dba/tests/default_handler_ini.phpt @@ -4,15 +4,15 @@ DBA dba.default_handler tests dba --SKIPIF-- --INI-- dba.default_handler=flatfile --FILE-- --CLEAN-- --EXPECTF-- database handler: flatfile Test 1 -Warning: ini_set(): No such handler: does_not_exist in %sdba012.php on line %d +Warning: ini_set(): No such handler: does_not_exist in %s on line %d resource(%d) of type (dba) Test 2 -Warning: dba_open(): No default handler selected in %sdba012.php on line %d +Warning: dba_open(): No default handler selected in %s on line %d bool(false) diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc new file mode 100644 index 0000000000000..e73a0e4f9f95b --- /dev/null +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -0,0 +1,186 @@ + Date: Thu, 30 Jun 2022 18:09:14 +0100 Subject: [PATCH 02/12] Add individual CONFLICT sections to have parallel testing --- ext/dba/tests/CONFLICTS | 2 -- ext/dba/tests/dba007.phpt | 2 ++ ext/dba/tests/dba009.phpt | 2 ++ ext/dba/tests/dba015.phpt | 2 ++ ext/dba/tests/dba_cdb_001.phpt | 2 ++ ext/dba/tests/dba_db4_001.phpt | 2 ++ ext/dba/tests/dba_db4_002.phpt | 2 ++ ext/dba/tests/dba_db4_003.phpt | 2 ++ ext/dba/tests/dba_db4_004.phpt | 2 ++ ext/dba/tests/dba_db4_005.phpt | 2 ++ ext/dba/tests/dba_db4_006.phpt | 2 ++ ext/dba/tests/dba_db4_007.phpt | 2 ++ ext/dba/tests/dba_db4_008.phpt | 2 ++ ext/dba/tests/dba_db4_009.phpt | 44 +++++++++-------------------- ext/dba/tests/dba_db4_011.phpt | 38 ------------------------- ext/dba/tests/dba_db4_012.phpt | 2 ++ ext/dba/tests/dba_db4_013.phpt | 2 ++ ext/dba/tests/dba_db4_014.phpt | 2 ++ ext/dba/tests/dba_db4_015.phpt | 2 ++ ext/dba/tests/dba_db4_016.phpt | 2 ++ ext/dba/tests/dba_db4_017.phpt | 2 ++ ext/dba/tests/dba_db4_018.phpt | 2 ++ ext/dba/tests/dba_db4_handlers.phpt | 2 ++ ext/dba/tests/dba_db4_optimize.phpt | 2 ++ ext/dba/tests/dba_db4_sync.phpt | 2 ++ ext/dba/tests/dba_sync.phpt | 2 ++ 26 files changed, 59 insertions(+), 71 deletions(-) delete mode 100644 ext/dba/tests/CONFLICTS delete mode 100644 ext/dba/tests/dba_db4_011.phpt diff --git a/ext/dba/tests/CONFLICTS b/ext/dba/tests/CONFLICTS deleted file mode 100644 index 7c5f980770edb..0000000000000 --- a/ext/dba/tests/CONFLICTS +++ /dev/null @@ -1,2 +0,0 @@ -# Many of these tests work on the same database file -dba diff --git a/ext/dba/tests/dba007.phpt b/ext/dba/tests/dba007.phpt index 04a6b353640a3..507999dea164f 100644 --- a/ext/dba/tests/dba007.phpt +++ b/ext/dba/tests/dba007.phpt @@ -8,6 +8,8 @@ dba if (!function_exists('dba_list')) die('skip dba_list() not available'); die("info $HND handler used"); ?> +--CONFLICTS-- +dba --FILE-- +--CONFLICTS-- +dba --FILE-- +--CONFLICTS-- +dba --FILE-- +--CONFLICTS-- +dba --FILE-- --FILE-- --CLEAN-- --EXPECTF-- database handler: db4 -database file created -database file created -database file created -array(3) { - [%d]=> - string(%d) "%stest0.dbm" +array(2) { [%d]=> string(%d) "%stest1.dbm" [%d]=> diff --git a/ext/dba/tests/dba_db4_011.phpt b/ext/dba/tests/dba_db4_011.phpt deleted file mode 100644 index 78252e97c6f23..0000000000000 --- a/ext/dba/tests/dba_db4_011.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -DBA DB4 with repeated key ---EXTENSIONS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -bool(true) -bool(true) -bool(false) -Content String 1 -Content String 2 diff --git a/ext/dba/tests/dba_db4_012.phpt b/ext/dba/tests/dba_db4_012.phpt index f5c29d993f0a2..cdf6257c126bd 100644 --- a/ext/dba/tests/dba_db4_012.phpt +++ b/ext/dba/tests/dba_db4_012.phpt @@ -2,6 +2,8 @@ DBA DB4 New File Creation open("rl") --EXTENSIONS-- dba +--CONFLICTS-- +dba --SKIPIF-- Date: Fri, 1 Jul 2022 01:24:28 +0100 Subject: [PATCH 03/12] Create a big matrix of creation test for DB4 This replaces various other tests The aim is to run such a matrix for each driver --- ext/dba/tests/dba_db4_001.phpt | 36 --- ext/dba/tests/dba_db4_002.phpt | 36 --- ext/dba/tests/dba_db4_003.phpt | 48 ---- ext/dba/tests/dba_db4_004.phpt | 44 ---- ext/dba/tests/dba_db4_005.phpt | 36 --- ext/dba/tests/dba_db4_006.phpt | 36 --- ext/dba/tests/dba_db4_007.phpt | 43 ---- ext/dba/tests/dba_db4_008.phpt | 44 ---- ext/dba/tests/dba_db4_012.phpt | 35 --- ext/dba/tests/dba_db4_013.phpt | 44 ---- ext/dba/tests/dba_db4_014.phpt | 36 --- ext/dba/tests/dba_db4_015.phpt | 43 ---- ext/dba/tests/dba_db4_016.phpt | 63 ------ ext/dba/tests/dba_db4_017.phpt | 41 ---- ext/dba/tests/dba_db4_creation_matrix.phpt | 252 +++++++++++++++++++++ 15 files changed, 252 insertions(+), 585 deletions(-) delete mode 100644 ext/dba/tests/dba_db4_001.phpt delete mode 100644 ext/dba/tests/dba_db4_002.phpt delete mode 100644 ext/dba/tests/dba_db4_003.phpt delete mode 100644 ext/dba/tests/dba_db4_004.phpt delete mode 100644 ext/dba/tests/dba_db4_005.phpt delete mode 100644 ext/dba/tests/dba_db4_006.phpt delete mode 100644 ext/dba/tests/dba_db4_007.phpt delete mode 100644 ext/dba/tests/dba_db4_008.phpt delete mode 100644 ext/dba/tests/dba_db4_012.phpt delete mode 100644 ext/dba/tests/dba_db4_013.phpt delete mode 100644 ext/dba/tests/dba_db4_014.phpt delete mode 100644 ext/dba/tests/dba_db4_015.phpt delete mode 100644 ext/dba/tests/dba_db4_016.phpt delete mode 100644 ext/dba/tests/dba_db4_017.phpt create mode 100644 ext/dba/tests/dba_db4_creation_matrix.phpt diff --git a/ext/dba/tests/dba_db4_001.phpt b/ext/dba/tests/dba_db4_001.phpt deleted file mode 100644 index f91bf9f29095e..0000000000000 --- a/ext/dba/tests/dba_db4_001.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -DBA DB4 New File Creation open("c") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_002.phpt b/ext/dba/tests/dba_db4_002.phpt deleted file mode 100644 index 95bd66dc1fe93..0000000000000 --- a/ext/dba/tests/dba_db4_002.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -DBA DB4 New File Creation open("n") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_003.phpt b/ext/dba/tests/dba_db4_003.phpt deleted file mode 100644 index f50451659ee78..0000000000000 --- a/ext/dba/tests/dba_db4_003.phpt +++ /dev/null @@ -1,48 +0,0 @@ ---TEST-- -DBA DB4 File Creation open("c") with existing file ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 -int(14) - -Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_003.php on line %d -Error creating %stest0.dbm -Dummy contents diff --git a/ext/dba/tests/dba_db4_004.phpt b/ext/dba/tests/dba_db4_004.phpt deleted file mode 100644 index c0d8baaf4db3a..0000000000000 --- a/ext/dba/tests/dba_db4_004.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -DBA DB4 Truncate Existing File open("n") ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -int(14) -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_005.phpt b/ext/dba/tests/dba_db4_005.phpt deleted file mode 100644 index a0385d7bf06df..0000000000000 --- a/ext/dba/tests/dba_db4_005.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -DBA DB4 New File Creation popen("c") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_006.phpt b/ext/dba/tests/dba_db4_006.phpt deleted file mode 100644 index 15feb52b9a2b8..0000000000000 --- a/ext/dba/tests/dba_db4_006.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -DBA DB4 New File Creation popen("n") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_007.phpt b/ext/dba/tests/dba_db4_007.phpt deleted file mode 100644 index 87570d3559556..0000000000000 --- a/ext/dba/tests/dba_db4_007.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -DBA DB4 File Creation popen("c") with existing invalid file ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 -int(14) - -Warning: dba_popen(): Driver initialization failed for handler: db4: Invalid argument in %sdba_db4_007.php on line %d -Error creating %stest0.dbm diff --git a/ext/dba/tests/dba_db4_008.phpt b/ext/dba/tests/dba_db4_008.phpt deleted file mode 100644 index 808187263cd98..0000000000000 --- a/ext/dba/tests/dba_db4_008.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -DBA DB4 Truncate Existing File popen("n") ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -int(14) -database file created -This is a test insert diff --git a/ext/dba/tests/dba_db4_012.phpt b/ext/dba/tests/dba_db4_012.phpt deleted file mode 100644 index cdf6257c126bd..0000000000000 --- a/ext/dba/tests/dba_db4_012.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -DBA DB4 New File Creation open("rl") ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 - -Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %sdba_db4_012.php on line %d -Error creating %stest0.dbm diff --git a/ext/dba/tests/dba_db4_013.phpt b/ext/dba/tests/dba_db4_013.phpt deleted file mode 100644 index 6b02c88a275d3..0000000000000 --- a/ext/dba/tests/dba_db4_013.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -DBA DB4 File open("rl") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 -database file created -database file opened - -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %sdba_db4_013.php on line %d diff --git a/ext/dba/tests/dba_db4_014.phpt b/ext/dba/tests/dba_db4_014.phpt deleted file mode 100644 index 2c3269967164d..0000000000000 --- a/ext/dba/tests/dba_db4_014.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -DBA DB4 File open("wl") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECTF-- -database handler: db4 - -Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %sdba_db4_014.php on line %d -Error creating %stest0.dbm diff --git a/ext/dba/tests/dba_db4_015.phpt b/ext/dba/tests/dba_db4_015.phpt deleted file mode 100644 index 8df6bf2f7d020..0000000000000 --- a/ext/dba/tests/dba_db4_015.phpt +++ /dev/null @@ -1,43 +0,0 @@ ---TEST-- -DBA DB4 File open("wl") & Insert Test ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -database file opened -This is a test insert diff --git a/ext/dba/tests/dba_db4_016.phpt b/ext/dba/tests/dba_db4_016.phpt deleted file mode 100644 index 0bf953e410b06..0000000000000 --- a/ext/dba/tests/dba_db4_016.phpt +++ /dev/null @@ -1,63 +0,0 @@ ---TEST-- -DBA DB4 File Creation popen("c") with existing valid file ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -bool(true) -This is a test insert -database file created -bool(false) -bool(true) -This is a test insert -second open test row 2 diff --git a/ext/dba/tests/dba_db4_017.phpt b/ext/dba/tests/dba_db4_017.phpt deleted file mode 100644 index af3120019cd1f..0000000000000 --- a/ext/dba/tests/dba_db4_017.phpt +++ /dev/null @@ -1,41 +0,0 @@ ---TEST-- -DBA DB4 file creation dba_open("cd") ---EXTENSIONS-- -dba ---CONFLICTS-- -dba ---SKIPIF-- - ---FILE-- - ---CLEAN-- - ---EXPECT-- -database handler: db4 -database file created -bool(true) -This is a test insert diff --git a/ext/dba/tests/dba_db4_creation_matrix.phpt b/ext/dba/tests/dba_db4_creation_matrix.phpt new file mode 100644 index 0000000000000..f61ab22e2ca64 --- /dev/null +++ b/ext/dba/tests/dba_db4_creation_matrix.phpt @@ -0,0 +1,252 @@ +--TEST-- +DBA DB4 opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: db4: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(db4_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: db4: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert From 0e5a017584332c26a72dc6742bff9b1d91d06b80 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 1 Jul 2022 02:32:11 +0100 Subject: [PATCH 04/12] Test lock file combination Also make test resilliants for 'any driver' as cdb and inifile are weird --- ext/dba/tests/bug36436.phpt | 2 +- ext/dba/tests/bug65708.phpt | 3 +- ext/dba/tests/dba_array_keys.phpt | 3 +- ext/dba/tests/dba_array_keys_errors.phpt | 3 +- ext/dba/tests/dba_array_keys_inifile.phpt | 42 ++++++++ .../tests/dba_array_keys_var_non_string.phpt | 3 +- ext/dba/tests/dba_db1.phpt | 54 +++-------- ext/dba/tests/dba_db2.phpt | 54 +++-------- ext/dba/tests/dba_db3.phpt | 54 +++-------- ext/dba/tests/dba_db4_000.phpt | 49 +--------- ext/dba/tests/dba_fetch_legacy_signature.phpt | 3 +- ext/dba/tests/dba_flatfile.phpt | 50 +--------- ext/dba/tests/dba_gdbm.phpt | 60 +++++++++++- ext/dba/tests/dba_inifile.phpt | 56 +---------- ext/dba/tests/dba_lmdb.phpt | 62 +++++++++++- ext/dba/tests/dba_ndbm.phpt | 57 +++++++++++ ext/dba/tests/dba_qdbm.phpt | 64 +++++++++++- ext/dba/tests/dba_tcadb.phpt | 49 +--------- ext/dba/tests/setup/setup_dba_tests.inc | 97 +++++++++++++++---- 19 files changed, 433 insertions(+), 332 deletions(-) create mode 100644 ext/dba/tests/dba_array_keys_inifile.phpt diff --git a/ext/dba/tests/bug36436.phpt b/ext/dba/tests/bug36436.phpt index 386a71cb5c5b9..9e7603f5a39f9 100644 --- a/ext/dba/tests/bug36436.phpt +++ b/ext/dba/tests/bug36436.phpt @@ -12,7 +12,7 @@ check_skip('db4'); require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'bug36436.db'; -$db = set_up_db_ex('db4', $db_name, false, true); +$db = set_up_db_ex('db4', $db_name, LockFlag::DbLock, persistent: true); var_dump($db, dba_fetch('key1', $db)); diff --git a/ext/dba/tests/bug65708.phpt b/ext/dba/tests/bug65708.phpt index 365e4f308fb10..1a5203e9cf88c 100644 --- a/ext/dba/tests/bug65708.phpt +++ b/ext/dba/tests/bug65708.phpt @@ -34,7 +34,8 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'bug65708.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +Using handler: "%s" integer integer integer diff --git a/ext/dba/tests/dba_array_keys.phpt b/ext/dba/tests/dba_array_keys.phpt index 6b8a36c9e7c85..a9883dabea161 100644 --- a/ext/dba/tests/dba_array_keys.phpt +++ b/ext/dba/tests/dba_array_keys.phpt @@ -31,7 +31,8 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'array_keys_basic.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +Using handler: "%s" bool(true) bool(true) bool(true) diff --git a/ext/dba/tests/dba_array_keys_errors.phpt b/ext/dba/tests/dba_array_keys_errors.phpt index db0e470bbd24b..d80915c7c3188 100644 --- a/ext/dba/tests/dba_array_keys_errors.phpt +++ b/ext/dba/tests/dba_array_keys_errors.phpt @@ -47,7 +47,8 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'array_keys_errors.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +Using handler: "%s" Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" Error: dba_insert(): Argument #1 ($key) must have exactly two elements: "key" and "name" Error: Object of class stdClass could not be converted to string diff --git a/ext/dba/tests/dba_array_keys_inifile.phpt b/ext/dba/tests/dba_array_keys_inifile.phpt new file mode 100644 index 0000000000000..70ebbfc3ba772 --- /dev/null +++ b/ext/dba/tests/dba_array_keys_inifile.phpt @@ -0,0 +1,42 @@ +--TEST-- +DBA check behaviour of array keys (inifile version) +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) +string(12) "Normal group" +string(0) "" +string(11) "Empty group" +bool(false) diff --git a/ext/dba/tests/dba_array_keys_var_non_string.phpt b/ext/dba/tests/dba_array_keys_var_non_string.phpt index a746ed827b91a..1ba64ec40b6c1 100644 --- a/ext/dba/tests/dba_array_keys_var_non_string.phpt +++ b/ext/dba/tests/dba_array_keys_var_non_string.phpt @@ -31,7 +31,8 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'array_keys_non_string.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +Using handler: "%s" array(2) { [0]=> int(5) diff --git a/ext/dba/tests/dba_db1.phpt b/ext/dba/tests/dba_db1.phpt index fee007e071f4a..69ab820bf1d9a 100644 --- a/ext/dba/tests/dba_db1.phpt +++ b/ext/dba/tests/dba_db1.phpt @@ -13,7 +13,6 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_db1.db'; $handler = 'db1'; -set_up_db($handler, $db_name); run_standard_tests($handler, $db_name); ?> @@ -24,15 +23,19 @@ $db_name = 'dba_db1.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) Try to remove key 1 again bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 key2: Content String 2 key4: Another Content String key5: The last content string -Total keys: 3 +name9: Content String 9 +Total keys: 6 Key 1 exists? N Key 2 exists? Y Key 3 exists? N @@ -50,46 +53,21 @@ Delete "key4" bool(true) Fetch "key2": Content 2 replaced 2nd time Fetch "key number 6": 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" -} ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -key2: Content String 2 -key4: Another Content String -key5: The last content string -Total keys: 3 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Expected: Failed to insert data for already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(3) { +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db2.phpt b/ext/dba/tests/dba_db2.phpt index 2504e075fec0d..690ecbbd9b6cd 100644 --- a/ext/dba/tests/dba_db2.phpt +++ b/ext/dba/tests/dba_db2.phpt @@ -13,7 +13,6 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_db2.db'; $handler = 'db2'; -set_up_db($handler, $db_name); run_standard_tests($handler, $db_name); ?> @@ -24,15 +23,19 @@ $db_name = 'dba_db2.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) Try to remove key 1 again bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 key2: Content String 2 key4: Another Content String key5: The last content string -Total keys: 3 +name9: Content String 9 +Total keys: 6 Key 1 exists? N Key 2 exists? Y Key 3 exists? N @@ -50,46 +53,21 @@ Delete "key4" bool(true) Fetch "key2": Content 2 replaced 2nd time Fetch "key number 6": 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" -} ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -key2: Content String 2 -key4: Another Content String -key5: The last content string -Total keys: 3 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Expected: Failed to insert data for already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(3) { +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db3.phpt b/ext/dba/tests/dba_db3.phpt index 6fad23523b2e4..bb262bcbc67af 100644 --- a/ext/dba/tests/dba_db3.phpt +++ b/ext/dba/tests/dba_db3.phpt @@ -13,7 +13,6 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_db3.db'; $handler = 'db3'; -set_up_db($handler, $db_name); run_standard_tests($handler, $db_name); ?> @@ -24,15 +23,19 @@ $db_name = 'dba_db3.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) Try to remove key 1 again bool(false) +[key10]name10: Content String 10 +[key30]name30: Content String 30 key2: Content String 2 key4: Another Content String key5: The last content string -Total keys: 3 +name9: Content String 9 +Total keys: 6 Key 1 exists? N Key 2 exists? Y Key 3 exists? N @@ -50,46 +53,21 @@ Delete "key4" bool(true) Fetch "key2": Content 2 replaced 2nd time Fetch "key number 6": 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" -} ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -key2: Content String 2 -key4: Another Content String -key5: The last content string -Total keys: 3 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Expected: Failed to insert data for already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(3) { +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_db4_000.phpt b/ext/dba/tests/dba_db4_000.phpt index 19079bbfa716b..5b97d68c8843b 100644 --- a/ext/dba/tests/dba_db4_000.phpt +++ b/ext/dba/tests/dba_db4_000.phpt @@ -24,6 +24,7 @@ $db_name = 'dba_db4.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) @@ -67,47 +68,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -[key10]name10: Content String 10 -[key30]name30: Content String 30 -key2: Content String 2 -key4: Another Content String -key5: The last content string -name9: Content String 9 -Total keys: 6 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Expected: Failed to insert data for already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(6) { - ["[key10]name10"]=> - string(17) "Content String 10" - ["[key30]name30"]=> - string(17) "Content String 30" - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" - ["name9"]=> - string(16) "Content String 9" -} +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_fetch_legacy_signature.phpt b/ext/dba/tests/dba_fetch_legacy_signature.phpt index 65edab28e1842..7bb71372f9717 100644 --- a/ext/dba/tests/dba_fetch_legacy_signature.phpt +++ b/ext/dba/tests/dba_fetch_legacy_signature.phpt @@ -25,6 +25,7 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'legacy_fetch_signature.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +Using handler: "%s" This is a test insert This is a test insert diff --git a/ext/dba/tests/dba_flatfile.phpt b/ext/dba/tests/dba_flatfile.phpt index d4d6d63bd5af5..9d989e9069b8d 100644 --- a/ext/dba/tests/dba_flatfile.phpt +++ b/ext/dba/tests/dba_flatfile.phpt @@ -13,7 +13,6 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_flatfile.db'; $handler = 'flatfile'; -set_up_db($handler, $db_name); run_standard_tests($handler, $db_name); ?> @@ -24,6 +23,7 @@ $db_name = 'dba_flatfile.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) @@ -67,47 +67,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -key2: Content String 2 -key4: Another Content String -key5: The last content string -name9: Content String 9 -[key10]name10: Content String 10 -[key30]name30: Content String 30 -Total keys: 6 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Expected: Failed to insert data for already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(6) { - ["[key10]name10"]=> - string(17) "Content String 10" - ["[key30]name30"]=> - string(17) "Content String 30" - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" - ["name9"]=> - string(16) "Content String 9" -} +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index 87ff628b03de4..ad7ae00d4f2a6 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -13,8 +13,7 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_gdbm.db'; $handler = 'gdbm'; -set_up_db($handler, $db_name, false /* Locking done by the library */); -run_standard_tests($handler, $db_name, false /* Locking done by the library */); +run_standard_tests($handler, $db_name); ?> --CLEAN-- @@ -24,6 +23,59 @@ $db_name = 'dba_gdbm.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler gdbm does locking internally in %s on line 1%d +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH DB LOCK (default) === Remove key 1 and 3 bool(true) bool(true) @@ -67,3 +119,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Failed to create DB diff --git a/ext/dba/tests/dba_inifile.phpt b/ext/dba/tests/dba_inifile.phpt index 91a62a44b7aac..06be22c085ff6 100644 --- a/ext/dba/tests/dba_inifile.phpt +++ b/ext/dba/tests/dba_inifile.phpt @@ -13,7 +13,6 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_inifile.db'; $handler = 'inifile'; -set_up_db($handler, $db_name); run_standard_tests($handler, $db_name); ?> @@ -25,6 +24,7 @@ cleanup_standard_db($db_name); ?> --WHITESPACE_SENSITIVE-- --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) @@ -74,53 +74,7 @@ array(8) { ["name9"]=> string(16) "Content String 9" } ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -key2: Content String 2 -key4: Another Content String -key5: The last content string -name9: Content String 9 -[key10]: -[key10]name10: Content String 10 -[key30]: -[key30]name30: Content String 30 -Total keys: 8 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Unexpected: Wrote data to already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(8) { - ["[key10]"]=> - string(0) "" - ["[key10]name10"]=> - string(17) "Content String 10" - ["[key30]"]=> - string(0) "" - ["[key30]name30"]=> - string(17) "Content String 30" - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" - ["name9"]=> - string(16) "Content String 9" -} +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt index 93757b0d387c0..87c9aca276482 100644 --- a/ext/dba/tests/dba_lmdb.phpt +++ b/ext/dba/tests/dba_lmdb.phpt @@ -13,8 +13,7 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_lmdb.db'; $handler = 'lmdb'; -set_up_db($handler, $db_name, false /* Locking done by the library */); -run_standard_tests($handler, $db_name, false /* Locking done by the library */); +run_standard_tests($handler, $db_name); ?> --CLEAN-- @@ -23,7 +22,60 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_lmdb.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +TODO Fix über slow LMDB on deletion of non existent key +[key10]name10: Content String 10 +[key30]name30: Content String 30 +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler lmdb does locking internally in %s on line 1%d +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH DB LOCK (default) === Remove key 1 and 3 bool(true) bool(true) @@ -67,3 +119,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Failed to create DB diff --git a/ext/dba/tests/dba_ndbm.phpt b/ext/dba/tests/dba_ndbm.phpt index 96b8f0e603303..5c50370947e89 100644 --- a/ext/dba/tests/dba_ndbm.phpt +++ b/ext/dba/tests/dba_ndbm.phpt @@ -24,6 +24,59 @@ $db_name = 'dba_ndbm.db'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 40 + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 40 + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 82 +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key4: Another Content String +key2: Content String 2 +key5: The last content string +[key10]name10: Content String 10 +name9: Content String 9 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler ndbm does locking internally in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 149 +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH DB LOCK (default) === Remove key 1 and 3 bool(true) bool(true) @@ -67,3 +120,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler ndbm in /home/girgias/Dev/php-src/ext/dba/tests/setup/setup_dba_tests.inc on line 40 +Failed to create DB diff --git a/ext/dba/tests/dba_qdbm.phpt b/ext/dba/tests/dba_qdbm.phpt index 5403673e44074..e4321e7dc3750 100644 --- a/ext/dba/tests/dba_qdbm.phpt +++ b/ext/dba/tests/dba_qdbm.phpt @@ -13,8 +13,7 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_qdbm.db'; $handler = 'qdbm'; -set_up_db($handler, $db_name, false /* Locking done by the library */); -run_standard_tests($handler, $db_name, false /* Locking done by the library */); +run_standard_tests($handler, $db_name); ?> --CLEAN-- @@ -23,17 +22,70 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_qdbm.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- +=== RUNNING WITH FILE LOCK === + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d Remove key 1 and 3 bool(true) bool(true) Try to remove key 1 again bool(false) -key4: Another Content String key2: Content String 2 +key4: Another Content String key5: The last content string +name9: Content String 9 [key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) +Content 2 replaced +Read during write: not allowed +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value + +Notice: dba_open(): Handler qdbm does locking internally in %s on line 1%d +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" + ["key number 6"]=> + string(13) "The 6th value" + ["key2"]=> + string(27) "Content 2 replaced 2nd time" + ["key5"]=> + string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" +} +=== RUNNING WITH DB LOCK (default) === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string name9: Content String 9 +[key10]name10: Content String 10 [key30]name30: Content String 30 Total keys: 6 Key 1 exists? N @@ -67,3 +119,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } +=== RUNNING WITH NO LOCK === + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Failed to create DB diff --git a/ext/dba/tests/dba_tcadb.phpt b/ext/dba/tests/dba_tcadb.phpt index 9d113fc785e21..6459c5b372ea7 100644 --- a/ext/dba/tests/dba_tcadb.phpt +++ b/ext/dba/tests/dba_tcadb.phpt @@ -24,6 +24,7 @@ $db_name = 'dba_tcadb.tch'; cleanup_standard_db($db_name); ?> --EXPECT-- +=== RUNNING WITH FILE LOCK === Remove key 1 and 3 bool(true) bool(true) @@ -67,47 +68,7 @@ array(6) { ["name9"]=> string(16) "Content String 9" } ---NO-LOCK-- -Remove key 1 and 3 -bool(true) -bool(true) -Try to remove key 1 again -bool(false) -key2: Content String 2 -key4: Another Content String -key5: The last content string -name9: Content String 9 -[key10]name10: Content String 10 -[key30]name30: Content String 30 -Total keys: 6 -Key 1 exists? N -Key 2 exists? Y -Key 3 exists? N -Key 4 exists? Y -Key 5 exists? Y -Replace second key data -bool(true) -Content 2 replaced -Read during write: not allowed -Expected: Added a new data entry -Expected: Failed to insert data for already used key -Replace second key data -bool(true) -Delete "key4" -bool(true) -Fetch "key2": Content 2 replaced 2nd time -Fetch "key number 6": The 6th value -array(6) { - ["[key10]name10"]=> - string(17) "Content String 10" - ["[key30]name30"]=> - string(17) "Content String 30" - ["key number 6"]=> - string(13) "The 6th value" - ["key2"]=> - string(27) "Content 2 replaced 2nd time" - ["key5"]=> - string(23) "The last content string" - ["name9"]=> - string(16) "Content String 9" -} +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc index e73a0e4f9f95b..f362c7b5028e5 100644 --- a/ext/dba/tests/setup/setup_dba_tests.inc +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -4,6 +4,12 @@ function check_skip_any() { if (dba_handlers() === []) { die('skip no handlers installed'); } + if (dba_handlers() === ['cdb']) { + die('skip only cdb installed which is not suitable'); + } + if (dba_handlers() === ['cdb_make']) { + die('skip only cdb_make installed which is not suitable'); + } } function check_skip(string $handler) { @@ -18,16 +24,29 @@ function check_skip(string $handler) { } function get_any_handler(): string { - return dba_handlers()[0]; + foreach (dba_handlers() as $handler) { + // Those are weird + if ($handler !== 'cdb' && $handler !== 'cdb_make' && $handler !== 'inifile') { + echo 'Using handler: "', $handler, '"', \PHP_EOL; + return $handler; + } + } + return 'should_not_happen'; } function get_any_db(string $name) { return dba_open($name, 'c', get_any_handler()); } +enum LockFlag: string { + case FileLock = 'l'; + case DbLock = 'd'; + case NoLock = '-'; +} + // TODO Test which opens a NON DB file to check for memory leaks (at least LMDB has) -function set_up_db_ex(string $handler, string $name, bool $useLock = true, bool $persistent = false) { - $lock_flag = $useLock ? 'l' : ''; +function set_up_db_ex(string $handler, string $name, LockFlag $lock, bool $persistent = false) { + $lock_flag = $lock->value; // Open file in creation/truncation mode $func = $persistent ? 'dba_popen' : 'dba_open'; @@ -52,13 +71,13 @@ function set_up_db_ex(string $handler, string $name, bool $useLock = true, bool return $db_file; } -function set_up_db(string $handler, string $name, bool $useLock = true) { - $db_file = set_up_db_ex($handler, $name, $useLock); +function set_up_db(string $handler, string $name, LockFlag $lock = LockFlag::FileLock): void { + $db_file = set_up_db_ex($handler, $name, $lock); // Close creation/truncation handler dba_close($db_file); } -function run_common_read_only_test($dbHandle) { +function run_common_read_only_test($dbHandle): void { $key = dba_firstkey($dbHandle); $result = []; while ($key) { @@ -69,8 +88,10 @@ function run_common_read_only_test($dbHandle) { var_dump($result); } -function run_standard_tests(string $handler, string $name, bool $useLock = true, bool $persistent = false) { - $lock_flag = $useLock ? 'l' : ''; +function run_standard_tests_ex(string $handler, string $name, LockFlag $lock, bool $persistent = false): void +{ + $lock_flag = $lock->value; + set_up_db($handler, $name, $lock); $db_writer = dba_open($name, 'w'.$lock_flag, $handler); if ($db_writer === false) { die("Failed to open DB for write"); @@ -104,7 +125,13 @@ function run_standard_tests(string $handler, string $name, bool $useLock = true, var_dump(dba_replace('key2', 'Content 2 replaced', $db_writer)); echo dba_fetch('key2', $db_writer), \PHP_EOL; - $db_reader = @dba_open($name, 'r'.$lock_flag.'t', $handler); + // Check that read is possible when a lock is used + $test_flag = 't'; + if ($lock === LockFlag::NoLock) { + // No point testing when we don't use locks + $test_flag = ''; + } + $db_reader = @dba_open($name, 'r'.$lock_flag.$test_flag, $handler); if ($db_reader === false) { echo 'Read during write: not allowed', \PHP_EOL; } else { @@ -143,17 +170,49 @@ function run_standard_tests(string $handler, string $name, bool $useLock = true, } } */ - /* If a lock is used, rerun tests without lock */ - if ($useLock) { - echo '--NO-LOCK--', \PHP_EOL; - cleanup_standard_db($name); - set_up_db($handler, $name, false); - run_standard_tests($handler, $name, false); +} + +function run_standard_tests(string $handler, string $name): void { + echo '=== RUNNING WITH FILE LOCK ===', \PHP_EOL; + ob_start(); + set_up_db($handler, $name, LockFlag::FileLock); + run_standard_tests_ex($handler, $name, LockFlag::FileLock); + cleanup_standard_db($name); + $run1_output = ob_get_flush(); + echo '=== RUNNING WITH DB LOCK (default) ===', \PHP_EOL; + ob_start(); + set_up_db($handler, $name, LockFlag::DbLock); + run_standard_tests_ex($handler, $name, LockFlag::DbLock); + cleanup_standard_db($name); + $run2_output = ob_get_clean(); + if ($run1_output === $run2_output) { + echo 'SAME OUTPUT AS PREVIOUS RUN', \PHP_EOL; + } else { + echo $run2_output; + } + + echo '=== RUNNING WITH NO LOCK ===', \PHP_EOL; + ob_start(); + set_up_db($handler, $name, LockFlag::NoLock); + run_standard_tests_ex($handler, $name, LockFlag::NoLock); + $run3_output = ob_get_clean(); + if ($run2_output === $run3_output) { + echo 'SAME OUTPUT AS PREVIOUS RUN', \PHP_EOL; + } else if ($run2_output === str_replace( // If only the fact that the lock prevented reads + 'Read during write: allowed', + 'Read during write: not allowed', + $run3_output + ) + ) { + echo 'SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock)', \PHP_EOL; + } else { + echo $run3_output; } } // TODO Array keys insertion -function set_up_cdb_db_and_run(string $name) { +// TODO Run all lock flags +function set_up_cdb_db_and_run(string $name): void { set_up_db('cdb', $name); $db_file = dba_open($name, 'rl', 'cdb'); @@ -168,8 +227,8 @@ function set_up_cdb_db_and_run(string $name) { echo '--NO-LOCK--', \PHP_EOL; cleanup_standard_db($name); - set_up_db('cdb', $name, false); - $db_file = dba_open($name, 'r', 'cdb'); + set_up_db('cdb', $name, LockFlag::NoLock); + $db_file = dba_open($name, 'r-', 'cdb'); if ($db_file === false) { die("Failed to reopen DB"); } @@ -179,7 +238,7 @@ function set_up_cdb_db_and_run(string $name) { run_common_read_only_test($db_file); } -function cleanup_standard_db(string $name) { +function cleanup_standard_db(string $name): void { @unlink($name); @unlink($name.'.lck'); @unlink($name.'-lock'); From 0045fafc95bad5dae134bc9b3f436ccfaf40211d Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 1 Jul 2022 17:21:12 +0100 Subject: [PATCH 05/12] LMDB Uber slow transaction is fixed --- ext/dba/tests/dba_lmdb.phpt | 10 +++++++--- ext/dba/tests/setup/setup_dba_tests.inc | 6 +----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/dba/tests/dba_lmdb.phpt b/ext/dba/tests/dba_lmdb.phpt index 87c9aca276482..7f8047f5808be 100644 --- a/ext/dba/tests/dba_lmdb.phpt +++ b/ext/dba/tests/dba_lmdb.phpt @@ -34,7 +34,9 @@ Remove key 1 and 3 bool(true) bool(true) Try to remove key 1 again -TODO Fix über slow LMDB on deletion of non existent key + +Warning: dba_delete(): MDB_NOTFOUND: No matching key/data pair found in %s on line %d +bool(false) [key10]name10: Content String 10 [key30]name30: Content String 30 key2: Content String 2 @@ -60,7 +62,7 @@ bool(true) Fetch "key2": Content 2 replaced 2nd time Fetch "key number 6": The 6th value -Notice: dba_open(): Handler lmdb does locking internally in %s on line 1%d +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d array(6) { ["[key10]name10"]=> string(17) "Content String 10" @@ -80,7 +82,9 @@ Remove key 1 and 3 bool(true) bool(true) Try to remove key 1 again -TODO Fix über slow LMDB on deletion of non existent key + +Warning: dba_delete(): MDB_NOTFOUND: No matching key/data pair found in %s on line %d +bool(false) [key10]name10: Content String 10 [key30]name30: Content String 30 key2: Content String 2 diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc index f362c7b5028e5..527ad8d435ba8 100644 --- a/ext/dba/tests/setup/setup_dba_tests.inc +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -102,11 +102,7 @@ function run_standard_tests_ex(string $handler, string $name, LockFlag $lock, bo var_dump(dba_delete("key1", $db_writer)); echo 'Try to remove key 1 again', \PHP_EOL; - if ($handler !== 'lmdb') { - var_dump(dba_delete("key1", $db_writer)); - } else { - echo 'TODO Fix über slow LMDB on deletion of non existent key', \PHP_EOL; - } + var_dump(dba_delete("key1", $db_writer)); // Fetch data $key = dba_firstkey($db_writer); From 8a2363098c9d6f2fcf032eaa8373be98bfe348ca Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 1 Jul 2022 17:50:20 +0100 Subject: [PATCH 06/12] Move DB4 Matrix creation test to a function --- ext/dba/tests/dba_db4_creation_matrix.phpt | 85 +--------------------- ext/dba/tests/setup/setup_dba_tests.inc | 52 +++++++++++++ 2 files changed, 54 insertions(+), 83 deletions(-) diff --git a/ext/dba/tests/dba_db4_creation_matrix.phpt b/ext/dba/tests/dba_db4_creation_matrix.phpt index f61ab22e2ca64..171472ec3b2ae 100644 --- a/ext/dba/tests/dba_db4_creation_matrix.phpt +++ b/ext/dba/tests/dba_db4_creation_matrix.phpt @@ -12,95 +12,14 @@ check_skip('db4'); require_once __DIR__ . '/setup/setup_dba_tests.inc'; $handler = 'db4'; - -$modes = ['r', 'w', 'c', 'n']; -$locks = ['l', 'd', '-', '' /* No lock flag is like 'd' */]; - -echo '=== OPENING NON-EXISTING FILE ===', \PHP_EOL; -/* Trying to open a non-existing file */ -$db_name = $handler . '_not_existing.db'; -foreach ($modes as $mode) { - foreach ($locks as $lock) { - $arg = $mode.$lock; - echo 'Mode parameter is "', $arg, '":', \PHP_EOL; - $db = dba_open($db_name, $arg, $handler); - if ($db !== false) { - assert(file_exists($db_name)); - $status = dba_insert("key1", "This is a test insert", $db); - if ($status) { - echo dba_fetch("key1", $db), \PHP_EOL; - } else { - echo 'Insertion failed', \PHP_EOL; - } - dba_close($db); - } else { - echo 'Opening DB failed', \PHP_EOL; - } - cleanup_standard_db($db_name); - } -} - -echo '=== OPENING EXISTING DB FILE ===', \PHP_EOL; -/* Trying to open an existing db file */ -$db_name = $handler . '_existing.db'; -foreach ($modes as $mode) { - foreach ($locks as $lock) { - dba_open($db_name, 'n', $handler); - $arg = $mode.$lock; - echo 'Mode parameter is "', $arg, '":', \PHP_EOL; - $db = dba_open($db_name, $arg, $handler); - if ($db !== false) { - assert(file_exists($db_name)); - $status = dba_insert("key1", "This is a test insert", $db); - if ($status) { - echo dba_fetch("key1", $db), \PHP_EOL; - } else { - echo 'Insertion failed', \PHP_EOL; - } - dba_close($db); - } else { - echo 'Opening DB failed', \PHP_EOL; - } - cleanup_standard_db($db_name); - } -} - -echo '=== OPENING EXISTING RANDOM FILE ===', \PHP_EOL; -/* Trying to open an existing random file */ -$db_name = $handler . '_random.txt'; -foreach ($modes as $mode) { - foreach ($locks as $lock) { - file_put_contents($db_name, "Dummy contents"); - $arg = $mode.$lock; - echo 'Mode parameter is "', $arg, '":', \PHP_EOL; - $db = dba_open($db_name, $arg, $handler); - if ($db !== false) { - assert(file_exists($db_name)); - $status = dba_insert("key1", "This is a test insert", $db); - if ($status) { - echo dba_fetch("key1", $db), \PHP_EOL; - } else { - echo 'Insertion failed', \PHP_EOL; - } - dba_close($db); - } else { - echo 'Opening DB failed', \PHP_EOL; - } - cleanup_standard_db($db_name); - } -} +run_creation_tests($handler); ?> --CLEAN-- --EXPECTF-- === OPENING NON-EXISTING FILE === diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc index 527ad8d435ba8..6137c86d9610d 100644 --- a/ext/dba/tests/setup/setup_dba_tests.inc +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -168,6 +168,58 @@ function run_standard_tests_ex(string $handler, string $name, LockFlag $lock, bo */ } +const MODES = ['r', 'w', 'c', 'n']; +const LOCKS = ['l', 'd', '-', '' /* No lock flag is like 'd' */]; +function run_creation_tests_ex(string $handler, string $file_suffix, string $pre_req): void +{ + $db_name = $handler . $file_suffix; + foreach (MODES as $mode) { + foreach (LOCKS as $lock) { + eval($pre_req); + $arg = $mode.$lock; + echo 'Mode parameter is "', $arg, '":', \PHP_EOL; + $db = dba_open($db_name, $arg, $handler); + if ($db !== false) { + assert(file_exists($db_name)); + $status = dba_insert("key1", "This is a test insert", $db); + if ($status) { + echo dba_fetch("key1", $db), \PHP_EOL; + } else { + echo 'Insertion failed', \PHP_EOL; + } + dba_close($db); + } else { + echo 'Opening DB failed', \PHP_EOL; + } + cleanup_standard_db($db_name); + } + } +} + +function run_creation_tests(string $handler): void +{ + /* Trying to open a non-existing file */ + echo '=== OPENING NON-EXISTING FILE ===', \PHP_EOL; + run_creation_tests_ex($handler, '_not_existing.db', ''); + + /* Trying to open an existing db file */ + echo '=== OPENING EXISTING DB FILE ===', \PHP_EOL; + run_creation_tests_ex($handler, '_existing.db', 'dba_open($db_name, "n", $handler);'); + + /* Trying to open an existing random file */ + echo '=== OPENING EXISTING RANDOM FILE ===', \PHP_EOL; + run_creation_tests_ex($handler, '_random.txt', 'file_put_contents($db_name, "Dummy contents");'); +} + +function clean_creation_tests(string $handler): void { + $db_name = $handler . '_not_existing.db'; + cleanup_standard_db($db_name); + $db_name = $handler . '_existing.db'; + cleanup_standard_db($db_name); + $db_name = $handler . '_random.txt'; + cleanup_standard_db($db_name); +} + function run_standard_tests(string $handler, string $name): void { echo '=== RUNNING WITH FILE LOCK ===', \PHP_EOL; ob_start(); From f24e9764af9c1ec7f1994dcf3044a3c77ecff08e Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 1 Jul 2022 18:08:45 +0100 Subject: [PATCH 07/12] Add creation matrix test for other drivers TODO Actually test GDBM as cannot test QDBM and it at the same time due to conflicts --- ext/dba/tests/dba_cdb_creation_matrix.phpt | 195 ++++++++++++++++ .../tests/dba_flatfile_creation_matrix.phpt | 155 +++++++++++++ ext/dba/tests/dba_gdbm_creation_matrix.phpt | 171 ++++++++++++++ .../tests/dba_inifile_creation_matrix.phpt | 155 +++++++++++++ ext/dba/tests/dba_lmdb_creation_matrix.phpt | 209 ++++++++++++++++++ ext/dba/tests/dba_qdbm_creation_matrix.phpt | 207 +++++++++++++++++ ext/dba/tests/dba_tcadb_creation_matrix.phpt | 179 +++++++++++++++ ext/dba/tests/setup/setup_dba_tests.inc | 12 +- 8 files changed, 1280 insertions(+), 3 deletions(-) create mode 100644 ext/dba/tests/dba_cdb_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_flatfile_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_gdbm_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_inifile_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_lmdb_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_qdbm_creation_matrix.phpt create mode 100644 ext/dba/tests/dba_tcadb_creation_matrix.phpt diff --git a/ext/dba/tests/dba_cdb_creation_matrix.phpt b/ext/dba/tests/dba_cdb_creation_matrix.phpt new file mode 100644 index 0000000000000..cd4e2789df189 --- /dev/null +++ b/ext/dba/tests/dba_cdb_creation_matrix.phpt @@ -0,0 +1,195 @@ +--TEST-- +DBA CDB opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(cdb_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "nl": +Cannot fetch insertion +Mode parameter is "nd": +Cannot fetch insertion +Mode parameter is "n-": +Cannot fetch insertion +Mode parameter is "n": +Cannot fetch insertion +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "nl": +Cannot fetch insertion +Mode parameter is "nd": +Cannot fetch insertion +Mode parameter is "n-": +Cannot fetch insertion +Mode parameter is "n": +Cannot fetch insertion +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: cdb: Update operations are not supported in %s on line %d +Opening DB failed +Mode parameter is "nl": +Cannot fetch insertion +Mode parameter is "nd": +Cannot fetch insertion +Mode parameter is "n-": +Cannot fetch insertion +Mode parameter is "n": +Cannot fetch insertion diff --git a/ext/dba/tests/dba_flatfile_creation_matrix.phpt b/ext/dba/tests/dba_flatfile_creation_matrix.phpt new file mode 100644 index 0000000000000..b37c340ad6fde --- /dev/null +++ b/ext/dba/tests/dba_flatfile_creation_matrix.phpt @@ -0,0 +1,155 @@ +--TEST-- +DBA flatfile opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(flatfile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +Cannot fetch insertion +Mode parameter is "wd": +Cannot fetch insertion +Mode parameter is "w-": +Cannot fetch insertion +Mode parameter is "w": +Cannot fetch insertion +Mode parameter is "cl": +Cannot fetch insertion +Mode parameter is "cd": +Cannot fetch insertion +Mode parameter is "c-": +Cannot fetch insertion +Mode parameter is "c": +Cannot fetch insertion +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_gdbm_creation_matrix.phpt b/ext/dba/tests/dba_gdbm_creation_matrix.phpt new file mode 100644 index 0000000000000..d1bb9c7a08712 --- /dev/null +++ b/ext/dba/tests/dba_gdbm_creation_matrix.phpt @@ -0,0 +1,171 @@ +--TEST-- +DBA GDBM opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Opening DB failed +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_inifile_creation_matrix.phpt b/ext/dba/tests/dba_inifile_creation_matrix.phpt new file mode 100644 index 0000000000000..f48ed1a955d18 --- /dev/null +++ b/ext/dba/tests/dba_inifile_creation_matrix.phpt @@ -0,0 +1,155 @@ +--TEST-- +DBA INIFILE opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(inifile_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_lmdb_creation_matrix.phpt b/ext/dba/tests/dba_lmdb_creation_matrix.phpt new file mode 100644 index 0000000000000..9980ef74701a2 --- /dev/null +++ b/ext/dba/tests/dba_lmdb_creation_matrix.phpt @@ -0,0 +1,209 @@ +--TEST-- +DBA LMDB opening matrix of combination +--EXTENSIONS-- +dba +--XFAIL-- +Memory leak present +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Notice: dba_open(): Handler lmdb does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "nd": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d +Opening DB failed +Mode parameter is "n": + +Warning: dba_open(): Driver initialization failed for handler: lmdb: MDB_INVALID: File is not an LMDB file in %s on line %d +Opening DB failed diff --git a/ext/dba/tests/dba_qdbm_creation_matrix.phpt b/ext/dba/tests/dba_qdbm_creation_matrix.phpt new file mode 100644 index 0000000000000..d22243b2309fe --- /dev/null +++ b/ext/dba/tests/dba_qdbm_creation_matrix.phpt @@ -0,0 +1,207 @@ +--TEST-- +DBA QDBM opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: open error in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: qdbm: broken database file in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Notice: dba_open(): Handler qdbm does locking internally in %s on line %d +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": + +Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line %d +Opening DB failed +Mode parameter is "n": +This is a test insert diff --git a/ext/dba/tests/dba_tcadb_creation_matrix.phpt b/ext/dba/tests/dba_tcadb_creation_matrix.phpt new file mode 100644 index 0000000000000..6380f14dc96d0 --- /dev/null +++ b/ext/dba/tests/dba_tcadb_creation_matrix.phpt @@ -0,0 +1,179 @@ +--TEST-- +DBA tcadb opening matrix of combination +--EXTENSIONS-- +dba +--SKIPIF-- + +--FILE-- + +--CLEAN-- + +--EXPECTF-- +=== OPENING NON-EXISTING FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(tcadb_not_existing.tch): Failed to open stream: No such file or directory in %s on line %d +Opening DB failed +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING DB FILE === +Mode parameter is "rl": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "rd": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r-": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "r": + +Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Insertion failed +Mode parameter is "wl": +This is a test insert +Mode parameter is "wd": +This is a test insert +Mode parameter is "w-": +This is a test insert +Mode parameter is "w": +This is a test insert +Mode parameter is "cl": +This is a test insert +Mode parameter is "cd": +This is a test insert +Mode parameter is "c-": +This is a test insert +Mode parameter is "c": +This is a test insert +Mode parameter is "nl": +This is a test insert +Mode parameter is "nd": +This is a test insert +Mode parameter is "n-": +This is a test insert +Mode parameter is "n": +This is a test insert +=== OPENING EXISTING RANDOM FILE === +Mode parameter is "rl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "rd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "r-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "r": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "wl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "wd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "w-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "w": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "cl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "cd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "c-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "c": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "nl": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "nd": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "n-": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed +Mode parameter is "n": + +Warning: dba_open(): Driver initialization failed for handler: tcadb in %s on line %d +Opening DB failed diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc index 6137c86d9610d..19e9edcfacf0c 100644 --- a/ext/dba/tests/setup/setup_dba_tests.inc +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -183,7 +183,12 @@ function run_creation_tests_ex(string $handler, string $file_suffix, string $pre assert(file_exists($db_name)); $status = dba_insert("key1", "This is a test insert", $db); if ($status) { - echo dba_fetch("key1", $db), \PHP_EOL; + $fetch = dba_fetch("key1", $db); + if ($fetch === false) { + echo 'Cannot fetch insertion', \PHP_EOL; + } else { + echo $fetch, \PHP_EOL; + } } else { echo 'Insertion failed', \PHP_EOL; } @@ -198,13 +203,14 @@ function run_creation_tests_ex(string $handler, string $file_suffix, string $pre function run_creation_tests(string $handler): void { + $extension = $handler === 'tcadb' ? 'tch' : 'db'; /* Trying to open a non-existing file */ echo '=== OPENING NON-EXISTING FILE ===', \PHP_EOL; - run_creation_tests_ex($handler, '_not_existing.db', ''); + run_creation_tests_ex($handler, '_not_existing.'.$extension, ''); /* Trying to open an existing db file */ echo '=== OPENING EXISTING DB FILE ===', \PHP_EOL; - run_creation_tests_ex($handler, '_existing.db', 'dba_open($db_name, "n", $handler);'); + run_creation_tests_ex($handler, '_existing.'.$extension, 'dba_open($db_name, "n", $handler);'); /* Trying to open an existing random file */ echo '=== OPENING EXISTING RANDOM FILE ===', \PHP_EOL; From 5d6d435bfa463ab1d70e9b3feff894ddb9f27df5 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 21 Jul 2022 13:27:06 +0100 Subject: [PATCH 08/12] GDBM test --- ext/dba/tests/dba_gdbm.phpt | 2 +- ext/dba/tests/dba_gdbm_creation_matrix.phpt | 92 ++++++++++++++------- 2 files changed, 65 insertions(+), 29 deletions(-) diff --git a/ext/dba/tests/dba_gdbm.phpt b/ext/dba/tests/dba_gdbm.phpt index ad7ae00d4f2a6..480e6063b5212 100644 --- a/ext/dba/tests/dba_gdbm.phpt +++ b/ext/dba/tests/dba_gdbm.phpt @@ -22,7 +22,7 @@ require_once __DIR__ . '/setup/setup_dba_tests.inc'; $db_name = 'dba_gdbm.db'; cleanup_standard_db($db_name); ?> ---EXPECT-- +--EXPECTF-- === RUNNING WITH FILE LOCK === Notice: dba_open(): Handler gdbm does locking internally in %s on line %d diff --git a/ext/dba/tests/dba_gdbm_creation_matrix.phpt b/ext/dba/tests/dba_gdbm_creation_matrix.phpt index d1bb9c7a08712..0e5e45e305ae5 100644 --- a/ext/dba/tests/dba_gdbm_creation_matrix.phpt +++ b/ext/dba/tests/dba_gdbm_creation_matrix.phpt @@ -25,55 +25,69 @@ clean_creation_tests($handler); === OPENING NON-EXISTING FILE === Mode parameter is "rl": -Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d Opening DB failed Mode parameter is "rd": -Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d Opening DB failed Mode parameter is "r-": -Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d Opening DB failed Mode parameter is "r": -Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d Opening DB failed Mode parameter is "wl": -Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d Opening DB failed Mode parameter is "wd": -Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d Opening DB failed Mode parameter is "w-": -Warning: dba_open(): Driver initialization failed for handler: gdbm: No such file or directory in %s on line %d +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d Opening DB failed Mode parameter is "w": -Warning: dba_open(gdbm_not_existing.db): Failed to open stream: No such file or directory in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: File open error in %s on line %d Opening DB failed Mode parameter is "cl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d This is a test insert Mode parameter is "cd": This is a test insert Mode parameter is "c-": -This is a test insert + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "c": This is a test insert Mode parameter is "nl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d This is a test insert Mode parameter is "nd": This is a test insert Mode parameter is "n-": -This is a test insert + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "n": This is a test insert === OPENING EXISTING DB FILE === Mode parameter is "rl": +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d Insertion failed Mode parameter is "rd": @@ -82,90 +96,112 @@ Warning: dba_insert(): You cannot perform a modification to a database without p Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d -Insertion failed +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "r": Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d Insertion failed Mode parameter is "wl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d This is a test insert Mode parameter is "wd": This is a test insert Mode parameter is "w-": -This is a test insert + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "w": This is a test insert Mode parameter is "cl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d This is a test insert Mode parameter is "cd": This is a test insert Mode parameter is "c-": -This is a test insert + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "c": This is a test insert Mode parameter is "nl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d This is a test insert Mode parameter is "nd": This is a test insert Mode parameter is "n-": -This is a test insert + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "n": This is a test insert === OPENING EXISTING RANDOM FILE === Mode parameter is "rl": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "rd": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "r-": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d Opening DB failed Mode parameter is "r": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "wl": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "wd": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "w-": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d Opening DB failed Mode parameter is "w": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "cl": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d + +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "cd": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "c-": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d Opening DB failed Mode parameter is "c": -Warning: dba_open(): Driver initialization failed for handler: gdbm: Invalid argument in %s on line %d +Warning: dba_open(): Driver initialization failed for handler: gdbm: Unexpected end of file in %s on line %d Opening DB failed Mode parameter is "nl": + +Notice: dba_open(): Handler gdbm does locking internally in %s on line %d This is a test insert Mode parameter is "nd": This is a test insert Mode parameter is "n-": -This is a test insert + +Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line %d +Opening DB failed Mode parameter is "n": This is a test insert From ff1685b1a442866452069528313ddb0ab1851662 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Thu, 21 Jul 2022 16:21:49 +0100 Subject: [PATCH 09/12] Drop XFAIL now the mem leak is fixed --- ext/dba/tests/dba_lmdb_creation_matrix.phpt | 2 -- 1 file changed, 2 deletions(-) diff --git a/ext/dba/tests/dba_lmdb_creation_matrix.phpt b/ext/dba/tests/dba_lmdb_creation_matrix.phpt index 9980ef74701a2..1d62063782dbb 100644 --- a/ext/dba/tests/dba_lmdb_creation_matrix.phpt +++ b/ext/dba/tests/dba_lmdb_creation_matrix.phpt @@ -2,8 +2,6 @@ DBA LMDB opening matrix of combination --EXTENSIONS-- dba ---XFAIL-- -Memory leak present --SKIPIF-- Date: Thu, 21 Jul 2022 16:18:23 +0100 Subject: [PATCH 10/12] WIP pgsql test fix --- ext/pgsql/tests/80_bug14383.phpt | 78 ++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/ext/pgsql/tests/80_bug14383.phpt b/ext/pgsql/tests/80_bug14383.phpt index c9848e30c1d64..f17af830d7041 100644 --- a/ext/pgsql/tests/80_bug14383.phpt +++ b/ext/pgsql/tests/80_bug14383.phpt @@ -5,7 +5,8 @@ dba pgsql --SKIPIF-- --FILE-- @@ -18,46 +19,65 @@ if (!$dbh) { } pg_close($dbh); -require_once(__DIR__.'/../../dba/tests/test.inc'); -require_once(__DIR__.'/../../dba/tests/dba_handler.inc'); +require_once dirname(__DIR__, 2) . '/dba/tests/setup/setup_dba_tests.inc'; +$name = 'bug14383.db'; +$handler = get_any_handler($name); +run_standard_tests($handler, $name); ?> --CLEAN-- --EXPECTF-- -database handler: %s -3NYNYY -Content String 2 -Content 2 replaced -Read during write:%sallowed -"key number 6" written -Failed to write "key number 6" 2nd time -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" -} ---NO-LOCK-- -3NYNYY -Content String 2 +Using handler: "%s" +=== RUNNING WITH FILE LOCK === +Remove key 1 and 3 +bool(true) +bool(true) +Try to remove key 1 again +bool(false) +key2: Content String 2 +key4: Another Content String +key5: The last content string +name9: Content String 9 +[key10]name10: Content String 10 +[key30]name30: Content String 30 +Total keys: 6 +Key 1 exists? N +Key 2 exists? Y +Key 3 exists? N +Key 4 exists? Y +Key 5 exists? Y +Replace second key data +bool(true) Content 2 replaced Read during write: not allowed -"key number 6" written -Failed to write "key number 6" 2nd time -Content 2 replaced 2nd time -The 6th value -array(3) { +Expected: Added a new data entry +Expected: Failed to insert data for already used key +Replace second key data +bool(true) +Delete "key4" +bool(true) +Fetch "key2": Content 2 replaced 2nd time +Fetch "key number 6": The 6th value +array(6) { + ["[key10]name10"]=> + string(17) "Content String 10" + ["[key30]name30"]=> + string(17) "Content String 30" ["key number 6"]=> string(13) "The 6th value" ["key2"]=> string(27) "Content 2 replaced 2nd time" ["key5"]=> string(23) "The last content string" + ["name9"]=> + string(16) "Content String 9" } +=== RUNNING WITH DB LOCK (default) === +SAME OUTPUT AS PREVIOUS RUN +=== RUNNING WITH NO LOCK === +SAME OUTPUT AS PREVIOUS RUN (modulo read during write due to no lock) From 26849b61aef5fd3b50b9a795a5891d8df8d29618 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Fri, 22 Jul 2022 16:31:01 +0100 Subject: [PATCH 11/12] Cleanup + drop todo comment --- ext/dba/tests/dba_array_keys_inifile.phpt | 4 ++-- ext/dba/tests/setup/setup_dba_tests.inc | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ext/dba/tests/dba_array_keys_inifile.phpt b/ext/dba/tests/dba_array_keys_inifile.phpt index 70ebbfc3ba772..658b53b8c0357 100644 --- a/ext/dba/tests/dba_array_keys_inifile.phpt +++ b/ext/dba/tests/dba_array_keys_inifile.phpt @@ -10,7 +10,7 @@ check_skip('inifile'); --FILE-- --EXPECTF-- diff --git a/ext/dba/tests/setup/setup_dba_tests.inc b/ext/dba/tests/setup/setup_dba_tests.inc index 19e9edcfacf0c..3e79ed3d54ce1 100644 --- a/ext/dba/tests/setup/setup_dba_tests.inc +++ b/ext/dba/tests/setup/setup_dba_tests.inc @@ -43,8 +43,6 @@ enum LockFlag: string { case NoLock = '-'; } -// TODO Test which opens a NON DB file to check for memory leaks (at least LMDB has) - function set_up_db_ex(string $handler, string $name, LockFlag $lock, bool $persistent = false) { $lock_flag = $lock->value; // Open file in creation/truncation mode From fb576f843f42379d4563ddba5819d843af4d3112 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 26 Jul 2022 12:43:14 +0100 Subject: [PATCH 12/12] Update test expectation after message update Also LMDB fails earlier now in some cases --- ext/dba/tests/dba_cdb_creation_matrix.phpt | 16 ++++++++-------- ext/dba/tests/dba_db4_creation_matrix.phpt | 8 ++++---- .../tests/dba_flatfile_creation_matrix.phpt | 16 ++++++++-------- ext/dba/tests/dba_gdbm_creation_matrix.phpt | 6 +++--- ext/dba/tests/dba_inifile_creation_matrix.phpt | 16 ++++++++-------- ext/dba/tests/dba_lmdb_creation_matrix.phpt | 18 +++++++++--------- ext/dba/tests/dba_qdbm_creation_matrix.phpt | 6 +++--- ext/dba/tests/dba_tcadb_creation_matrix.phpt | 8 ++++---- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/ext/dba/tests/dba_cdb_creation_matrix.phpt b/ext/dba/tests/dba_cdb_creation_matrix.phpt index cd4e2789df189..36880911c89cf 100644 --- a/ext/dba/tests/dba_cdb_creation_matrix.phpt +++ b/ext/dba/tests/dba_cdb_creation_matrix.phpt @@ -82,19 +82,19 @@ Cannot fetch insertion === OPENING EXISTING DB FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": @@ -139,19 +139,19 @@ Cannot fetch insertion === OPENING EXISTING RANDOM FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": diff --git a/ext/dba/tests/dba_db4_creation_matrix.phpt b/ext/dba/tests/dba_db4_creation_matrix.phpt index 171472ec3b2ae..2abfde5ebe02c 100644 --- a/ext/dba/tests/dba_db4_creation_matrix.phpt +++ b/ext/dba/tests/dba_db4_creation_matrix.phpt @@ -74,19 +74,19 @@ This is a test insert === OPENING EXISTING DB FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": This is a test insert diff --git a/ext/dba/tests/dba_flatfile_creation_matrix.phpt b/ext/dba/tests/dba_flatfile_creation_matrix.phpt index b37c340ad6fde..6009c07789417 100644 --- a/ext/dba/tests/dba_flatfile_creation_matrix.phpt +++ b/ext/dba/tests/dba_flatfile_creation_matrix.phpt @@ -74,19 +74,19 @@ This is a test insert === OPENING EXISTING DB FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": This is a test insert @@ -115,19 +115,19 @@ This is a test insert === OPENING EXISTING RANDOM FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": Cannot fetch insertion diff --git a/ext/dba/tests/dba_gdbm_creation_matrix.phpt b/ext/dba/tests/dba_gdbm_creation_matrix.phpt index 0e5e45e305ae5..b254819a21afc 100644 --- a/ext/dba/tests/dba_gdbm_creation_matrix.phpt +++ b/ext/dba/tests/dba_gdbm_creation_matrix.phpt @@ -88,11 +88,11 @@ Mode parameter is "rl": Notice: dba_open(): Handler gdbm does locking internally in %s on line %d -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": @@ -100,7 +100,7 @@ Warning: dba_open(): Locking cannot be disabled for handler gdbm in %s on line % Opening DB failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": diff --git a/ext/dba/tests/dba_inifile_creation_matrix.phpt b/ext/dba/tests/dba_inifile_creation_matrix.phpt index f48ed1a955d18..aff1fdfb4f165 100644 --- a/ext/dba/tests/dba_inifile_creation_matrix.phpt +++ b/ext/dba/tests/dba_inifile_creation_matrix.phpt @@ -74,19 +74,19 @@ This is a test insert === OPENING EXISTING DB FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": This is a test insert @@ -115,19 +115,19 @@ This is a test insert === OPENING EXISTING RANDOM FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": This is a test insert diff --git a/ext/dba/tests/dba_lmdb_creation_matrix.phpt b/ext/dba/tests/dba_lmdb_creation_matrix.phpt index 1d62063782dbb..ffe861934a24b 100644 --- a/ext/dba/tests/dba_lmdb_creation_matrix.phpt +++ b/ext/dba/tests/dba_lmdb_creation_matrix.phpt @@ -27,20 +27,20 @@ Mode parameter is "rl": Notice: dba_open(): Handler lmdb does locking internally in %s on line %d -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d -Insertion failed +Warning: dba_open(): Driver initialization failed for handler: lmdb: No such file or directory in %s on line %d +Opening DB failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d -Insertion failed +Warning: dba_open(): Driver initialization failed for handler: lmdb: No such file or directory in %s on line %d +Opening DB failed Mode parameter is "r-": Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line %d Opening DB failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d -Insertion failed +Warning: dba_open(): Driver initialization failed for handler: lmdb: No such file or directory in %s on line %d +Opening DB failed Mode parameter is "wl": Notice: dba_open(): Handler lmdb does locking internally in %s on line %d @@ -82,11 +82,11 @@ Mode parameter is "rl": Notice: dba_open(): Handler lmdb does locking internally in %s on line %d -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": @@ -94,7 +94,7 @@ Warning: dba_open(): Locking cannot be disabled for handler lmdb in %s on line % Opening DB failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": diff --git a/ext/dba/tests/dba_qdbm_creation_matrix.phpt b/ext/dba/tests/dba_qdbm_creation_matrix.phpt index d22243b2309fe..299dc70ec5418 100644 --- a/ext/dba/tests/dba_qdbm_creation_matrix.phpt +++ b/ext/dba/tests/dba_qdbm_creation_matrix.phpt @@ -88,11 +88,11 @@ Mode parameter is "rl": Notice: dba_open(): Handler qdbm does locking internally in %s on line %d -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": @@ -100,7 +100,7 @@ Warning: dba_open(): Locking cannot be disabled for handler qdbm in %s on line % Opening DB failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": diff --git a/ext/dba/tests/dba_tcadb_creation_matrix.phpt b/ext/dba/tests/dba_tcadb_creation_matrix.phpt index 6380f14dc96d0..e86efce75cae1 100644 --- a/ext/dba/tests/dba_tcadb_creation_matrix.phpt +++ b/ext/dba/tests/dba_tcadb_creation_matrix.phpt @@ -74,19 +74,19 @@ This is a test insert === OPENING EXISTING DB FILE === Mode parameter is "rl": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "rd": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r-": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "r": -Warning: dba_insert(): You cannot perform a modification to a database without proper access in %s on line %d +Warning: dba_insert(): Cannot perform a modification on a readonly database in %s on line %d Insertion failed Mode parameter is "wl": This is a test insert