drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 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 | # |
danielk1977 | ed10afb | 2007-09-05 13:56:32 +0000 | [diff] [blame^] | 9 | # $Id: async.test,v 1.11 2007/09/05 13:56:32 danielk1977 Exp $ |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 10 | |
| 11 | |
| 12 | if {[catch {sqlite3async_enable}]} { |
| 13 | # The async logic is not built into this system |
| 14 | return |
| 15 | } |
| 16 | |
| 17 | |
| 18 | set testdir [file dirname $argv0] |
| 19 | source $testdir/tester.tcl |
| 20 | rename finish_test really_finish_test |
danielk1977 | b6be675 | 2007-09-05 11:34:54 +0000 | [diff] [blame] | 21 | proc finish_test {} { |
| 22 | catch {db close} |
| 23 | catch {db2 close} |
| 24 | catch {db3 close} |
| 25 | } |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 26 | set ISQUICK 1 |
| 27 | |
| 28 | set INCLUDE { |
danielk1977 | ed10afb | 2007-09-05 13:56:32 +0000 | [diff] [blame^] | 29 | insert.test |
| 30 | insert2.test |
| 31 | insert3.test |
| 32 | lock.test |
| 33 | lock2.test |
| 34 | lock3.test |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 35 | select1.test |
| 36 | select2.test |
| 37 | select3.test |
| 38 | select4.test |
drh | 97bbdc0 | 2006-02-13 18:35:06 +0000 | [diff] [blame] | 39 | trans.test |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 40 | } |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 41 | |
| 42 | # Enable asynchronous IO. |
| 43 | sqlite3async_enable 1 |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 44 | |
| 45 | rename do_test really_do_test |
| 46 | proc do_test {name args} { |
| 47 | uplevel really_do_test async_io-$name $args |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 48 | sqlite3async_start |
danielk1977 | ed10afb | 2007-09-05 13:56:32 +0000 | [diff] [blame^] | 49 | sqlite3async_halt idle |
drh | 97bbdc0 | 2006-02-13 18:35:06 +0000 | [diff] [blame] | 50 | sqlite3async_wait |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 51 | } |
| 52 | |
| 53 | foreach testfile [lsort -dictionary [glob $testdir/*.test]] { |
| 54 | set tail [file tail $testfile] |
| 55 | if {[lsearch -exact $INCLUDE $tail]<0} continue |
| 56 | source $testfile |
danielk1977 | b6be675 | 2007-09-05 11:34:54 +0000 | [diff] [blame] | 57 | |
| 58 | # Make sure everything is flushed through. This is because [source]ing |
| 59 | # the next test file will delete the database file on disk (using |
| 60 | # [file delete]). If the asynchronous backend still has the file |
| 61 | # open, it will become confused. |
| 62 | # |
| 63 | sqlite3async_halt idle |
| 64 | sqlite3async_start |
| 65 | sqlite3async_wait |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 66 | } |
| 67 | |
danielk1977 | 750b03e | 2006-02-14 10:48:39 +0000 | [diff] [blame] | 68 | # Flush the write-queue and disable asynchronous IO. This should ensure |
| 69 | # all allocated memory is cleaned up. |
drh | 05a8298 | 2006-03-19 13:00:25 +0000 | [diff] [blame] | 70 | set sqlite3async_trace 1 |
danielk1977 | 750b03e | 2006-02-14 10:48:39 +0000 | [diff] [blame] | 71 | sqlite3async_halt idle |
| 72 | sqlite3async_start |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 73 | sqlite3async_wait |
| 74 | sqlite3async_enable 0 |
drh | 05a8298 | 2006-03-19 13:00:25 +0000 | [diff] [blame] | 75 | set sqlite3async_trace 0 |
danielk1977 | 750b03e | 2006-02-14 10:48:39 +0000 | [diff] [blame] | 76 | |
| 77 | really_finish_test |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 78 | rename really_do_test do_test |
| 79 | rename really_finish_test finish_test |