]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Add omittest.tcl script to automate testing compile-time OMIT symbols. (CVS 3031)
authordanielk1977 <danielk1977@noemail.net>
Thu, 26 Jan 2006 13:11:36 +0000 (13:11 +0000)
committerdanielk1977 <danielk1977@noemail.net>
Thu, 26 Jan 2006 13:11:36 +0000 (13:11 +0000)
FossilOrigin-Name: 540d28a7d355d846cedfc21fb5156379fec830ce

manifest
manifest.uuid
test/shared2.test
tool/omittest.tcl [new file with mode: 0644]

index 7a66b3ec3068217206a4a56e9213ed31317a69a8..2126a5fbad333ca5c8119ef538867e492a369bb7 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Handle\sa\smalloc()\sfailure\sin\sresizeOpArray().\s(CVS\s3030)
-D 2006-01-26T10:35:05
+C Add\somittest.tcl\sscript\sto\sautomate\stesting\scompile-time\sOMIT\ssymbols.\s(CVS\s3031)
+D 2006-01-26T13:11:37
 F Makefile.in e936c6fc3134838318aa0335a85041e6da31f6ee
 F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -229,7 +229,7 @@ F test/select6.test d8ea108b65607399580f2765df0aee5e464b0fd8
 F test/select7.test 1bf795b948c133a15a2a5e99d3270e652ec58ce6
 F test/server1.test e328b8e641ba8fe9273132cfef497383185dc1f5
 F test/shared.test 0ed247941236788c255b3b29b5a82d5ca71b6432
-F test/shared2.test 3466dc54ca69a3c50ac259e106fb5cd067b8cd53
+F test/shared2.test 8b48f8d33494413ef4cf250110d89403e2bf6b23
 F test/shared_err.test 299a9180a6376b2089e8e0d469f383fe91bfa4ff
 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5
 F test/subquery.test ae324ee928c5fb463a3ce08a8860d6e7f1ca5797
@@ -284,6 +284,7 @@ F tool/memleak2.awk 9cc20c8e8f3c675efac71ea0721ee6874a1566e8
 F tool/memleak3.tcl 7707006ee908cffff210c98158788d85bb3fcdbf
 F tool/mkkeywordhash.c fa58d31c047fa3411761b01907d6df05781970d6
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e x
+F tool/omittest.tcl 3d07c8f67e7e6c369b07d31d97aaa3e434f0e9e7
 F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
 F tool/report1.txt 9eae07f26a8fc53889b45fc833a66a33daa22816
 F tool/showdb.c a086a3d788c7a23cb008317c3180ceb19f20bce0
@@ -346,7 +347,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 9e55dcd1a57f2b6ad5b267e8fa58c58b266dc8c7
-R 50d385e1d4cc2be81d84f045aa659461
+P 5cecb4527b40c245cc6f3d6ce9f33466045d1469
+R 167e219a347c7a86ebd59590ad4b4d34
 U danielk1977
-Z 3e812ebff127cb7648b222781378b092
+Z 7e436f8b3b0e7e9dfae1126c1d6808ee
index ed95691ea389aa98b20ae8fb57f6c201a26e5ea1..093daddd1967a0129635ed3048f2d4cc2e1c6274 100644 (file)
@@ -1 +1 @@
-5cecb4527b40c245cc6f3d6ce9f33466045d1469
\ No newline at end of file
+540d28a7d355d846cedfc21fb5156379fec830ce
\ No newline at end of file
index d7428fa51d2f34438c23c67282e1d5a48635083c..9af30de4fc322ac32c5973bd7ae3fd48dc3b346a 100644 (file)
@@ -9,7 +9,7 @@
 #
 #***********************************************************************
 #
-# $Id: shared2.test,v 1.3 2006/01/24 14:21:24 danielk1977 Exp $
+# $Id: shared2.test,v 1.4 2006/01/26 13:11:37 danielk1977 Exp $
 
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -21,7 +21,6 @@ ifcapable !shared_cache {
 }
 set ::enable_shared_cache [sqlite3_enable_shared_cache 1]
 
