sl@0: # sl@0: # May you do good and not evil. sl@0: # May you find forgiveness for yourself and forgive others. sl@0: # May you share freely, never taking more than you give. sl@0: # sl@0: #*********************************************************************** sl@0: # This file runs all tests. sl@0: # sl@0: # $Id: async.test,v 1.14 2008/09/15 14:47:21 danielk1977 Exp $ sl@0: sl@0: set testdir [file dirname $argv0] sl@0: source $testdir/tester.tcl sl@0: sl@0: if {[catch {sqlite3async_enable}]} { sl@0: # The async logic is not built into this system sl@0: finish_test sl@0: return sl@0: } sl@0: sl@0: rename finish_test really_finish_test sl@0: proc finish_test {} { sl@0: catch {db close} sl@0: catch {db2 close} sl@0: catch {db3 close} sl@0: } sl@0: set ISQUICK 1 sl@0: sl@0: set INCLUDE { sl@0: insert.test sl@0: insert2.test sl@0: insert3.test sl@0: lock.test sl@0: lock2.test sl@0: lock3.test sl@0: select1.test sl@0: select2.test sl@0: select3.test sl@0: select4.test sl@0: trans.test sl@0: } sl@0: sl@0: # Enable asynchronous IO. sl@0: sqlite3async_enable 1 sl@0: sl@0: rename do_test really_do_test sl@0: proc do_test {name args} { sl@0: uplevel really_do_test async_io-$name $args sl@0: sqlite3async_start sl@0: sqlite3async_halt idle sl@0: sqlite3async_wait sl@0: sqlite3async_halt never sl@0: } sl@0: sl@0: foreach testfile [lsort -dictionary [glob $testdir/*.test]] { sl@0: set tail [file tail $testfile] sl@0: if {[lsearch -exact $INCLUDE $tail]<0} continue sl@0: source $testfile sl@0: sl@0: # Make sure everything is flushed through. This is because [source]ing sl@0: # the next test file will delete the database file on disk (using sl@0: # [file delete]). If the asynchronous backend still has the file sl@0: # open, it will become confused. sl@0: # sl@0: sqlite3async_halt idle sl@0: sqlite3async_start sl@0: sqlite3async_wait sl@0: sqlite3async_halt never sl@0: } sl@0: sl@0: # Flush the write-queue and disable asynchronous IO. This should ensure sl@0: # all allocated memory is cleaned up. sl@0: set sqlite3async_trace 1 sl@0: sqlite3async_halt idle sl@0: sqlite3async_start sl@0: sqlite3async_wait sl@0: sqlite3async_halt never sl@0: sqlite3async_enable 0 sl@0: set sqlite3async_trace 0 sl@0: sl@0: really_finish_test sl@0: rename really_do_test do_test sl@0: rename really_finish_test finish_test