drh | 85c23c6 | 2005-08-20 03:03:04 +0000 | [diff] [blame] | 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 | # |
danielk1977 | 5a8f937 | 2007-10-09 08:29:32 +0000 | [diff] [blame^] | 15 | # $Id: attachmalloc.test,v 1.7 2007/10/09 08:29:32 danielk1977 Exp $ |
drh | 85c23c6 | 2005-08-20 03:03:04 +0000 | [diff] [blame] | 16 | # |
| 17 | |
| 18 | set testdir [file dirname $argv0] |
| 19 | source $testdir/tester.tcl |
| 20 | |
danielk1977 | 5a8f937 | 2007-10-09 08:29:32 +0000 | [diff] [blame^] | 21 | ifcapable !memdebug||!attach { |
drh | da57895 | 2007-08-27 23:48:23 +0000 | [diff] [blame] | 22 | finish_test |
| 23 | return |
| 24 | } |
| 25 | |
danielk1977 | 222a757 | 2007-08-25 13:37:48 +0000 | [diff] [blame] | 26 | source $testdir/malloc_common.tcl |
drh | 85c23c6 | 2005-08-20 03:03:04 +0000 | [diff] [blame] | 27 | |
| 28 | do_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 | } |
danielk1977 | ae72d98 | 2007-10-03 08:46:44 +0000 | [diff] [blame] | 38 | sqlite3_extended_result_codes db 1 |
drh | 85c23c6 | 2005-08-20 03:03:04 +0000 | [diff] [blame] | 39 | } -sqlbody { |
| 40 | ATTACH 'test2.db' AS two; |
| 41 | CREATE TABLE two.t1(x); |
| 42 | ATTACH 'test3.db' AS three; |
| 43 | CREATE TABLE three.t1(x); |
| 44 | ATTACH 'test4.db' AS four; |
| 45 | CREATE TABLE four.t1(x); |
| 46 | } |
| 47 | |
| 48 | finish_test |