From 1ad7f64aac2aa5f94b686790df8a3b5c26a2a77e Mon Sep 17 00:00:00 2001 From: danielk1977 Date: Thu, 20 Jan 2005 05:24:32 +0000 Subject: [PATCH] Changes so that crash.test works when SQLITE_OMIT_PAGER_PRAGMAS is defined. (CVS 2242) FossilOrigin-Name: f0add0a60e0afb833202e42cdba97bafe6a59dfc --- manifest | 14 +++++++------- manifest.uuid | 2 +- src/test3.c | 30 +++++++++++++++++++++++++++++- test/crash.test | 13 ++++++++++--- 4 files changed, 47 insertions(+), 12 deletions(-) diff --git a/manifest b/manifest index c0b2502332..be3dc90f8a 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\ssome\stest\sscripts\sso\sthat\sthey\swork\swith\sa\sminimal\sbuild\sconfiguration.\s(CVS\s2241) -D 2005-01-20T02:17:02 +C Changes\sso\sthat\scrash.test\sworks\swhen\sSQLITE_OMIT_PAGER_PRAGMAS\sis\sdefined.\s(CVS\s2242) +D 2005-01-20T05:24:33 F Makefile.in ffd81f5e926d40b457071b4de8d7c1fa18f39b5a F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -66,7 +66,7 @@ F src/table.c 25b3ff2b39b7d87e8d4a5da0713d68dfc06cbee9 F src/tclsqlite.c fd27457b228118be96524dae285146c76efe032b F src/test1.c 59fc0f0c35cb3bccdf166f36a1a5f9ffb0b951e7 F src/test2.c bbc2ecc58ceeab12d1e40970f831b1017524e40d -F src/test3.c a72f20066cccd5a7b9f20b7b78fa9b05b47b3020 +F src/test3.c 5c2ec5c8eb689ac93fb0546f84b310659ad287c6 F src/test4.c 7c6b9fc33dd1f3f93c7f1ee6e5e6d016afa6c1df F src/test5.c 64f08b2a50ef371a1bd68ff206829e7b1b9997f5 F src/tokenize.c 88bef43fe3e3c8865a7447f934296ac13238c4f6 @@ -116,7 +116,7 @@ F test/collate6.test 6c9470d1606ee3e564675b229653e320c49ec638 F test/conflict.test c5b849b01cfbe0a4f63a90cba6f68e2fe3a75f87 F test/corrupt.test 916977f0255c81217a44abe0ac01b8508f65dcbf F test/corrupt2.test cb1f813df7559de3021e01170af0bba31507a9a5 -F test/crash.test fa5d79ece85e8f6677bd81703db5f869a15963aa +F test/crash.test f38b980a0508655d08c957a6dd27d66bca776504 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2 F test/cursor.test d7c65ea0fc4e321e12fbcf5c7f3e2211ef45379b F test/date.test ef6c679d0b59502457dbd78ee1c3c085c949c4c4 @@ -270,7 +270,7 @@ F www/tclsqlite.tcl e73f8f8e5f20e8277619433f7970060ab01088fc F www/vdbe.tcl 095f106d93875c94b47367384ebc870517431618 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl c3b50d3ac31c54be2a1af9b488a89d22f1e6e746 -P 2d3ab1ab5ae08fe21f4662b171f04362c1326eb0 -R 5ba3e96793e1fa69b896ac82bdf9868f +P d267fb3ca3f31ee138c9613cb84e873ede7f141a +R 55044367795c6eaf0d2957842ac9aaf4 U danielk1977 -Z ec1fffb60f32816ed9904cccfc34fd61 +Z 27da8f82b49b57c87cafc749a59dab56 diff --git a/manifest.uuid b/manifest.uuid index fc8941839b..2829336d9f 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d267fb3ca3f31ee138c9613cb84e873ede7f141a \ No newline at end of file +f0add0a60e0afb833202e42cdba97bafe6a59dfc \ No newline at end of file diff --git a/src/test3.c b/src/test3.c index f932c1f32f..2997a29f4e 100644 --- a/src/test3.c +++ b/src/test3.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test3.c,v 1.59 2005/01/10 12:59:53 danielk1977 Exp $ +** $Id: test3.c,v 1.60 2005/01/20 05:24:33 danielk1977 Exp $ */ #include "sqliteInt.h" #include "pager.h" @@ -1363,6 +1363,33 @@ static int btree_from_db( return TCL_OK; } + +/* +** usage: btree_set_cache_size ID NCACHE +** +** Set the size of the cache used by btree $ID. +*/ +static int btree_set_cache_size( + void *NotUsed, + Tcl_Interp *interp, /* The TCL interpreter that invoked this command */ + int argc, /* Number of arguments */ + const char **argv /* Text of each argument */ +){ + int nCache; + Btree *pBt; + + if( argc!=3 ){ + Tcl_AppendResult(interp, "wrong # args: should be \"", argv[0], + " BT NCACHE\"", 0); + return TCL_ERROR; + } + pBt = sqlite3TextToPtr(argv[1]); + if( Tcl_GetInt(interp, argv[2], &nCache) ) return TCL_ERROR; + sqlite3BtreeSetCacheSize(pBt, nCache); + return TCL_OK; +} + + /* ** Register commands with the TCL interpreter. */ @@ -1410,6 +1437,7 @@ int Sqlitetest3_Init(Tcl_Interp *interp){ { "btree_commit_statement", (Tcl_CmdProc*)btree_commit_statement }, { "btree_rollback_statement", (Tcl_CmdProc*)btree_rollback_statement }, { "btree_from_db", (Tcl_CmdProc*)btree_from_db }, + { "btree_set_cache_size", (Tcl_CmdProc*)btree_set_cache_size }, }; int i; diff --git a/test/crash.test b/test/crash.test index afbddf895c..9763a052bc 100644 --- a/test/crash.test +++ b/test/crash.test @@ -20,7 +20,7 @@ # The special crash-test module with its os_test.c backend only works # on Unix. # -# $Id: crash.test,v 1.16 2005/01/16 09:06:34 danielk1977 Exp $ +# $Id: crash.test,v 1.17 2005/01/20 05:24:33 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -46,8 +46,15 @@ proc crashsql {crashdelay crashfile sql} { set f [open crash.tcl w] puts $f "sqlite3_crashparams $crashdelay $cfile" - puts $f "sqlite3 db test.db" - puts $f "db eval {pragma cache_size = 10}" + puts $f {sqlite3 db test.db} + + # This block sets the cache size of the main database to 10 + # pages. This is done in case the build is configured to omit + # "PRAGMA cache_size". + puts $f {db eval {SELECT * FROM sqlite_master;}} + puts $f {set bt [btree_from_db db]} + puts $f {btree_set_cache_size $bt 10} + puts $f "db eval {" puts $f "$sql" puts $f "}"