1344a6276Sdrh# 2006 June 25 2344a6276Sdrh# 3344a6276Sdrh# The author disclaims copyright to this source code. In place of 4344a6276Sdrh# a legal notice, here is a blessing: 5344a6276Sdrh# 6344a6276Sdrh# May you do good and not evil. 7344a6276Sdrh# May you find forgiveness for yourself and forgive others. 8344a6276Sdrh# May you share freely, never taking more than you give. 9344a6276Sdrh# 10344a6276Sdrh#*********************************************************************** 11344a6276Sdrh# This file attempts to check the library in an out-of-memory situation. 12344a6276Sdrh# 13*eee4c8caSdrh# $Id: malloc6.test,v 1.5 2008/02/18 22:24:58 drh Exp $ 14344a6276Sdrh 15344a6276Sdrhset testdir [file dirname $argv0] 16344a6276Sdrhsource $testdir/tester.tcl 17*eee4c8caSdrhsource $testdir/malloc_common.tcl 18344a6276Sdrh 19344a6276Sdrh# Only run these tests if memory debugging is turned on. 20344a6276Sdrh# 21*eee4c8caSdrhif {!$MEMDEBUG} { 225a3032b3Sdrh puts "Skipping malloc6 tests: not compiled with -DSQLITE_MEMDEBUG..." 23344a6276Sdrh finish_test 24344a6276Sdrh return 25344a6276Sdrh} 26344a6276Sdrh 27344a6276Sdrh 28344a6276Sdrhset sqlite_os_trace 0 29ed138fb3Sdrhdo_malloc_test malloc6-1 -tclprep { 30344a6276Sdrh db close 31344a6276Sdrh} -tclbody { 32344a6276Sdrh if {[catch {sqlite3 db test.db}]} { 33344a6276Sdrh error "out of memory" 34344a6276Sdrh } 35ae72d982Sdanielk1977 sqlite3_extended_result_codes db 1 36344a6276Sdrh} -sqlbody { 37344a6276Sdrh DROP TABLE IF EXISTS t1; 38344a6276Sdrh CREATE TABLE IF NOT EXISTS t1( 39344a6276Sdrh a int, b float, c double, d text, e varchar(20), 40344a6276Sdrh primary key(a,b,c) 41344a6276Sdrh ); 42344a6276Sdrh CREATE TABLE IF NOT EXISTS t1( 43344a6276Sdrh a int, b float, c double, d text, e varchar(20), 44344a6276Sdrh primary key(a,b,c) 45344a6276Sdrh ); 46344a6276Sdrh DROP TABLE IF EXISTS t1; 47344a6276Sdrh} 48344a6276Sdrh 49344a6276Sdrh# Ensure that no file descriptors were leaked. 50344a6276Sdrhdo_test malloc6-1.X { 51344a6276Sdrh catch {db close} 52344a6276Sdrh set sqlite_open_file_count 53344a6276Sdrh} {0} 54344a6276Sdrh 55344a6276Sdrhfinish_test 56