sl@0: # 2006 February 10 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: # This file implements regression tests for SQLite library. sl@0: # sl@0: # This file implements tests to verify that ticket #1667 has been sl@0: # fixed. sl@0: # sl@0: # sl@0: # $Id: tkt1667.test,v 1.3 2008/07/12 14:52:20 drh Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: ifcapable !autovacuum||!tclvar { sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: db close sl@0: file delete -force test.db test.db-journal sl@0: sl@0: # Set the pending byte offset such that the page it is on is sl@0: # the first autovacuum pointer map page in the file (assume a page sl@0: # size of 1024). sl@0: sl@0: set first_ptrmap_page [expr 1024/5 + 3] sl@0: set sqlite_pending_byte [expr 1024 * ($first_ptrmap_page-1)] sl@0: sl@0: sqlite db test.db sl@0: sl@0: do_test tkt1667-1 { sl@0: execsql { sl@0: PRAGMA auto_vacuum = 1; sl@0: BEGIN; sl@0: CREATE TABLE t1(a, b); sl@0: } sl@0: for {set i 0} {$i < 500} {incr i} { sl@0: execsql { sl@0: INSERT INTO t1 VALUES($i, randstr(1000, 2000)) sl@0: } sl@0: } sl@0: execsql { sl@0: COMMIT; sl@0: } sl@0: } {} sl@0: for {set i 0} {$i < 500} {incr i} { sl@0: do_test tkt1667-2.$i.1 { sl@0: execsql { sl@0: DELETE FROM t1 WHERE a = $i; sl@0: } sl@0: } {} sl@0: integrity_check tkt1667-2.$i.2 sl@0: } sl@0: sl@0: do_test tkt1667-3 { sl@0: execsql { sl@0: BEGIN; sl@0: } sl@0: for {set i 0} {$i < 500} {incr i} { sl@0: execsql { sl@0: INSERT INTO t1 VALUES($i, randstr(1000, 2000)) sl@0: } sl@0: } sl@0: execsql { sl@0: COMMIT; sl@0: } sl@0: } {} sl@0: do_test tkt1667-4.1 { sl@0: execsql { sl@0: DELETE FROM t1; sl@0: } sl@0: } {} sl@0: integrity_check tkt1667-4.2 sl@0: sl@0: finish_test