summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/test/mallocI.test
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/sqlite/test/mallocI.test')
-rw-r--r--third_party/sqlite/test/mallocI.test22
1 files changed, 21 insertions, 1 deletions
diff --git a/third_party/sqlite/test/mallocI.test b/third_party/sqlite/test/mallocI.test
index ace92dc..f4ddaa2 100644
--- a/third_party/sqlite/test/mallocI.test
+++ b/third_party/sqlite/test/mallocI.test
@@ -11,7 +11,7 @@
#
# This test script checks malloc failures in various obscure operations.
#
-# $Id: mallocI.test,v 1.1 2008/08/02 03:50:39 drh Exp $
+# $Id: mallocI.test,v 1.3 2009/08/10 04:26:39 danielk1977 Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -40,4 +40,24 @@ do_malloc_test mallocI-3 -sqlprep {
CREATE TABLE t2 AS SELECT b,c FROM t1;
}
+# This tests that a malloc failure that occurs while passing the schema
+# does not result in a SHARED lock being left on the database file.
+#
+do_malloc_test mallocI-4 -tclprep {
+ sqlite3 db2 test.db
+ db2 eval {
+ CREATE TABLE t1(a, b, c);
+ CREATE TABLE t2(a, b, c);
+ }
+} -sqlbody {
+ SELECT * FROM t1
+} -cleanup {
+ do_test mallocI-4.$::n.2 {
+ # If this INSERT is possible then [db] does not hold a shared lock
+ # on the database file.
+ catchsql { INSERT INTO t1 VALUES(1, 2, 3) } db2
+ } {0 {}}
+}
+catch { db2 close }
+
finish_test