From: danielk1977 Date: Sat, 10 Jan 2009 11:10:18 +0000 (+0000) Subject: Add a malloc failure test case that covers a few previously untested lines in pager... X-Git-Tag: version-3.6.10~30 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=958552884497e41d99dd6dae249536fed89915a2;p=thirdparty%2Fsqlite.git Add a malloc failure test case that covers a few previously untested lines in pager.c (CVS 6154) FossilOrigin-Name: 000aedb0471b5f5a69e7b61f5e1d4b2644994f32 --- diff --git a/manifest b/manifest index a89c80d025..73b36645dc 100644 --- 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 diff --git a/manifest.uuid b/manifest.uuid index 3b3e35b29e..7886316021 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -64c56226b91e57883c8059f65330318e53376b8a \ No newline at end of file +000aedb0471b5f5a69e7b61f5e1d4b2644994f32 \ No newline at end of file diff --git a/test/malloc.test b/test/malloc.test index 812741248b..1e7c60833c 100644 --- a/test/malloc.test +++ b/test/malloc.test @@ -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 {