From: danielk1977 Date: Wed, 3 Nov 2004 09:30:54 +0000 (+0000) Subject: Comment the autovacuum.test script. No code or test-case changes. (CVS 2047) X-Git-Tag: version-3.1.0~211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1be29eb6be7136743468a093496c8879eef27696;p=thirdparty%2Fsqlite.git Comment the autovacuum.test script. No code or test-case changes. (CVS 2047) FossilOrigin-Name: 2eacd38620f7270467b16e9e2f350aa0b4869a10 --- diff --git a/manifest b/manifest index 1d01247464..700ea66798 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Auto-vacuum\sbug:\sCorrectly\smanipulate\spage\scache\shash-table\sentries\sin\ssqlite3pager_movepage().\s(CVS\s2046) -D 2004-11-03T08:44:06 +C Comment\sthe\sautovacuum.test\sscript.\sNo\scode\sor\stest-case\schanges.\s(CVS\s2047) +D 2004-11-03T09:30:55 F Makefile.in c4d2416860f472a1e3393714d0372074197565df F Makefile.linux-gcc a9e5a0d309fa7c38e7c14d3ecf7690879d3a5457 F README a01693e454a00cc117967e3f9fdab2d4d52e9bc1 @@ -87,7 +87,7 @@ F test/attach.test 6ad560eb3e77751a4faecd77da09deac9e38cc41 F test/attach2.test f7795123d3051ace1672b6d23973da6435de3745 F test/attach3.test 6d060986ff004ebb89e1876a331d96c6bb62269e F test/auth.test 1cc252d9e7b3bdc1314199cbf3a0d3c5ed026c21 -F test/autovacuum.test 176a9a541726ee6bbc8ed64cf2d41934dc4df63b +F test/autovacuum.test 832bcbb0086b7a1a5af24f32399e02304f0056d4 F test/bigfile.test d3744a8821ce9abb8697f2826a3e3d22b719e89f F test/bigrow.test f0aeb7573dcb8caaafea76454be3ade29b7fc747 F test/bind.test a8682ba41433b93bb36a4213a43f282ca9aec5a9 @@ -252,7 +252,7 @@ F www/tclsqlite.tcl 560ecd6a916b320e59f2917317398f3d59b7cc25 F www/vdbe.tcl 59288db1ac5c0616296b26dce071c36cb611dfe9 F www/version3.tcl 092a01f5ef430d2c4acc0ae558d74c4bb89638a0 F www/whentouse.tcl fdacb0ba2d39831e8a6240d05a490026ad4c4e4c -P 007aec11333432e08d1091b728773011e9078bc3 -R 745d17de8251e17a5bf338dbe0b72b9d +P 719c1b79671c8cd7c5a6b5967ad4265b65e433d3 +R b36063b6d6cae6f63b6c4ea7219e3ded U danielk1977 -Z 2233bf7f9ac4fbde946c01ae92386ee6 +Z 2b831eb943422ab301a0d60aaa718fbd diff --git a/manifest.uuid b/manifest.uuid index ba1f119215..2048da1d7c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -719c1b79671c8cd7c5a6b5967ad4265b65e433d3 \ No newline at end of file +2eacd38620f7270467b16e9e2f350aa0b4869a10 \ No newline at end of file diff --git a/test/autovacuum.test b/test/autovacuum.test index d70fe3031d..341eb92ef0 100644 --- a/test/autovacuum.test +++ b/test/autovacuum.test @@ -11,37 +11,55 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the SELECT statement. # -# $Id: autovacuum.test,v 1.3 2004/11/03 03:01:17 danielk1977 Exp $ +# $Id: autovacuum.test,v 1.4 2004/11/03 09:30:55 danielk1977 Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl +# Return a string $len characters long. The returned string is $char repeated +# over and over. For example, [make_str abc 8] returns "abcabcab". proc make_str {char len} { set str [string repeat $char. $len] return [string range $str 0 [expr $len-1]] } +# Return the number of pages in the file test.db by looking at the file system. proc file_pages {} { return [expr [file size test.db] / 1024] } -do_test autovacuum-1.1 { - execsql { - CREATE TABLE av1(a); - CREATE INDEX av1_idx ON av1(a); - } -} {} - -set ENTRY_LEN 3000 - +# Test cases autovacuum-1.* work as follows: +# +# 1. A table with a single indexed field is created. +# 2. Approximately 20 rows are inserted into the table. Each row is long +# enough such that it uses at least 2 overflow pages for both the table +# and index entry. +# 3. The rows are deleted in a psuedo-random order. Sometimes only one row +# is deleted per transaction, sometimes more than one. +# 4. After each transaction the table data is checked to ensure it is correct +# and a "PRAGMA integrity_check" is executed. +# 5. Once all the rows are deleted the file is checked to make sure it +# consists of exactly 4 pages. +# +# Steps 2-5 are repeated for a few different psuedo-random delete patterns +# (defined by the $delete_orders list). set delete_orders [list] lappend delete_orders {1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20} lappend delete_orders {20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1} lappend delete_orders {8 18 2 4 14 11 13 3 10 7 9 5 12 17 19 15 20 6 16 1} lappend delete_orders {10 3 11 17 19 20 7 4 13 6 1 14 16 12 9 18 8 15 5 2} lappend delete_orders {{1 2 3 4 5 6 7 8 9 10} {11 12 13 14 15 16 17 18 19 20}} -lappend delete_orders \ - {{19 8 17 15} {16 11 9 14} {18 5 3 1} {13 20 7 2} {6 12 4 10}} +lappend delete_orders {{19 8 17 15} {16 11 9 14} {18 5 3 1} {13 20 7 2} {6 12}} + +# The length of each table entry. +set ENTRY_LEN 3500 + +do_test autovacuum-1.1 { + execsql { + CREATE TABLE av1(a); + CREATE INDEX av1_idx ON av1(a); + } +} {} set tn 0 foreach delete_order $delete_orders { @@ -54,6 +72,7 @@ foreach delete_order $delete_orders { lappend ::tbl_data [make_str $i $ENTRY_LEN] } + # Make sure the integrity check passes with the initial data. do_test autovacuum-1.$tn.1 { execsql { pragma integrity_check @@ -61,18 +80,21 @@ foreach delete_order $delete_orders { } {ok} foreach delete $delete_order { + # Delete one set of rows from the table. do_test autovacuum-1.$tn.($delete).1 { execsql " DELETE FROM av1 WHERE oid IN ([join $delete ,]) " } {} + # Do the integrity check. do_test autovacuum-1.$tn.($delete).2 { execsql { pragma integrity_check } } {ok} + # Ensure the data remaining in the table is what was expected. foreach d $delete { set idx [lsearch $::tbl_data [make_str $d $ENTRY_LEN]] set ::tbl_data [lreplace $::tbl_data $idx $idx] @@ -84,6 +106,7 @@ foreach delete_order $delete_orders { } $::tbl_data } + # All rows have been deleted. Ensure the file has shrunk to 4 pages. do_test autovacuum-1.$tn.3 { file_pages } {4}