xref: /sqlite-3.40.0/test/pragmafault.test (revision 75f95588)
1*75f95588Sdan# 2010 June 15
2*75f95588Sdan#
3*75f95588Sdan# The author disclaims copyright to this source code.  In place of
4*75f95588Sdan# a legal notice, here is a blessing:
5*75f95588Sdan#
6*75f95588Sdan#    May you do good and not evil.
7*75f95588Sdan#    May you find forgiveness for yourself and forgive others.
8*75f95588Sdan#    May you share freely, never taking more than you give.
9*75f95588Sdan#
10*75f95588Sdan#***********************************************************************
11*75f95588Sdan#
12*75f95588Sdan
13*75f95588Sdanset testdir [file dirname $argv0]
14*75f95588Sdansource $testdir/tester.tcl
15*75f95588Sdansource $testdir/lock_common.tcl
16*75f95588Sdansource $testdir/malloc_common.tcl
17*75f95588Sdanset testprefix pragmafault
18*75f95588Sdan
19*75f95588Sdandb close
20*75f95588Sdansqlite3 db test.db
21*75f95588Sdansqlite3_db_config_lookaside db 0 0 0
22*75f95588Sdando_execsql_test 1.0 {
23*75f95588Sdan  CREATE TABLE t1(a, b, CHECK(a!=b));
24*75f95588Sdan  INSERT INTO t1 VALUES(1, 2);
25*75f95588Sdan  INSERT INTO t1 VALUES(3, 4);
26*75f95588Sdan}
27*75f95588Sdanfaultsim_save_and_close
28*75f95588Sdan
29*75f95588Sdando_faultsim_test 1 -prep {
30*75f95588Sdan  faultsim_restore_and_reopen
31*75f95588Sdan} -body {
32*75f95588Sdan  catchsql { PRAGMA integrity_check }
33*75f95588Sdan  set {} 0
34*75f95588Sdan} -test {
35*75f95588Sdan  faultsim_test_result {0 0}
36*75f95588Sdan}
37*75f95588Sdan
38*75f95588Sdan
39*75f95588Sdanfinish_test
40