From f0578823ddf4cc283595625d2a345fb022fa7eb3 Mon Sep 17 00:00:00 2001 From: dan Date: Wed, 2 Oct 2019 19:43:38 +0000 Subject: [PATCH] Update corruptM.test to account for the fact that the database schema may be loaded from within the "sqlite3" command for some test permutations. FossilOrigin-Name: cb9470fc064aad72a4e42c6a021410401b3b1a32446ae8b9cd9c759f0a2a01ef --- manifest | 12 +++---- manifest.uuid | 2 +- test/corruptM.test | 88 +++++++++++++++++++--------------------------- 3 files changed, 43 insertions(+), 59 deletions(-) diff --git a/manifest b/manifest index 400777bad9..b514708d03 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\slong-standing\sproblem\sin\sfts4\sincrmental\smerge. -D 2019-10-02T19:33:34.820 +C Update\scorruptM.test\sto\saccount\sfor\sthe\sfact\sthat\sthe\sdatabase\sschema\smay\sbe\sloaded\sfrom\swithin\sthe\s"sqlite3"\scommand\sfor\ssome\stest\spermutations. +D 2019-10-02T19:43:38.593 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -770,7 +770,7 @@ F test/corruptI.test a17bbf54fdde78d43cf3cc34b0057719fd4a173a3d824285b67dc5257c0 F test/corruptJ.test 4d5ccc4bf959464229a836d60142831ef76a5aa4 F test/corruptK.test 5b4212fe346699831c5ad559a62c54e11c0611bdde1ea8423a091f9c01aa32af F test/corruptL.test dfad96373bf9264d73039315ea6013994b90bf6776847adc7ec06b6fad3c04b2 -F test/corruptM.test 04a4061b1979283851953217e411187be79e50f5e5e3ef340c3f8e564173aae1 +F test/corruptM.test 7d574320e08c1b36caa3e47262061f186367d593a7e305d35f15289cc2c3e067 F test/cost.test 51f4fcaae6e78ad5a57096831259ed6c760e2ac6876836e91c00030fad385b34 F test/count.test cb2e0f934c6eb33670044520748d2ecccd46259c F test/countofview.test e17d6e6688cf74f22783c9ec6e788c0790ee4fbbaee713affd00b1ac0bb39b86 @@ -1846,7 +1846,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 9f4035f91a9f914797c67afbf19139b2cd25aea48595f7254fe5d18cd693d972 -R ecf43fec21823a32835595bc3d6e883d +P 67da31e24ebb49c4cac81c9e7cfca37ca422555fd0fdb01d8f180890783c84ff +R af61f483cecb17e85d55b46e8f6dcdd9 U dan -Z 5ae170bea58b20654aba07c2eb8e0ce7 +Z 55a2533bc51db158e8dea3afe120e7b9 diff --git a/manifest.uuid b/manifest.uuid index ed75b7ad90..16a75fe474 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -67da31e24ebb49c4cac81c9e7cfca37ca422555fd0fdb01d8f180890783c84ff \ No newline at end of file +cb9470fc064aad72a4e42c6a021410401b3b1a32446ae8b9cd9c759f0a2a01ef \ No newline at end of file diff --git a/test/corruptM.test b/test/corruptM.test index 0b9f5e4983..15fc8d6d0d 100644 --- a/test/corruptM.test +++ b/test/corruptM.test @@ -22,6 +22,16 @@ set testprefix corruptM # database_may_be_corrupt +proc open_db2_and_catchsql {sql} { + set rc [catch { sqlite3 db2 test.db } msg] + if {$rc} { + return [list $rc $msg] + } + set res [catchsql $sql db2] + db2 close + set res +} + db close forcedelete test.db sqlite3 db test.db @@ -38,165 +48,139 @@ do_execsql_test corruptM-101 { UPDATE sqlite_master SET tbl_name=NULL WHERE name='t1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 {} | index i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-102 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; - } db2 + } } {1 {malformed database schema (t1)}} -db2 close do_execsql_test corruptM-110 { UPDATE sqlite_master SET tbl_name='tx' WHERE name='t1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 tx | index i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-111 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; - } db2 + } } {1 {malformed database schema (t1)}} -db2 close do_execsql_test corruptM-112 { UPDATE sqlite_master SET tbl_name='t1', type='tabl' WHERE name='t1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {tabl t1 t1 | index i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-113 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; - } db2 + } } {1 {malformed database schema (t1)}} -db2 close do_execsql_test corruptM-114 { UPDATE sqlite_master SET tbl_name='t9',type='table',name='t9'WHERE name='t1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t9 t9 | index i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-114 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; - } db2 + } } {1 {malformed database schema (t9)}} -db2 close do_execsql_test corruptM-120 { UPDATE sqlite_master SET name='t1',tbl_name='T1' WHERE name='t9'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 T1 | index i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-121 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {0 {ok 111 222 333 15 22}} -db2 close do_execsql_test corruptM-130 { UPDATE sqlite_master SET type='view' WHERE name='t1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {view t1 T1 | index i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-131 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (t1)}} -db2 close do_execsql_test corruptM-140 { UPDATE sqlite_master SET type='table', tbl_name='t1' WHERE name='t1'; UPDATE sqlite_master SET tbl_name='tx' WHERE name='i1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | index i1 tx | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-141 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (i1)}} -db2 close do_execsql_test corruptM-150 { UPDATE sqlite_master SET type='table', tbl_name='t1' WHERE name='i1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | table i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-151 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (i1)}} -db2 close do_execsql_test corruptM-160 { UPDATE sqlite_master SET type='view', tbl_name='t1' WHERE name='i1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | view i1 t1 | view v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-161 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (i1)}} -db2 close do_execsql_test corruptM-170 { UPDATE sqlite_master SET type='index', tbl_name='t1' WHERE name='i1'; UPDATE sqlite_master SET type='table', tbl_name='v2' WHERE name='v2'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | index i1 t1 | table v2 v2 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-171 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (v2)}} -db2 close do_execsql_test corruptM-180 { UPDATE sqlite_master SET type='view',name='v3',tbl_name='v3' WHERE name='v2'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | index i1 t1 | view v3 v3 | trigger r1 t1 |} -sqlite3 db2 test.db do_test corruptM-181 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (v3)}} -db2 close do_execsql_test corruptM-190 { UPDATE sqlite_master SET type='view',name='v2',tbl_name='v2' WHERE name='v3'; UPDATE sqlite_master SET type='view' WHERE name='r1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | index i1 t1 | view v2 v2 | view r1 t1 |} -sqlite3 db2 test.db do_test corruptM-191 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (r1)}} -db2 close do_execsql_test corruptM-192 { UPDATE sqlite_master SET type='trigger',tbl_name='v2' WHERE name='r1'; SELECT type, name, tbl_name, '|' FROM sqlite_master; } {table t1 t1 | index i1 t1 | view v2 v2 | trigger r1 v2 |} -sqlite3 db2 test.db do_test corruptM-193 { - catchsql { + open_db2_and_catchsql { PRAGMA quick_check; SELECT * FROM t1, v2; - } db2 + } } {1 {malformed database schema (r1)}} -db2 close finish_test