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.
6 #***********************************************************************
7 # This file runs all tests.
9 # $Id: async.test,v 1.21 2009/06/05 17:09:12 drh Exp $
11 set testdir [file dirname $argv0]
12 source $testdir/tester.tcl
14 if {[info commands sqlite3async_initialize] eq ""} {
15 # The async logic is not built into this system
20 rename finish_test async_really_finish_test
26 if {[info exists G(isquick)]} { set ASYNC_SAVE_ISQUICK $G(isquick) }
43 # Enable asynchronous IO.
44 sqlite3async_initialize "" 1
46 # This proc flushes the contents of the async-IO queue through to the
47 # underlying VFS. A couple of the test scripts identified in $ASYNC_INCLUDE
48 # above contain lines like "catch flush_async_queue" in places where
49 # this is required for the tests to work in async mode.
51 proc flush_async_queue {} {
52 sqlite3async_control halt idle
55 sqlite3async_control halt never
58 rename do_test async_really_do_test
59 proc do_test {name args} {
60 uplevel async_really_do_test async_io-$name $args
64 foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
65 set tail [file tail $testfile]
66 if {[lsearch -exact $ASYNC_INCLUDE $tail]<0} continue
69 # Make sure everything is flushed through. This is because [source]ing
70 # the next test file will delete the database file on disk (using
71 # [delete_file]). If the asynchronous backend still has the file
72 # open, it will become confused.
77 # Flush the write-queue and disable asynchronous IO. This should ensure
78 # all allocated memory is cleaned up.
79 set sqlite3async_trace 1
82 set sqlite3async_trace 0
85 rename async_really_do_test do_test
87 rename async_really_finish_test finish_test
89 if {[info exists ASYNC_SAVE_ISQUICK]} { set G(isquick) $ASYNC_SAVE_ISQUICK }