3 # The author disclaims copyright to this source code. In place of
4 # a legal notice, here is a blessing:
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.
10 #***********************************************************************
11 # This file implements regression tests for SQLite library. The
12 # focus of this script testing the ability of SQLite to handle database
13 # files larger than 4GB.
15 # $Id: bigfile.test,v 1.7 2004/10/30 20:23:09 drh Exp $
18 set testdir [file dirname $argv0]
19 source $testdir/tester.tcl
21 # These tests only work for Tcl version 8.4 and later. Prior to 8.4,
22 # Tcl was unable to handle large files.
24 scan $::tcl_version %f vx
27 # Mac OS X does not handle large files efficiently. So skip this test
29 if {$tcl_platform(os)=="Darwin"} return
31 # This is the md5 checksum of all the data in table t1 as created
32 # by the first test. We will use this number to make sure that data
35 set MAGIC_SUM {593f1efcfdbe698c28b4b1b693f7e4cf}
41 INSERT INTO t1 VALUES('abcdefghijklmnopqrstuvwxyz');
42 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
43 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
44 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
45 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
46 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
47 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
48 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
52 SELECT md5sum(x) FROM t1;
56 # Try to create a large file - a file that is larger than 2^32 bytes.
57 # If this fails, it means that the system being tested does not support
58 # large files. So skip all of the remaining tests in this file.
61 if {[catch {fake_big_file 4096 test.db}]} {
62 puts "**** Unable to create a file larger than 4096 MB. *****"
70 SELECT md5sum(x) FROM t1;
74 # The previous test may fail on some systems because they are unable
75 # to handle large files. If that is so, then skip all of the following
76 # tests. We will know the above test failed because the "db" command
79 if {[llength [info command db]]>0} {
83 CREATE TABLE t2 AS SELECT * FROM t1;
84 SELECT md5sum(x) FROM t2;
91 SELECT md5sum(x) FROM t1;
96 SELECT md5sum(x) FROM t2;
101 if {[catch {fake_big_file 8192 test.db}]} {
102 puts "**** Unable to create a file larger than 8192 MB. *****"
107 do_test bigfile-1.6 {
110 SELECT md5sum(x) FROM t1;
113 do_test bigfile-1.7 {
115 CREATE TABLE t3 AS SELECT * FROM t1;
116 SELECT md5sum(x) FROM t3;
119 do_test bigfile-1.8 {
123 SELECT md5sum(x) FROM t1;
126 do_test bigfile-1.9 {
128 SELECT md5sum(x) FROM t2;
131 do_test bigfile-1.10 {
133 SELECT md5sum(x) FROM t3;
138 if {[catch {fake_big_file 16384 test.db}]} {
139 puts "**** Unable to create a file larger than 16384 MB. *****"
144 do_test bigfile-1.11 {
147 SELECT md5sum(x) FROM t1;
150 do_test bigfile-1.12 {
152 CREATE TABLE t4 AS SELECT * FROM t1;
153 SELECT md5sum(x) FROM t4;
156 do_test bigfile-1.13 {
160 SELECT md5sum(x) FROM t1;
163 do_test bigfile-1.14 {
165 SELECT md5sum(x) FROM t2;
168 do_test bigfile-1.15 {
170 SELECT md5sum(x) FROM t3;
173 do_test bigfile-1.16 {
175 SELECT md5sum(x) FROM t3;
179 } ;# End of the "if( db command exists )"