1# 2# May you do good and not evil. 3# May you find forgiveness for yourself and forgive others. 4# May you share freely, never taking more than you give. 5# 6#*********************************************************************** 7# This file runs all tests. 8# 9# $Id: async.test,v 1.11 2007/09/05 13:56:32 danielk1977 Exp $ 10 11 12if {[catch {sqlite3async_enable}]} { 13 # The async logic is not built into this system 14 return 15} 16 17 18set testdir [file dirname $argv0] 19source $testdir/tester.tcl 20rename finish_test really_finish_test 21proc finish_test {} { 22 catch {db close} 23 catch {db2 close} 24 catch {db3 close} 25} 26set ISQUICK 1 27 28set INCLUDE { 29 insert.test 30 insert2.test 31 insert3.test 32 lock.test 33 lock2.test 34 lock3.test 35 select1.test 36 select2.test 37 select3.test 38 select4.test 39 trans.test 40} 41 42# Enable asynchronous IO. 43sqlite3async_enable 1 44 45rename do_test really_do_test 46proc do_test {name args} { 47 uplevel really_do_test async_io-$name $args 48 sqlite3async_start 49 sqlite3async_halt idle 50 sqlite3async_wait 51} 52 53foreach testfile [lsort -dictionary [glob $testdir/*.test]] { 54 set tail [file tail $testfile] 55 if {[lsearch -exact $INCLUDE $tail]<0} continue 56 source $testfile 57 58 # Make sure everything is flushed through. This is because [source]ing 59 # the next test file will delete the database file on disk (using 60 # [file delete]). If the asynchronous backend still has the file 61 # open, it will become confused. 62 # 63 sqlite3async_halt idle 64 sqlite3async_start 65 sqlite3async_wait 66} 67 68# Flush the write-queue and disable asynchronous IO. This should ensure 69# all allocated memory is cleaned up. 70set sqlite3async_trace 1 71sqlite3async_halt idle 72sqlite3async_start 73sqlite3async_wait 74sqlite3async_enable 0 75set sqlite3async_trace 0 76 77really_finish_test 78rename really_do_test do_test 79rename really_finish_test finish_test 80