blob: d45f0a83786c95a333baa30b0ff53fea3c2aab1a [file] [log] [blame]
danielk19777be2cce2007-09-05 14:32:25 +00001# 2007 September 5
2#
3# The author disclaims copyright to this source code. In place of
4# a legal notice, here is a blessing:
5#
6# May you do good and not evil.
7# May you find forgiveness for yourself and forgive others.
8# May you share freely, never taking more than you give.
9#
10#***********************************************************************
11#
12# The focus of this file is testing the code in test_async.c.
13# Specifically, it tests that the xFullPathname() method of
14# of the asynchronous vfs works correctly.
15#
16# $Id: async3.test,v 1.1 2007/09/05 14:32:25 danielk1977 Exp $
17
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
21if { [info commands sqlite3async_enable]=="" } {
22 # The async logic is not built into this system
23 puts "Skipping async3 tests: not compiled with required features"
24 finish_test
25 return
26}
27
28db close
29sqlite3async_enable 1
30sqlite3async_start
31
32set paths {
33 chocolate/banana/vanilla/file.db
34 chocolate//banana/vanilla/file.db
35 chocolate/./banana//vanilla/file.db
36 chocolate/banana/./vanilla/file.db
37 chocolate/banana/../banana/vanilla/file.db
38 chocolate/banana/./vanilla/extra_bit/../file.db
39}
40
41do_test async3-1.0 {
42 file mkdir [file join chocolate banana vanilla]
43 file delete -force chocolate/banana/vanilla/file.db
44 file delete -force chocolate/banana/vanilla/file.db-journal
45} {}
46do_test async3-1.1 {
47 sqlite3 db chocolate/banana/vanilla/file.db
48 execsql {
49 CREATE TABLE abc(a, b, c);
50 BEGIN;
51 INSERT INTO abc VALUES(1, 2, 3);
52 }
53} {}
54
55set N 2
56foreach p $paths {
57 sqlite3 db2 $p
58 do_test async3-1.$N.1 {
59 execsql {SELECT * FROM abc} db2
60 } {}
61 do_test async3-1.$N.2 {
62 catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
63 } {1 {database is locked}}
64 db2 close
65 incr N
66}
67
68db close
69sqlite3async_halt idle
70sqlite3async_wait
71sqlite3async_enable 0
72finish_test