From: drh Date: Fri, 26 Aug 2011 17:17:50 +0000 (+0000) Subject: Cherrypick the recursion fix to test_vfs.c from [065e5a5ea4f82]. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b709c0b65185430922eebefa12f0659c6c1439e;p=thirdparty%2Fsqlite.git Cherrypick the recursion fix to test_vfs.c from [065e5a5ea4f82]. Also fix the nan.test module to handle upper/lower case changes in TCL. FossilOrigin-Name: 41b5f86971ed9d7ddca31bd9b43d0a41f03f002b --- diff --git a/manifest b/manifest index f72ca6ad62..99856e0d61 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Cherrypicked\sfrom\strunk:\s\sDo\snot\stry\sto\suse\sSTAT2\sfor\srow\sestimates\sif\sthe\nindex\sis\sunique\sor\snearly\sso. -D 2011-07-13T18:53:13.589 +C Cherrypick\sthe\srecursion\sfix\sto\stest_vfs.c\sfrom\s[065e5a5ea4f82].\nAlso\sfix\sthe\snan.test\smodule\sto\shandle\supper/lower\scase\schanges\sin\sTCL. +D 2011-08-26T17:17:50.794 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 543f91f24cd7fee774ecc0a61c19704c0c3e78fd F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -210,7 +210,7 @@ F src/test_server.c bbba05c144b5fc4b52ff650a4328027b3fa5fcc6 F src/test_stat.c f682704b5d1ba8e1d4e7e882a6d7922e2dcf066c F src/test_tclvar.c f4dc67d5f780707210d6bb0eb6016a431c04c7fa F src/test_thread.c bedd05cad673dba53326f3aa468cc803038896c0 -F src/test_vfs.c 702e52636113f6b9721da90ef1bf26e07fff414d +F src/test_vfs.c 367e050ebedac89f741dbfdcade3d584a8061dc9 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 F src/tokenize.c 604607d6813e9551cf5189d899e0a25c12681080 F src/trigger.c b8bedb9c0084ceb51a40f54fcca2ce048c8de852 @@ -536,7 +536,7 @@ F test/misc7.test c5f4e6a82e04e71820c0f9f64f6733f04c8ae0ae F test/misuse.test 30b3a458e5a70c31e74c291937b6c82204c59f33 F test/mutex1.test 5b71777fc127509cd257910c8db799de557a02de F test/mutex2.test bfeaeac2e73095b2ac32285d2756e3a65e681660 -F test/nan.test a44e04df1486fcfb02d32468cbcd3c8e1e433723 +F test/nan.test c4b7462e15e0296f16e2ca0e11f3b011dd8d8cbb F test/notify1.test 8433bc74bd952fb8a6e3f8d7a4c2b28dfd69e310 F test/notify2.test 195a467e021f74197be2c4fb02d6dee644b8d8db F test/notify3.test d60923e186e0900f4812a845fcdfd8eea096e33a @@ -851,7 +851,7 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f -P 7afb2354d3791cbce00200ddee6d9f230b9452e2 -R 284ce20ede0bb04e29c76d365b6f3d0b +P d55b64ef7e04e10a31360dea55751a33a0d591a4 +R 9b91be012c6fe7c568f3cf1c45e2011e U drh -Z 90dfab96918bae66e5af513add83497e +Z 5a1720d89ddb619a80580f5e81a47527 diff --git a/manifest.uuid b/manifest.uuid index c101a07873..f442942dd2 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -d55b64ef7e04e10a31360dea55751a33a0d591a4 \ No newline at end of file +41b5f86971ed9d7ddca31bd9b43d0a41f03f002b \ No newline at end of file diff --git a/src/test_vfs.c b/src/test_vfs.c index c606cfbe5c..362842b8ee 100644 --- a/src/test_vfs.c +++ b/src/test_vfs.c @@ -81,8 +81,6 @@ struct Testvfs { sqlite3_vfs *pVfs; /* The testvfs registered with SQLite */ Tcl_Interp *interp; /* Interpreter to run script in */ Tcl_Obj *pScript; /* Script to execute */ - int nScript; /* Number of elements in array apScript */ - Tcl_Obj **apScript; /* Array version of pScript */ TestvfsBuffer *pBuffer; /* List of shared buffers */ int isNoshm; @@ -268,48 +266,26 @@ static void tvfsExecTcl( Tcl_Obj *arg3 ){ int rc; /* Return code from Tcl_EvalObj() */ - int nArg; /* Elements in eval'd list */ - int nScript; - Tcl_Obj ** ap; - + Tcl_Obj *pEval; assert( p->pScript ); - if( !p->apScript ){ - int nByte; - int i; - if( TCL_OK!=Tcl_ListObjGetElements(p->interp, p->pScript, &nScript, &ap) ){ - Tcl_BackgroundError(p->interp); - Tcl_ResetResult(p->interp); - return; - } - p->nScript = nScript; - nByte = (nScript+TESTVFS_MAX_ARGS)*sizeof(Tcl_Obj *); - p->apScript = (Tcl_Obj **)ckalloc(nByte); - memset(p->apScript, 0, nByte); - for(i=0; iapScript[i] = ap[i]; - } - } - - p->apScript[p->nScript] = Tcl_NewStringObj(zMethod, -1); - p->apScript[p->nScript+1] = arg1; - p->apScript[p->nScript+2] = arg2; - p->apScript[p->nScript+3] = arg3; + assert( zMethod ); + assert( p ); + assert( arg2==0 || arg1!=0 ); + assert( arg3==0 || arg2!=0 ); - for(nArg=p->nScript; p->apScript[nArg]; nArg++){ - Tcl_IncrRefCount(p->apScript[nArg]); - } + pEval = Tcl_DuplicateObj(p->pScript); + Tcl_IncrRefCount(p->pScript); + Tcl_ListObjAppendElement(p->interp, pEval, Tcl_NewStringObj(zMethod, -1)); + if( arg1 ) Tcl_ListObjAppendElement(p->interp, pEval, arg1); + if( arg2 ) Tcl_ListObjAppendElement(p->interp, pEval, arg2); + if( arg3 ) Tcl_ListObjAppendElement(p->interp, pEval, arg3); - rc = Tcl_EvalObjv(p->interp, nArg, p->apScript, TCL_EVAL_GLOBAL); + rc = Tcl_EvalObjEx(p->interp, pEval, TCL_EVAL_GLOBAL); if( rc!=TCL_OK ){ Tcl_BackgroundError(p->interp); Tcl_ResetResult(p->interp); } - - for(nArg=p->nScript; p->apScript[nArg]; nArg++){ - Tcl_DecrRefCount(p->apScript[nArg]); - p->apScript[nArg] = 0; - } } @@ -1074,9 +1050,6 @@ static int testvfs_obj_cmd( int nByte; if( p->pScript ){ Tcl_DecrRefCount(p->pScript); - ckfree((char *)p->apScript); - p->apScript = 0; - p->nScript = 0; p->pScript = 0; } Tcl_GetStringFromObj(objv[2], &nByte); @@ -1230,7 +1203,6 @@ static void testvfs_obj_del(ClientData cd){ Testvfs *p = (Testvfs *)cd; if( p->pScript ) Tcl_DecrRefCount(p->pScript); sqlite3_vfs_unregister(p->pVfs); - ckfree((char *)p->apScript); ckfree((char *)p->pVfs); ckfree((char *)p); } diff --git a/test/nan.test b/test/nan.test index 0e9462fcb5..246446f8f4 100644 --- a/test/nan.test +++ b/test/nan.test @@ -46,31 +46,31 @@ if {$tcl_platform(platform) != "symbian"} { sqlite3_bind_double $::STMT 1 +Inf sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real} do_test nan-1.1.3 { sqlite3_bind_double $::STMT 1 -Inf sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real} do_test nan-1.1.4 { sqlite3_bind_double $::STMT 1 -NaN sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real {} null} do_test nan-1.1.5 { sqlite3_bind_double $::STMT 1 NaN0 sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real {} null {} null} do_test nan-1.1.6 { sqlite3_bind_double $::STMT 1 -NaN0 sqlite3_step $::STMT sqlite3_reset $::STMT - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {{} null inf real -inf real {} null {} null {} null} do_test nan-1.1.7 { db eval { @@ -234,12 +234,12 @@ if {$tcl_platform(platform) != "symbian"} { do_test nan-4.7 { db eval {DELETE FROM t1} db eval "INSERT INTO t1 VALUES([string repeat 9 309].0)" - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {inf real} do_test nan-4.8 { db eval {DELETE FROM t1} db eval "INSERT INTO t1 VALUES(-[string repeat 9 309].0)" - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {-inf real} } do_test nan-4.9 { @@ -317,7 +317,7 @@ do_test nan-4.20 { db eval {DELETE FROM t1} set big [string repeat 9 10000].0e-9000 db eval "INSERT INTO t1 VALUES($big)" - db eval {SELECT x, typeof(x) FROM t1} + string tolower [db eval {SELECT x, typeof(x) FROM t1}] } {inf real}