blob: 9336b660589e986a335eb54b6edac2f077c99306 [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#
danielk19776f050aa2009-04-25 08:39:14 +000016# $Id: async3.test,v 1.5 2009/04/25 08:39:15 danielk1977 Exp $
danielk19777be2cce2007-09-05 14:32:25 +000017
18set testdir [file dirname $argv0]
19source $testdir/tester.tcl
20
danielk19776f050aa2009-04-25 08:39:14 +000021if { [info commands sqlite3async_initialize]=="" } {
danielk19777be2cce2007-09-05 14:32:25 +000022 # 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
danielk19776f050aa2009-04-25 08:39:14 +000029sqlite3async_initialize "" 1
drh17561ad2009-03-28 18:56:14 +000030#set sqlite3async_trace 1
danielk19777be2cce2007-09-05 14:32:25 +000031sqlite3async_start
32
33set paths {
34 chocolate/banana/vanilla/file.db
35 chocolate//banana/vanilla/file.db
36 chocolate/./banana//vanilla/file.db
37 chocolate/banana/./vanilla/file.db
38 chocolate/banana/../banana/vanilla/file.db
39 chocolate/banana/./vanilla/extra_bit/../file.db
40}
41
42do_test async3-1.0 {
43 file mkdir [file join chocolate banana vanilla]
mistachkinfda06be2011-08-02 00:57:34 +000044 forcedelete chocolate/banana/vanilla/file.db
45 forcedelete chocolate/banana/vanilla/file.db-journal
danielk19777be2cce2007-09-05 14:32:25 +000046} {}
danielk19777a4252b2007-09-05 16:54:41 +000047
danielk19777be2cce2007-09-05 14:32:25 +000048do_test async3-1.1 {
49 sqlite3 db chocolate/banana/vanilla/file.db
50 execsql {
51 CREATE TABLE abc(a, b, c);
52 BEGIN;
53 INSERT INTO abc VALUES(1, 2, 3);
54 }
55} {}
56
57set N 2
58foreach p $paths {
59 sqlite3 db2 $p
60 do_test async3-1.$N.1 {
61 execsql {SELECT * FROM abc} db2
62 } {}
63 do_test async3-1.$N.2 {
64 catchsql {INSERT INTO abc VALUES(4, 5, 6)} db2
65 } {1 {database is locked}}
66 db2 close
67 incr N
68}
69
70db close
drh17561ad2009-03-28 18:56:14 +000071
danielk19776f050aa2009-04-25 08:39:14 +000072sqlite3async_control halt idle
danielk19777be2cce2007-09-05 14:32:25 +000073sqlite3async_wait
danielk19776f050aa2009-04-25 08:39:14 +000074sqlite3async_control halt never
75sqlite3async_shutdown
danielk19777be2cce2007-09-05 14:32:25 +000076finish_test