/ Check-in [22a14663]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Update test cases in corruptI.test so that they work with both SQLITE_ENABLE_OVERSIZE_CELL_CHECK and SQLITE_DEFAULT_AUTOVACUUM builds.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 22a14663782312fa7f4f18545509ef4b27e9b8c1
User & Date: dan 2015-05-26 14:57:45
Context
2015-05-26
16:12
Fix another bug in the in-memory VFS for fuzzcheck. check-in: 16878a31 user: drh tags: trunk
14:57
Update test cases in corruptI.test so that they work with both SQLITE_ENABLE_OVERSIZE_CELL_CHECK and SQLITE_DEFAULT_AUTOVACUUM builds. check-in: 22a14663 user: dan tags: trunk
12:18
Return SQLITE_CORRUPT to the user if an attempt is made to add database page 1 to the free page list. check-in: 68876003 user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to test/corruptI.test.

   119    119     INSERT INTO t1 VALUES(-1, 'abcdefghij');
   120    120     INSERT INTO t1 VALUES(0, 'abcdefghij');
   121    121   }
   122    122   
   123    123   set root [db one {SELECT rootpage FROM sqlite_master}]
   124    124   set offset [expr ($root-1) * 65536]
   125    125   
          126  +ifcapable oversize_cell_check {
          127  +  set res {1 {database disk image is malformed}}
          128  +} else {
          129  +  set res {0 {}}
          130  +}
   126    131   do_test 4.1 {
   127    132     db close
   128    133     hexio_write test.db [expr $offset + 8 + 2] 0000
   129    134     hexio_write test.db [expr $offset + 5] 0000
   130    135     sqlite3 db test.db
   131         -  execsql { DELETE FROM t1 WHERE a=0 }
   132         -} {}
          136  +  catchsql { DELETE FROM t1 WHERE a=0 }
          137  +} $res
   133    138   
   134    139   
   135    140   #-------------------------------------------------------------------------
   136    141   # Database properties:
   137    142   #
   138    143   #   * Incremental vacuum mode.
   139    144   #   * Database root table has a single leaf page.
................................................................................
   188    193   # Set the payload size of a cell to just less than 2^32 bytes (not
   189    194   # possible in an uncorrupted db). Then try to delete the cell. At one
   190    195   # point this led to an integer overflow that caused an assert() to fail.
   191    196   #
   192    197   reset_db
   193    198   do_execsql_test 6.0 {
   194    199     PRAGMA page_size = 512;
          200  +  PRAGMA auto_vacuum=0;
   195    201     CREATE TABLE t1(x);
   196    202     INSERT INTO t1 VALUES(zeroblob(300));
   197    203     INSERT INTO t1 VALUES(zeroblob(600));
   198    204   } {}
   199    205   do_test 6.1 {
   200    206     db close
   201    207     hexio_write test.db 616 EAFFFFFF0202
................................................................................
   206    212   
   207    213   #-------------------------------------------------------------------------
   208    214   # See what happens if the sqlite_master entry associated with a PRIMARY
   209    215   # KEY or UNIQUE index is removed. 
   210    216   #
   211    217   reset_db
   212    218   do_execsql_test 7.0 {
          219  +  PRAGMA auto_vacuum=0;
   213    220     CREATE TABLE t1(x PRIMARY KEY, y);
   214    221     INSERT INTO t1 VALUES('a', 'A');
   215    222     INSERT INTO t1 VALUES('b', 'A');
   216    223     INSERT INTO t1 VALUES('c', 'A');
   217    224     SELECT name FROM sqlite_master;
   218    225   } {t1 sqlite_autoindex_t1_1}
   219    226   do_execsql_test 7.1 {
................................................................................
   227    234   } {1 {database disk image is malformed}}
   228    235   
   229    236   #-------------------------------------------------------------------------
   230    237   # At one point an assert() would fail if attempt was made to free page 1.
   231    238   #
   232    239   reset_db
   233    240   do_execsql_test 8.0 {
          241  +  PRAGMA auto_vacuum=0;
   234    242     CREATE TABLE t1(x);
   235    243     INSERT INTO t1 VALUES(zeroblob(300));
   236    244     INSERT INTO t1 VALUES(zeroblob(300));
   237    245     INSERT INTO t1 VALUES(zeroblob(300));
   238    246     INSERT INTO t1 VALUES(zeroblob(300));
   239    247   } {}
   240    248