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 | 7eb42c8 | 2007-11-05 17:01:08 +0000 | [diff] [blame^] | 9 | # $Id: async.test,v 1.13 2007/11/05 17:01:08 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 | |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 17 | set testdir [file dirname $argv0] |
| 18 | source $testdir/tester.tcl |
| 19 | rename finish_test really_finish_test |
danielk1977 | b6be675 | 2007-09-05 11:34:54 +0000 | [diff] [blame] | 20 | proc finish_test {} { |
| 21 | catch {db close} |
| 22 | catch {db2 close} |
| 23 | catch {db3 close} |
| 24 | } |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 25 | set ISQUICK 1 |
| 26 | |
| 27 | set INCLUDE { |
danielk1977 | ed10afb | 2007-09-05 13:56:32 +0000 | [diff] [blame] | 28 | insert.test |
| 29 | insert2.test |
| 30 | insert3.test |
| 31 | lock.test |
| 32 | lock2.test |
| 33 | lock3.test |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 34 | select1.test |
| 35 | select2.test |
| 36 | select3.test |
| 37 | select4.test |
drh | 97bbdc0 | 2006-02-13 18:35:06 +0000 | [diff] [blame] | 38 | trans.test |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 39 | } |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 40 | |
| 41 | # Enable asynchronous IO. |
| 42 | sqlite3async_enable 1 |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 43 | |
| 44 | rename do_test really_do_test |
| 45 | proc do_test {name args} { |
| 46 | uplevel really_do_test async_io-$name $args |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 47 | sqlite3async_start |
danielk1977 | ed10afb | 2007-09-05 13:56:32 +0000 | [diff] [blame] | 48 | sqlite3async_halt idle |
drh | 97bbdc0 | 2006-02-13 18:35:06 +0000 | [diff] [blame] | 49 | sqlite3async_wait |
danielk1977 | 7eb42c8 | 2007-11-05 17:01:08 +0000 | [diff] [blame^] | 50 | sqlite3async_halt never |
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 |
danielk1977 | 7eb42c8 | 2007-11-05 17:01:08 +0000 | [diff] [blame^] | 66 | sqlite3async_halt never |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 67 | } |
| 68 | |
danielk1977 | 750b03e | 2006-02-14 10:48:39 +0000 | [diff] [blame] | 69 | # Flush the write-queue and disable asynchronous IO. This should ensure |
| 70 | # all allocated memory is cleaned up. |
drh | 05a8298 | 2006-03-19 13:00:25 +0000 | [diff] [blame] | 71 | set sqlite3async_trace 1 |
danielk1977 | 750b03e | 2006-02-14 10:48:39 +0000 | [diff] [blame] | 72 | sqlite3async_halt idle |
| 73 | sqlite3async_start |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 74 | sqlite3async_wait |
danielk1977 | 7eb42c8 | 2007-11-05 17:01:08 +0000 | [diff] [blame^] | 75 | sqlite3async_halt never |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 76 | sqlite3async_enable 0 |
drh | 05a8298 | 2006-03-19 13:00:25 +0000 | [diff] [blame] | 77 | set sqlite3async_trace 0 |
danielk1977 | 750b03e | 2006-02-14 10:48:39 +0000 | [diff] [blame] | 78 | |
| 79 | really_finish_test |
drh | 2366940 | 2006-01-09 17:29:52 +0000 | [diff] [blame] | 80 | rename really_do_test do_test |
| 81 | rename really_finish_test finish_test |