Index: third_party/sqlite/src/test/corruptE.test |
diff --git a/third_party/sqlite/src/test/corruptE.test b/third_party/sqlite/src/test/corruptE.test |
index a47adba1f18ad9dcd0188aadf2a636ac8646f618..4d5b5db3d680134abb8731b88e14d43ca8fe1564 100644 |
--- a/third_party/sqlite/src/test/corruptE.test |
+++ b/third_party/sqlite/src/test/corruptE.test |
@@ -16,8 +16,6 @@ |
# |
# $Id: corruptE.test,v 1.14 2009/07/11 06:55:34 danielk1977 Exp $ |
-catch {file delete -force test.db test.db-journal test.bu} |
- |
set testdir [file dirname $argv0] |
source $testdir/tester.tcl |
@@ -26,6 +24,10 @@ source $testdir/tester.tcl |
# |
do_not_use_codec |
+# These tests deal with corrupt database files |
+# |
+database_may_be_corrupt |
+ |
# Do not run the tests in this file if ENABLE_OVERSIZE_CELL_CHECK is on. |
# |
ifcapable oversize_cell_check { |
@@ -51,7 +53,7 @@ do_test corruptE-1.1 { |
INSERT OR IGNORE INTO t1 SELECT x*17,y FROM t1; |
INSERT OR IGNORE INTO t1 SELECT x*19,y FROM t1; |
CREATE INDEX t1i1 ON t1(x); |
- CREATE TABLE t2 AS SELECT x,2 as y FROM t1 WHERE rowid%5!=0; |
+ CREATE TABLE t2 AS SELECT x,2 as y FROM t1 WHERE rowid%5!=0 ORDER BY rowid; |
COMMIT; |
} |
} {} |
@@ -60,23 +62,17 @@ ifcapable {integrityck} { |
integrity_check corruptE-1.2 |
} |
-# Copy file $from into $to |
-# |
-proc copy_file {from to} { |
- file copy -force $from $to |
-} |
- |
# Setup for the tests. Make a backup copy of the good database in test.bu. |
# |
db close |
-copy_file test.db test.bu |
+forcecopy test.db test.bu |
sqlite3 db test.db |
set fsize [file size test.db] |
do_test corruptE-2.1 { |
db close |
- copy_file test.bu test.db |
+ forcecopy test.bu test.db |
# insert corrupt byte(s) |
hexio_write test.db 2041 [format %02x 0x2e] |
@@ -92,7 +88,7 @@ do_test corruptE-2.1 { |
do_test corruptE-2.2 { |
db close |
- copy_file test.bu test.db |
+ forcecopy test.bu test.db |
# insert corrupt byte(s) |
hexio_write test.db 2047 [format %02x 0x84] |
@@ -108,7 +104,7 @@ do_test corruptE-2.2 { |
do_test corruptE-2.3 { |
db close |
- copy_file test.bu test.db |
+ forcecopy test.bu test.db |
# insert corrupt byte(s) |
hexio_write test.db 7420 [format %02x 0xa8] |
@@ -124,7 +120,7 @@ do_test corruptE-2.3 { |
do_test corruptE-2.4 { |
db close |
- copy_file test.bu test.db |
+ forcecopy test.bu test.db |
# insert corrupt byte(s) |
hexio_write test.db 10233 [format %02x 0xd0] |
@@ -165,7 +161,7 @@ set tc 1 |
foreach test $tests { |
do_test corruptE-3.$tc { |
db close |
- copy_file test.bu test.db |
+ forcecopy test.bu test.db |
# insert corrupt byte(s) |
hexio_write test.db [lindex $test 0] [format %02x [lindex $test 1]] |