1# 2011 March 9 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# 12# This file contains tests of the mem5 allocation subsystem. 13# 14 15set testdir [file dirname $argv0] 16source $testdir/tester.tcl 17 18ifcapable !mem5 { 19 finish_test 20 return 21} 22 23# The tests in this file configure the lookaside allocator after a 24# connection is opened. This will not work if there is any "presql" 25# configured (SQL run within the [sqlite3] wrapper in tester.tcl). 26if {[info exists ::G(perm:presql)]} { 27 finish_test 28 return 29} 30 31do_test mem5-1.1 { 32 catch {db close} 33 sqlite3_shutdown 34 sqlite3_config_heap 25000000 0 35 sqlite3_config_lookaside 0 0 36 sqlite3_initialize 37} {SQLITE_OK} 38 39# try with min request size = 2^30 40do_test mem5-1.2 { 41 catch {db close} 42 sqlite3_shutdown 43 sqlite3_config_heap 1 1073741824 44 sqlite3_config_lookaside 0 0 45 sqlite3_initialize 46} {SQLITE_NOMEM} 47 48# try with min request size = 2^30+1 49# previously this was causing the memsys5Log() func to infinitely loop. 50do_test mem5-1.3 { 51 catch {db close} 52 sqlite3_shutdown 53 sqlite3_config_heap 1 1073741825 54 sqlite3_config_lookaside 0 0 55 sqlite3_initialize 56} {SQLITE_NOMEM} 57 58do_test mem5-1.4 { 59 catch {db close} 60 sqlite3_shutdown 61 sqlite3_config_heap 0 0 62 sqlite3_config_lookaside 0 0 63 sqlite3_initialize 64} {SQLITE_OK} 65 66finish_test 67