1# 2013 November 22 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# This file implements regression tests for SQLite library. The 12# focus of this script is recovery from transient manditory locks 13# that sometimes appear on database files due to anti-virus software. 14# 15 16if {$tcl_platform(platform)!="windows"} return 17 18set testdir [file dirname $argv0] 19source $testdir/tester.tcl 20 21ifcapable !win32malloc { 22 finish_test 23 return 24} 25 26set testprefix win32heap 27 28do_test 1.1 { 29 catch {db close} 30 sqlite3_shutdown 31 sqlite3_config_heap_size 1048576 32 sqlite3_initialize 33} {SQLITE_OK} 34 35do_test 1.2 { 36 sqlite3 db test.db 37 catchsql { 38 CREATE TABLE t1(x); 39 } 40} {0 {}} 41 42do_test 1.3 { 43 catchsql { 44 INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576)); 45 } 46} {1 {out of memory}} 47 48do_test 1.4 { 49 catchsql { 50 SELECT COUNT(*) FROM t1; 51 } 52} {0 0} 53 54do_test 1.5 { 55 catch {db close} 56 sqlite3_shutdown 57 sqlite3_config_heap_size 0 58 sqlite3_initialize 59} {SQLITE_OK} 60 61do_test 1.6 { 62 sqlite3 db test.db 63 catchsql { 64 INSERT INTO t1 (x) VALUES(RANDOMBLOB(1048576)); 65 } 66} {0 {}} 67 68do_test 1.7 { 69 catchsql { 70 SELECT COUNT(*) FROM t1; 71 } 72} {0 1} 73 74finish_test 75