sl@0: # 2005 September 19
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.  The
sl@0: # focus of this script is testing the ATTACH statement and
sl@0: # specifically out-of-memory conditions within that command.
sl@0: #
sl@0: # $Id: attachmalloc.test,v 1.9 2008/08/04 20:13:27 drh Exp $
sl@0: #
sl@0: 
sl@0: set testdir [file dirname $argv0]
sl@0: source $testdir/tester.tcl
sl@0: 
sl@0: ifcapable !memdebug||!attach {
sl@0:   finish_test
sl@0:   return
sl@0: }
sl@0: 
sl@0: source $testdir/malloc_common.tcl
sl@0: 
sl@0: do_malloc_test attachmalloc-1 -tclprep {
sl@0:   db close
sl@0:   for {set i 2} {$i<=4} {incr i} {
sl@0:     file delete -force test$i.db
sl@0:     file delete -force test$i.db-journal
sl@0:   }
sl@0: } -tclbody {
sl@0:   if {[catch {sqlite3 db test.db}]} {
sl@0:     error "out of memory"
sl@0:   }
sl@0:   sqlite3_db_config_lookaside db 0 0 0
sl@0:   sqlite3_extended_result_codes db 1
sl@0: } -sqlbody {
sl@0:   ATTACH 'test2.db' AS two;
sl@0:   CREATE TABLE two.t1(x);
sl@0:   ATTACH 'test3.db' AS three;
sl@0:   CREATE TABLE three.t1(x);
sl@0:   ATTACH 'test4.db' AS four;
sl@0:   CREATE TABLE four.t1(x);
sl@0: }
sl@0: 
sl@0: finish_test