diff --git a/manifest b/manifest index 0b3ebc2de4..b8c0a39117 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\sckfree()\sinstead\sof\ssqlite3_free()\sto\sfree\san\sallocation\smade\sby\sckalloc()\sin\stest_thread.c\s(test\scode\sonly).\s(CVS\s5633) -D 2008-08-28T13:15:50 +C Avoid\susing\s(clock\sseconds)\sin\sthread003.test.\sIt\sis\snot\savailable\sif\stestfixture\sis\slinked\sto\stcl\s8.5.\s(CVS\s5634) +D 2008-08-28T13:55:10 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 689e14735f862a5553bceef206d8c13e29504e44 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -178,7 +178,7 @@ F src/test_osinst.c ae29e9c09485622a157849508302dd9ffe44f21f F src/test_schema.c 4b4bf7bb329326458c491b0e6facd4c8c4c5b479 F src/test_server.c f0a403b5f699c09bd2b1236b6f69830fd6221f6b F src/test_tclvar.c 9e42fa59d3d2f064b7ab8628e7ab2dc8a9fe93d4 -F src/test_thread.c ecb4b86f5f348d7129bdfc7565cbc9afd668cd68 +F src/test_thread.c d74fc445e0dba0e00806117eb449b307c0b146bf F src/tokenize.c d16ca0e9944161c76d2e4c11dc379ec88189b93b F src/trigger.c 649940b5bf5838a33721fb72372e7c9d1faf56a9 F src/update.c f2cf6f00d542956bd49ba4b9815c2900d9225bf2 @@ -503,7 +503,7 @@ F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125 F test/tester.tcl 12fd8394caeb71f7d961707da8668756389bc9d3 F test/thread001.test 3fb08080e1fe84d1bb7ec7bbc9e13743a77e5bc5 F test/thread002.test ed9b800460df01e3cf9428ee11dc4e3f04b9b896 -F test/thread003.test d78038bf0ec882b61bd5d05c4e77affb23f5033f +F test/thread003.test fae60bf3f15c074fd24768492ecb476d8734cffd F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 F test/thread2.test 6d7b30102d600f51b4055ee3a5a19228799049fb F test/thread_common.tcl 8a9d7a4500dfdbbd36679c977831b62c130b76b1 @@ -625,7 +625,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 1dbced29de5f59ba2ebf877edcadf171540374d1 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 5e304fed275137f98be56f475504422d1f5113a4 -R c752f6e3a22232cc2fbb6d6779da507b +P 677ac144c8f7e2722fdf05da1431919d6a8bb45f +R e5bc691d64a66c3c32e3f3fdc2b65463 U danielk1977 -Z 3fa1e66ece378940e87415f3818f5176 +Z a14388406a05abc10347757e6741d06a diff --git a/manifest.uuid b/manifest.uuid index 8d839af593..fe1cbd0136 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -677ac144c8f7e2722fdf05da1431919d6a8bb45f \ No newline at end of file +b606263d0868aed267bcec623b9fe4d142099145 \ No newline at end of file diff --git a/src/test_thread.c b/src/test_thread.c index fc9172adb5..1986ddc7d1 100644 --- a/src/test_thread.c +++ b/src/test_thread.c @@ -14,7 +14,7 @@ ** test that sqlite3 database handles may be concurrently accessed by ** multiple threads. Right now this only works on unix. ** -** $Id: test_thread.c,v 1.7 2008/08/28 13:15:50 danielk1977 Exp $ +** $Id: test_thread.c,v 1.8 2008/08/28 13:55:10 danielk1977 Exp $ */ #include "sqliteInt.h" @@ -51,6 +51,7 @@ struct EvalEvent { }; static Tcl_ObjCmdProc sqlthread_proc; +static Tcl_ObjCmdProc clock_seconds_proc; int Sqlitetest1_Init(Tcl_Interp *); /* @@ -99,6 +100,7 @@ static Tcl_ThreadCreateType tclScriptThread(ClientData pSqlThread){ SqlThread *p = (SqlThread *)pSqlThread; interp = Tcl_CreateInterp(); + Tcl_CreateObjCommand(interp, "clock_seconds", clock_seconds_proc, 0, 0); Tcl_CreateObjCommand(interp, "sqlthread", sqlthread_proc, pSqlThread, 0); Sqlitetest1_Init(interp); @@ -171,7 +173,7 @@ static int sqlthread_spawn( rc = Tcl_CreateThread(&x, tclScriptThread, (void *)pNew, nStack, flags); if( rc!=TCL_OK ){ Tcl_AppendResult(interp, "Error in Tcl_CreateThread()", 0); - ckfree(pNew); + ckfree((char *)pNew); return TCL_ERROR; } @@ -318,11 +320,31 @@ static int sqlthread_proc( return pSub->xProc(clientData, interp, objc, objv); } +/* +** The [clock_seconds] command. This is more or less the same as the +** regular tcl [clock seconds], except that it is available in testfixture +** when linked against both Tcl 8.4 and 8.5. Because [clock seconds] is +** implemented as a script in Tcl 8.5, it is not usually available to +** testfixture. +*/ +static int clock_seconds_proc( + ClientData clientData, + Tcl_Interp *interp, + int objc, + Tcl_Obj *CONST objv[] +){ + Tcl_Time now; + Tcl_GetTime(&now); + Tcl_SetObjResult(interp, Tcl_NewIntObj(now.sec)); + return TCL_OK; +} + /* ** Register commands with the TCL interpreter. */ int SqlitetestThread_Init(Tcl_Interp *interp){ Tcl_CreateObjCommand(interp, "sqlthread", sqlthread_proc, 0, 0); + Tcl_CreateObjCommand(interp, "clock_seconds", clock_seconds_proc, 0, 0); return TCL_OK; } #else diff --git a/test/thread003.test b/test/thread003.test index 8e3fbd312c..cc487fa643 100644 --- a/test/thread003.test +++ b/test/thread003.test @@ -12,7 +12,7 @@ # This file contains tests that attempt to break the pcache module # by bombarding it with simultaneous requests from multiple threads. # -# $Id: thread003.test,v 1.2 2008/08/28 10:21:17 danielk1977 Exp $ +# $Id: thread003.test,v 1.3 2008/08/28 13:55:10 danielk1977 Exp $ set testdir [file dirname $argv0] @@ -83,14 +83,13 @@ puts "Starting thread003.2 (should run for ~$nSecond seconds)" do_test thread003.2 { foreach zFile {test.db test2.db} { set SCRIPT [format { - set iStart [clock seconds] - set iEnd [expr {[clock seconds] + %d}] + set iEnd [expr {[clock_seconds] + %d}] set ::DB [sqlthread open %s] # Set the cache size to 15 pages per cache. 30 available globally. execsql { PRAGMA cache_size = 15 } - while {[clock seconds] < $iEnd} { + while {[clock_seconds] < $iEnd} { set iQuery [expr {int(rand()*5000)}] execsql " SELECT * FROM t1 WHERE a = $iQuery " } @@ -120,14 +119,14 @@ puts "Starting thread003.3 (should run for ~$nSecond seconds)" do_test thread003.3 { foreach zFile {test.db test2.db} { set SCRIPT [format { - set iStart [clock seconds] - set iEnd [expr {[clock seconds] + %d}] + set iStart [clock_seconds] + set iEnd [expr {[clock_seconds] + %d}] set ::DB [sqlthread open %s] # Set the cache size to 15 pages per cache. 30 available globally. execsql { PRAGMA cache_size = 15 } - while {[clock seconds] < $iEnd} { + while {[clock_seconds] < $iEnd} { set iQuery [expr {int(rand()*5000)}] execsql "SELECT * FROM t1 WHERE a = $iQuery" execsql "UPDATE t1 SET b = randomblob(200) @@ -158,13 +157,13 @@ set nSecond 30 puts "Starting thread003.3 (should run for ~$nSecond seconds)" do_test thread003.4 { thread_spawn finished(1) $thread_procs [format { - set iEnd [expr {[clock seconds] + %d}] + set iEnd [expr {[clock_seconds] + %d}] set ::DB [sqlthread open test.db] # Set the cache size to 15 pages per cache. 30 available globally. execsql { PRAGMA cache_size = 15 } - while {[clock seconds] < $iEnd} { + while {[clock_seconds] < $iEnd} { set iQuery [expr {int(rand()*5000)}] execsql "SELECT * FROM t1 WHERE a = $iQuery" } @@ -173,9 +172,9 @@ do_test thread003.4 { expr 1 } $nSecond] thread_spawn finished(2) [format { - set iEnd [expr {[clock seconds] + %d}] + set iEnd [expr {[clock_seconds] + %d}] - while {[clock seconds] < $iEnd} { + while {[clock_seconds] < $iEnd} { sqlite3_release_memory 1000 } } $nSecond]