1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/mallocD.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,65 @@
1.4 +# 2007 Aug 29
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +#
1.15 +# $Id: mallocD.test,v 1.6 2008/02/18 22:24:58 drh Exp $
1.16 +
1.17 +set testdir [file dirname $argv0]
1.18 +source $testdir/tester.tcl
1.19 +source $testdir/malloc_common.tcl
1.20 +
1.21 +# Only run these tests if memory debugging is turned on.
1.22 +#
1.23 +if {!$MEMDEBUG} {
1.24 + puts "Skipping mallocD tests: not compiled with -DSQLITE_MEMDEBUG..."
1.25 + finish_test
1.26 + return
1.27 +}
1.28 +
1.29 +db close
1.30 +sqlite3_simulate_device -char atomic
1.31 +sqlite3 db test.db -vfs devsym
1.32 +
1.33 +set PREP {
1.34 + PRAGMA page_size = 1024;
1.35 + CREATE TABLE abc(a, b, c);
1.36 +}
1.37 +
1.38 +do_malloc_test mallocD-1 -sqlprep $PREP -sqlbody {
1.39 + INSERT INTO abc VALUES(1, 2, 3);
1.40 +}
1.41 +
1.42 +do_malloc_test mallocD-2 -sqlprep $PREP -sqlbody {
1.43 + BEGIN;
1.44 + INSERT INTO abc VALUES(1, 2, 3);
1.45 + INSERT INTO abc VALUES(4, 5, 6);
1.46 + ROLLBACK;
1.47 +}
1.48 +
1.49 +do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody {
1.50 + BEGIN;
1.51 + INSERT INTO abc VALUES(1, 2, 3);
1.52 + INSERT INTO abc VALUES(4, 5, randstr(1500,1500));
1.53 + COMMIT;
1.54 +}
1.55 +
1.56 +ifcapable attach {
1.57 + do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody {
1.58 + ATTACH 'test2.db' AS aux;
1.59 + BEGIN;
1.60 + CREATE TABLE aux.def(d, e, f);
1.61 + INSERT INTO abc VALUES(4, 5, 6);
1.62 + COMMIT;
1.63 + }
1.64 +}
1.65 +
1.66 +sqlite3_simulate_device -char {}
1.67 +
1.68 +finish_test