From ef5a2e189f34353b6a0d34177b0584ca0e66b483 Mon Sep 17 00:00:00 2001 From: drh Date: Wed, 7 May 2008 13:28:38 +0000 Subject: [PATCH] Add a new I/O error test: ioerr4. (CVS 5097) FossilOrigin-Name: c3ab1a7e2e40eb8f51f1b11bf0591e251d69882b --- manifest | 11 +++--- manifest.uuid | 2 +- test/ioerr4.test | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+), 6 deletions(-) create mode 100644 test/ioerr4.test diff --git a/manifest b/manifest index 8a25af8b32..edb657c4bf 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\snull-pointer\sdereference\sthat\scan\soccur\sfollowing\sa\sDISKFULL\serror\nwhile\srunning\sVACUUM.\s(CVS\s5096) -D 2008-05-07T12:45:41 +C Add\sa\snew\sI/O\serror\stest:\sioerr4.\s(CVS\s5097) +D 2008-05-07T13:28:38 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 8b9b8263852f0217157f9042b8e3dae7427ec739 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -343,6 +343,7 @@ F test/io.test 833a1746518ec3005aa7792f9bcb8f01923ff544 F test/ioerr.test 32cff40562447bda194ba67ad601170edbaed49b F test/ioerr2.test b9c9a0491a812707762a7c002876553be54d9969 F test/ioerr3.test d3cec5e1a11ad6d27527d0d38573fbff14c71bdd +F test/ioerr4.test 2bfe11c7ad030eec7d2d848f8d8ddeecb7279cb0 F test/join.test af0443185378b64878750aa1cf4b83c216f246b4 F test/join2.test f2171c265e57ee298a27e57e7051d22962f9f324 F test/join3.test 6f0c774ff1ba0489e6c88a3e77b9d3528fb4fda0 @@ -632,7 +633,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P d15d0bbab043e4366f7988423115babb550198a1 -R cc97a864eea5af3981d05a3f9edeedde +P 438d77a762a6f3cc7438e4d688013cc26e3e9486 +R a2819e9c0d3d8d02d619e0bf904d581b U drh -Z 953a72f11c0f918cae5f87eb3c8317a8 +Z 99995189b6ca74e935f2f2147cae37c2 diff --git a/manifest.uuid b/manifest.uuid index 02e6707dd6..1036a61957 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -438d77a762a6f3cc7438e4d688013cc26e3e9486 \ No newline at end of file +c3ab1a7e2e40eb8f51f1b11bf0591e251d69882b \ No newline at end of file diff --git a/test/ioerr4.test b/test/ioerr4.test new file mode 100644 index 0000000000..576beff57d --- /dev/null +++ b/test/ioerr4.test @@ -0,0 +1,96 @@ +# 2007 December 19 +# +# 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 file is testing for correct handling of I/O errors +# during incremental vacuum with a shared cache. +# +# $Id: ioerr4.test,v 1.1 2008/05/07 13:28:38 drh Exp $ + +set testdir [file dirname $argv0] +source $testdir/tester.tcl + +# This test requires both shared cache and incremental vacuum. +# +ifcapable {!shared_cache || !autovacuum} { + finish_test + return +} + +# Enable shared cache mode and incremental vacuum. +# +do_test ioerr4-1.1 { + db close + sqlite3_enable_shared_cache 1 +} {0} +do_test ioerr4-1.2 { + file delete -force test.db test.db-journal + sqlite3 db test.db + sqlite3 db2 test.db + db eval { + PRAGMA auto_vacuum=INCREMENTAL; + CREATE TABLE a(i INTEGER, b BLOB); + } + db2 eval { + SELECT name FROM sqlite_master + } +} {a} +do_test ioerr4-1.3 { + db eval { + PRAGMA auto_vacuum; + } +} {2} + +# Insert and delete many records in order to put lots of pages +# on the freelist. +# +do_test ioerr4-1.4 { + db eval { + INSERT INTO a VALUES(1, zeroblob(2000)); + INSERT INTO a VALUES(2, zeroblob(2000)); + INSERT INTO a SELECT i+2, zeroblob(2000) FROM a; + INSERT INTO a SELECT i+4, zeroblob(2000) FROM a; + INSERT INTO a SELECT i+8, zeroblob(2000) FROM a; + INSERT INTO a SELECT i+16, zeroblob(2000) FROM a; + SELECT count(*) FROM a; + } +} {32} +do_test ioerr4-1.5 { + db eval { + PRAGMA freelist_count + } +} {0} +do_test ioerr4-1.6 { + db eval { + DELETE FROM a; + PRAGMA freelist_count; + } +} {64} + +# Set up for an I/O error on incremental vacuum +# with two connections on shared cache. +# +db close +db2 close +file copy -force test.db test.db-bu +do_ioerr_test ioerr4-2 -tclprep { + catch {db2 close} + db close + file delete -force test.db test.db-journal + file copy -force test.db-bu test.db + sqlite3_enable_shared_cache 1 + set ::DB [sqlite3 db test.db; sqlite3_connection_pointer db] + db eval {PRAGMA auto_vacuum=INCREMENTAL} + sqlite3 db2 test.db +} -tclbody { + db eval {PRAGMA incremental_vacuum(5)} +} + +finish_test -- 2.47.2