1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Added test code to check for file descriptor leaks. All regression tests pass

now on both win2k and linux. (CVS 868)

FossilOrigin-Name: 75ba78280f7ab6b6acce5878859312f3223ee898
This commit is contained in:
drh
2003-02-16 22:21:32 +00:00
parent 99ee360003
commit 94e9203247
13 changed files with 102 additions and 35 deletions

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file runs all tests.
#
# $Id: all.test,v 1.18 2002/12/04 13:40:27 drh Exp $
# $Id: all.test,v 1.19 2003/02/16 22:21:33 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -67,6 +67,12 @@ for {set Counter 0} {$Counter<$COUNT && $nErr==0} {incr Counter} {
set tail [file tail $testfile]
if {[lsearch -exact $EXCLUDE $tail]>=0} continue
source $testfile
catch {db close}
if {$sqlite_open_file_count>0} {
puts "$tail did not close all files: $sqlite_open_file_count"
incr nErr
lappend ::failList $tail
}
}
if {[info exists Leak]} {
lappend LeakList $Leak
@ -98,4 +104,6 @@ if {$LeakList!=""} {
catch {source $testdir/misuse.test}
catch {source $testdir/malloc.test}
catch {db close}
set sqlite_open_file_count 0
really_finish_test

View File

@ -11,7 +11,7 @@
# This file implements regression tests for SQLite library. The
# focus of this script testing the callback-free C/C++ API.
#
# $Id: capi2.test,v 1.3 2003/01/29 22:58:27 drh Exp $
# $Id: capi2.test,v 1.4 2003/02/16 22:21:33 drh Exp $
#
set testdir [file dirname $argv0]
@ -390,4 +390,6 @@ do_test capi2-6.99 {
list [catch {sqlite_finalize $VM1} msg] [set msg]
} {0 {}}
db2 close
finish_test

View File

@ -15,7 +15,7 @@
# The tests in this file use special facilities that are only
# available in the SQLite test fixture.
#
# $Id: ioerr.test,v 1.1 2001/10/12 17:30:05 drh Exp $
# $Id: ioerr.test,v 1.2 2003/02/16 22:21:33 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -26,6 +26,7 @@ for {set n 1} {$go} {incr n} {
set ::sqlite_io_error_pending 0
db close
catch {file delete -force test.db}
catch {file delete -force test.db-journal}
sqlite db test.db
execsql {SELECT * FROM sqlite_master}
} {}

View File

@ -10,7 +10,7 @@
#***********************************************************************
# This file runs all tests.
#
# $Id: quick.test,v 1.4 2002/08/24 18:24:57 drh Exp $
# $Id: quick.test,v 1.5 2003/02/16 22:21:33 drh Exp $
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@ -24,12 +24,21 @@ set EXCLUDE {
btree2.test
malloc.test
memleak.test
misuse.test
}
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
set tail [file tail $testfile]
if {[lsearch -exact $EXCLUDE $tail]>=0} continue
source $testfile
catch {db close}
if {$sqlite_open_file_count>0} {
puts "$tail did not close all files: $sqlite_open_file_count"
incr nErr
lappend ::failList $tail
}
}
source $testdir/misuse.test
set sqlite_open_file_count 0
really_finish_test

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.23 2002/06/25 13:16:04 drh Exp $
# $Id: tester.tcl,v 1.24 2003/02/16 22:21:33 drh Exp $
# Make sure tclsqlite was compiled correctly. Abort now with an
# error message if not.
@ -158,7 +158,7 @@ proc finish_test {} {
finalize_testing
}
proc finalize_testing {} {
global nTest nErr nProb
global nTest nErr nProb sqlite_open_file_count
if {$nErr==0} memleak_check
catch {db close}
puts "$nErr errors out of $nTest tests"
@ -167,6 +167,10 @@ proc finalize_testing {} {
puts "$nProb probabilistic tests also failed, but this does"
puts "not necessarily indicate a malfunction."
}
if {$sqlite_open_file_count} {
puts "$sqlite_open_file_count files were left open"
incr nErr
}
exit [expr {$nErr>0}]
}