]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add crash2.test, for robustness testing with variable disk block size. (CVS 3696)
authordanielk1977 <danielk1977@noemail.net>
Sat, 17 Mar 2007 10:28:04 +0000 (10:28 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Sat, 17 Mar 2007 10:28:04 +0000 (10:28 +0000)
FossilOrigin-Name: b0f8203dbbf1036418a2dcc480f352f761826194

manifest
manifest.uuid
test/crash2.test [new file with mode: 0644]

index f9ee0929e76b1e927e3f6581241a357526e39f1f..b6fff56b9b3ba546b0989acf94cc55f1b14bcfa7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Modifications\sto\scrash-test\sinfrastructure.\s(CVS\s3695)
-D 2007-03-17T10:26:59
+C Add\scrash2.test,\sfor\srobustness\stesting\swith\svariable\sdisk\sblock\ssize.\s(CVS\s3696)
+D 2007-03-17T10:28:05
 F Makefile.in 1fe3d0b46e40fd684e1e61f8e8056cefed16de9f
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -184,6 +184,7 @@ F test/conflict.test 8a59399f61a14296a9bfed02e0570590a8a79cba
 F test/corrupt.test 18c7a995b1af76a8c8600b996257f2c7b7bff083
 F test/corrupt2.test 572f8df0303d0ce63ddad5c5c9101a83a345ae46
 F test/crash.test 167eb4652eccbedb199b6f21850346c3f5d779fb
+F test/crash2.test 10be14f91865c6959db6764a7dd478c6561bf4c1
 F test/crashtest1.c 09c1c7d728ccf4feb9e481671e29dda5669bbcc2
 F test/date.test 63cc718e1d209b10c6b7be8ce72b11addb9f1e04
 F test/default.test 252298e42a680146b1dd64f563b95bdf088d94fb
@@ -436,7 +437,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P eaf434d5887bf75330e1cea12be810dfe667b62a
-R 3e037a9ae48873c3a73dcd8bd26cfac6
+P c4be8d9949fc7b5e1bed757423c5195f38069048
+R 786fefa2d7d4a54acc7c3b42a1497810
 U danielk1977
-Z 2681bb64cf477e20030d108b1c89215c
+Z 9168113432a3c177fb5aa5377927a80e
index fcaddc3ac86bb7babe5b3b00c968ab013a78afe6..788fd0fa6df4b10893c26be75fa87f19b3e6b012 100644 (file)
@@ -1 +1 @@
-c4be8d9949fc7b5e1bed757423c5195f38069048
\ No newline at end of file
+b0f8203dbbf1036418a2dcc480f352f761826194
\ No newline at end of file
diff --git a/test/crash2.test b/test/crash2.test
new file mode 100644 (file)
index 0000000..07e5556
--- /dev/null
@@ -0,0 +1,64 @@
+# 2001 September 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.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library.
+#
+# The focus of this file is testing the ability of the database to
+# uses its rollback journal to recover intact (no database corruption)
+# from a power failure during the middle of a COMMIT. Even more
+# specifically, the tests in this file verify this functionality
+# for storage mediums with various sector sizes.
+#
+# $Id: crash2.test,v 1.1 2007/03/17 10:28:05 danielk1977 Exp $
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+ifcapable !crashtest {
+  finish_test
+  return
+}
+
+# This test is designed to check that the crash-test infrastructure
+# can create files that do not consist of an integer number of
+# simulated disk blocks (i.e. 3KB file using 2KB disk blocks).
+#
+do_test crash2-1.1 {
+  crashsql -delay 500 -file test.db -blocksize 2048 {
+    BEGIN;
+    CREATE TABLE abc AS SELECT 1 AS a, 2 AS b, 3 AS c;
+    CREATE TABLE def AS SELECT 1 AS d, 2 AS e, 3 AS f;
+    COMMIT;
+  }
+  file size test.db
+} {3072}
+
+for {set ii 0} {$ii < 5} {incr ii} {
+
+  # Simple test using the database created above: Create a new
+  # table so that page 1 and page 4 are modified. Using a
+  # block-size of 2048 and page-size of 1024, this means
+  # pages 2 and 3 must also be saved in the journal to avoid
+  # risking corruption.
+  #
+  # The loop is so that this test can be run with a couple
+  # of different seeds for the random number generator.
+  #
+  do_test crash2-1.2.$ii {
+    crashsql -file test.db -blocksize 2048 "
+      [string repeat {SELECT random();} $ii]
+      CREATE TABLE hij(h, i, j);
+    "
+    db eval {PRAGMA integrity_check}
+  } {ok}
+}
+
+finish_test
+