1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Test a couple of specific malloc() failures that were not tested before. (CVS 5350)

FossilOrigin-Name: b96bcaa197519b5be89e1f6a1579f0e36fe2b644
This commit is contained in:
danielk1977
2008-07-07 14:56:56 +00:00
parent 24b58dd717
commit 7eaabcdb2a
5 changed files with 39 additions and 17 deletions

View File

@ -16,7 +16,7 @@
# 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.62 2008/06/19 18:17:50 danielk1977 Exp $
# $Id: malloc.test,v 1.63 2008/07/07 14:56:57 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -594,6 +594,22 @@ ifcapable view&&trigger {
}
}
do_malloc_test 25 -sqlprep {
CREATE TABLE abc(a, b, c);
CREATE INDEX i1 ON abc(a, b);
INSERT INTO abc VALUES(1, 2, 3);
INSERT INTO abc VALUES(4, 5, 6);
} -tclbody {
# For each UPDATE executed, the cursor used for the SELECT statement
# must be "saved". Because the cursor is open on an index, this requires
# a malloc() to allocate space to save the index key. This test case is
# aimed at testing the response of the library to a failure in that
# particular malloc() call.
db eval {SELECT a FROM abc ORDER BY a} {
db eval {UPDATE abc SET b = b - 1 WHERE a = $a}
}
}
# Ensure that no file descriptors were leaked.
do_test malloc-99.X {
catch {db close}