Small performance optimization in sqlite3VdbeRecordCompareWithSkip() for
[sqlite.git] / test / corrupt5.test
blob3f5099630e74fa36dc7006ca5861e61a1f931efc
1 # 2008 Jan 22
3 # The author disclaims copyright to this source code.  In place of
4 # a legal notice, here is a blessing:
6 #    May you do good and not evil.
7 #    May you find forgiveness for yourself and forgive others.
8 #    May you share freely, never taking more than you give.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library.
13 # This file implements tests to make sure SQLite does not crash or
14 # segfault if it sees a corrupt database file.  Checks for 
15 # malformed schema.
17 # $Id: corrupt5.test,v 1.3 2009/06/04 02:47:04 shane Exp $
19 set testdir [file dirname $argv0]
20 source $testdir/tester.tcl
22 # These tests deal with corrupt database files
24 database_may_be_corrupt
26 # We must have the page_size pragma for these tests to work.
28 ifcapable !pager_pragmas {
29   finish_test
30   return
33 # Create a database with a freelist containing at least two pages.
35 do_test corrupt5-1.1 {
36   execsql {
37     CREATE TABLE t1(a,b,c);
38     CREATE INDEX i1 ON t1(a,b);
39     PRAGMA writable_schema=ON;
40     UPDATE sqlite_master SET name=NULL, sql=NULL WHERE name='i1';
41   }
42   db close
43   sqlite3 db test.db
44   catchsql {
45     SELECT * FROM t1
46   }
47 } {1 {malformed database schema (?)}}
49 finish_test