2008-07-30 13:15:43 +00:00
|
|
|
# 2007 September 5
|
|
|
|
#
|
|
|
|
# The author disclaims copyright to this source code. In place of
|
|
|
|
# a legal notice, here is a blessing:
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
#***********************************************************************
|
|
|
|
#
|
|
|
|
# The focus of this file is testing the code in test_async.c.
|
|
|
|
# Specifically, it tests that the xFullPathname() method of
|
|
|
|
# of the asynchronous vfs works correctly.
|
|
|
|
#
|
2009-05-08 09:27:02 +00:00
|
|
|
# $Id: async3.test,v 1.5 2009/04/25 08:39:15 danielk1977 Exp $
|
2008-07-30 13:15:43 +00:00
|
|
|
|
|
|
|
set testdir [file dirname $argv0]
|
|
|
|
source $testdir/tester.tcl
|
|
|
|
|
2009-05-08 09:27:02 +00:00
|
|
|
if { [info commands sqlite3async_initialize]=="" } {
|
2008-07-30 13:15:43 +00:00
|
|
|
# The async logic is not built into this system
|
|
|
|
puts "Skipping async3 tests: not compiled with required features"
|
|
|
|
finish_test
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
db close
|
2009-05-08 09:27:02 +00:00
|
|
|
sqlite3async_initialize "" 1
|
2009-04-21 14:39:00 +00:00
|
|
|
#set sqlite3async_trace 1
|
2008-07-30 13:15:43 +00:00
|
|
|
sqlite3async_start
|
|
|
|
|
|
|
|
set paths {
|
|
|
|
chocolate/banana/vanilla/file.db
|
|
|
|
chocolate//banana/vanilla/file.db
|
|
|
|
chocolate/./banana//vanilla/file.db
|
|
|
|
chocolate/banana/./vanilla/file.db
|
|
|
|
chocolate/banana/../banana/vanilla/file.db
|
|
|
|
chocolate/banana/./vanilla/extra_bit/../file.db
|
|
|
|
}
|
|
|
|
|
|
|
|
do_test async3-1.0 {
|
|
|
|
file mkdir [file join chocolate banana vanilla]
|
2011-12-26 19:52:17 +00:00
|
|
|
forcedelete chocolate/banana/vanilla/file.db
|
|
|
|
forcedelete chocolate/banana/vanilla/file.db-journal
|
2008-07-30 13:15:43 +00:00
|
|
|
} {}
|
|
|
|
|
|
|
|
do_test async3-1.1 {
|
|
|
|
sqlite3 db chocolate/banana/vanilla/file.db
|
|
|
|
execsql {
|
|
|
|
CREATE TABLE abc(a, b, c);
|
|
|
|
BEGIN;
|
|
|
|
INSERT INTO abc VALUES(1, 2, 3);
|
|
|
|
}
|
|
|
|
} {}
|
|
|
|
|
|
|
|
set N 2
|
|
|
|
foreach p $paths {
|
|
|
|
sqlite3 db2 $p
|
|
|
|
do_test async3-1.$N.1 {
|
|
|
|
execsql {SELECT * FROM abc} db2
|
|
|
|
} {}
|
|
|
|
do_test async3-1.$N.2 {
|
|
|
|
catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
|
|
|
|
} {1 {database is locked}}
|
|
|
|
db2 close
|
|
|
|
incr N
|
|
|
|
}
|
|
|
|
|
|
|
|
db close
|
2009-04-21 14:39:00 +00:00
|
|
|
|
2009-05-08 09:27:02 +00:00
|
|
|
sqlite3async_control halt idle
|
2008-07-30 13:15:43 +00:00
|
|
|
sqlite3async_wait
|
2009-05-08 09:27:02 +00:00
|
|
|
sqlite3async_control halt never
|
|
|
|
sqlite3async_shutdown
|
2008-07-30 13:15:43 +00:00
|
|
|
finish_test
|