From 99bd5525037af200796e9c40e4435ba7abbe81bb Mon Sep 17 00:00:00 2001 From: larrybr Date: Wed, 19 May 2021 02:33:42 +0000 Subject: [PATCH] Cure some TCL test failures and narrow an object scope. FossilOrigin-Name: 1155696c700862de1a8b1318bc41cd5cd01dec1af2c7720d8ef1e5c3321c425d --- manifest | 22 +++---- manifest.uuid | 2 +- src/memdb.c | 4 +- test/corrupt4.test | 28 ++++----- test/corruptN.test | 117 ++++++++++++++++++++------------------ test/releasetest.tcl | 1 - test/releasetest_data.tcl | 1 - 7 files changed, 90 insertions(+), 85 deletions(-) diff --git a/manifest b/manifest index cce7561db1..7d27194ce8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sMULTI-INDEX\sOR\squery\splan,\scode\sfor\ssub-expressions\scan\ssometimes\sbe\ngenerated\stwice.\s\sBut\sfor\ssome\ssubqueries,\sgenerating\scode\soff\sof\sthe\ssame\ntree\stwice\scauses\sproblems.\s\sSo\snow\sMULTI-INDEX\sOR\smakes\sa\scopy\sof\sthe\nsub-expressions\sit\suses\sto\savoid\scode-generating\sthem\smore\sthan\sonce.\ndbsqlfuzz\s9ebd2140e7206ff724e665f172faea28af801635. -D 2021-05-18T19:10:10.627 +C Cure\ssome\sTCL\stest\sfailures\sand\snarrow\san\sobject\sscope. +D 2021-05-19T02:33:42.773 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -514,7 +514,7 @@ F src/mem1.c c12a42539b1ba105e3707d0e628ad70e611040d8f5e38cf942cee30c867083de F src/mem2.c b93b8762ab999a29ae7751532dadf0a1ac78040308a5fb1d17fcc365171d67eb F src/mem3.c 30301196cace2a085cbedee1326a49f4b26deff0af68774ca82c1f7c06fda4f6 F src/mem5.c 9bf955937b07f8c32541c8a9991f33ce3173d944 -F src/memdb.c 5028ea424597fcec4fa80e0302bf535af1c82de27c3af01682bd5762a990419a +F src/memdb.c f6ce717b26cd51a24cda62fce611b4b72b3db367113374aa498e489a69470715 F src/memjournal.c 431c70a111223a8a6e2e7e9f014afc6c88d818d357d866afc563195f2277d50e F src/msvc.h 3a15918220367a8876be3fa4f2abe423a861491e84b864fb2b7426bf022a28f8 F src/mutex.c 5e3409715552348732e97b9194abe92fdfcd934cfb681df4ba0ab87ac6c18d25 @@ -782,7 +782,7 @@ F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4 F test/corrupt.test d7cb0300e4a297147b6a05e92a1684bc8973635c3bcaa3d66e983c9cbdbf47a3 F test/corrupt2.test bb50042cf9a1f1023d73af325d47eb02a6bb11e3c52f8812644b220c5d4bca35 F test/corrupt3.test 2520432b1fbf99994841e69804a3c59fb828183f4d09b85a1631bc7adca17e31 -F test/corrupt4.test 04965221ecd005901923fdc57f26811fa07178074b0672e50ea424c21638c708 +F test/corrupt4.test b5ae41607e8d17d9c1f3e94fdb572ce061ed3beeebdb46fb3a348181b8c8a097 F test/corrupt5.test 387be3250795e2a86e6234745558b80efb248a357d0cd8e53bce75c7463f545d F test/corrupt6.test fc6a891716139665dae0073b6945e3670bf92568 F test/corrupt7.test b036f94bda4b0b23a2919bf717046ce9ecca4543 @@ -801,7 +801,7 @@ F test/corruptJ.test 4d5ccc4bf959464229a836d60142831ef76a5aa4 F test/corruptK.test 5b4212fe346699831c5ad559a62c54e11c0611bdde1ea8423a091f9c01aa32af F test/corruptL.test df132ba9ffd6fa15038380b4154998b9904ab8f1ea78400d7da53c920cb3b13d F test/corruptM.test 7d574320e08c1b36caa3e47262061f186367d593a7e305d35f15289cc2c3e067 -F test/corruptN.test 7a8a8399f57cdc6a189f275230300ccbb2b31a5aea8399070251beeebe2cc02b +F test/corruptN.test f56e3417fe9a444efd765ae55acbe65595d7b8f747785fe0fd785dbdc424932a F test/cost.test b11cdbf9f11ffe8ef99c9881bf390e61fe92baf2182bad1dbe6de59a7295c576 F test/count.test 5364003488249957750a5f15ee42ca1cd7b100b1131c2dc71fff266a1250bf55 F test/countofview.test e17d6e6688cf74f22783c9ec6e788c0790ee4fbbaee713affd00b1ac0bb39b86 @@ -1293,8 +1293,8 @@ F test/recover.test ccb8c2623902a92ebb76770edd075cb4f75a4760bb7afde38026572c6e79 F test/regexp1.test 497ea812f264d12b6198d6e50a76be4a1973a9d8 F test/regexp2.test 40e894223b3d6672655481493f1be12012f2b33c F test/reindex.test cd9d6021729910ece82267b4f5e1b5ac2911a7566c43b43c176a6a4732e2118d -F test/releasetest.tcl 7b2a9968f81a77558d94f5a028ed67c4a767df92f921b00f24ea8fa08d08b212 x -F test/releasetest_data.tcl a05e066e409680e1baa4a36d6467e70bbfca6edca528c7cd99c9c6cbdcebeb85 +F test/releasetest.tcl 6f803ef0b896f8f3f4c26eb072c0399963a5987a509a64d45f5dfbc1ebae2951 x +F test/releasetest_data.tcl f88ed29aa18366ed3956ace36c96ec6868ef5b9ee04cc05d32f4d81031e19e28 F test/resetdb.test 8062cf10a09d8c048f8de7711e94571c38b38168db0e5877ba7561789e5eeb2b F test/resolver01.test f4022acafda7f4d40eca94dbf16bc5fc4ac30ceb F test/returning1.test 353a87c22f4607ffcf74d2aa6cf09f8ab20c77fd78a87187e20dbb196d125d36 @@ -1913,7 +1913,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P f2a17f1fad08779486e4d50d0d9277c7f87a9558a53af1a68aa5fe2ec30e820e -R d1ee727748d372a9a4a6be0c1bffc86c -U drh -Z 41c8ad722578c7f47efc179345a7656e +P 4a55f72542c8bcc80253aa77043314cecb29d73cb4f51aa80f7811e86cc8ef68 +R f721dcacaf96f60a8059027d8f123919 +U larrybr +Z 681dd5878065eb5f11f8cfdfb71baed7 diff --git a/manifest.uuid b/manifest.uuid index f8eef81ae5..8ad9c481a7 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4a55f72542c8bcc80253aa77043314cecb29d73cb4f51aa80f7811e86cc8ef68 \ No newline at end of file +1155696c700862de1a8b1318bc41cd5cd01dec1af2c7720d8ef1e5c3321c425d \ No newline at end of file diff --git a/src/memdb.c b/src/memdb.c index 4560d6ed65..965ec36d41 100644 --- a/src/memdb.c +++ b/src/memdb.c @@ -89,12 +89,12 @@ struct MemFile { }; /* -** Global variables for holding the memdb files that are accessible +** File-scope variables for holding the memdb files that are accessible ** to multiple database connections in separate threads. ** ** Must hold SQLITE_MUTEX_STATIC_VFS1 to access any part of this object. */ -struct MemFS { +static struct MemFS { int nMemStore; /* Number of shared MemStore objects */ MemStore **apMemStore; /* Array of all shared MemStore objects */ } memdb_g; diff --git a/test/corrupt4.test b/test/corrupt4.test index 0aa42aa6ab..5b0965a836 100644 --- a/test/corrupt4.test +++ b/test/corrupt4.test @@ -129,19 +129,21 @@ set pgnoChild [get4byte $fd $offChild] put4byte $fd $offChild 1 close $fd -sqlite3 db test.db -do_catchsql_test 2.2 { - PRAGMA writable_schema = 1; - SELECT * FROM sqlite_schema; -} {1 {database disk image is malformed}} - -do_test 2.3 { - list [catch { - for {set ii $nView} {$ii<$nView*2} {incr ii} { - execsql "INSERT INTO sqlite_master VALUES(1, 2, 3, 4, 5)" - } - } msg] $msg -} {1 {database disk image is malformed}} +if {![info exists ::G(perm:presql)]} { + sqlite3 db test.db + do_catchsql_test 2.2 { + PRAGMA writable_schema = 1; + SELECT * FROM sqlite_schema; + } {1 {database disk image is malformed}} + + do_test 2.3 { + list [catch { + for {set ii $nView} {$ii<$nView*2} {incr ii} { + execsql "INSERT INTO sqlite_master VALUES(1, 2, 3, 4, 5)" + } + } msg] $msg + } {1 {database disk image is malformed}} +} finish_test diff --git a/test/corruptN.test b/test/corruptN.test index 8eca2fdb8d..4349468bb5 100644 --- a/test/corruptN.test +++ b/test/corruptN.test @@ -149,69 +149,74 @@ INSERT INTO t1(a) SELECT randomblob(null) FROM c; } {1 {database disk image is malformed}} reset_db -do_execsql_test 3.0 { - CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y); - PRAGMA writable_schema = 1; - UPDATE sqlite_schema - SET sql = 'CREATE TABLE sqlite_sequence(name-seq)' - WHERE name = 'sqlite_sequence'; -} -db close -sqlite3 db test.db -do_catchsql_test 3.1 { - PRAGMA writable_schema = 1; - INSERT INTO t1(y) VALUES('abc'); -} {1 {database disk image is malformed}} +if {![info exists ::G(perm:presql)]} { + do_execsql_test 3.0 { + CREATE TABLE t1(x INTEGER PRIMARY KEY AUTOINCREMENT, y); + PRAGMA writable_schema = 1; + UPDATE sqlite_schema + SET sql = 'CREATE TABLE sqlite_sequence(name-seq)' + WHERE name = 'sqlite_sequence'; + } + db close + sqlite3 db test.db + do_catchsql_test 3.1 { + PRAGMA writable_schema = 1; + INSERT INTO t1(y) VALUES('abc'); + } {1 {database disk image is malformed}} + reset_db + + do_execsql_test 4.1 { + CREATE TABLE x1(a INTEGER PRIMARY KEY, b UNIQUE, c UNIQUE); + INSERT INTO x1 VALUES(1, 1, 2); + INSERT INTO x1 VALUES(2, 2, 3); + INSERT INTO x1 VALUES(3, 3, 4); + INSERT INTO x1 VALUES(4, 5, 6); + PRAGMA writable_schema = 1; + + UPDATE sqlite_schema SET rootpage = ( + SELECT rootpage FROM sqlite_schema WHERE name = 'sqlite_autoindex_x1_2' + ) WHERE name = 'sqlite_autoindex_x1_1'; + } + + db close + sqlite3 db test.db + breakpoint + do_catchsql_test 4.2 { + PRAGMA writable_schema = 1; + REPLACE INTO x1 VALUES(5, 2, 3); + } {1 {database disk image is malformed}} -reset_db -do_execsql_test 4.1 { - CREATE TABLE x1(a INTEGER PRIMARY KEY, b UNIQUE, c UNIQUE); - INSERT INTO x1 VALUES(1, 1, 2); - INSERT INTO x1 VALUES(2, 2, 3); - INSERT INTO x1 VALUES(3, 3, 4); - INSERT INTO x1 VALUES(4, 5, 6); - PRAGMA writable_schema = 1; - - UPDATE sqlite_schema SET rootpage = ( - SELECT rootpage FROM sqlite_schema WHERE name = 'sqlite_autoindex_x1_2' - ) WHERE name = 'sqlite_autoindex_x1_1'; } -db close -sqlite3 db test.db -breakpoint -do_catchsql_test 3.1 { - PRAGMA writable_schema = 1; - REPLACE INTO x1 VALUES(5, 2, 3); -} {1 {database disk image is malformed}} - #------------------------------------------------------------------------- reset_db -db func strreplace strreplace -proc strreplace {orig a b} { - string map [list $a $b] $orig -} - -do_execsql_test 4.0 { - CREATE TABLE t1(a, b); - CREATE INDEX t1a ON t1(a); - CREATE INDEX t1b ON t1(b); - - PRAGMA writable_schema = 1; - UPDATE sqlite_schema - SET sql = strreplace(sql, 't1', 'json_each') - WHERE type='index'; -} - -db close -sqlite3 db test.db - -do_execsql_test 4.1 { - PRAGMA writable_schema = 1; - SELECT * FROM t1 -} +ifcapable json1&&vtab { + db func strreplace strreplace + proc strreplace {orig a b} { + string map [list $a $b] $orig + } + + do_execsql_test 5.0 { + CREATE TABLE t1(a, b); + CREATE INDEX t1a ON t1(a); + CREATE INDEX t1b ON t1(b); + + PRAGMA writable_schema = 1; + UPDATE sqlite_schema + SET sql = strreplace(sql, 't1', 'json_each') + WHERE type='index'; + } + + db close + sqlite3 db test.db + + do_execsql_test 5.1 { + PRAGMA writable_schema = 1; + SELECT * FROM t1 + } +}; # ifcapable json1&&vtab finish_test diff --git a/test/releasetest.tcl b/test/releasetest.tcl index 5822a2676e..da6113a19a 100755 --- a/test/releasetest.tcl +++ b/test/releasetest.tcl @@ -161,7 +161,6 @@ array set ::Configs [strip_comments { -DSQLITE_OMIT_VIRTUALTABLE=1 -DSQLITE_ENABLE_HIDDEN_COLUMNS -DSQLITE_TEMP_STORE=3 - -DSQLITE_OMIT_DESERIALIZE=1 --enable-json1 } "Device-Two" { diff --git a/test/releasetest_data.tcl b/test/releasetest_data.tcl index 876020c0f0..00be202286 100644 --- a/test/releasetest_data.tcl +++ b/test/releasetest_data.tcl @@ -169,7 +169,6 @@ array set ::Configs [strip_comments { -DSQLITE_OMIT_VIRTUALTABLE=1 -DSQLITE_ENABLE_HIDDEN_COLUMNS -DSQLITE_TEMP_STORE=3 - -DSQLITE_OMIT_DESERIALIZE=1 --enable-json1 } "Device-Two" { -- 2.47.2