blob: a6de5cecb3ee860ebc77abe864ff60ac8f5b0d4e [file] [log] [blame]
drh85c23c62005-08-20 03:03:04 +00001# 2005 September 19
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#*************************************************************************
11# This file implements regression tests for SQLite library. The
12# focus of this script is testing the ATTACH statement and
13# specifically out-of-memory conditions within that command.
14#
drhe9d1c722008-08-04 20:13:26 +000015# $Id: attachmalloc.test,v 1.9 2008/08/04 20:13:27 drh Exp $
drh85c23c62005-08-20 03:03:04 +000016#
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
danielk19775a8f9372007-10-09 08:29:32 +000021ifcapable !memdebug||!attach {
drhda578952007-08-27 23:48:23 +000022 finish_test
23 return
24}
25
danielk1977222a7572007-08-25 13:37:48 +000026source $testdir/malloc_common.tcl
drh85c23c62005-08-20 03:03:04 +000027
28do_malloc_test attachmalloc-1 -tclprep {
29 db close
30 for {set i 2} {$i<=4} {incr i} {
31 file delete -force test$i.db
32 file delete -force test$i.db-journal
33 }
34} -tclbody {
35 if {[catch {sqlite3 db test.db}]} {
36 error "out of memory"
37 }
drhe9d1c722008-08-04 20:13:26 +000038 sqlite3_db_config_lookaside db 0 0 0
danielk1977ae72d982007-10-03 08:46:44 +000039 sqlite3_extended_result_codes db 1
drh85c23c62005-08-20 03:03:04 +000040} -sqlbody {
41 ATTACH 'test2.db' AS two;
42 CREATE TABLE two.t1(x);
43 ATTACH 'test3.db' AS three;
44 CREATE TABLE three.t1(x);
45 ATTACH 'test4.db' AS four;
46 CREATE TABLE four.t1(x);
47}
48
49finish_test