diff options
author | drh <drh@noemail.net> | 2013-11-29 15:06:27 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2013-11-29 15:06:27 +0000 |
commit | 09fe614372b54ba46196ba8387561460919ecfc9 (patch) | |
tree | 4116c98b2af17422d3575725977a2fa11f9cbdb7 | |
parent | 1b4b334abbf67fe23e7ca03f76045625b24c8ef1 (diff) | |
download | sqlite-09fe614372b54ba46196ba8387561460919ecfc9.tar.gz sqlite-09fe614372b54ba46196ba8387561460919ecfc9.zip |
Add a new sqlite3_test_control() that indicates that database files are
always well-formed. Use this during testing to enable assert() statements
that prove conditions that are always true for well-formed databases.
FossilOrigin-Name: 15e4f63d1f3cbcd0aa789fd3e460cd6e4d3338f9
-rw-r--r-- | manifest | 58 | ||||
-rw-r--r-- | manifest.uuid | 2 | ||||
-rw-r--r-- | src/global.c | 2 | ||||
-rw-r--r-- | src/main.c | 13 | ||||
-rw-r--r-- | src/sqlite.h.in | 3 | ||||
-rw-r--r-- | src/sqliteInt.h | 18 | ||||
-rw-r--r-- | src/test1.c | 33 | ||||
-rw-r--r-- | src/vdbeaux.c | 3 | ||||
-rw-r--r-- | test/corrupt.test | 4 | ||||
-rw-r--r-- | test/corrupt2.test | 4 | ||||
-rw-r--r-- | test/corrupt3.test | 4 | ||||
-rw-r--r-- | test/corrupt4.test | 4 | ||||
-rw-r--r-- | test/corrupt5.test | 4 | ||||
-rw-r--r-- | test/corrupt6.test | 4 | ||||
-rw-r--r-- | test/corrupt7.test | 4 | ||||
-rw-r--r-- | test/corrupt8.test | 4 | ||||
-rw-r--r-- | test/corrupt9.test | 4 | ||||
-rw-r--r-- | test/corruptA.test | 4 | ||||
-rw-r--r-- | test/corruptB.test | 4 | ||||
-rw-r--r-- | test/corruptC.test | 4 | ||||
-rw-r--r-- | test/corruptD.test | 4 | ||||
-rw-r--r-- | test/corruptE.test | 4 | ||||
-rw-r--r-- | test/corruptF.test | 4 | ||||
-rw-r--r-- | test/corruptG.test | 4 | ||||
-rw-r--r-- | test/tester.tcl | 6 |
25 files changed, 169 insertions, 33 deletions
@@ -1,5 +1,5 @@ -C Update\sa\sfew\stest\scases\sto\saccount\sfor\sthe\snew\serror\smessage\sformats. -D 2013-11-28T19:28:00.296 +C Add\sa\snew\ssqlite3_test_control()\sthat\sindicates\sthat\sdatabase\sfiles\sare\nalways\swell-formed.\s\sUse\sthis\sduring\stesting\sto\senable\sassert()\sstatements\nthat\sprove\sconditions\sthat\sare\salways\strue\sfor\swell-formed\sdatabases. +D 2013-11-29T15:06:27.785 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e1a9b4258bbde53f5636f4e238c65b7e11459e2b F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -179,7 +179,7 @@ F src/expr.c 31a2b65339f6c3795d4cfa5e99798cd72f9fdfdf F src/fault.c 160a0c015b6c2629d3899ed2daf63d75754a32bb F src/fkey.c 2ab0f5384b70594468ef3ac5c7ed8ca24bfd17d5 F src/func.c ef30d26ae4d79bbc7300c74e77fd117a0ba30235 -F src/global.c 5caf4deab621abb45b4c607aad1bd21c20aac759 +F src/global.c 1d7bb7ea8254ae6a68ed9bfaf65fcb3d1690b486 F src/hash.c ac3470bbf1ca4ae4e306a8ecb0fdf1731810ffe4 F src/hash.h 8890a25af81fb85a9ad7790d32eedab4b994da22 F src/hwtime.h d32741c8f4df852c7d959236615444e2b1063b08 @@ -188,7 +188,7 @@ F src/journal.c b4124532212b6952f42eb2c12fa3c25701d8ba8d F src/legacy.c 0df0b1550b9cc1f58229644735e317ac89131f12 F src/lempar.c cdf0a000315332fc9b50b62f3b5e22e080a0952b F src/loadext.c 867c7b330b740c6c917af9956b13b81d0a048303 -F src/main.c 441a2e106d0e2913fec47e5f13d5802c742e32bb +F src/main.c 74bdee8f574588868e67c25cd377df7cba80102e F src/malloc.c 543a8eb5508eaf4cadf55a9b503379eba2088128 F src/mem0.c 6a55ebe57c46ca1a7d98da93aaa07f99f1059645 F src/mem1.c c0c990fcaddff810ea277b4fb5d9138603dd5d4b @@ -221,15 +221,15 @@ F src/resolve.c 7eda9097b29fcf3d2b42fdc17d1de672134e09b6 F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0 F src/select.c d41381d80a22d3a83352aeca274cccf264ac277a F src/shell.c 936a72ff784efff3832cce274a96ed0b036e6758 -F src/sqlite.h.in af7f4349f939c40848bdfa217855d0bb88f3a581 +F src/sqlite.h.in baf55c31c4e15a4b626acfeaa792f2aaa566657f F src/sqlite3.rc 11094cc6a157a028b301a9f06b3d03089ea37c3e F src/sqlite3ext.h 886f5a34de171002ad46fae8c36a7d8051c190fc -F src/sqliteInt.h 9d586cb37572cd9e0a48242d449c6a69c2e74e72 +F src/sqliteInt.h c26e4cde71fd6dbe34b708f2abd2f6436ce191bf F src/sqliteLimit.h 164b0e6749d31e0daa1a4589a169d31c0dec7b3d F src/status.c 7ac05a5c7017d0b9f0b4bcd701228b784f987158 F src/table.c 2cd62736f845d82200acfa1287e33feb3c15d62e F src/tclsqlite.c 651b10698c87bbc3ae5772e2491e3444c5bbf153 -F src/test1.c 5757066e503a8ed51313cb3a5d9bcdcced2991a9 +F src/test1.c 760e0419705f712d80595f47199568cd7e3b57a4 F src/test2.c 7355101c085304b90024f2261e056cdff13c6c35 F src/test3.c 1c0e5d6f080b8e33c1ce8b3078e7013fdbcd560c F src/test4.c 9b32d22f5f150abe23c1830e2057c4037c45b3df @@ -284,7 +284,7 @@ F src/vdbe.c 54894fde8dc806d259e015ac7c9680145e725835 F src/vdbe.h c06f0813f853566457ce9cfb1a4a4bc39a5da644 F src/vdbeInt.h 05fbda0e061dbc4aaa2709a8cccf3515c245b263 F src/vdbeapi.c 93a22a9ba2abe292d5c2cf304d7eb2e894dde0ed -F src/vdbeaux.c 91438d61d807e738c876c902bf93911294fa4e9c +F src/vdbeaux.c 28a791e1694018f7143c349b154b78237f0ea1fb F src/vdbeblob.c 8cd05a5630e6d5563ad017bf82edaf812b28acde F src/vdbemem.c af650c2019dc197f062440cdb4650b7204e648bf F src/vdbesort.c 9d83601f9d6243fe70dd0169a2820c5ddfd48147 @@ -390,22 +390,22 @@ F test/conflict.test 841bcf7cabbfca39c577eb8411ea8601843b46a8 F test/conflict2.test 3ed0b6ec3c2cb8acebbc89677ea0e58c01aaa1ff F test/conflict3.test dec0634c0f31dec9a4b01c63063e939f0cd21b6b F test/contrib01.test 2a1cbc0f2f48955d7d073f725765da6fbceda6b4 -F test/corrupt.test 4aabd06cff3fe759e3e658bcc17b71789710665e -F test/corrupt2.test 9c0ab4becd50e9050bc1ebb8675456a4e5587bf0 -F test/corrupt3.test 889d7cdb811800303aa722d7813fe8a4299cf726 -F test/corrupt4.test b963f9e01e0f92d15c76fb0747876fd4b96dc30a -F test/corrupt5.test c23da7bfb20917cc7fdbb13ee25c7cc4e9fffeff -F test/corrupt6.test 4e4161aef1f30b9f34582bb4142334b7f47eacae -F test/corrupt7.test a90caf89c7d7cb7893ea4d92529bd0c129317ee4 -F test/corrupt8.test 48eb37ffb9a03bceada62219e2bd4c92f4b0cb75 -F test/corrupt9.test 959179e68dc0b7b99f424cf3e0381c86dcdd0112 -F test/corruptA.test fafa652aa585753be4f6b62ff0bb250266eaf7ce -F test/corruptB.test 20d4a20cbed23958888c3e8995b424a47223d647 -F test/corruptC.test b497c185822c6042d48e2397bbb61b6afa9145f2 -F test/corruptD.test 3b09903a2e2fe07ecafe775fea94177f8a4bb34f -F test/corruptE.test d3a3d7e864a95978195741744dda4abfd8286018 -F test/corruptF.test 1c7b6f77cf3f237fb7fbb5b61d6c921fd4c7b993 -F test/corruptG.test c67fd860e9e3943bc90b856a3049c9a28827167e +F test/corrupt.test 141c39ea650c1365e85a49e402fa05cb9617fb97 +F test/corrupt2.test f2064e0bf934124cc38868fd8badb8f0dd67b552 +F test/corrupt3.test 4b548d0bbe2933bc81d3f54099a05fc4d28aff18 +F test/corrupt4.test b99652079d542b21f4965f6248703b983e40fe80 +F test/corrupt5.test 8ead52af76006f3286e9396cb41898018ccea107 +F test/corrupt6.test 269548d19427ac554c830763b1c5ea54a0252f80 +F test/corrupt7.test 22cc644c2e76c9804bc844121267aa6f8f7c0ded +F test/corrupt8.test 2399dfe40d2c0c63af86706e30f3e6302a8d0516 +F test/corrupt9.test 730a3db08d4ab9aa43392ea30d9c2b4879cbff85 +F test/corruptA.test 53e56dafd180addcdadb402244b8cb9771d2ba26 +F test/corruptB.test 73a8d6c0b9833697ecf16b63e3c5c05c945b5dec +F test/corruptC.test 02405cf7ed0c1e989060e1aab6d02ffbc3906fbb +F test/corruptD.test b3c205fac7952b1de645ce44bb02335cd9e3e040 +F test/corruptE.test 193b4ca4e927e77c1d5f4f56203ddc998432a7ee +F test/corruptF.test be9fde98e4c93648f1ba52b74e5318edc8f59fe4 +F test/corruptG.test c150f156dace653c00a121ad0f5772a0568c41ba F test/count.test 42a251178e32f617eda33f76236a7f79825a50b5 F test/coveridxscan.test cdb47d01acc4a634a34fd25abe85189e0d0f1e62 F test/crash.test fb9dc4a02dcba30d4aa5c2c226f98b220b2b959f @@ -840,7 +840,7 @@ F test/tclsqlite.test 37a61c2da7e3bfe3b8c1a2867199f6b860df5d43 F test/tempdb.test 19d0f66e2e3eeffd68661a11c83ba5e6ace9128c F test/temptable.test d2c9b87a54147161bcd1822e30c1d1cd891e5b30 F test/temptrigger.test 8ec228b0db5d7ebc4ee9b458fc28cb9e7873f5e1 -F test/tester.tcl bce6b929932498383ce92431da6a96432c690bf7 +F test/tester.tcl 2a7cce4abf404557c09323a84a2444b189835d0f F test/thread001.test 9f22fd3525a307ff42a326b6bc7b0465be1745a5 F test/thread002.test e630504f8a06c00bf8bbe68528774dd96aeb2e58 F test/thread003.test ee4c9efc3b86a6a2767516a37bd64251272560a7 @@ -1145,7 +1145,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh d1a6de74685f360ab718efda6265994b99bbea01 F tool/win/sqlite.vsix 030f3eeaf2cb811a3692ab9c14d021a75ce41fff -P 0bcf75516f59e49536f9e5c5cd542058ab61e2fc -R 6e7556e59872b6a951f274edf04e3ab4 -U dan -Z 028b27b689b89b3e9fc267cb7f1e10e7 +P 65a5bce3ffb656a43a2e5d2308a4bc67497105de +R e2c54e83c6d9de52db2502c5f23f4d01 +U drh +Z 79de7aa38f99c75e5cc2a8b158cbdc48 diff --git a/manifest.uuid b/manifest.uuid index a1bddb66b..f6f482e26 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -65a5bce3ffb656a43a2e5d2308a4bc67497105de
\ No newline at end of file +15e4f63d1f3cbcd0aa789fd3e460cd6e4d3338f9
\ No newline at end of file diff --git a/src/global.c b/src/global.c index 7b02cf213..1ee3f6436 100644 --- a/src/global.c +++ b/src/global.c @@ -148,6 +148,7 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { SQLITE_USE_URI, /* bOpenUri */ SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ 0x7ffffffe, /* mxStrlen */ + 0, /* neverCorrupt */ 128, /* szLookaside */ 500, /* nLookaside */ {0,0,0,0,0,0,0,0}, /* m */ @@ -183,7 +184,6 @@ SQLITE_WSD struct Sqlite3Config sqlite3Config = { #endif }; - /* ** Hash table for global functions - functions common to all ** database connections. After initialization, this table is diff --git a/src/main.c b/src/main.c index a6a04b4b4..69a399f38 100644 --- a/src/main.c +++ b/src/main.c @@ -3296,6 +3296,19 @@ int sqlite3_test_control(int op, ...){ } #endif + /* sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int); + ** + ** Set or clear a flag that indicates that the database file is always well- + ** formed and never corrupt. This flag is clear by default, indicating that + ** database files might have arbitrary corruption. Setting the flag during + ** testing causes certain assert() statements in the code to be activated + ** that demonstrat invariants on well-formed database files. + */ + case SQLITE_TESTCTRL_NEVER_CORRUPT: { + sqlite3Config.neverCorrupt = va_arg(ap, int); + break; + } + } va_end(ap); #endif /* SQLITE_OMIT_BUILTIN_TEST */ diff --git a/src/sqlite.h.in b/src/sqlite.h.in index 228d9cca3..98c89da32 100644 --- a/src/sqlite.h.in +++ b/src/sqlite.h.in @@ -6069,7 +6069,8 @@ int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_SCRATCHMALLOC 17 #define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 #define SQLITE_TESTCTRL_EXPLAIN_STMT 19 -#define SQLITE_TESTCTRL_LAST 19 +#define SQLITE_TESTCTRL_NEVER_CORRUPT 20 +#define SQLITE_TESTCTRL_LAST 20 /* ** CAPI3REF: SQLite Runtime Status diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 6373bb75d..98dabeb4e 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -2538,6 +2538,7 @@ struct Sqlite3Config { int bOpenUri; /* True to interpret filenames as URIs */ int bUseCis; /* Use covering indices for full-scans */ int mxStrlen; /* Maximum string length */ + int neverCorrupt; /* Database is always well-formed */ int szLookaside; /* Default lookaside buffer size */ int nLookaside; /* Default lookaside buffer count */ sqlite3_mem_methods m; /* Low-level memory allocation interface */ @@ -2575,6 +2576,23 @@ struct Sqlite3Config { }; /* +** This macro is used inside of assert() statements to indicate that +** the assert is only valid on a well-formed database. Instead of: +** +** assert( X ); +** +** One writes: +** +** assert( X || CORRUPTIBLE ); +** +** CORRUPTIBLE is true during normal operation. But for many test cases, +** it is set to false using a sqlite3_test_control(). This enables assert() +** statements to prove things that are always true for well-formed +** databases. +*/ +#define CORRUPTIBLE (sqlite3Config.neverCorrupt==0) + +/* ** Context pointer passed down through the tree-walk. */ struct Walker { diff --git a/src/test1.c b/src/test1.c index d8a9e52d2..e0c16e13a 100644 --- a/src/test1.c +++ b/src/test1.c @@ -5454,6 +5454,37 @@ static int reset_prng_state( } /* +** tclcmd: database_may_be_corrupt +** +** Indicate that database files might be corrupt. In other words, set the normal +** state of operation. +*/ +static int database_may_be_corrupt( + ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, 0); + return TCL_OK; +} +/* +** tclcmd: database_never_corrupt +** +** Indicate that database files are always well-formed. This enables extra assert() +** statements that test conditions that are always true for well-formed databases. +*/ +static int database_never_corrupt( + ClientData clientData, /* Pointer to sqlite3_enable_XXX function */ + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int objc, /* Number of arguments */ + Tcl_Obj *CONST objv[] /* Command arguments */ +){ + sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, 1); + return TCL_OK; +} + +/* ** tclcmd: pcache_stats */ static int test_pcache_stats( @@ -6331,6 +6362,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){ { "save_prng_state", save_prng_state, 0 }, { "restore_prng_state", restore_prng_state, 0 }, { "reset_prng_state", reset_prng_state, 0 }, + { "database_never_corrupt", database_never_corrupt, 0}, + { "database_may_be_corrupt", database_may_be_corrupt, 0}, { "optimization_control", optimization_control,0}, #if SQLITE_OS_WIN { "lock_win32_file", win32_file_lock, 0 }, diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 1f51e681b..85685f357 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -3112,8 +3112,9 @@ int sqlite3VdbeRecordCompare( idx1 = getVarint32(aKey1, szHdr1); d1 = szHdr1; - assert( pKeyInfo->nField+pKeyInfo->nXField>=pPKey2->nField ); + assert( pKeyInfo->nField+pKeyInfo->nXField>=pPKey2->nField || CORRUPTIBLE ); assert( pKeyInfo->aSortOrder!=0 ); + assert( (idx1<=szHdr1 && i<pPKey2->nField) || CORRUPTIBLE ); do{ u32 serial_type1; diff --git a/test/corrupt.test b/test/corrupt.test index 09f3c5bd7..3e49a9ff1 100644 --- a/test/corrupt.test +++ b/test/corrupt.test @@ -25,6 +25,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # Construct a large database for testing. # do_test corrupt-1.1 { diff --git a/test/corrupt2.test b/test/corrupt2.test index 744a76ed0..805a6148f 100644 --- a/test/corrupt2.test +++ b/test/corrupt2.test @@ -23,6 +23,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + set presql "" catch { set presql "$::G(perm:presql);" } unset -nocomplain ::G(perm:presql) diff --git a/test/corrupt3.test b/test/corrupt3.test index a3827227b..436a46618 100644 --- a/test/corrupt3.test +++ b/test/corrupt3.test @@ -23,6 +23,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas||direct_read { diff --git a/test/corrupt4.test b/test/corrupt4.test index 19061134f..24db60fd5 100644 --- a/test/corrupt4.test +++ b/test/corrupt4.test @@ -23,6 +23,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas { diff --git a/test/corrupt5.test b/test/corrupt5.test index dca06e5fe..3f5099630 100644 --- a/test/corrupt5.test +++ b/test/corrupt5.test @@ -19,6 +19,10 @@ set testdir [file dirname $argv0] source $testdir/tester.tcl +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas { diff --git a/test/corrupt6.test b/test/corrupt6.test index c0dcedf3d..7d90c4a3b 100644 --- a/test/corrupt6.test +++ b/test/corrupt6.test @@ -24,6 +24,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas { diff --git a/test/corrupt7.test b/test/corrupt7.test index ad566560f..db92cf1de 100644 --- a/test/corrupt7.test +++ b/test/corrupt7.test @@ -24,6 +24,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas { diff --git a/test/corrupt8.test b/test/corrupt8.test index 012beb562..d7bceba31 100644 --- a/test/corrupt8.test +++ b/test/corrupt8.test @@ -24,6 +24,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas||!autovacuum { diff --git a/test/corrupt9.test b/test/corrupt9.test index f199452f9..bb37758b1 100644 --- a/test/corrupt9.test +++ b/test/corrupt9.test @@ -24,6 +24,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # We must have the page_size pragma for these tests to work. # ifcapable !pager_pragmas { diff --git a/test/corruptA.test b/test/corruptA.test index 8b76d3a20..bb9912bd2 100644 --- a/test/corruptA.test +++ b/test/corruptA.test @@ -24,6 +24,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # Create a database to work with. # diff --git a/test/corruptB.test b/test/corruptB.test index 0ff2d6e9e..c51cb5768 100644 --- a/test/corruptB.test +++ b/test/corruptB.test @@ -30,6 +30,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + do_test corruptB-1.1 { execsql { diff --git a/test/corruptC.test b/test/corruptC.test index bf5c3f397..adf6f44c4 100644 --- a/test/corruptC.test +++ b/test/corruptC.test @@ -27,6 +27,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # Construct a compact, dense database for testing. # do_test corruptC-1.1 { diff --git a/test/corruptD.test b/test/corruptD.test index 2423cd428..63474584c 100644 --- a/test/corruptD.test +++ b/test/corruptD.test @@ -19,6 +19,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + #-------------------------------------------------------------------------- # OVERVIEW # diff --git a/test/corruptE.test b/test/corruptE.test index 48292ab2e..4d5b5db3d 100644 --- a/test/corruptE.test +++ b/test/corruptE.test @@ -24,6 +24,10 @@ source $testdir/tester.tcl # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # Do not run the tests in this file if ENABLE_OVERSIZE_CELL_CHECK is on. # ifcapable oversize_cell_check { diff --git a/test/corruptF.test b/test/corruptF.test index 64c6eb890..8c4fd8421 100644 --- a/test/corruptF.test +++ b/test/corruptF.test @@ -19,6 +19,10 @@ set testprefix corruptF # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + proc str {i} { format %08d $i } # Create a 6 page database containing a single table - t1. Table t1 diff --git a/test/corruptG.test b/test/corruptG.test index c34911195..11253fd12 100644 --- a/test/corruptG.test +++ b/test/corruptG.test @@ -19,6 +19,10 @@ set testprefix corruptG # do_not_use_codec +# These tests deal with corrupt database files +# +database_may_be_corrupt + # Create a simple database with a single entry. Then corrupt the # header-size varint on the index payload so that it maps into a # negative number. Try to use the database. diff --git a/test/tester.tcl b/test/tester.tcl index c1272210d..771ca9144 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -1886,5 +1886,11 @@ set AUTOVACUUM $sqlite_options(default_autovacuum) # Make sure the FTS enhanced query syntax is disabled. set sqlite_fts3_enable_parentheses 0 +# During testing, assume that all database files are well-formed. The +# few test cases that deliberately corrupt database files should rescind +# this setting by invoking "database_can_be_corrupt" +# +database_never_corrupt + source $testdir/thread_common.tcl source $testdir/malloc_common.tcl |