1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TclScript/async3.test Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,74 @@
1.4 +# 2007 September 5
1.5 +#
1.6 +# The author disclaims copyright to this source code. In place of
1.7 +# a legal notice, here is a blessing:
1.8 +#
1.9 +# May you do good and not evil.
1.10 +# May you find forgiveness for yourself and forgive others.
1.11 +# May you share freely, never taking more than you give.
1.12 +#
1.13 +#***********************************************************************
1.14 +#
1.15 +# The focus of this file is testing the code in test_async.c.
1.16 +# Specifically, it tests that the xFullPathname() method of
1.17 +# of the asynchronous vfs works correctly.
1.18 +#
1.19 +# $Id: async3.test,v 1.3 2007/11/05 17:01:08 danielk1977 Exp $
1.20 +
1.21 +set testdir [file dirname $argv0]
1.22 +source $testdir/tester.tcl
1.23 +
1.24 +if { [info commands sqlite3async_enable]=="" } {
1.25 + # The async logic is not built into this system
1.26 + puts "Skipping async3 tests: not compiled with required features"
1.27 + finish_test
1.28 + return
1.29 +}
1.30 +
1.31 +db close
1.32 +sqlite3async_enable 1
1.33 +sqlite3async_start
1.34 +
1.35 +set paths {
1.36 + chocolate/banana/vanilla/file.db
1.37 + chocolate//banana/vanilla/file.db
1.38 + chocolate/./banana//vanilla/file.db
1.39 + chocolate/banana/./vanilla/file.db
1.40 + chocolate/banana/../banana/vanilla/file.db
1.41 + chocolate/banana/./vanilla/extra_bit/../file.db
1.42 +}
1.43 +
1.44 +do_test async3-1.0 {
1.45 + file mkdir [file join chocolate banana vanilla]
1.46 + file delete -force chocolate/banana/vanilla/file.db
1.47 + file delete -force chocolate/banana/vanilla/file.db-journal
1.48 +} {}
1.49 +
1.50 +do_test async3-1.1 {
1.51 + sqlite3 db chocolate/banana/vanilla/file.db
1.52 + execsql {
1.53 + CREATE TABLE abc(a, b, c);
1.54 + BEGIN;
1.55 + INSERT INTO abc VALUES(1, 2, 3);
1.56 + }
1.57 +} {}
1.58 +
1.59 +set N 2
1.60 +foreach p $paths {
1.61 + sqlite3 db2 $p
1.62 + do_test async3-1.$N.1 {
1.63 + execsql {SELECT * FROM abc} db2
1.64 + } {}
1.65 + do_test async3-1.$N.2 {
1.66 + catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
1.67 + } {1 {database is locked}}
1.68 + db2 close
1.69 + incr N
1.70 +}
1.71 +
1.72 +db close
1.73 +sqlite3async_halt idle
1.74 +sqlite3async_wait
1.75 +sqlite3async_halt never
1.76 +sqlite3async_enable 0
1.77 +finish_test