| OLD | NEW | 
 | (Empty) | 
|   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.21 2009/06/05 17:09:12 drh Exp $ |  | 
|  10  |  | 
|  11 set testdir [file dirname $argv0] |  | 
|  12 source $testdir/tester.tcl |  | 
|  13  |  | 
|  14 if {[info commands sqlite3async_initialize] eq ""} { |  | 
|  15   # The async logic is not built into this system |  | 
|  16   finish_test |  | 
|  17   return |  | 
|  18 } |  | 
|  19  |  | 
|  20 rename finish_test async_really_finish_test |  | 
|  21 proc finish_test {} { |  | 
|  22   catch {db close} |  | 
|  23   catch {db2 close} |  | 
|  24   catch {db3 close} |  | 
|  25 } |  | 
|  26 if {[info exists ISQUICK]} { set ASYNC_SAVE_ISQUICK $ISQUICK } |  | 
|  27 set ISQUICK 1 |  | 
|  28  |  | 
|  29 set ASYNC_INCLUDE { |  | 
|  30   insert.test |  | 
|  31   insert2.test |  | 
|  32   insert3.test |  | 
|  33   lock.test |  | 
|  34   lock2.test |  | 
|  35   lock3.test |  | 
|  36   select1.test |  | 
|  37   select2.test |  | 
|  38   select3.test |  | 
|  39   select4.test |  | 
|  40   trans.test |  | 
|  41 } |  | 
|  42  |  | 
|  43 # Enable asynchronous IO. |  | 
|  44 sqlite3async_initialize "" 1 |  | 
|  45  |  | 
|  46 rename do_test async_really_do_test |  | 
|  47 proc do_test {name args} { |  | 
|  48   uplevel async_really_do_test async_io-$name $args |  | 
|  49   sqlite3async_start |  | 
|  50   sqlite3async_control halt idle |  | 
|  51   sqlite3async_wait |  | 
|  52   sqlite3async_control halt never |  | 
|  53 } |  | 
|  54  |  | 
|  55 foreach testfile [lsort -dictionary [glob $testdir/*.test]] { |  | 
|  56   set tail [file tail $testfile] |  | 
|  57   if {[lsearch -exact $ASYNC_INCLUDE $tail]<0} continue |  | 
|  58   source $testfile |  | 
|  59  |  | 
|  60   # Make sure everything is flushed through. This is because [source]ing  |  | 
|  61   # the next test file will delete the database file on disk (using |  | 
|  62   # [file delete]). If the asynchronous backend still has the file |  | 
|  63   # open, it will become confused. |  | 
|  64   # |  | 
|  65   sqlite3async_control halt idle |  | 
|  66   sqlite3async_start |  | 
|  67   sqlite3async_wait |  | 
|  68   sqlite3async_control halt never |  | 
|  69 } |  | 
|  70  |  | 
|  71 # Flush the write-queue and disable asynchronous IO. This should ensure |  | 
|  72 # all allocated memory is cleaned up. |  | 
|  73 set sqlite3async_trace 1 |  | 
|  74 sqlite3async_control halt idle |  | 
|  75 sqlite3async_start |  | 
|  76 sqlite3async_wait |  | 
|  77 sqlite3async_control halt never |  | 
|  78 sqlite3async_shutdown |  | 
|  79 set sqlite3async_trace 0 |  | 
|  80  |  | 
|  81 rename do_test {} |  | 
|  82 rename async_really_do_test do_test |  | 
|  83 rename finish_test {} |  | 
|  84 rename async_really_finish_test finish_test |  | 
|  85  |  | 
|  86 if {[info exists ASYNC_SAVE_ISQUICK]} { set ISQUICK $ASYNC_SAVE_ISQUICK } |  | 
|  87 finish_test |  | 
| OLD | NEW |