SQLite

Check-in [161643a694]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add a test for malloc() failure when compiling a trigger step of the form "INSERT INTO ... SELECT ...". Currently causes a segfault. (CVS 4232)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 161643a694458e76849cd663f277892ae7c6b729
User & Date: danielk1977 2007-08-16 04:39:01.000
Context
2007-08-16
10:09
More work on refactoring of malloc() interfaces. There are still many errors. (CVS 4233) (check-in: 77b1671351 user: danielk1977 tags: trunk)
04:39
Add a test for malloc() failure when compiling a trigger step of the form "INSERT INTO ... SELECT ...". Currently causes a segfault. (CVS 4232) (check-in: 161643a694 user: danielk1977 tags: trunk)
04:30
Half-way through a major refactoring of the memory allocation. I have not even attempted to compile so I am certain there are countless errors. (CVS 4231) (check-in: deb7ecd65f user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/malloc.test.
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#***********************************************************************
# This file attempts to check the library in an out-of-memory situation.
# When compiled with -DSQLITE_DEBUG=1, the SQLite library accepts a special
# command (sqlite_malloc_fail N) which causes the N-th malloc to fail.  This
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.42 2007/05/30 10:36:47 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if memory debugging is turned on.
#
if {[info command sqlite_malloc_stat]==""} {







|







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#***********************************************************************
# This file attempts to check the library in an out-of-memory situation.
# When compiled with -DSQLITE_DEBUG=1, the SQLite library accepts a special
# command (sqlite_malloc_fail N) which causes the N-th malloc to fail.  This
# special feature is used to see what happens in the library if a malloc
# were to really fail due to an out-of-memory situation.
#
# $Id: malloc.test,v 1.43 2007/08/16 04:39:01 danielk1977 Exp $

set testdir [file dirname $argv0]
source $testdir/tester.tcl

# Only run these tests if memory debugging is turned on.
#
if {[info command sqlite_malloc_stat]==""} {
132
133
134
135
136
137
138


139
140
141
142
143
144
145

do_malloc_test 5 -sqlbody {
  BEGIN TRANSACTION;
  CREATE TABLE t1(a,b);
  CREATE TABLE t2(x,y);
  CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
    INSERT INTO t2(x,y) VALUES(new.rowid,1);


    UPDATE t2 SET y=y+1 WHERE x=new.rowid;
    SELECT 123;
    DELETE FROM t2 WHERE x=new.rowid;
  END;
  INSERT INTO t1(a,b) VALUES(2,3);
  COMMIT;
} 







>
>







132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147

do_malloc_test 5 -sqlbody {
  BEGIN TRANSACTION;
  CREATE TABLE t1(a,b);
  CREATE TABLE t2(x,y);
  CREATE TRIGGER r1 AFTER INSERT ON t1 BEGIN
    INSERT INTO t2(x,y) VALUES(new.rowid,1);
    INSERT INTO t2(x,y) SELECT * FROM t2;
    INSERT INTO t2 SELECT * FROM t2;
    UPDATE t2 SET y=y+1 WHERE x=new.rowid;
    SELECT 123;
    DELETE FROM t2 WHERE x=new.rowid;
  END;
  INSERT INTO t1(a,b) VALUES(2,3);
  COMMIT;
}