From 521cc8494e4e55194b4569c85f2e021f4058d428 Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 15 Apr 2008 02:36:33 +0000 Subject: [PATCH] Add out-of-range tests on the first parameter to sqlite3_limit(). Add the ability to record tests that have been skipped due to configuration limitations. (CVS 5009) FossilOrigin-Name: b7ffc6f0f33b14430ab84a6c60110bc07514f056 --- manifest | 20 ++++++++++---------- manifest.uuid | 2 +- src/main.c | 4 ++-- src/test1.c | 6 +++++- test/sqllimits1.test | 18 +++++++++++++++++- test/tester.tcl | 21 +++++++++++++++++++-- test/vacuum.test | 4 +++- 7 files changed, 57 insertions(+), 18 deletions(-) diff --git a/manifest b/manifest index 8999bd1a0f..8a96ab11c9 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\stest\scase\sto\scover\sthe\sbug\sfixed\sin\scheck-in\s(5007).\s(CVS\s5008) -D 2008-04-15T00:02:00 +C Add\sout-of-range\stests\son\sthe\sfirst\sparameter\sto\ssqlite3_limit().\nAdd\sthe\sability\sto\srecord\stests\sthat\shave\sbeen\sskipped\sdue\sto\nconfiguration\slimitations.\s(CVS\s5009) +D 2008-04-15T02:36:34 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7 F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -104,7 +104,7 @@ F src/insert.c 5208f16ddfc77d9e72bb30041a1d04a18b18a170 F src/journal.c 807bed7a158979ac8d63953e1774e8d85bff65e2 F src/legacy.c 8267890e6a0a71f13b680794520999c642299081 F src/loadext.c 5c20a5afeb154e68d62ed6d9c634add1b21387fd -F src/main.c afcd42ba14d144034ed0e285bee100594f00b8fa +F src/main.c 8f3ce9735280fc099d4b64e13ca0e0ce28f14fe9 F src/malloc.c 12c1ae98ef1eff34b13c9eb526e0b7b479e1e820 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/mem1.c fc716ff521b6dd3e43eaa211967383308800e70a @@ -144,7 +144,7 @@ F src/sqliteInt.h 6e6e847b7315e9609ab79dba6d68748b7ad3e214 F src/sqliteLimit.h f435e728c6b620ef7312814d660a81f9356eb5c8 F src/table.c 2c48c575dd59b3a6c5c306bc55f51a9402cf429a F src/tclsqlite.c c4892f48927cb3db19faeb448ea8abddfd4846a8 -F src/test1.c aada95d7a7229366e51c71055d5764c920d3364c +F src/test1.c 8d633bcf3cd3b805c3393d58b5c1011d49b9b550 F src/test2.c f0808cc643528b9620e4059ca9bda8346f526121 F src/test3.c c715b5a8a6415d7b2c67f97c394eef488b6f7e63 F src/test4.c c2c0f5dc907f1346f5d4b65eb5799f11eb9e4071 @@ -447,7 +447,7 @@ F test/speed2.test 53177056baf6556dcbdcf032bbdfc41c1aa74ded F test/speed3.test e312d7e442a5047d730569fdae2ba99bc94e1a13 F test/speed4.test 20d8ea20bea3ca09c3ef3b5ec820a17e58e132cb F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b -F test/sqllimits1.test cebd870957dbf8d931c5c9cadf757e0d31a3f71a +F test/sqllimits1.test 68f7eab0bfc27ef68d677864d37e37e38f67db00 F test/subquery.test 8203f85db56ba022a57a0589890090c8feed4e59 F test/subselect.test 974e87f8fc91c5f00dd565316d396a5a6c3106c4 F test/substr.test 4be572ac017143e59b4058dc75c91a0d0dc6d4e0 @@ -457,7 +457,7 @@ F test/tableapi.test 791f7e3891d9b70bdb43b311694bf5e9befcbc34 F test/tclsqlite.test 3fac87cb1059c46b8fa8a60b553f4f1adb0fb6d9 F test/tempdb.test b88ac8a19823cf771d742bf61eef93ef337c06b1 F test/temptable.test 19b851b9e3e64d91e9867619b2a3f5fffee6e125 -F test/tester.tcl 7820fa85db914ef8cfff72b689fd4a9ed8712cec +F test/tester.tcl 93b57b686ad5a9d9cafaa86c7c231f773e52931b F test/thread001.test 8fbd9559da0bbdc273e00318c7fd66c162020af7 F test/thread002.test 2c4ad2c386f60f6fe268cd91c769ee35b3c1fd0b F test/thread1.test 776c9e459b75ba905193b351926ac4019b049f35 @@ -520,7 +520,7 @@ F test/unique.test 0253c4227a5dc533e312202ce21ecfad18058d18 F test/update.test 8bc86fd7ef1a00014f76dc6a6a7c974df4aef172 F test/utf16.test 20e2d9ba0d57e952a18b1ac8deab9ad49e082893 F test/utf16align.test 7360e84472095518c56746f76b1f9d4dce99fb4d -F test/vacuum.test f67853a15caa120af591f819670f01a11fcc2bfc +F test/vacuum.test 0bc75ee74ab9c69322d6563aa2287375697e630b F test/vacuum2.test d3b9691541fe6ed5c711f547a1c7d70e9760ac6f F test/vacuum3.test f22cd134cc43887514fb793e828d95c75a93e1cb F test/varint.test ab7b110089a08b9926ed7390e7e97bdefeb74102 @@ -629,7 +629,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5 -P 7bb9a4165afb96043dfeffad21eb51591a1fd2dd -R 95872015313aa0ab31ee9558f8a82a98 +P 1863e87c40499ee3d9fd9cba6670e9a0e946d390 +R 326cf8a2b7ebf9f02937bb1cbd68fb2c U drh -Z 490b66623347d3f07228780b8130d933 +Z df93ea55892e12cf9b9e914f17244e03 diff --git a/manifest.uuid b/manifest.uuid index 9e9da8f94d..cabe1a1e3a 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1863e87c40499ee3d9fd9cba6670e9a0e946d390 \ No newline at end of file +b7ffc6f0f33b14430ab84a6c60110bc07514f056 \ No newline at end of file diff --git a/src/main.c b/src/main.c index 2a63dfcae6..3c1a4e905f 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** -** $Id: main.c,v 1.431 2008/04/03 16:28:25 danielk1977 Exp $ +** $Id: main.c,v 1.432 2008/04/15 02:36:34 drh Exp $ */ #include "sqliteInt.h" #include @@ -1006,7 +1006,7 @@ static const int aHardLimit[] = { */ int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ int oldLimit; - if( limitId<0 || limitId>SQLITE_N_LIMIT ){ + if( limitId<0 || limitId>=SQLITE_N_LIMIT ){ return -1; } oldLimit = db->aLimit[limitId]; diff --git a/src/test1.c b/src/test1.c index 9c0af0244d..09199ffe94 100644 --- a/src/test1.c +++ b/src/test1.c @@ -13,7 +13,7 @@ ** is not included in the SQLite library. It is used for automated ** testing of the SQLite library. ** -** $Id: test1.c,v 1.297 2008/04/08 03:07:55 mlcreech Exp $ +** $Id: test1.c,v 1.298 2008/04/15 02:36:34 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" @@ -4361,6 +4361,10 @@ static int test_limit( { "SQLITE_LIMIT_ATTACHED", SQLITE_LIMIT_ATTACHED }, { "SQLITE_LIMIT_LIKE_PATTERN_LENGTH", SQLITE_LIMIT_LIKE_PATTERN_LENGTH }, { "SQLITE_LIMIT_VARIABLE_NUMBER", SQLITE_LIMIT_VARIABLE_NUMBER }, + + /* Out of range test cases */ + { "SQLITE_LIMIT_TOOSMALL", -1, }, + { "SQLITE_LIMIT_TOOBIG", SQLITE_LIMIT_VARIABLE_NUMBER+1 }, }; int i, id; int val; diff --git a/test/sqllimits1.test b/test/sqllimits1.test index 66bb3ad5c0..dca5b71119 100644 --- a/test/sqllimits1.test +++ b/test/sqllimits1.test @@ -12,7 +12,7 @@ # This file contains tests to verify that the limits defined in # sqlite source file limits.h are enforced. # -# $Id: sqllimits1.test,v 1.27 2008/03/22 23:59:58 drh Exp $ +# $Id: sqllimits1.test,v 1.28 2008/04/15 02:36:34 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -52,6 +52,22 @@ do_test sqllimits1-1.10 { sqlite3_limit db SQLITE_LIMIT_VARIABLE_NUMBER -1 } $SQLITE_MAX_VARIABLE_NUMBER +# Limit parameters out of range. +# +do_test sqllimits1-1.20 { + sqlite3_limit db SQLITE_LIMIT_TOOSMALL 123 +} {-1} +do_test sqllimits1-1.21 { + sqlite3_limit db SQLITE_LIMIT_TOOSMALL 123 +} {-1} +do_test sqllimits1-1.22 { + sqlite3_limit db SQLITE_LIMIT_TOOBIG 123 +} {-1} +do_test sqllimits1-1.23 { + sqlite3_limit db SQLITE_LIMIT_TOOBIG 123 +} {-1} + + # Decrease all limits by half. Verify that the new limits take. # if {$SQLITE_MAX_LENGTH>=2} { diff --git a/test/tester.tcl b/test/tester.tcl index d172d4df07..5fd9d35782 100644 --- a/test/tester.tcl +++ b/test/tester.tcl @@ -11,7 +11,7 @@ # This file implements some common TCL routines used for regression # testing the SQLite library # -# $Id: tester.tcl,v 1.114 2008/04/10 17:27:39 danielk1977 Exp $ +# $Id: tester.tcl,v 1.115 2008/04/15 02:36:34 drh Exp $ # # What for user input before continuing. This gives an opportunity @@ -142,10 +142,18 @@ set nErr 0 set nTest 0 set skip_test 0 set failList {} +set omitList {} if {![info exists speedTest]} { set speedTest 0 } +# Record the fact that a sequence of tests were omitted. +# +proc omit_test {name reason} { + global omitList + lappend omitList [list $name $reason] +} + # Invoke the do_test procedure to run a single test # proc do_test {name cmd expected} { @@ -234,7 +242,7 @@ proc finish_test {} { finalize_testing } proc finalize_testing {} { - global nTest nErr sqlite_open_file_count + global nTest nErr sqlite_open_file_count omitList catch {db close} catch {db2 close} @@ -258,6 +266,15 @@ proc finalize_testing {} { if {$nErr>0} { puts "Failures on these tests: $::failList" } + if {[llength $omitList]>0} { + puts "Omitted test cases:" + set prec {} + foreach {rec} [lsort $omitList] { + if {$rec==$prec} continue + set prec $rec + puts [format { %-12s %s} [lindex $rec 0] [lindex $rec 1]] + } + } if {$nErr>0 && ![working_64bit_int]} { puts "******************************************************************" puts "N.B.: The version of TCL that you used to build this test harness" diff --git a/test/vacuum.test b/test/vacuum.test index 580f0fcad2..a81ce287b5 100644 --- a/test/vacuum.test +++ b/test/vacuum.test @@ -11,7 +11,7 @@ # This file implements regression tests for SQLite library. The # focus of this file is testing the VACUUM statement. # -# $Id: vacuum.test,v 1.40 2008/01/17 02:36:28 drh Exp $ +# $Id: vacuum.test,v 1.41 2008/04/15 02:36:34 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl @@ -20,10 +20,12 @@ source $testdir/tester.tcl # the tests in this file. # ifcapable {!vacuum} { + omit_test vacuum.test {Compiled with SQLITE_OMIT_VACUUM} finish_test return } if $AUTOVACUUM { + omit_test vacuum.test {Auto-vacuum is enabled} finish_test return }