Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Enable the thread test logic to work with the SQLITE_HAS_CODEC compile-time option. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
20ddfb4780b87953718f3a8e67b777dc |
User & Date: | drh 2011-08-30 19:52:32.227 |
Context
2011-08-31
| ||
13:27 | Add checks to make sure cells in corrupt database files do not overflow a page when doing autovacuum. Problem detected by valgrind. (check-in: d0b347b412 user: drh tags: trunk) | |
2011-08-30
| ||
19:52 | Enable the thread test logic to work with the SQLITE_HAS_CODEC compile-time option. (check-in: 20ddfb4780 user: drh tags: trunk) | |
01:29 | Change the build process so that it does not require the unix "sort" command. This avoids confusion between ms-sort and mingw-sort on windows systems. (check-in: f1bd5bbae5 user: drh tags: trunk) | |
Changes
Changes to src/test_thread.c.
︙ | ︙ | |||
278 279 280 281 282 283 284 285 286 287 288 289 290 291 | extern void Md5_Register(sqlite3*); UNUSED_PARAMETER(clientData); UNUSED_PARAMETER(objc); zFilename = Tcl_GetString(objv[2]); rc = sqlite3_open(zFilename, &db); Md5_Register(db); sqlite3_busy_handler(db, xBusy, 0); if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR; Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; | > > > > > > > > > > > > > > > | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | extern void Md5_Register(sqlite3*); UNUSED_PARAMETER(clientData); UNUSED_PARAMETER(objc); zFilename = Tcl_GetString(objv[2]); rc = sqlite3_open(zFilename, &db); #ifdef SQLITE_HAS_CODEC if( db && objc>=4 ){ const char *zKey; int nKey; zKey = Tcl_GetStringFromObj(objv[3], &nKey); rc = sqlite3_key(db, zKey, nKey); if( rc!=SQLITE_OK ){ char *zErrMsg = sqlite3_mprintf("error %d: %s", rc, sqlite3_errmsg(db)); sqlite3_close(db); Tcl_AppendResult(interp, zErrMsg, (char*)0); sqlite3_free(zErrMsg); return TCL_ERROR; } } #endif Md5_Register(db); sqlite3_busy_handler(db, xBusy, 0); if( sqlite3TestMakePointerStr(interp, zBuf, db) ) return TCL_ERROR; Tcl_AppendResult(interp, zBuf, 0); return TCL_OK; |
︙ | ︙ | |||
345 346 347 348 349 350 351 | rc = Tcl_GetIndexFromObjStruct( interp, objv[1], aSub, sizeof(aSub[0]), "sub-command", 0, &iIndex ); if( rc!=TCL_OK ) return rc; pSub = &aSub[iIndex]; | | | 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | rc = Tcl_GetIndexFromObjStruct( interp, objv[1], aSub, sizeof(aSub[0]), "sub-command", 0, &iIndex ); if( rc!=TCL_OK ) return rc; pSub = &aSub[iIndex]; if( objc<(pSub->nArg+2) ){ Tcl_WrongNumArgs(interp, 2, objv, pSub->zUsage); return TCL_ERROR; } return pSub->xProc(clientData, interp, objc, objv); } |
︙ | ︙ |
Changes to test/thread001.test.
︙ | ︙ | |||
38 39 40 41 42 43 44 | catchsql { DROP TABLE ab; } do_test thread001.$tn.0 { db close sqlite3_enable_shared_cache $shared_cache sqlite3_enable_shared_cache $shared_cache } $shared_cache | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | catchsql { DROP TABLE ab; } do_test thread001.$tn.0 { db close sqlite3_enable_shared_cache $shared_cache sqlite3_enable_shared_cache $shared_cache } $shared_cache sqlite3 db test.db -fullmutex 1 -key xyzzy set dbconfig "" if {$same_db} { set dbconfig [list set ::DB [sqlite3_connection_pointer db]] } # Set up a database and a schema. The database contains a single |
︙ | ︙ | |||
73 74 75 76 77 78 79 | execsql { PRAGMA integrity_check } } {ok} set thread_program { #sqlthread parent {puts STARTING..} set needToClose 0 if {![info exists ::DB]} { | | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | execsql { PRAGMA integrity_check } } {ok} set thread_program { #sqlthread parent {puts STARTING..} set needToClose 0 if {![info exists ::DB]} { set ::DB [sqlthread open test.db xyzzy] #sqlthread parent "puts \"OPEN $::DB\"" set needToClose 1 } for {set i 0} {$i < 100} {incr i} { # Test that the invariant is true. do_test t1 { |
︙ | ︙ |
Changes to test/thread002.test.
︙ | ︙ | |||
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # This test attempts to deadlock SQLite in shared-cache mode. # # # $Id: thread002.test,v 1.9 2009/03/26 14:48:07 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl if {[run_thread_tests]==0} { finish_test ; return } db close set ::enable_shared_cache [sqlite3_enable_shared_cache 1] set ::NTHREAD 10 do_test thread002.1 { | > > | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # This test attempts to deadlock SQLite in shared-cache mode. # # # $Id: thread002.test,v 1.9 2009/03/26 14:48:07 danielk1977 Exp $ set testdir [file dirname $argv0] set do_not_use_codec 1 source $testdir/tester.tcl if {[run_thread_tests]==0} { finish_test ; return } db close set ::enable_shared_cache [sqlite3_enable_shared_cache 1] set ::NTHREAD 10 do_test thread002.1 { |
︙ | ︙ |
Changes to test/thread003.test.
︙ | ︙ | |||
76 77 78 79 80 81 82 | # set nSecond 30 puts "Starting thread003.2 (should run for ~$nSecond seconds)" do_test thread003.2 { foreach zFile {test.db test2.db} { set SCRIPT [format { set iEnd [expr {[clock_seconds] + %d}] | | | 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | # set nSecond 30 puts "Starting thread003.2 (should run for ~$nSecond seconds)" do_test thread003.2 { foreach zFile {test.db test2.db} { set SCRIPT [format { set iEnd [expr {[clock_seconds] + %d}] set ::DB [sqlthread open %s xyzzy] # Set the cache size to 15 pages per cache. 30 available globally. execsql { PRAGMA cache_size = 15 } while {[clock_seconds] < $iEnd} { set iQuery [expr {int(rand()*5000)}] execsql " SELECT * FROM t1 WHERE a = $iQuery " |
︙ | ︙ | |||
113 114 115 116 117 118 119 | set nSecond 30 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}] | | | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | set nSecond 30 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 ::DB [sqlthread open %s xyzzy] # Set the cache size to 15 pages per cache. 30 available globally. execsql { PRAGMA cache_size = 15 } while {[clock_seconds] < $iEnd} { set iQuery [expr {int(rand()*5000)}] execsql "SELECT * FROM t1 WHERE a = $iQuery" |
︙ | ︙ | |||
152 153 154 155 156 157 158 | set nSecond 30 puts "Starting thread003.4 (should run for ~$nSecond seconds)" unset -nocomplain finished(1) unset -nocomplain finished(2) do_test thread003.4 { thread_spawn finished(1) $thread_procs [format { set iEnd [expr {[clock_seconds] + %d}] | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | set nSecond 30 puts "Starting thread003.4 (should run for ~$nSecond seconds)" unset -nocomplain finished(1) unset -nocomplain finished(2) do_test thread003.4 { thread_spawn finished(1) $thread_procs [format { set iEnd [expr {[clock_seconds] + %d}] set ::DB [sqlthread open test.db xyzzy] # Set the cache size to 15 pages per cache. 30 available globally. execsql { PRAGMA cache_size = 15 } while {[clock_seconds] < $iEnd} { set iQuery [expr {int(rand()*5000)}] execsql "SELECT * FROM t1 WHERE a = $iQuery" |
︙ | ︙ |