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 # such as writes failing because the disk is full.
15 # The tests in this file use special facilities that are only
16 # available in the SQLite test fixture.
18 # $Id: autovacuum_ioerr2.test,v 1.7 2008/07/12 14:52:20 drh Exp $
20 set testdir [file dirname $argv0]
21 source $testdir/tester.tcl
23 # If this build of the library does not support auto-vacuum, omit this
25 ifcapable {!autovacuum} {
30 do_ioerr_test autovacuum-ioerr2-1 -sqlprep {
31 PRAGMA auto_vacuum = 1;
33 INSERT INTO abc VALUES(randstr(1500,1500));
38 INSERT INTO abc VALUES(randstr(1500,1500));
43 do_ioerr_test autovacuum-ioerr2-2 -tclprep {
45 PRAGMA auto_vacuum = 1;
46 PRAGMA cache_size = 10;
49 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 4 is overflow
50 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 5 is overflow
52 for {set i 0} {$i<150} {incr i} {
54 INSERT INTO abc VALUES(randstr(100,100));
60 DELETE FROM abc WHERE length(a)>100;
61 UPDATE abc SET a = randstr(90,90);
66 do_ioerr_test autovacuum-ioerr2-3 -sqlprep {
67 PRAGMA auto_vacuum = 1;
72 INSERT INTO abc2 VALUES(10);
80 do_ioerr_test autovacuum-ioerr2-4 -tclprep {
81 if {![file exists backup.db]} {
84 PRAGMA auto_vacuum = 1;
87 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 4 is overflow
88 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 5 is overflow
90 for {set i 0} {$i<2500} {incr i} {
92 INSERT INTO abc VALUES(randstr(100,100));
97 PRAGMA cache_size = 10;
103 forcedelete test.db-journal
104 forcecopy backup.db test.db
105 set ::DB [sqlite3 db test.db]
107 PRAGMA cache_size = 10;
111 DELETE FROM abc WHERE oid < 3;
112 UPDATE abc SET a = randstr(100,100) WHERE oid > 2300;
113 UPDATE abc SET a = randstr(1100,1100) WHERE oid =
114 (select max(oid) from abc);
119 do_ioerr_test autovacuum-ioerr2-1 -sqlprep {
120 PRAGMA auto_vacuum = 1;
122 INSERT INTO abc VALUES(randstr(1500,1500));
124 CREATE TABLE abc2(a);
127 INSERT INTO abc VALUES(randstr(1500,1500));
128 CREATE TABLE abc3(a);