2 #pragma ident "%Z%%M% %I% %E% SMI"
6 # The author disclaims copyright to this source code. In place of
7 # a legal notice, here is a blessing:
9 # May you do good and not evil.
10 # May you find forgiveness for yourself and forgive others.
11 # May you share freely, never taking more than you give.
13 #***********************************************************************
14 # This file implements regression tests for SQLite library. The
15 # focus of this script testing the ability of SQLite to handle database
16 # files larger than 4GB.
18 # $Id: bigfile.test,v 1.3 2003/12/19 12:31:22 drh Exp $
21 set testdir [file dirname $argv0]
22 source $testdir/tester.tcl
24 # These tests only work for Tcl version 8.4 and later. Prior to 8.4,
25 # Tcl was unable to handle large files.
27 scan $::tcl_version %f vx
30 # This is the md5 checksum of all the data in table t1 as created
31 # by the first test. We will use this number to make sure that data
34 set MAGIC_SUM {593f1efcfdbe698c28b4b1b693f7e4cf}
40 INSERT INTO t1 VALUES('abcdefghijklmnopqrstuvwxyz');
41 INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
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;
51 SELECT md5sum(x) FROM t1;
55 # Try to create a large file - a file that is larger than 2^32 bytes.
56 # If this fails, it means that the system being tested does not support
57 # large files. So skip all of the remaining tests in this file.
60 if {[catch {fake_big_file 4096 test.db}]} {
61 puts "**** Unable to create a file larger than 4096 MB. *****"
69 SELECT md5sum(x) FROM t1;
73 # The previous test may fail on some systems because they are unable
74 # to handle large files. If that is so, then skip all of the following
75 # tests. We will know the above test failed because the "db" command
78 if {[llength [info command db]]>0} {
82 CREATE TABLE t2 AS SELECT * FROM t1;
83 SELECT md5sum(x) FROM t2;
90 SELECT md5sum(x) FROM t1;
95 SELECT md5sum(x) FROM t2;
100 if {[catch {fake_big_file 8192 test.db}]} {
101 puts "**** Unable to create a file larger than 8192 MB. *****"
106 do_test bigfile-1.6 {
109 SELECT md5sum(x) FROM t1;
112 do_test bigfile-1.7 {
114 CREATE TABLE t3 AS SELECT * FROM t1;
115 SELECT md5sum(x) FROM t3;
118 do_test bigfile-1.8 {
122 SELECT md5sum(x) FROM t1;
125 do_test bigfile-1.9 {
127 SELECT md5sum(x) FROM t2;
130 do_test bigfile-1.10 {
132 SELECT md5sum(x) FROM t3;
137 if {[catch {fake_big_file 16384 test.db}]} {
138 puts "**** Unable to create a file larger than 16384 MB. *****"
143 do_test bigfile-1.11 {
146 SELECT md5sum(x) FROM t1;
149 do_test bigfile-1.12 {
151 CREATE TABLE t4 AS SELECT * FROM t1;
152 SELECT md5sum(x) FROM t4;
155 do_test bigfile-1.13 {
159 SELECT md5sum(x) FROM t1;
162 do_test bigfile-1.14 {
164 SELECT md5sum(x) FROM t2;
167 do_test bigfile-1.15 {
169 SELECT md5sum(x) FROM t3;
172 do_test bigfile-1.16 {
174 SELECT md5sum(x) FROM t3;
178 } ;# End of the "if( db command exists )"