From: drh Date: Fri, 25 Sep 2015 23:40:01 +0000 (+0000) Subject: Fix threads.c so that setting sqlite3FaultSim(200) using the X-Git-Tag: version-3.9.0~60 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ea31b1286adb309baad799e5e82a2d28071d785;p=thirdparty%2Fsqlite.git Fix threads.c so that setting sqlite3FaultSim(200) using the SQLITE_TESTCTRL_FAULT_INSTALL callback causes both unix and windows worker threads to be sequential and deterministic, so that they can be tested reliably. FossilOrigin-Name: 2d867c054d6d3e1e841ba9ca524e986bc6993ac3 --- diff --git a/manifest b/manifest index c2494e6384..2325407c95 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sPRAGMA\sintegrity_check\sso\sthat\sit\sworks\swith\sa\sUNIQUE\sindex\sover\nexpressions. -D 2015-09-25T20:49:16.032 +C Fix\sthreads.c\sso\sthat\ssetting\ssqlite3FaultSim(200)\susing\sthe\nSQLITE_TESTCTRL_FAULT_INSTALL\scallback\scauses\sboth\sunix\sand\swindows\sworker\nthreads\sto\sbe\ssequential\sand\sdeterministic,\sso\sthat\sthey\scan\sbe\stested\nreliably. +D 2015-09-25T23:40:01.663 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e1afa6fb2de2bddd50e0ddae8166c2ee9d69b301 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -395,7 +395,7 @@ F src/test_thread.c af391ec03d23486dffbcc250b7e58e073f172af9 F src/test_vfs.c 3b65d42e18b262805716bd96178c81da8f2d9283 F src/test_vfstrace.c bab9594adc976cbe696ff3970728830b4c5ed698 F src/test_wsd.c 41cadfd9d97fe8e3e4e44f61a4a8ccd6f7ca8fe9 -F src/threads.c 6bbcc9fe50c917864d48287b4792d46d6e873481 +F src/threads.c 87639bc293d470f50d48c370028511ad3e1ccfd5 F src/tokenize.c 83c6ed569423a3af83a83973b444cf7123be33a6 F src/treeview.c 154f0acc622fa3514de8777dcedf4c8a8802b4ce F src/trigger.c 322f23aad694e8f31d384dcfa386d52a48d3c52f @@ -1388,7 +1388,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 6e4ac0be2de1a16fcbb2a314504122ad95aa257e -R ddf8c16716e71dc2258fab1042b22895 +P 113181cec4db418b07640d6b1967923992efd71a +R c9cd2c770b7c10173d40a9ea442ad6dd U drh -Z 58a6b6e5eae00c6fe24fb1e13719f1e4 +Z 0fbda38735b1950a4a02ae04b92eb3a5 diff --git a/manifest.uuid b/manifest.uuid index 4cdda680b1..906e367c5d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -113181cec4db418b07640d6b1967923992efd71a \ No newline at end of file +2d867c054d6d3e1e841ba9ca524e986bc6993ac3 \ No newline at end of file diff --git a/src/threads.c b/src/threads.c index 4ce6122274..8ed2b42611 100644 --- a/src/threads.c +++ b/src/threads.c @@ -67,6 +67,10 @@ int sqlite3ThreadCreate( memset(p, 0, sizeof(*p)); p->xTask = xTask; p->pIn = pIn; + /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a + ** function that returns SQLITE_ERROR when passed the argument 200, that + ** forces worker threads to run sequentially and deterministically + ** for testing purposes. */ if( sqlite3FaultSim(200) ){ rc = 1; }else{ @@ -151,7 +155,12 @@ int sqlite3ThreadCreate( *ppThread = 0; p = sqlite3Malloc(sizeof(*p)); if( p==0 ) return SQLITE_NOMEM; - if( sqlite3GlobalConfig.bCoreMutex==0 ){ + /* If the SQLITE_TESTCTRL_FAULT_INSTALL callback is registered to a + ** function that returns SQLITE_ERROR when passed the argument 200, that + ** forces worker threads to run sequentially and deterministically + ** (via the sqlite3FaultSim() term of the conditional) for testing + ** purposes. */ + if( sqlite3GlobalConfig.bCoreMutex==0 || sqlite3FaultSim(200) ){ memset(p, 0, sizeof(*p)); }else{ p->xTask = xTask;