sl@0: # 2007 Oct 3 sl@0: # sl@0: # The author disclaims copyright to this source code. In place of sl@0: # a legal notice, here is a blessing: sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # sl@0: # This file is to test that ticket #2686 has been fixed. sl@0: # sl@0: # $Id: tkt2686.test,v 1.3 2008/02/02 02:48:52 drh Exp $ sl@0: # sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable !subquery { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: db eval { sl@0: PRAGMA page_size=1024; sl@0: PRAGMA max_page_count=50; sl@0: PRAGMA auto_vacuum=0; sl@0: CREATE TABLE filler (fill); sl@0: } sl@0: for {set i 1} {$i<2000} {incr i} { sl@0: do_test tkt2686-$i.1 { sl@0: db eval BEGIN sl@0: set rc [catch { sl@0: while 1 { sl@0: db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) } sl@0: } sl@0: } msg] sl@0: lappend rc $msg sl@0: } {1 {database or disk is full}} sl@0: do_test tkt2686-$i.2 { sl@0: execsql { sl@0: DELETE FROM filler sl@0: WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20) sl@0: } sl@0: } {} sl@0: integrity_check tkt2686-$i.3 sl@0: catch {db eval COMMIT} sl@0: } sl@0: sl@0: db close sl@0: file delete -force test.db test.db-journal sl@0: sqlite3 db test.db sl@0: sl@0: db eval { sl@0: PRAGMA page_size=1024; sl@0: PRAGMA max_page_count=50; sl@0: PRAGMA auto_vacuum=1; sl@0: CREATE TABLE filler (fill); sl@0: } sl@0: for {set i 10000} {$i<12000} {incr i} { sl@0: do_test tkt2686-$i.1 { sl@0: db eval BEGIN sl@0: set rc [catch { sl@0: while 1 { sl@0: db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) } sl@0: } sl@0: } msg] sl@0: lappend rc $msg sl@0: } {1 {database or disk is full}} sl@0: do_test tkt2686-$i.2 { sl@0: execsql { sl@0: DELETE FROM filler sl@0: WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20) sl@0: } sl@0: } {} sl@0: integrity_check tkt2686-$i.3 sl@0: catch {db eval COMMIT} sl@0: } sl@0: sl@0: finish_test