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.15 2009/03/24 16:55:44 drh 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 set ::ASYNC 1 58 source $testfile 59 unset ::ASYNC 60 61 # Make sure everything is flushed through. This is because [source]ing 62 # the next test file will delete the database file on disk (using 63 # [file delete]). If the asynchronous backend still has the file 64 # open, it will become confused. 65 # 66 sqlite3async_halt idle 67 sqlite3async_start 68 sqlite3async_wait 69 sqlite3async_halt never 70} 71 72# Flush the write-queue and disable asynchronous IO. This should ensure 73# all allocated memory is cleaned up. 74set sqlite3async_trace 1 75sqlite3async_halt idle 76sqlite3async_start 77sqlite3async_wait 78sqlite3async_halt never 79sqlite3async_enable 0 80set sqlite3async_trace 0 81 82really_finish_test 83rename really_do_test do_test 84rename really_finish_test finish_test 85