1 # 2007 Oct 3 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 # 12 # This file is to test that ticket #2686 has been fixed. 13 # 14 # $Id: tkt2686.test,v 1.3 2008/02/02 02:48:52 drh Exp $ 15 # 16 17 set testdir [file dirname $argv0] 18 source $testdir/tester.tcl 19 20 ifcapable !subquery { 21 finish_test 22 return 23 } 24 25 db eval { 26 PRAGMA page_size=1024; 27 PRAGMA max_page_count=50; 28 PRAGMA auto_vacuum=0; 29 CREATE TABLE filler (fill); 30 } 31 for {set i 1} {$i<2000} {incr i} { 32 do_test tkt2686-$i.1 { 33 db eval BEGIN 34 set rc [catch { 35 while 1 { 36 db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) } 37 } 38 } msg] 39 lappend rc $msg 40 } {1 {database or disk is full}} 41 do_test tkt2686-$i.2 { 42 execsql { 43 DELETE FROM filler 44 WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20) 45 } 46 } {} 47 integrity_check tkt2686-$i.3 48 catch {db eval COMMIT} 49 } 50 51 db close 52 file delete -force test.db test.db-journal 53 sqlite3 db test.db 54 55 db eval { 56 PRAGMA page_size=1024; 57 PRAGMA max_page_count=50; 58 PRAGMA auto_vacuum=1; 59 CREATE TABLE filler (fill); 60 } 61 for {set i 10000} {$i<12000} {incr i} { 62 do_test tkt2686-$i.1 { 63 db eval BEGIN 64 set rc [catch { 65 while 1 { 66 db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) } 67 } 68 } msg] 69 lappend rc $msg 70 } {1 {database or disk is full}} 71 do_test tkt2686-$i.2 { 72 execsql { 73 DELETE FROM filler 74 WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20) 75 } 76 } {} 77 integrity_check tkt2686-$i.3 78 catch {db eval COMMIT} 79 } 80 81 finish_test 82