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.14 2008/09/15 14:47:21 danielk1977 Exp $ 10 11set testdir [file dirname $argv0] 12source $testdir/tester.tcl 13 14if {[catch {sqlite3async_enable}]} { 15 # The async logic is not built into this system 16 finish_test 17 return 18} 19 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 sqlite3async_halt never 52} 53 54foreach testfile [lsort -dictionary [glob $testdir/*.test]] { 55 set tail [file tail $testfile] 56 if {[lsearch -exact $INCLUDE $tail]<0} continue 57 source $testfile 58 59 # Make sure everything is flushed through. This is because [source]ing 60 # the next test file will delete the database file on disk (using 61 # [file delete]). If the asynchronous backend still has the file 62 # open, it will become confused. 63 # 64 sqlite3async_halt idle 65 sqlite3async_start 66 sqlite3async_wait 67 sqlite3async_halt never 68} 69 70# Flush the write-queue and disable asynchronous IO. This should ensure 71# all allocated memory is cleaned up. 72set sqlite3async_trace 1 73sqlite3async_halt idle 74sqlite3async_start 75sqlite3async_wait 76sqlite3async_halt never 77sqlite3async_enable 0 78set sqlite3async_trace 0 79 80really_finish_test 81rename really_do_test do_test 82rename really_finish_test finish_test 83