mirror of
				https://github.com/sqlite/sqlite.git
				synced 2025-11-03 16:53:36 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			89 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
#
 | 
						|
#    May you do good and not evil.
 | 
						|
#    May you find forgiveness for yourself and forgive others.
 | 
						|
#    May you share freely, never taking more than you give.
 | 
						|
#
 | 
						|
#***********************************************************************
 | 
						|
# This file runs all tests.
 | 
						|
#
 | 
						|
# $Id: async.test,v 1.20 2009/04/25 08:39:15 danielk1977 Exp $
 | 
						|
 | 
						|
set testdir [file dirname $argv0]
 | 
						|
source $testdir/tester.tcl
 | 
						|
 | 
						|
if {[info commands sqlite3async_initialize] eq ""} {
 | 
						|
  # The async logic is not built into this system
 | 
						|
  finish_test
 | 
						|
  return
 | 
						|
}
 | 
						|
 | 
						|
rename finish_test async_really_finish_test
 | 
						|
proc finish_test {} {
 | 
						|
  catch {db close}
 | 
						|
  catch {db2 close}
 | 
						|
  catch {db3 close}
 | 
						|
}
 | 
						|
if {[info exists ISQUICK]} { set ASYNC_SAVE_ISQUICK $ISQUICK }
 | 
						|
set ISQUICK 1
 | 
						|
 | 
						|
set ASYNC_INCLUDE {
 | 
						|
  insert.test
 | 
						|
  insert2.test
 | 
						|
  insert3.test
 | 
						|
  lock.test
 | 
						|
  lock2.test
 | 
						|
  lock3.test
 | 
						|
  select1.test
 | 
						|
  select2.test
 | 
						|
  select3.test
 | 
						|
  select4.test
 | 
						|
  trans.test
 | 
						|
}
 | 
						|
 | 
						|
# Enable asynchronous IO.
 | 
						|
sqlite3async_initialize "" 1
 | 
						|
 | 
						|
rename do_test async_really_do_test
 | 
						|
proc do_test {name args} {
 | 
						|
  uplevel async_really_do_test async_io-$name $args
 | 
						|
  sqlite3async_start
 | 
						|
  sqlite3async_control halt idle
 | 
						|
  sqlite3async_wait
 | 
						|
  sqlite3async_control halt never
 | 
						|
}
 | 
						|
 | 
						|
foreach testfile [lsort -dictionary [glob $testdir/*.test]] {
 | 
						|
  set tail [file tail $testfile]
 | 
						|
  if {[lsearch -exact $ASYNC_INCLUDE $tail]<0} continue
 | 
						|
  source $testfile
 | 
						|
 | 
						|
  # Make sure everything is flushed through. This is because [source]ing 
 | 
						|
  # the next test file will delete the database file on disk (using
 | 
						|
  # [file delete]). If the asynchronous backend still has the file
 | 
						|
  # open, it will become confused.
 | 
						|
  #
 | 
						|
  sqlite3async_control halt idle
 | 
						|
  sqlite3async_start
 | 
						|
  sqlite3async_wait
 | 
						|
  sqlite3async_control halt never
 | 
						|
}
 | 
						|
 | 
						|
# Flush the write-queue and disable asynchronous IO. This should ensure
 | 
						|
# all allocated memory is cleaned up.
 | 
						|
set sqlite3async_trace 1
 | 
						|
sqlite3async_control halt idle
 | 
						|
sqlite3async_start
 | 
						|
sqlite3async_wait
 | 
						|
sqlite3async_control halt never
 | 
						|
sqlite3async_shutdown
 | 
						|
set sqlite3async_trace 0
 | 
						|
 | 
						|
rename do_test {}
 | 
						|
rename async_really_do_test do_test
 | 
						|
rename finish_test {}
 | 
						|
rename async_really_finish_test finish_test
 | 
						|
 | 
						|
if {[info exists ASYNC_SAVE_ISQUICK]} { set ISQUICK $ASYNC_SAVE_ISQUICK }
 | 
						|
finish_test
 | 
						|
 |