1
0
mirror of https://github.com/sqlite/sqlite.git synced 2026-01-06 08:01:16 +03:00

Add the --soft-heap-limit=N option to the test scripts. Set this value to

enforce a soft heap limit across all tests.  This changes exposes several
new bugs. (CVS 4202)

FossilOrigin-Name: 8be845981654d2a846c95c699395af222b6c3b43
This commit is contained in:
drh
2007-08-10 16:41:08 +00:00
parent 915d2150f8
commit 3a7fb7c459
5 changed files with 54 additions and 19 deletions

View File

@@ -11,7 +11,7 @@
# This file implements some common TCL routines used for regression
# testing the SQLite library
#
# $Id: tester.tcl,v 1.81 2007/05/04 12:05:56 danielk1977 Exp $
# $Id: tester.tcl,v 1.82 2007/08/10 16:41:09 drh Exp $
# Make sure tclsqlite3 was compiled correctly. Abort now with an
# error message if not.
@@ -43,6 +43,26 @@ if {[sqlite3 -tcl-uses-utf]} {
set tcl_precision 15
set sqlite_pending_byte 0x0010000
#
# Check the command-line arguments for a default soft-heap-limit.
# Store this default value in the global variable ::soft_limit and
# update the soft-heap-limit each time this script is run. In that
# way if an individual test file changes the soft-heap-limit, it
# will be reset at the start of the next test file.
#
if {![info exists soft_limit]} {
set soft_limit 0
for {set i 0} {$i<[llength $argv]} {incr i} {
if {[regexp {^--soft-heap-limit=(.+)$} [lindex $argv $i] all value]} {
if {$value!="off"} {
set soft_limit $value
}
set argv [lreplace $argv $i $i]
}
}
}
sqlite3_soft_heap_limit $soft_limit
# Use the pager codec if it is available
#
if {[sqlite3 -has-codec] && [info command sqlite_orig]==""} {
@@ -178,6 +198,14 @@ proc finalize_testing {} {
sqlite3 db {}
# sqlite3_clear_tsd_memdebug
db close
set heaplimit [sqlite3_soft_heap_limit]
if {$heaplimit!=$::soft_limit} {
puts "soft-heap-limit changed by this script\
from $::soft_limit to $heaplimit"
} elseif {$heaplimit!="" && $heaplimit>0} {
puts "soft-heap-limit set to $heaplimit"
}
sqlite3_soft_heap_limit 0
if {$::sqlite3_tsd_count} {
puts "Thread-specific data leak: $::sqlite3_tsd_count instances"
incr nErr
@@ -480,7 +508,6 @@ proc do_ioerr_test {testname args} {
# 1. We never hit the IO error and the SQL returned OK
# 2. An IO error was hit and the SQL failed
#
#puts "$s $r $::go - $msg"
expr { ($s && !$r && !$::go) || (!$s && $r && $::go) }
} {1}