1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/async.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,82 @@
1.4 +#
1.5 +# May you do good and not evil.
1.6 +# May you find forgiveness for yourself and forgive others.
1.7 +# May you share freely, never taking more than you give.
1.8 +#
1.9 +#***********************************************************************
1.10 +# This file runs all tests.
1.11 +#
1.12 +# $Id: async.test,v 1.14 2008/09/15 14:47:21 danielk1977 Exp $
1.13 +
1.14 +set testdir [file dirname $argv0]
1.15 +source $testdir/tester.tcl
1.16 +
1.17 +if {[catch {sqlite3async_enable}]} {
1.18 + # The async logic is not built into this system
1.19 + finish_test
1.20 + return
1.21 +}
1.22 +
1.23 +rename finish_test really_finish_test
1.24 +proc finish_test {} {
1.25 + catch {db close}
1.26 + catch {db2 close}
1.27 + catch {db3 close}
1.28 +}
1.29 +set ISQUICK 1
1.30 +
1.31 +set INCLUDE {
1.32 + insert.test
1.33 + insert2.test
1.34 + insert3.test
1.35 + lock.test
1.36 + lock2.test
1.37 + lock3.test
1.38 + select1.test
1.39 + select2.test
1.40 + select3.test
1.41 + select4.test
1.42 + trans.test
1.43 +}
1.44 +
1.45 +# Enable asynchronous IO.
1.46 +sqlite3async_enable 1
1.47 +
1.48 +rename do_test really_do_test
1.49 +proc do_test {name args} {
1.50 + uplevel really_do_test async_io-$name $args
1.51 + sqlite3async_start
1.52 + sqlite3async_halt idle
1.53 + sqlite3async_wait
1.54 + sqlite3async_halt never
1.55 +}
1.56 +
1.57 +foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
1.58 + set tail [file tail $testfile]
1.59 + if {[lsearch -exact $INCLUDE $tail]<0} continue
1.60 + source $testfile
1.61 +
1.62 + # Make sure everything is flushed through. This is because [source]ing
1.63 + # the next test file will delete the database file on disk (using
1.64 + # [file delete]). If the asynchronous backend still has the file
1.65 + # open, it will become confused.
1.66 + #
1.67 + sqlite3async_halt idle
1.68 + sqlite3async_start
1.69 + sqlite3async_wait
1.70 + sqlite3async_halt never
1.71 +}
1.72 +
1.73 +# Flush the write-queue and disable asynchronous IO. This should ensure
1.74 +# all allocated memory is cleaned up.
1.75 +set sqlite3async_trace 1
1.76 +sqlite3async_halt idle
1.77 +sqlite3async_start
1.78 +sqlite3async_wait
1.79 +sqlite3async_halt never
1.80 +sqlite3async_enable 0
1.81 +set sqlite3async_trace 0
1.82 +
1.83 +really_finish_test
1.84 +rename really_do_test do_test
1.85 +rename really_finish_test finish_test