File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sqlite3 / test / async3.test
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 17:04:16 2012 UTC (12 years, 10 months ago) by misho
Branches: sqlite3, MAIN
CVS tags: v3_7_10, HEAD
sqlite3

    1: # 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.1.1 2012/02/21 17:04:16 misho Exp $
   17: 
   18: set testdir [file dirname $argv0]
   19: source $testdir/tester.tcl
   20: 
   21: if { [info commands sqlite3async_initialize]==""  } {
   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: 
   28: db close
   29: sqlite3async_initialize "" 1
   30: #set sqlite3async_trace 1
   31: sqlite3async_start
   32: 
   33: set 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: 
   42: do_test async3-1.0 {
   43:   file mkdir [file join chocolate banana vanilla]
   44:   forcedelete chocolate/banana/vanilla/file.db
   45:   forcedelete chocolate/banana/vanilla/file.db-journal
   46: } {}
   47: 
   48: do_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: 
   57: set N 2
   58: foreach 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: 
   70: db close
   71: 
   72: sqlite3async_control halt idle
   73: sqlite3async_wait
   74: sqlite3async_control halt never
   75: sqlite3async_shutdown
   76: finish_test

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>