/ Check-in [161643a6]
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 | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 161643a694458e76849cd663f277892ae7c6b729
User & Date: danielk1977 2007-08-16 04:39:01
Context
2007-08-16
10:09
More work on refactoring of malloc() interfaces. There are still many errors. (CVS 4233) check-in: 77b16713 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: 161643a6 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: deb7ecd6 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/malloc.test.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
132
133
134
135
136
137
138


139
140
141
142
143
144
145
#***********************************************************************
# 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]==""} {
................................................................................

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;
} 







|







 







>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#***********************************************************************
# 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]==""} {
................................................................................

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;
}