xref: /sqlite-3.40.0/test/attachmalloc.test (revision 222a757d)
1# 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#
15# $Id: attachmalloc.test,v 1.4 2007/08/25 13:37:49 danielk1977 Exp $
16#
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21source $testdir/malloc_common.tcl
22
23do_malloc_test attachmalloc-1 -tclprep {
24  db close
25  for {set i 2} {$i<=4} {incr i} {
26    file delete -force test$i.db
27    file delete -force test$i.db-journal
28  }
29} -tclbody {
30  if {[catch {sqlite3 db test.db}]} {
31    error "out of memory"
32  }
33} -sqlbody {
34  ATTACH 'test2.db' AS two;
35  CREATE TABLE two.t1(x);
36  ATTACH 'test3.db' AS three;
37  CREATE TABLE three.t1(x);
38  ATTACH 'test4.db' AS four;
39  CREATE TABLE four.t1(x);
40}
41
42finish_test
43