OLD | NEW |
1 # 2002 November 30 | 1 # 2002 November 30 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
11 # This file implements regression tests for SQLite library. The | 11 # This file implements regression tests for SQLite library. The |
12 # focus of this script testing the ability of SQLite to handle database | 12 # focus of this script testing the ability of SQLite to handle database |
13 # files larger than 4GB. | 13 # files larger than 4GB. |
14 # | 14 # |
15 # $Id: bigfile.test,v 1.12 2009/03/05 04:27:08 shane Exp $ | 15 # $Id: bigfile.test,v 1.12 2009/03/05 04:27:08 shane Exp $ |
16 # | 16 # |
17 | 17 |
18 set testdir [file dirname $argv0] | 18 set testdir [file dirname $argv0] |
19 source $testdir/tester.tcl | 19 source $testdir/tester.tcl |
20 | 20 |
| 21 # Do not use a codec for this file, as the database is manipulated using |
| 22 # external methods (the [fake_big_file] and [hexio_write] commands). |
| 23 # |
| 24 do_not_use_codec |
| 25 |
21 # If SQLITE_DISABLE_LFS is defined, omit this file. | 26 # If SQLITE_DISABLE_LFS is defined, omit this file. |
22 ifcapable !lfs { | 27 ifcapable !lfs { |
23 finish_test | 28 finish_test |
24 return | 29 return |
25 } | 30 } |
26 | 31 |
27 # These tests only work for Tcl version 8.4 and later. Prior to 8.4, | 32 # These tests only work for Tcl version 8.4 and later. Prior to 8.4, |
28 # Tcl was unable to handle large files. | 33 # Tcl was unable to handle large files. |
29 # | 34 # |
30 scan $::tcl_version %f vx | 35 scan $::tcl_version %f vx |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 # Try to create a large file - a file that is larger than 2^32 bytes. | 67 # Try to create a large file - a file that is larger than 2^32 bytes. |
63 # If this fails, it means that the system being tested does not support | 68 # If this fails, it means that the system being tested does not support |
64 # large files. So skip all of the remaining tests in this file. | 69 # large files. So skip all of the remaining tests in this file. |
65 # | 70 # |
66 db close | 71 db close |
67 if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} { | 72 if {[catch {fake_big_file 4096 [pwd]/test.db} msg]} { |
68 puts "**** Unable to create a file larger than 4096 MB. *****" | 73 puts "**** Unable to create a file larger than 4096 MB. *****" |
69 finish_test | 74 finish_test |
70 return | 75 return |
71 } | 76 } |
| 77 hexio_write test.db 28 00000000 |
72 | 78 |
73 do_test bigfile-1.2 { | 79 do_test bigfile-1.2 { |
74 sqlite3 db test.db | 80 sqlite3 db test.db |
75 execsql { | 81 execsql { |
76 SELECT md5sum(x) FROM t1; | 82 SELECT md5sum(x) FROM t1; |
77 } | 83 } |
78 } $::MAGIC_SUM | 84 } $::MAGIC_SUM |
79 | 85 |
80 # The previous test may fail on some systems because they are unable | 86 # The previous test may fail on some systems because they are unable |
81 # to handle large files. If that is so, then skip all of the following | 87 # to handle large files. If that is so, then skip all of the following |
(...skipping 19 matching lines...) Expand all Loading... |
101 SELECT md5sum(x) FROM t1; | 107 SELECT md5sum(x) FROM t1; |
102 } | 108 } |
103 } $::MAGIC_SUM | 109 } $::MAGIC_SUM |
104 | 110 |
105 db close | 111 db close |
106 if {[catch {fake_big_file 8192 [pwd]/test.db}]} { | 112 if {[catch {fake_big_file 8192 [pwd]/test.db}]} { |
107 puts "**** Unable to create a file larger than 8192 MB. *****" | 113 puts "**** Unable to create a file larger than 8192 MB. *****" |
108 finish_test | 114 finish_test |
109 return | 115 return |
110 } | 116 } |
| 117 hexio_write test.db 28 00000000 |
111 | 118 |
112 do_test bigfile-1.5 { | 119 do_test bigfile-1.5 { |
113 sqlite3 db test.db | 120 sqlite3 db test.db |
114 execsql { | 121 execsql { |
115 SELECT md5sum(x) FROM t1; | 122 SELECT md5sum(x) FROM t1; |
116 } | 123 } |
117 } $::MAGIC_SUM | 124 } $::MAGIC_SUM |
118 do_test bigfile-1.6 { | 125 do_test bigfile-1.6 { |
119 sqlite3 db test.db | 126 sqlite3 db test.db |
120 execsql { | 127 execsql { |
(...skipping 18 matching lines...) Expand all Loading... |
139 SELECT md5sum(x) FROM t2; | 146 SELECT md5sum(x) FROM t2; |
140 } | 147 } |
141 } $::MAGIC_SUM | 148 } $::MAGIC_SUM |
142 | 149 |
143 db close | 150 db close |
144 if {[catch {fake_big_file 16384 [pwd]/test.db}]} { | 151 if {[catch {fake_big_file 16384 [pwd]/test.db}]} { |
145 puts "**** Unable to create a file larger than 16384 MB. *****" | 152 puts "**** Unable to create a file larger than 16384 MB. *****" |
146 finish_test | 153 finish_test |
147 return | 154 return |
148 } | 155 } |
| 156 hexio_write test.db 28 00000000 |
149 | 157 |
150 do_test bigfile-1.10 { | 158 do_test bigfile-1.10 { |
151 sqlite3 db test.db | 159 sqlite3 db test.db |
152 execsql { | 160 execsql { |
153 SELECT md5sum(x) FROM t1; | 161 SELECT md5sum(x) FROM t1; |
154 } | 162 } |
155 } $::MAGIC_SUM | 163 } $::MAGIC_SUM |
156 do_test bigfile-1.11 { | 164 do_test bigfile-1.11 { |
157 sqlite3 db test.db | 165 sqlite3 db test.db |
158 execsql { | 166 execsql { |
(...skipping 24 matching lines...) Expand all Loading... |
183 SELECT md5sum(x) FROM t2; | 191 SELECT md5sum(x) FROM t2; |
184 } | 192 } |
185 } $::MAGIC_SUM | 193 } $::MAGIC_SUM |
186 do_test bigfile-1.16 { | 194 do_test bigfile-1.16 { |
187 execsql { | 195 execsql { |
188 SELECT md5sum(x) FROM t3; | 196 SELECT md5sum(x) FROM t3; |
189 } | 197 } |
190 } $::MAGIC_SUM | 198 } $::MAGIC_SUM |
191 | 199 |
192 finish_test | 200 finish_test |
OLD | NEW |