os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2686.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/tkt2686.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,81 @@
     1.4 +# 2007 Oct 3
     1.5 +#
     1.6 +# The author disclaims copyright to this source code. In place of
     1.7 +# a legal notice, here is a blessing:
     1.8 +#
     1.9 +#    May you do good and not evil.
    1.10 +#    May you find forgiveness for yourself and forgive others.
    1.11 +#    May you share freely, never taking more than you give.
    1.12 +#
    1.13 +#***********************************************************************
    1.14 +#
    1.15 +# This file is to test that ticket #2686 has been fixed.
    1.16 +#
    1.17 +# $Id: tkt2686.test,v 1.3 2008/02/02 02:48:52 drh Exp $
    1.18 +#
    1.19 +
    1.20 +set testdir [file dirname $argv0]
    1.21 +source $testdir/tester.tcl
    1.22 +
    1.23 +ifcapable !subquery {
    1.24 +  finish_test
    1.25 +  return
    1.26 +}
    1.27 +
    1.28 +db eval {
    1.29 +  PRAGMA page_size=1024;
    1.30 +  PRAGMA max_page_count=50;
    1.31 +  PRAGMA auto_vacuum=0;
    1.32 +  CREATE TABLE filler (fill);
    1.33 +}
    1.34 +for {set i 1} {$i<2000} {incr i} {
    1.35 +  do_test tkt2686-$i.1 {
    1.36 +    db eval BEGIN
    1.37 +    set rc [catch {
    1.38 +      while 1 {
    1.39 +        db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
    1.40 +      }
    1.41 +    } msg]
    1.42 +    lappend rc $msg
    1.43 +  } {1 {database or disk is full}}
    1.44 +  do_test tkt2686-$i.2 {
    1.45 +    execsql {
    1.46 +      DELETE FROM filler 
    1.47 +       WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
    1.48 +    }
    1.49 +  } {}
    1.50 +  integrity_check tkt2686-$i.3
    1.51 +  catch {db eval COMMIT}
    1.52 +}
    1.53 +
    1.54 +db close
    1.55 +file delete -force test.db test.db-journal
    1.56 +sqlite3 db test.db
    1.57 +
    1.58 +db eval {
    1.59 +  PRAGMA page_size=1024;
    1.60 +  PRAGMA max_page_count=50;
    1.61 +  PRAGMA auto_vacuum=1;
    1.62 +  CREATE TABLE filler (fill);
    1.63 +}
    1.64 +for {set i 10000} {$i<12000} {incr i} {
    1.65 +  do_test tkt2686-$i.1 {
    1.66 +    db eval BEGIN
    1.67 +    set rc [catch {
    1.68 +      while 1 {
    1.69 +        db eval {INSERT INTO filler (fill) VALUES (randstr(1000, 10000)) }
    1.70 +      }
    1.71 +    } msg]
    1.72 +    lappend rc $msg
    1.73 +  } {1 {database or disk is full}}
    1.74 +  do_test tkt2686-$i.2 {
    1.75 +    execsql {
    1.76 +      DELETE FROM filler 
    1.77 +       WHERE rowid <= (SELECT MAX(rowid) FROM filler LIMIT 20)
    1.78 +    }
    1.79 +  } {}
    1.80 +  integrity_check tkt2686-$i.3
    1.81 +  catch {db eval COMMIT}
    1.82 +}
    1.83 +
    1.84 +finish_test