sl@0
|
1 |
# 2007 Oct 3
|
sl@0
|
2 |
#
|
sl@0
|
3 |
# The author disclaims copyright to this source code. In place of
|
sl@0
|
4 |
# a legal notice, here is a blessing:
|
sl@0
|
5 |
#
|
sl@0
|
6 |
# May you do good and not evil.
|
sl@0
|
7 |
# May you find forgiveness for yourself and forgive others.
|
sl@0
|
8 |
# May you share freely, never taking more than you give.
|
sl@0
|
9 |
#
|
sl@0
|
10 |
#***********************************************************************
|
sl@0
|
11 |
#
|
sl@0
|
12 |
# This file is to test that ticket #2686 has been fixed.
|
sl@0
|
13 |
#
|
sl@0
|
14 |
# $Id: tkt2686.test,v 1.3 2008/02/02 02:48:52 drh Exp $
|
sl@0
|
15 |
#
|
sl@0
|
16 |
|
sl@0
|
17 |
set testdir [file dirname $argv0]
|
sl@0
|
18 |
source $testdir/tester.tcl
|
sl@0
|
19 |
|
sl@0
|
20 |
ifcapable !subquery {
|
sl@0
|
21 |
finish_test
|
sl@0
|
22 |
return
|
sl@0
|
23 |
}
|
sl@0
|
24 |
|
sl@0
|
25 |
db eval {
|
sl@0
|
26 |
PRAGMA page_size=1024;
|
sl@0
|
27 |
PRAGMA max_page_count=50;
|
sl@0
|
28 |
PRAGMA auto_vacuum=0;
|
sl@0
|
29 |
CREATE TABLE filler (fill);
|
sl@0
|
30 |
}
|
sl@0
|
31 |
for {set i 1} {$i<2000} {incr i} {
|
sl@0
|
32 |
do_test tkt2686-$i.1 {
|
sl@0
|
33 |
db eval BEGIN
|
sl@0
|
34 |
set rc [catch {
|
sl@0
|
35 |
while 1 {
|
sl@0
|
36 |
db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
|
sl@0
|
37 |
}
|
sl@0
|
38 |
} msg]
|
sl@0
|
39 |
lappend rc $msg
|
sl@0
|
40 |
} {1 {database or disk is full}}
|
sl@0
|
41 |
do_test tkt2686-$i.2 {
|
sl@0
|
42 |
execsql {
|
sl@0
|
43 |
DELETE FROM filler
|
sl@0
|
44 |
WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
|
sl@0
|
45 |
}
|
sl@0
|
46 |
} {}
|
sl@0
|
47 |
integrity_check tkt2686-$i.3
|
sl@0
|
48 |
catch {db eval COMMIT}
|
sl@0
|
49 |
}
|
sl@0
|
50 |
|
sl@0
|
51 |
db close
|
sl@0
|
52 |
file delete -force test.db test.db-journal
|
sl@0
|
53 |
sqlite3 db test.db
|
sl@0
|
54 |
|
sl@0
|
55 |
db eval {
|
sl@0
|
56 |
PRAGMA page_size=1024;
|
sl@0
|
57 |
PRAGMA max_page_count=50;
|
sl@0
|
58 |
PRAGMA auto_vacuum=1;
|
sl@0
|
59 |
CREATE TABLE filler (fill);
|
sl@0
|
60 |
}
|
sl@0
|
61 |
for {set i 10000} {$i<12000} {incr i} {
|
sl@0
|
62 |
do_test tkt2686-$i.1 {
|
sl@0
|
63 |
db eval BEGIN
|
sl@0
|
64 |
set rc [catch {
|
sl@0
|
65 |
while 1 {
|
sl@0
|
66 |
db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
|
sl@0
|
67 |
}
|
sl@0
|
68 |
} msg]
|
sl@0
|
69 |
lappend rc $msg
|
sl@0
|
70 |
} {1 {database or disk is full}}
|
sl@0
|
71 |
do_test tkt2686-$i.2 {
|
sl@0
|
72 |
execsql {
|
sl@0
|
73 |
DELETE FROM filler
|
sl@0
|
74 |
WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
|
sl@0
|
75 |
}
|
sl@0
|
76 |
} {}
|
sl@0
|
77 |
integrity_check tkt2686-$i.3
|
sl@0
|
78 |
catch {db eval COMMIT}
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
finish_test
|