1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/attachmalloc.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,49 @@
1.4 +# 2005 September 19
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 +# This file implements regression tests for SQLite library. The
1.15 +# focus of this script is testing the ATTACH statement and
1.16 +# specifically out-of-memory conditions within that command.
1.17 +#
1.18 +# $Id: attachmalloc.test,v 1.9 2008/08/04 20:13:27 drh Exp $
1.19 +#
1.20 +
1.21 +set testdir [file dirname $argv0]
1.22 +source $testdir/tester.tcl
1.23 +
1.24 +ifcapable !memdebug||!attach {
1.25 + finish_test
1.26 + return
1.27 +}
1.28 +
1.29 +source $testdir/malloc_common.tcl
1.30 +
1.31 +do_malloc_test attachmalloc-1 -tclprep {
1.32 + db close
1.33 + for {set i 2} {$i<=4} {incr i} {
1.34 + file delete -force test$i.db
1.35 + file delete -force test$i.db-journal
1.36 + }
1.37 +} -tclbody {
1.38 + if {[catch {sqlite3 db test.db}]} {
1.39 + error "out of memory"
1.40 + }
1.41 + sqlite3_db_config_lookaside db 0 0 0
1.42 + sqlite3_extended_result_codes db 1
1.43 +} -sqlbody {
1.44 + ATTACH 'test2.db' AS two;
1.45 + CREATE TABLE two.t1(x);
1.46 + ATTACH 'test3.db' AS three;
1.47 + CREATE TABLE three.t1(x);
1.48 + ATTACH 'test4.db' AS four;
1.49 + CREATE TABLE four.t1(x);
1.50 +}
1.51 +
1.52 +finish_test