Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: third_party/sqlite/src/test/corrupt.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/sqlite/src/test/contrib01.test ('k') | third_party/sqlite/src/test/corrupt2.test » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/sqlite/src/test/corrupt.test
diff --git a/third_party/sqlite/src/test/corrupt.test b/third_party/sqlite/src/test/corrupt.test
index 719c19ccb95d2caa464e959aad1507747e1f2a7c..3e49a9ff189727ca6dfd22c5624526fa0402c3e0 100644
--- a/third_party/sqlite/src/test/corrupt.test
+++ b/third_party/sqlite/src/test/corrupt.test
@@ -15,7 +15,7 @@
#
# $Id: corrupt.test,v 1.12 2009/07/13 09:41:45 danielk1977 Exp $
-catch {file delete -force test.db test.db-journal test.bu}
+catch {forcedelete test.db test.db-journal test.bu}
set testdir [file dirname $argv0]
source $testdir/tester.tcl
@@ -25,6 +25,10 @@ source $testdir/tester.tcl
#
do_not_use_codec
+# These tests deal with corrupt database files
+#
+database_may_be_corrupt
+
# Construct a large database for testing.
#
do_test corrupt-1.1 {
@@ -51,22 +55,10 @@ do_test corrupt-1.1 {
} {}
integrity_check corrupt-1.2
-# Copy file $from into $to
-#
-proc copy_file {from to} {
- set f [open $from]
- fconfigure $f -translation binary
- set t [open $to w]
- fconfigure $t -translation binary
- puts -nonewline $t [read $f [file size $from]]
- close $t
- close $f
-}
-
# Setup for the tests. Make a backup copy of the good database in test.bu.
# Create a string of garbage data that is 256 bytes long.
#
-copy_file test.db test.bu
+forcecopy test.db test.bu
set fsize [file size test.db]
set junk "abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
while {[string length $junk]<256} {append junk $junk}
@@ -79,7 +71,7 @@ set junk [string range $junk 0 255]
for {set i [expr {1*256}]} {$i<$fsize-256} {incr i 256} {
set tn [expr {$i/256}]
db close
- copy_file test.bu test.db
+ forcecopy test.bu test.db
set fd [open test.db r+]
fconfigure $fd -translation binary
seek $fd $i
@@ -132,7 +124,7 @@ for {set i [expr {1*256}]} {$i<$fsize-256} {incr i 256} {
#
do_test corrupt-3.1 {
db close
- copy_file test.bu test.db
+ forcecopy test.bu test.db
sqlite3 db test.db
list
} {}
@@ -181,7 +173,7 @@ do_test corrupt-3.6 {
do_test corrupt-4.1 {
db close
- file delete -force test.db test.db-journal
+ forcedelete test.db test.db-journal
sqlite3 db test.db
execsql {
PRAGMA page_size = 1024;
@@ -213,7 +205,7 @@ do_test corrupt-4.2 {
do_test corrupt-5.1 {
db close
- file delete -force test.db test.db-journal
+ forcedelete test.db test.db-journal
sqlite3 db test.db
execsql { PRAGMA page_size = 1024 }
@@ -236,7 +228,7 @@ do_test corrupt-5.2 {
# running this testcase under valgrind revealed the problem.
do_test corrupt-6.1 {
db close
- file delete -force test.db test.db-journal
+ forcedelete test.db test.db-journal
sqlite3 db test.db
execsql {
PRAGMA page_size = 1024; CREATE TABLE t1(x);
@@ -264,7 +256,7 @@ do_test corrupt-6.1 {
ifcapable oversize_cell_check {
db close
- file delete -force test.db test.db-journal
+ forcedelete test.db test.db-journal
sqlite3 db test.db
execsql {
PRAGMA page_size = 1024; CREATE TABLE t1(x);
@@ -317,7 +309,7 @@ ifcapable oversize_cell_check {
}
db close
-file delete -force test.db test.db-journal
+forcedelete test.db test.db-journal
do_test corrupt-8.1 {
sqlite3 db test.db
execsql {
@@ -335,7 +327,7 @@ do_test corrupt-8.1 {
} {1 {database disk image is malformed}}
db close
-file delete -force test.db test.db-journal
+forcedelete test.db test.db-journal
do_test corrupt-8.2 {
sqlite3 db test.db
execsql {
« no previous file with comments | « third_party/sqlite/src/test/contrib01.test ('k') | third_party/sqlite/src/test/corrupt2.test » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698