-
 # Test that if we delete all rows from a table any read-uncommitted 
 # cursors are correctly invalidated. Test on both table and index btrees.
 do_test shared2-1.1 {
@@ -78,7 +77,9 @@ do_test shared2-1.3 {
   list $a $count
 } {32 64}
 
-# Rollback data into or out of a table while a read-uncommitted 
+#---------------------------------------------------------------------------
+# These tests, shared2.2.*, test the outcome when data is added to or 
+# removed from a table due to a rollback while a read-uncommitted 
 # cursor is scanning it.
 #
 do_test shared2-2.1 {
diff --git a/tool/omittest.tcl b/tool/omittest.tcl
new file mode 100644 (file)
index 0000000..c8e0450
--- /dev/null
@@ -0,0 +1,173 @@
+
+set rcsid {$Id: omittest.tcl,v 1.1 2006/01/26 13:11:37 danielk1977 Exp $}
+
+# Documentation for this script. This may be output to stderr
+# if the script is invoked incorrectly.
+set ::USAGE_MESSAGE {
+This Tcl script is used to test the various compile time options 
+available for omitting code (the SQLITE_OMIT_xxx options). It
+should be invoked as follows:
+
+    <script> ?-makefile PATH-TO-MAKEFILE?
+
+The default value for ::MAKEFILE is "../Makefile.linux.gcc".
+
+This script builds the testfixture program and runs the SQLite test suite
+once with each SQLITE_OMIT_ option defined and then once with all options
+defined together. Each run is performed in a seperate directory created
+as a sub-directory of the current directory by the script. The output
+of the build is saved in <sub-directory>/build.log. The output of the
+test-suite is saved in <sub-directory>/test.log.
+
+Almost any SQLite makefile (except those generated by configure - see below)
+should work. The following properties are required:
+
+  * The makefile should support the "testfixture" target.
+  * The makefile should support the "test" target.
+  * The makefile should support the variable "OPTS" as a way to pass
+    options from the make command line to lemon and the C compiler.
+
+More precisely, the following two invocations must be supported:
+
+  make -f $::MAKEFILE testfixture OPTS="-DSQLITE_OMIT_ALTERTABLE=1"
+  make -f $::MAKEFILE test
+
+Makefiles generated by the sqlite configure program cannot be used as
+they do not respect the OPTS variable.
+}
+
+
+# Build a testfixture executable and run quick.test using it. The first
+# parameter is the name of the directory to create and use to run the
+# test in. The second parameter is a list of OMIT symbols to define
+# when doing so. For example:
+#
+#     run_quick_test /tmp/testdir {SQLITE_OMIT_TRIGGER SQLITE_OMIT_VIEW}
+#
+#
+proc run_quick_test {dir omit_symbol_list} {
+  # Compile the value of the OPTS Makefile variable.
+  set opts "-DSQLITE_MEMDEBUG=2 -DSQLITE_DEBUG -DOS_UNIX" 
+  foreach sym $omit_symbol_list {
+    append opts " -D${sym}=1"
+  }
+
+  # Create the directory and do the build. If an error occurs return
+  # early without attempting to run the test suite.
+  file mkdir $dir
+  puts -nonewline "Building $dir..."
+  flush stdout
+  set rc [catch {
+    exec make -C $dir -f $::MAKEFILE testfixture OPTS=$opts >& $dir/build.log
+  }]
+  if {$rc} {
+    puts "No good. See $dir/build.log."
+    return
+  } else {
+    puts "Ok"
+  }
+  
+  # Create an empty file "$dir/sqlite3". This is to trick the makefile out 
+  # of trying to build the sqlite shell. The sqlite shell won't build 
+  # with some of the OMIT options (i.e OMIT_COMPLETE).
+  if {![file exists $dir/sqlite3]} {
+    set wr [open $dir/sqlite3 w]
+    puts $wr "dummy"
+    close $wr
+  }
+
+  # Run the test suite.
+  puts -nonewline "Testing $dir..."
+  flush stdout
+  set rc [catch {
+    exec make -C $dir -f $::MAKEFILE test OPTS=$opts >& $dir/test.log
+  }]
+  if {$rc} {
+    puts "No good. See $dir/test.log."
+  } else {
+    puts "Ok"
+  }
+}
+
+
+# This proc processes the command line options passed to this script.
+# Currently the only option supported is "-makefile", default
+# "../Makefile.linux-gcc". Set the ::MAKEFILE variable to the value of this
+# option.
+#
+proc process_options {argv} {
+  set ::MAKEFILE ../Makefile.linux-gcc              ;# Default value
+  for {set i 0} {$i < [llength $argv]} {incr i} {
+    switch -- [lindex $argv $i] {
+      -makefile {
+        incr i
+        set ::MAKEFILE [lindex $argv $i]
+      }
+  
+      default {
+        puts stderr [string trim $::USAGE_MESSAGE]
+        exit -1
+      }
+    }
+    set ::MAKEFILE [file normalize $::MAKEFILE]
+  }
+}
+
+# Main routine.
+#
+proc main {argv} {
+  # List of SQLITE_OMIT_XXX symbols supported by SQLite.
+  set ::SYMBOLS [list                  \
+    SQLITE_OMIT_COMPLETE               \
+    SQLITE_OMIT_ALTERTABLE             \
+    SQLITE_OMIT_AUTOVACUUM             \
+    SQLITE_OMIT_AUTHORIZATION          \
+    SQLITE_OMIT_AUTOINCREMENT          \
+    SQLITE_OMIT_BLOB_LITERAL           \
+    SQLITE_OMIT_COMPOUND_SELECT        \
+    SQLITE_OMIT_CONFLICT_CLAUSE        \
+    SQLITE_OMIT_DATETIME_FUNCS         \
+    SQLITE_OMIT_EXPLAIN                \
+    SQLITE_OMIT_FLOATING_POINT         \
+    SQLITE_OMIT_FOREIGN_KEY            \
+    SQLITE_OMIT_INTEGRITY_CHECK        \
+    SQLITE_OMIT_MEMORYDB               \
+    SQLITE_OMIT_PAGER_PRAGMAS          \
+    SQLITE_OMIT_PRAGMA                 \
+    SQLITE_OMIT_PROGRESS_CALLBACK      \
+    SQLITE_OMIT_REINDEX                \
+    SQLITE_OMIT_SCHEMA_PRAGMAS         \
+    SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS \
+    SQLITE_OMIT_SUBQUERY               \
+    SQLITE_OMIT_TCL_VARIABLE           \
+    SQLITE_OMIT_TRIGGER                \
+    SQLITE_OMIT_UTF16                  \
+    SQLITE_OMIT_VACUUM                 \
+    SQLITE_OMIT_VIEW                   \
+  ]
+
+  # Process any command line options.
+  process_options $argv
+  
+  # First try a test with all OMIT symbols except SQLITE_OMIT_FLOATING_POINT 
+  # and SQLITE_OMIT_PRAGMA defined. The former doesn't work (causes segfaults)
+  # and the latter is currently incompatible with the test suite (this should
+  # be fixed, but it will be a lot of work).
+  set allsyms [list]
+  foreach s $::SYMBOLS {
+    if {$s!="SQLITE_OMIT_FLOATING_POINT" && $s!="SQLITE_OMIT_PRAGMA"} {
+      lappend allsyms $s
+    }
+  }
+  run_quick_test test_OMIT_EVERYTHING $allsyms
+  
+  # Now try one quick.test with each of the OMIT symbols defined. Included
+  # are the OMIT_FLOATING_POINT and OMIT_PRAGMA symbols, even though we
+  # know they will fail. It's good to be reminded of this from time to time.
+  foreach sym $::SYMBOLS {
+    set dirname "test_[string range $sym 7 end]"
+    run_quick_test $dirname $sym
+  }
+}
+
+main $argv