]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add a malloc failure test case that covers a few previously untested lines in pager...
authordanielk1977 <danielk1977@noemail.net>
Sat, 10 Jan 2009 11:10:18 +0000 (11:10 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 10 Jan 2009 11:10:18 +0000 (11:10 +0000)
FossilOrigin-Name: 000aedb0471b5f5a69e7b61f5e1d4b2644994f32

manifest
manifest.uuid
test/malloc.test

index a89c80d02570331744121c71eb0e2606c371cdca..73b36645dccfeb86f790c77f2486f6bba9dbe85c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Coverage\simprovements\sin\spragma.c.\s\sChange\sthe\s__DARWIN__\smacro\sto\s__APPLE__,\nwhich\sis\savailable\sby\sdefault\son\sLeopard.\s(CVS\s6153)
-D 2009-01-09T21:41:17
+C Add\sa\smalloc\sfailure\stest\scase\sthat\scovers\sa\sfew\spreviously\suntested\slines\sin\spager.c\s(CVS\s6154)
+D 2009-01-10T11:10:19
 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0
 F Makefile.in 05461a9b5803d5ad10c79f989801e9fd2cc3e592
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -430,7 +430,7 @@ F test/lock6.test f4e9052b14da3bd6807a757d5aed15c17321031a
 F test/lookaside.test e69f822f13745f1d5c445c6e30e30f059f30c8e5
 F test/main.test 187a9a1b5248ed74a83838c581c15ec6023b555b
 F test/make-where7.tcl 40bb740b37eead343eaf57b74ab72d2a5a304745
-F test/malloc.test 6bfb1b95188b103b69536effa943ad195c7655d1
+F test/malloc.test db0bed8b5510e6cb5393a007db5e5d64f812ffe5
 F test/malloc3.test 4bc57f850b212f706f3e1b37c4eced1d5a727cd1
 F test/malloc4.test 957337613002b7058a85116493a262f679f3a261
 F test/malloc5.test 20d1a0884b03edf811bfd7005faade028367e7c8
@@ -696,7 +696,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81
 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
-P 0f3f9011fa143f7b63c9bf79d3e411327d5c6f9d
-R e1e4036b9a98af33862eb0ed9594debc
-U drh
-Z a59dff8080441c305d285f6286bef741
+P 64c56226b91e57883c8059f65330318e53376b8a
+R 627a95057c81b1b036cca76929f6bd69
+U danielk1977
+Z cec672afe18d5c5dc5f6dd5421434555
index 3b3e35b29eb41785ca0af5261acdc256ec5f7fc7..7886316021282109ca20a044c09aa6d6a19b9c8e 100644 (file)
@@ -1 +1 @@
-64c56226b91e57883c8059f65330318e53376b8a
\ No newline at end of file
+000aedb0471b5f5a69e7b61f5e1d4b2644994f32
\ No newline at end of file
index 812741248b9d1157c02d571c394a339b6ce01e5a..1e7c60833c3695acc1d9a0c1b5ca4171e41b3f37 100644 (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.70 2008/11/21 09:43:20 danielk1977 Exp $
+# $Id: malloc.test,v 1.71 2009/01/10 11:10:19 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -678,6 +678,36 @@ do_malloc_test 29 -sqlprep {
   INSERT INTO t1 SELECT * FROM t1 UNION ALL SELECT * FROM t1;
 }
 
+do_malloc_test 29 -tclprep {
+  db eval {
+    CREATE TABLE t1(x PRIMARY KEY);
+    INSERT INTO t1 VALUES(randstr(500,500));
+    INSERT INTO t1 VALUES(randstr(500,500));
+    INSERT INTO t1 VALUES(randstr(500,500));
+  }
+  db close
+  sqlite3 db test.db
+
+  # The DELETE command in the following block moves the overflow pages that
+  # are part of the primary key index to the free-list. But it does not
+  # actually load the content of the pages. This leads to the peculiar
+  # situation where cache entries exist, but are not populated with data.
+  # They are populated next time they are requested by the b-tree layer.
+  #
+  db eval {
+    BEGIN;
+      DELETE FROM t1;
+    ROLLBACK;
+  }
+} -sqlbody {
+  # This statement requires the 'no-content' pages loaded by the DELETE
+  # statement above. When requesting the pages, the content is loaded
+  # from the database file. The point of this test case is to test handling
+  # of malloc errors (including SQLITE_IOERR_NOMEM errors) when loading
+  # the content.
+  SELECT * FROM t1 ORDER BY x;
+}
+
 
 # Ensure that no file descriptors were leaked.
 do_test malloc-99.X {