xref: /sqlite-3.40.0/test/tkt-94c04eaadb.test (revision f6b1a8e1)
1# 2009 October 19
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.
12#
13
14set testdir [file dirname $argv0]
15source $testdir/tester.tcl
16
17if {[info commands sqlite3async_initialize] eq ""} {
18  # The async logic is not built into this system
19  finish_test
20  return
21}
22
23# Create a database.
24do_test tkt-94c94-1.1 {
25  execsql { CREATE TABLE t1(a, b) }
26} {}
27
28# Grow the file to larger than 4096MB (2^32 bytes)
29db close
30if {[catch {fake_big_file 4096 [get_pwd]/test.db} msg]} {
31  puts "**** Unable to create a file larger than 4096 MB. *****"
32  finish_test
33  return
34}
35
36# Switch to async mode.
37sqlite3async_initialize "" 1
38sqlite3 db test.db
39sqlite3 db2 test.db
40
41# Read from and write to the db just past the 4096MB mark.
42#
43do_test tkt-94c94-2.1 {
44  execsql { CREATE TABLE t2(x, y) } db
45} {}
46do_test tkt-94c94-2.2 {
47  execsql { INSERT INTO t2 VALUES(1, 2) } db2
48} {}
49do_test tkt-94c94-2.3 {
50  execsql { SELECT * FROM t2 } db
51} {1 2}
52do_test tkt-94c94-2.4 {
53  sqlite3async_control halt idle
54  sqlite3async_start
55  sqlite3async_wait
56} {}
57do_test tkt-94c94-2.5 {
58  execsql { SELECT * FROM t2 } db
59} {1 2}
60do_test tkt-94c94-2.6 {
61  sqlite3async_start
62  sqlite3async_wait
63} {}
64
65db close
66db2 close
67sqlite3async_start
68sqlite3async_wait
69sqlite3async_control halt never
70sqlite3async_shutdown
71
72finish_test
73