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
+17 -1
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}
+5 -2
View File
@@ -13,7 +13,7 @@
# cache context. What happens to connection B if one connection A encounters
# an IO-error whilst reading or writing the file-system?
#
# $Id: shared_err.test,v 1.19 2008/05/22 13:56:17 danielk1977 Exp $
# $Id: shared_err.test,v 1.20 2008/07/07 14:56:57 danielk1977 Exp $
proc skip {args} {}
@@ -30,7 +30,6 @@ ifcapable !shared_cache||!subquery {
set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
do_ioerr_test shared_ioerr-1 -tclprep {
sqlite3 db2 test.db
execsql {
@@ -500,6 +499,10 @@ do_malloc_test shared_err-11 -tclprep {
execsql { SELECT * FROM sqlite_master }
}
do_malloc_test shared_err-12 -sqlbody {
CREATE TABLE abc(a, b, c);
INSERT INTO abc VALUES(1, 2, 3);
}
catch {db close}
catch {db2 close}