Same fix as r45172 for classes/iconimage:
[AROS-Contrib.git] / sqlite3 / test / bigfile.test
blobccaf6f4c52ebe0338387b9f39c5d613e81a7b63a
1 # 2002 November 30
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
25 if {$vx<8.4} return
27 # Mac OS X does not handle large files efficiently.  So skip this test
28 # on that platform.
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
33 # never changes.
35 set MAGIC_SUM {593f1efcfdbe698c28b4b1b693f7e4cf}
37 do_test bigfile-1.1 {
38   execsql {
39     BEGIN;
40     CREATE TABLE t1(x);
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;
49     COMMIT;
50   }
51   execsql {
52     SELECT md5sum(x) FROM t1;
53   }
54 } $::MAGIC_SUM
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.
60 db close
61 if {[catch {fake_big_file 4096 test.db}]} {
62   puts "**** Unable to create a file larger than 4096 MB. *****"
63   finish_test
64   return
67 do_test bigfile-1.2 {
68   sqlite3 db test.db
69   execsql {
70     SELECT md5sum(x) FROM t1;
71   }
72 } $::MAGIC_SUM
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
77 # does not exist.
79 if {[llength [info command db]]>0} {
81 do_test bigfile-1.3 {
82   execsql {
83     CREATE TABLE t2 AS SELECT * FROM t1;
84     SELECT md5sum(x) FROM t2;
85   }
86 } $::MAGIC_SUM
87 do_test bigfile-1.4 {
88   db close
89   sqlite3 db test.db
90   execsql {
91     SELECT md5sum(x) FROM t1;
92   }
93 } $::MAGIC_SUM
94 do_test bigfile-1.5 {
95   execsql {
96     SELECT md5sum(x) FROM t2;
97   }
98 } $::MAGIC_SUM
100 db close
101 if {[catch {fake_big_file 8192 test.db}]} {
102   puts "**** Unable to create a file larger than 8192 MB. *****"
103   finish_test
104   return
107 do_test bigfile-1.6 {
108   sqlite3 db test.db
109   execsql {
110     SELECT md5sum(x) FROM t1;
111   }
112 } $::MAGIC_SUM
113 do_test bigfile-1.7 {
114   execsql {
115     CREATE TABLE t3 AS SELECT * FROM t1;
116     SELECT md5sum(x) FROM t3;
117   }
118 } $::MAGIC_SUM
119 do_test bigfile-1.8 {
120   db close
121   sqlite3 db test.db
122   execsql {
123     SELECT md5sum(x) FROM t1;
124   }
125 } $::MAGIC_SUM
126 do_test bigfile-1.9 {
127   execsql {
128     SELECT md5sum(x) FROM t2;
129   }
130 } $::MAGIC_SUM
131 do_test bigfile-1.10 {
132   execsql {
133     SELECT md5sum(x) FROM t3;
134   }
135 } $::MAGIC_SUM
137 db close
138 if {[catch {fake_big_file 16384 test.db}]} {
139   puts "**** Unable to create a file larger than 16384 MB. *****"
140   finish_test
141   return
144 do_test bigfile-1.11 {
145   sqlite3 db test.db
146   execsql {
147     SELECT md5sum(x) FROM t1;
148   }
149 } $::MAGIC_SUM
150 do_test bigfile-1.12 {
151   execsql {
152     CREATE TABLE t4 AS SELECT * FROM t1;
153     SELECT md5sum(x) FROM t4;
154   }
155 } $::MAGIC_SUM
156 do_test bigfile-1.13 {
157   db close
158   sqlite3 db test.db
159   execsql {
160     SELECT md5sum(x) FROM t1;
161   }
162 } $::MAGIC_SUM
163 do_test bigfile-1.14 {
164   execsql {
165     SELECT md5sum(x) FROM t2;
166   }
167 } $::MAGIC_SUM
168 do_test bigfile-1.15 {
169   execsql {
170     SELECT md5sum(x) FROM t3;
171   }
172 } $::MAGIC_SUM
173 do_test bigfile-1.16 {
174   execsql {
175     SELECT md5sum(x) FROM t3;
176   }
177 } $::MAGIC_SUM
179 } ;# End of the "if( db command exists )"
181 finish_test