mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Initial checking of two new test files: format3.test and memleak.test. (CVS 735)
FossilOrigin-Name: 6ffedb90a6478af6548db5298368eeca2b708cdc
This commit is contained in:
77
test/memleak.test
Normal file
77
test/memleak.test
Normal file
@ -0,0 +1,77 @@
|
||||
# 2001 September 15
|
||||
#
|
||||
# The author disclaims copyright to this source code. In place of
|
||||
# a legal notice, here is a blessing:
|
||||
#
|
||||
# May you do good and not evil.
|
||||
# May you find forgiveness for yourself and forgive others.
|
||||
# May you share freely, never taking more than you give.
|
||||
#
|
||||
#***********************************************************************
|
||||
# This file runs all tests.
|
||||
#
|
||||
# $Id: memleak.test,v 1.1 2002/08/31 16:52:45 drh Exp $
|
||||
|
||||
set testdir [file dirname $argv0]
|
||||
source $testdir/tester.tcl
|
||||
rename finish_test really_finish_test
|
||||
proc finish_test {} {
|
||||
catch {db close}
|
||||
memleak_check
|
||||
}
|
||||
|
||||
if {[file exists ./sqlite_test_count]} {
|
||||
set COUNT [exec cat ./sqlite_test_count]
|
||||
} else {
|
||||
set COUNT 3
|
||||
}
|
||||
|
||||
# LeakList will hold a list of the number of unfreed mallocs after
|
||||
# each round of the test. This number should be constant. If it
|
||||
# grows, it may mean there is a memory leak in the library.
|
||||
#
|
||||
set LeakList {}
|
||||
|
||||
set EXCLUDE {
|
||||
all.test
|
||||
quick.test
|
||||
malloc.test
|
||||
misuse.test
|
||||
memleak.test
|
||||
btree2.test
|
||||
trans.test
|
||||
}
|
||||
|
||||
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
|
||||
set tail [file tail $testfile]
|
||||
if {[lsearch -exact $EXCLUDE $tail]>=0} continue
|
||||
set LeakList {}
|
||||
for {set COUNTER 0} {$COUNTER<$COUNT} {incr COUNTER} {
|
||||
source $testfile
|
||||
if {[info exists Leak]} {
|
||||
lappend LeakList $Leak
|
||||
}
|
||||
}
|
||||
if {$LeakList!=""} {
|
||||
puts -nonewline memory-leak-test-$tail...
|
||||
incr ::nTest
|
||||
foreach x $LeakList {
|
||||
if {$x!=[lindex $LeakList 0]} {
|
||||
puts " failed! ($LeakList)"
|
||||
incr ::nErr
|
||||
lappend ::failList memory-leak-test-$tail
|
||||
break
|
||||
}
|
||||
}
|
||||
puts " Ok"
|
||||
}
|
||||
}
|
||||
really_finish_test
|
||||
|
||||
# Run the malloc tests and the misuse test after memory leak detection.
|
||||
# Both tests leak memory.
|
||||
#
|
||||
#catch {source $testdir/misuse.test}
|
||||
#catch {source $testdir/malloc.test}
|
||||
|
||||
really_finish_test
|
Reference in New Issue
Block a user