]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Check in some changes to fuzz.test. Still failing. (CVS 3985)
authordanielk1977 <danielk1977@noemail.net>
Fri, 11 May 2007 16:58:03 +0000 (16:58 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Fri, 11 May 2007 16:58:03 +0000 (16:58 +0000)
FossilOrigin-Name: 6f346a6be9803b84260509352315f8fa1e820490

manifest
manifest.uuid
test/fuzz.test

index fde216afd4e7a4ec1d06d783f22ce6967eb230ab..df18e436b57dd00bf55563039f9b72ff2dd47d36 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Avoid\smultiple\sstorage\sclass\sspecifiers\s("static\sextern")\sin\sthe\samalagmation.\s(CVS\s3984)
-D 2007-05-11T12:30:04
+C Check\sin\ssome\schanges\sto\sfuzz.test.\sStill\sfailing.\s(CVS\s3985)
+D 2007-05-11T16:58:04
 F Makefile.in 87b200ad9970907f76df734d29dff3d294c10935
 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -248,7 +248,7 @@ F test/fts2l.test 4c53c89ce3919003765ff4fd8d98ecf724d97dd3
 F test/fts2m.test 4b30142ead6f3ed076e880a2a464064c5ad58c51
 F test/fts2n.test a70357e72742681eaebfdbe9007b87ff3b771638
 F test/func.test bf30bac1c5ce10448ab739994268cf18f8b3fa30
-F test/fuzz.test e939852bfd1d2db7264d6a55ed9b17834a535728
+F test/fuzz.test 5bd59290ab42cabbfb2e0ad1683a480f0d8e8693
 F test/fuzz2.test fdbea571808441c12c91e9cd038eb77b4692d42b
 F test/hook.test 7e7645fd9a033f79cce8fdff151e32715e7ec50a
 F test/icu.test e6bfae7f625c88fd14df6f540fe835bdfc1e4329
@@ -488,7 +488,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 4e1bb41f302c13095aa9c638e59ae11417f49682
-R 0ef77c803856268fd492e9a8b4d88856
-U drh
-Z 29baa4cb103abeeafa2097c522aa6ac6
+P 2f70159b1d6ded4a1ac446faa3baf7269f37703f
+R 0b013336ad3732dc516052d4aa155e80
+U danielk1977
+Z 5241c0f63790746ffd570aebaabc6267
index da5612bf42854d7cf29130ce35220e0e71855985..d9a825f5fbd12922583a253925b9bf6bfabf3225 100644 (file)
@@ -1 +1 @@
-2f70159b1d6ded4a1ac446faa3baf7269f37703f
\ No newline at end of file
+6f346a6be9803b84260509352315f8fa1e820490
\ No newline at end of file
index b4e27b2faf93f4d55d16baa1258fe2868af84d02..40ff5dde6bf496d8eca2393470d64dd80fa788d7 100644 (file)
 # (a.k.a. "fuzz") and sending it into the parser to try to generate
 # errors.
 #
-# $Id: fuzz.test,v 1.6 2007/05/11 10:10:33 danielk1977 Exp $
+# $Id: fuzz.test,v 1.7 2007/05/11 16:58:04 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
 
+set ::REPEATS 20
+set ::REPEATS 5000
+
 proc fuzz {TemplateList} {
   set n [llength $TemplateList]
   set i [expr {int(rand()*$n)}]
@@ -74,7 +77,7 @@ proc Expr { {c {}} } {
   incr ::ExprDepth
 
   set TemplateList [concat $c {[Literal]}]
-  if {$::ExprDepth < 25} {
+  if {$::ExprDepth < 5} {
     lappend TemplateList \
       {[Expr $c] [BinaryOp] [Expr $c]} \
       {[UnaryOp] [Expr $c]}            \
@@ -84,6 +87,17 @@ proc Expr { {c {}} } {
       {CAST([Expr $c] AS text)}        \
       {CAST([Expr $c] AS integer)}     \
       {CAST([Expr $c] AS real)}        \
+      {abs([Expr])}                    \
+      {coalesce([Expr], [Expr])}       \
+      {hex([Expr])}                    \
+      {length([Expr])}                 \
+      {lower([Expr])}                  \
+      {upper([Expr])}                  \
+      {quote([Expr])}                  \
+      {random()}                       \
+      {randomblob(min(max([Expr],1), 500))}   \
+      {typeof([Expr])}                 \
+      {substr([Expr],[Expr],[Expr])}   \
       {CASE WHEN [Expr $c] THEN [Expr $c] ELSE [Expr $c] END}       \
       {[Literal]} {[Literal]} {[Literal]}
   }
@@ -110,6 +124,7 @@ proc Table {} {
 # Return a SELECT statement.
 #
 set ::SelectDepth 0
+set ::ColumnList [list]
 proc Select {{isExpr 0}} {
   incr ::SelectDepth
   set TemplateList {
@@ -119,14 +134,15 @@ proc Select {{isExpr 0}} {
   if {$::SelectDepth < 5} {
     lappend TemplateList \
         {SELECT [Expr] FROM ([Select])}                \
-        {SELECT [Expr] FROM [Table]}                   \
+        {SELECT [Expr $::ColumnList] FROM [Table]}     \
 
     if {0 == $isExpr} {
       lappend TemplateList                                         \
           {SELECT [Expr], [Expr] FROM ([Select]) ORDER BY [Expr]}  \
           {SELECT * FROM ([Select]) ORDER BY [Expr]}               \
           {SELECT * FROM [Table]}                                  \
-          {SELECT * FROM [Table] WHERE [Expr]}                     \
+          {SELECT * FROM [Table] WHERE [Expr $::ColumnList]}       \
+{SELECT * FROM [Table],[Table] AS t2 WHERE [Expr $::ColumnList] LIMIT 1}
     }
   } 
   set res [fuzz $TemplateList]
@@ -145,6 +161,38 @@ proc Insert {} {
   fuzz $TemplateList
 }
 
+proc Column {} {
+  fuzz $::ColumnList
+}
+
+# Generate and return a fuzzy UPDATE statement.
+#
+proc Update {} {
+  set TemplateList {
+    {UPDATE [Table] 
+     SET [Column] = [Expr $::ColumnList] 
+     WHERE [Expr $::ColumnList]}
+  }
+  fuzz $TemplateList
+}
+
+proc Delete {} {
+  set TemplateList {
+    {DELETE FROM [Table] WHERE [Expr $::ColumnList]}
+  }
+  fuzz $TemplateList
+}
+
+proc Statement {} {
+  set TemplateList {
+    {[Update]}
+    {[Insert]}
+    {[Select]}
+    {[Delete]}
+  }
+  fuzz $TemplateList
+}
+
 ########################################################################
 
 set ::log [open fuzzy.log w]
@@ -160,7 +208,7 @@ proc do_fuzzy_test {testname args} {
   array set ::fuzzyopts $args
   lappend ::fuzzyopts(-errorlist) {parser stack overflow} {ORDER BY column}
 
-  for {set ii 0} {$ii < 2000} {incr ii} {
+  for {set ii 0} {$ii < $::REPEATS} {incr ii} {
     do_test ${testname}.$ii {
       set ::sql [subst $::fuzzyopts(-template)]
       puts $::log $::sql
@@ -231,11 +279,29 @@ do_test fuzz-1.7 {
 } [execsql {SELECT zeroblob(1000)}]
 
 do_test fuzz-1.8 {
+  # Problems with opcode OP_ToText (did not account for MEM_Zero).
+  # Also MemExpandBlob() was marking expanded blobs as nul-terminated.
+  # They are not.
   execsql {
     SELECT CAST(zeroblob(1000) AS text);
   }
 } {{}}
 
+do_test fuzz-1.9 {
+  # This was causing a NULL pointer dereference of Expr.pList.
+  execsql {
+    SELECT 1 FROM (SELECT * FROM sqlite_master WHERE random())
+  }
+} {}
+
+do_test fuzz-1.10 {
+  # Bug in calculation of Parse.ckOffset causing an assert() 
+  # to fail. Probably harmless.
+  execsql {
+    SELECT coalesce(1, substr( 1, 2, length('in' IN (SELECT 1))))
+  }
+} {1}
+
 #----------------------------------------------------------------
 # Test some fuzzily generated expressions.
 #
@@ -249,7 +315,6 @@ do_test fuzz-3.1 {
   }
 } {}
 set ::TableList  [list abc def ghi]
-set ::ColumnList [list a b c]
 
 #----------------------------------------------------------------
 # Test some fuzzily generated SELECT statements.
@@ -287,7 +352,23 @@ integrity_check fuzz-5.2.integrity
 do_test         fuzz-5.3 {execsql COMMIT} {}
 integrity_check fuzz-5.4.integrity
 
-do_fuzzy_test fuzz-6.1 -template {[Select]}
+#----------------------------------------------------------------
+# Now that there is data in the datbase, run some more SELECT 
+# statements
+#
+set ::ColumnList [list a b c]
+set E {{no such col} {ambiguous column name}}
+do_fuzzy_test fuzz-6.1 -template {[Select]} -errorlist $E
+
+#----------------------------------------------------------------
+# Run some SELECTs, INSERTs, UPDATEs and DELETEs in a transaction.
+#
+set E {{no such col} {ambiguous column name} {table}}
+do_test         fuzz-7.1 {execsql BEGIN} {}
+do_fuzzy_test   fuzz-7.2 -template {[Statement]} -errorlist $E
+integrity_check fuzz-7.3.integrity
+do_test         fuzz-7.4 {execsql COMMIT} {}
+integrity_check fuzz-7.5.integrity
 
 close $::log
 finish_test