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. The
12 # focus of this file is testing for correct handling of I/O errors
13 # during incremental vacuum with a shared cache.
15 # $Id: ioerr4.test,v 1.2 2008/05/08 01:11:42 drh Exp $
17 set testdir [file dirname $argv0]
18 source $testdir/tester.tcl
20 # This test requires both shared cache and incremental vacuum.
22 ifcapable {!shared_cache || !autovacuum} {
27 # Enable shared cache mode and incremental vacuum.
31 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
34 forcedelete test.db test.db-journal
38 PRAGMA auto_vacuum=INCREMENTAL;
39 CREATE TABLE a(i INTEGER, b BLOB);
42 SELECT name FROM sqlite_master
51 # Insert and delete many records in order to put lots of pages
56 INSERT INTO a VALUES(1, zeroblob(2000));
57 INSERT INTO a VALUES(2, zeroblob(2000));
58 INSERT INTO a SELECT i+2, zeroblob(2000) FROM a;
59 INSERT INTO a SELECT i+4, zeroblob(2000) FROM a;
60 INSERT INTO a SELECT i+8, zeroblob(2000) FROM a;
61 INSERT INTO a SELECT i+16, zeroblob(2000) FROM a;
62 SELECT count(*) FROM a;
73 PRAGMA freelist_count;
77 # Set up for an I/O error on incremental vacuum
78 # with two connections on shared cache.
82 forcecopy test.db test.db-bu
83 do_ioerr_test ioerr4-2 -tclprep {
86 forcedelete test.db test.db-journal
87 forcecopy test.db-bu test.db
88 sqlite3_enable_shared_cache 1
89 set ::DB [sqlite3 db test.db; sqlite3_connection_pointer db]
90 db eval {PRAGMA auto_vacuum=INCREMENTAL}
93 db eval {PRAGMA incremental_vacuum(5)}
97 forcedelete test.db-bu
98 sqlite3_enable_shared_cache $::enable_shared_cache