summaryrefslogtreecommitdiffstats
path: root/third_party/sqlite/src/test/pagerfault2.test
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 14:24:48 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-25 14:24:48 +0000
commitfb8f976cb2b5ce1a8e078852c67e049987edf81f (patch)
treea2ff864293ca82a55ca09d61977b48891fab0ff8 /third_party/sqlite/src/test/pagerfault2.test
parentf77106a2d1fdba26aa169caec3f70717dd2bff18 (diff)
downloadchromium_src-fb8f976cb2b5ce1a8e078852c67e049987edf81f.zip
chromium_src-fb8f976cb2b5ce1a8e078852c67e049987edf81f.tar.gz
chromium_src-fb8f976cb2b5ce1a8e078852c67e049987edf81f.tar.bz2
Import SQLite 3.7.6.3.
Ran through the import script in third_party/sqlite/README.Chromium, including the SQLite test suite. A few minor errors under oserror-1.1.[123], I suspect my Linux reference machine is becoming outdated. SQLite changes are going to be hard/impossible to review. It's a year and a half of changes, might as well be a new package. Removed patches which are no longer necessary: icu-regepx.patch is already present safe-tolower.patch is already present attach-integer.patch no longer relevant For attach-integer.patch, the code has been refactored. The failure in http://crbug.com/38745 no longer occurs (ATTACH 12345 as db; attaches the SQLite database "12345" rather than crashing). Tweak test.patch for modern era. Adjusted webdb.patch for new flag. Clean up fts3.patch. fts3 has been substantially refactored, so much of the patch no longer applies. Reviewed fts3_write.c and many of the patches are now handled appropriately. I found one issue in fts3.c, and I'm still reviewing it. This will be ongoing. Disabled WAL (Write Ahead Log) and fts4 support for now as unknown unknowns. BUG=71731 TEST=*EVERYTHING* continues to work. Review URL: http://codereview.chromium.org/6990047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86616 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/sqlite/src/test/pagerfault2.test')
-rw-r--r--third_party/sqlite/src/test/pagerfault2.test99
1 files changed, 99 insertions, 0 deletions
diff --git a/third_party/sqlite/src/test/pagerfault2.test b/third_party/sqlite/src/test/pagerfault2.test
new file mode 100644
index 0000000..6cdb99a
--- /dev/null
+++ b/third_party/sqlite/src/test/pagerfault2.test
@@ -0,0 +1,99 @@
+# 2010 June 15
+#
+# 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.
+#
+#***********************************************************************
+#
+# The tests in this file test the pager modules response to various
+# fault conditions (OOM, IO error, disk full etc.). They are similar
+# to those in file pagerfault1.test.
+#
+# More specifically, the tests in this file are those deemed too slow to
+# run as part of pagerfault1.test.
+#
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+source $testdir/lock_common.tcl
+source $testdir/malloc_common.tcl
+
+if {[permutation] == "inmemory_journal"} {
+ finish_test
+ return
+}
+
+sqlite3_memdebug_vfs_oom_test 0
+
+set a_string_counter 1
+proc a_string {n} {
+ global a_string_counter
+ incr a_string_counter
+ string range [string repeat "${a_string_counter}." $n] 1 $n
+}
+db func a_string a_string
+
+do_test pagerfault2-1-pre1 {
+ faultsim_delete_and_reopen
+ db func a_string a_string
+ execsql {
+ PRAGMA auto_vacuum = 0;
+ PRAGMA journal_mode = DELETE;
+ PRAGMA page_size = 1024;
+ CREATE TABLE t1(a, b);
+ INSERT INTO t1 VALUES(a_string(401), a_string(402));
+ }
+ for {set ii 0} {$ii < 13} {incr ii} {
+ execsql { INSERT INTO t1 SELECT a_string(401), a_string(402) FROM t1 }
+ }
+ faultsim_save_and_close
+ file size test.db
+} [expr 1024 * 8268]
+
+do_faultsim_test pagerfault2-1 -faults oom-transient -prep {
+ faultsim_restore_and_reopen
+ sqlite3_db_config_lookaside db 0 256 4096
+ execsql {
+ BEGIN;
+ SELECT * FROM t1;
+ INSERT INTO t1 VALUES(5, 6);
+ SAVEPOINT abc;
+ UPDATE t1 SET a = a||'x' WHERE rowid<3700;
+ }
+} -body {
+ execsql { UPDATE t1 SET a = a||'x' WHERE rowid>=3700 AND rowid<=4200 }
+ execsql { ROLLBACK TO abc }
+} -test {
+ faultsim_test_result {0 {}}
+}
+
+do_test pagerfault2-2-pre1 {
+ faultsim_restore_and_reopen
+ execsql { DELETE FROM t1 }
+ faultsim_save_and_close
+} {}
+
+do_faultsim_test pagerfault2-2 -faults oom-transient -prep {
+ faultsim_restore_and_reopen
+ sqlite3_db_config_lookaside db 0 256 4096
+ db func a_string a_string
+
+ execsql {
+ PRAGMA cache_size = 20;
+ BEGIN;
+ INSERT INTO t1 VALUES(a_string(401), a_string(402));
+ SAVEPOINT abc;
+ }
+} -body {
+ execsql { INSERT INTO t1 VALUES (a_string(2000000), a_string(2500000)) }
+} -test {
+ faultsim_test_result {0 {}}
+}
+
+sqlite3_memdebug_vfs_oom_test 1
+finish_test
+