SQLite

Check-in [ea80b21c88]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Do not report an error if the open-file-count is not as it should be after running a multi-threaded test. The counter instrumentation is not thread-safe.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ea80b21c881fabaec1da788588c35c6c9782dcbd
User & Date: dan 2010-07-05 14:54:49.000
Context
2010-07-05
17:43
When rolling back page 1 from a journal, restore the "nReserve" setting in case it has been corrupted by a prior crash. (check-in: c0d124da88 user: drh tags: trunk)
14:54
Do not report an error if the open-file-count is not as it should be after running a multi-threaded test. The counter instrumentation is not thread-safe. (check-in: ea80b21c88 user: dan tags: trunk)
12:54
Call Tcl_ExitThread() from within threads created using Tcl_CreateThread(). Not doing so causes notifier related errors on OSX. (check-in: 684eae6623 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/tester.tcl.
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308


309
310
311
312
313
314
315
316
#
proc do_test {name cmd expected} {

  global argv cmdlinearg

  sqlite3_memdebug_settitle $name

  if {[llength $argv]==0} { 
    set go 1
  } else {
    set go 0
    foreach pattern $argv {
      if {[string match $pattern $name]} {
        set go 1
        break
      }
    }
  }


  if {!$go} return

  if {[info exists ::G(perm:prefix)]} {
    set name "$::G(perm:prefix)$name"
  }

  incr_ntest
  puts -nonewline $name...







|
|
|
|
|
|
|
|
<
<
<
>
>
|







291
292
293
294
295
296
297
298
299
300
301
302
303
304
305



306
307
308
309
310
311
312
313
314
315
#
proc do_test {name cmd expected} {

  global argv cmdlinearg

  sqlite3_memdebug_settitle $name

#  if {[llength $argv]==0} { 
#    set go 1
#  } else {
#    set go 0
#    foreach pattern $argv {
#      if {[string match $pattern $name]} {
#        set go 1
#        break



#      }
#    }
#  }

  if {[info exists ::G(perm:prefix)]} {
    set name "$::G(perm:prefix)$name"
  }

  incr_ntest
  puts -nonewline $name...
1166
1167
1168
1169
1170
1171
1172
1173


1174
1175

1176
1177
1178
1179
1180
1181
1182


1183

1184
1185
1186

1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203

1204
1205
1206
1207
1208
1209
1210
1211
1212
  # Delete the interpreter used to run the test script.
  interp delete tinterp
}

proc slave_test_file {zFile} {
  set tail [file tail $zFile]

  ifcapable shared_cache { 


    set scs [sqlite3_enable_shared_cache] 
  }


  reset_prng_state
  set ::sqlite_open_file_count 0
  set time [time { slave_test_script [list source $zFile] }]
  set ms [expr [lindex $time 0] / 1000]

  # Test that all files opened by the test script were closed.


  #

  do_test ${tail}-closeallfiles {
    expr {$::sqlite_open_file_count>0}
  } {0}

  set ::sqlite_open_file_count 0

  # Test that the global "shared-cache" setting was not altered by 
  # the test script.
  #
  ifcapable shared_cache { 
    set res [expr {[sqlite3_enable_shared_cache] == $scs}]
    do_test ${tail}-sharedcachesetting [list set {} $res] 1
  }

  if {$::sqlite_open_file_count>0} {
    puts "$tail did not close all files: $::sqlite_open_file_count"
    fail_test "$tail-closeallfiles"
    set ::sqlite_open_file_count 0
  }
  puts "Time: $tail $ms ms"


  show_memstats
}


# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)

source $testdir/thread_common.tcl







|
>
>
|
|
>
|





|
>
>

>
|
<
<
>










<
<
<
<
<
|
|
>









1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189


1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200





1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
  # Delete the interpreter used to run the test script.
  interp delete tinterp
}

proc slave_test_file {zFile} {
  set tail [file tail $zFile]

  # Remember the value of the shared-cache setting. So that it is possible
  # to check afterwards that it was not modified by the test script.
  #
  ifcapable shared_cache { set scs [sqlite3_enable_shared_cache] }

  # Run the test script in a slave interpreter.
  #
  reset_prng_state
  set ::sqlite_open_file_count 0
  set time [time { slave_test_script [list source $zFile] }]
  set ms [expr [lindex $time 0] / 1000]

  # Test that all files opened by the test script were closed. Omit this
  # if the test script has "thread" in its name. The open file counter
  # is not thread-safe.
  #
  if {[string match *thread* $tail]==0} {
    do_test ${tail}-closeallfiles { expr {$::sqlite_open_file_count>0} } {0}


  }
  set ::sqlite_open_file_count 0

  # Test that the global "shared-cache" setting was not altered by 
  # the test script.
  #
  ifcapable shared_cache { 
    set res [expr {[sqlite3_enable_shared_cache] == $scs}]
    do_test ${tail}-sharedcachesetting [list set {} $res] 1
  }






  # Add some info to the output.
  #
  puts "Time: $tail $ms ms"
  show_memstats
}


# If the library is compiled with the SQLITE_DEFAULT_AUTOVACUUM macro set
# to non-zero, then set the global variable $AUTOVACUUM to 1.
set AUTOVACUUM $sqlite_options(default_autovacuum)

source $testdir/thread_common.tcl