blob: 074224b2e4c7f9b3a2295787b56e71774b4ae256 [file] [log] [blame]
danielk197765839c62007-08-30 08:08:17 +00001# 2007 Aug 29
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#
danielk19775a8f9372007-10-09 08:29:32 +000012# $Id: mallocD.test,v 1.4 2007/10/09 08:29:33 danielk1977 Exp $
danielk197765839c62007-08-30 08:08:17 +000013
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
danielk1977369ff422007-09-03 07:31:09 +000016
drhdec6fae2007-09-03 17:02:50 +000017# Only run these tests if memory debugging is turned on.
18#
19ifcapable !memdebug {
20 puts "Skipping mallocD tests: not compiled with -DSQLITE_MEMDEBUG..."
21 finish_test
22 return
23}
24source $testdir/malloc_common.tcl
danielk197765839c62007-08-30 08:08:17 +000025
26sqlite3_simulate_device -char atomic
27
28set PREP {
29 PRAGMA page_size = 1024;
30 CREATE TABLE abc(a, b, c);
31}
32
33do_malloc_test mallocD-1 -sqlprep $PREP -sqlbody {
34 INSERT INTO abc VALUES(1, 2, 3);
35}
36
37do_malloc_test mallocD-2 -sqlprep $PREP -sqlbody {
38 BEGIN;
39 INSERT INTO abc VALUES(1, 2, 3);
40 INSERT INTO abc VALUES(4, 5, 6);
41 ROLLBACK;
42}
43
44do_malloc_test mallocD-3 -sqlprep $PREP -sqlbody {
45 BEGIN;
46 INSERT INTO abc VALUES(1, 2, 3);
47 INSERT INTO abc VALUES(4, 5, randstr(1500,1500));
48 COMMIT;
49}
50
danielk19775a8f9372007-10-09 08:29:32 +000051ifcapable attach {
52 do_malloc_test mallocD-4 -sqlprep $PREP -sqlbody {
53 ATTACH 'test2.db' AS aux;
54 BEGIN;
55 CREATE TABLE aux.def(d, e, f);
56 INSERT INTO abc VALUES(4, 5, 6);
57 COMMIT;
58 }
danielk197765839c62007-08-30 08:08:17 +000059}
60
61sqlite3_simulate_device -char {}
62
63finish_test