mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
151 lines
3.3 KiB
Plaintext
151 lines
3.3 KiB
Plaintext
# 2002 November 30
|
|
#
|
|
# The author disclaims copyright to this source code. In place of
|
|
# a legal notice, here is a blessing:
|
|
#
|
|
# May you do good and not evil.
|
|
# May you find forgiveness for yourself and forgive others.
|
|
# May you share freely, never taking more than you give.
|
|
#
|
|
#***********************************************************************
|
|
# This file implements regression tests for SQLite library. The
|
|
# focus of this script testing the ability of SQLite to handle database
|
|
# files larger than 4GB.
|
|
#
|
|
# $Id: bigfile.test,v 1.1 2002/12/01 02:00:58 drh Exp $
|
|
#
|
|
|
|
set testdir [file dirname $argv0]
|
|
source $testdir/tester.tcl
|
|
|
|
# This is the md5 checksum of all the data in table t1 as created
|
|
# by the first test. We will use this number to make sure that data
|
|
# never changes.
|
|
#
|
|
set MAGIC_SUM {593f1efcfdbe698c28b4b1b693f7e4cf}
|
|
|
|
do_test bigfile-1.1 {
|
|
execsql {
|
|
BEGIN;
|
|
CREATE TABLE t1(x);
|
|
INSERT INTO t1 VALUES('abcdefghijklmnopqrstuvwxyz');
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
INSERT INTO t1 SELECT rowid || ' ' || x FROM t1;
|
|
COMMIT;
|
|
}
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
|
|
do_test bigfile-1.2 {
|
|
db close
|
|
fake_big_file 4096 test.db
|
|
sqlite db test.db
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
|
|
# The previous test may fail on some systems because they are unable
|
|
# to handle large files. If that is so, then skip all of the following
|
|
# tests. We will know the above test failed because the "db" command
|
|
# does not exist.
|
|
#
|
|
if {[llength [info command db]]>0} {
|
|
|
|
do_test bigfile-1.3 {
|
|
execsql {
|
|
CREATE TABLE t2 AS SELECT * FROM t1;
|
|
SELECT md5sum(x) FROM t2;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.4 {
|
|
db close
|
|
sqlite db test.db
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.5 {
|
|
execsql {
|
|
SELECT md5sum(x) FROM t2;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.6 {
|
|
db close
|
|
fake_big_file 8192 test.db
|
|
sqlite db test.db
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.7 {
|
|
execsql {
|
|
CREATE TABLE t3 AS SELECT * FROM t1;
|
|
SELECT md5sum(x) FROM t3;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.8 {
|
|
db close
|
|
sqlite db test.db
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.9 {
|
|
execsql {
|
|
SELECT md5sum(x) FROM t2;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.10 {
|
|
execsql {
|
|
SELECT md5sum(x) FROM t3;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.11 {
|
|
db close
|
|
fake_big_file 16384 test.db
|
|
sqlite db test.db
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.12 {
|
|
execsql {
|
|
CREATE TABLE t4 AS SELECT * FROM t1;
|
|
SELECT md5sum(x) FROM t4;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.13 {
|
|
db close
|
|
sqlite db test.db
|
|
execsql {
|
|
SELECT md5sum(x) FROM t1;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.14 {
|
|
execsql {
|
|
SELECT md5sum(x) FROM t2;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.15 {
|
|
execsql {
|
|
SELECT md5sum(x) FROM t3;
|
|
}
|
|
} $::MAGIC_SUM
|
|
do_test bigfile-1.16 {
|
|
execsql {
|
|
SELECT md5sum(x) FROM t3;
|
|
}
|
|
} $::MAGIC_SUM
|
|
|
|
} ;# End of the "if( db command exists )"
|
|
|
|
finish_test
|