aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test
diff options
context:
space:
mode:
authordan miller2007-10-20 02:49:29 +0000
committerdan miller2007-10-20 02:49:29 +0000
commite36d23a85ebff914d74bb541558c2b6082b78edb (patch)
tree54b58fdf162e78af64055282a6035c8d2443389d /libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test
parent* Fixed an issue whereby avatar chat distances were being calculated against ... (diff)
downloadopensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.zip
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.gz
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.bz2
opensim-SC-e36d23a85ebff914d74bb541558c2b6082b78edb.tar.xz
sqlite source (unix build) added to libraries
Diffstat (limited to 'libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test')
-rw-r--r--libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test133
1 files changed, 133 insertions, 0 deletions
diff --git a/libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test b/libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test
new file mode 100644
index 0000000..3eb549d
--- /dev/null
+++ b/libraries/sqlite/unix/sqlite-3.5.1/test/autovacuum_ioerr2.test
@@ -0,0 +1,133 @@
1# 2001 October 12
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
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.
9#
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.
14#
15# The tests in this file use special facilities that are only
16# available in the SQLite test fixture.
17#
18# $Id: autovacuum_ioerr2.test,v 1.6 2007/04/28 15:47:44 danielk1977 Exp $
19
20set testdir [file dirname $argv0]
21source $testdir/tester.tcl
22
23# If this build of the library does not support auto-vacuum, omit this
24# whole file.
25ifcapable {!autovacuum} {
26 finish_test
27 return
28}
29
30do_ioerr_test autovacuum-ioerr2-1 -sqlprep {
31 PRAGMA auto_vacuum = 1;
32 CREATE TABLE abc(a);
33 INSERT INTO abc VALUES(randstr(1500,1500));
34} -sqlbody {
35 CREATE TABLE abc2(a);
36 BEGIN;
37 DELETE FROM abc;
38 INSERT INTO abc VALUES(randstr(1500,1500));
39 CREATE TABLE abc3(a);
40 COMMIT;
41}
42
43do_ioerr_test autovacuum-ioerr2-2 -tclprep {
44 execsql {
45 PRAGMA auto_vacuum = 1;
46 PRAGMA cache_size = 10;
47 BEGIN;
48 CREATE TABLE abc(a);
49 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 4 is overflow
50 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 5 is overflow
51 }
52 for {set i 0} {$i<150} {incr i} {
53 execsql {
54 INSERT INTO abc VALUES(randstr(100,100));
55 }
56 }
57 execsql COMMIT
58} -sqlbody {
59 BEGIN;
60 DELETE FROM abc WHERE length(a)>100;
61 UPDATE abc SET a = randstr(90,90);
62 CREATE TABLE abc3(a);
63 COMMIT;
64}
65
66do_ioerr_test autovacuum-ioerr2-3 -sqlprep {
67 PRAGMA auto_vacuum = 1;
68 CREATE TABLE abc(a);
69 CREATE TABLE abc2(b);
70} -sqlbody {
71 BEGIN;
72 INSERT INTO abc2 VALUES(10);
73 DROP TABLE abc;
74 COMMIT;
75 DROP TABLE abc2;
76}
77
78file delete -force backup.db
79ifcapable subquery {
80 do_ioerr_test autovacuum-ioerr2-4 -tclprep {
81 if {![file exists backup.db]} {
82 sqlite3 dbb backup.db
83 execsql {
84 PRAGMA auto_vacuum = 1;
85 BEGIN;
86 CREATE TABLE abc(a);
87 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 4 is overflow
88 INSERT INTO abc VALUES(randstr(1100,1100)); -- Page 5 is overflow
89 } dbb
90 for {set i 0} {$i<2500} {incr i} {
91 execsql {
92 INSERT INTO abc VALUES(randstr(100,100));
93 } dbb
94 }
95 execsql {
96 COMMIT;
97 PRAGMA cache_size = 10;
98 } dbb
99 dbb close
100 }
101 db close
102 file delete -force test.db
103 file delete -force test.db-journal
104 copy_file backup.db test.db
105 set ::DB [sqlite3 db test.db]
106 execsql {
107 PRAGMA cache_size = 10;
108 }
109 } -sqlbody {
110 BEGIN;
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);
115 COMMIT;
116 }
117}
118
119do_ioerr_test autovacuum-ioerr2-1 -sqlprep {
120 PRAGMA auto_vacuum = 1;
121 CREATE TABLE abc(a);
122 INSERT INTO abc VALUES(randstr(1500,1500));
123} -sqlbody {
124 CREATE TABLE abc2(a);
125 BEGIN;
126 DELETE FROM abc;
127 INSERT INTO abc VALUES(randstr(1500,1500));
128 CREATE TABLE abc3(a);
129 COMMIT;
130}
131
132finish_test
133