File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / sqlite3 / tool / soak1.tcl
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 17:04:17 2012 UTC (12 years, 10 months ago) by misho
Branches: sqlite3, MAIN
CVS tags: v3_7_10, HEAD
sqlite3

    1: #!/usr/bin/tclsh
    2: #
    3: # Usage:
    4: #
    5: #    tclsh soak1.tcl local-makefile.mk ?target? ?scenario?
    6: #
    7: # This generates many variations on local-makefile.mk (by modifing
    8: # the OPT = lines) and runs them will fulltest, one by one.  The
    9: # constructed makefiles are named "soak1.mk".
   10: #
   11: # If ?target? is provided, that is the makefile target that is run.
   12: # The default is "fulltest"
   13: #
   14: # If ?scenario? is provided, it is the name of a single scenario to
   15: # be run.   All other scenarios are skipped.
   16: #
   17: set localmake [lindex $argv 0]
   18: set target [lindex $argv 1]
   19: set scene [lindex $argv 2]
   20: if {$target==""} {set target fulltest}
   21: if {$scene==""} {set scene all}
   22: 
   23: set in [open $localmake]
   24: set maketxt [read $in]
   25: close $in
   26: regsub -all {\\\n} $maketxt {} maketxt
   27: #set makefilename "soak1-[expr {int(rand()*1000000000)}].mk"
   28: set makefilename "soak1.mk"
   29: 
   30: # Generate a makefile
   31: #
   32: proc generate_makefile {pattern} {
   33:   global makefilename maketxt
   34:   set out [open $makefilename w]
   35:   set seen_opt 0
   36:   foreach line [split $maketxt \n] {
   37:     if {[regexp {^ *#? *OPTS[ =+]} $line]} {
   38:       if {!$seen_opt} {
   39:          puts $out "OPTS += -DSQLITE_NO_SYNC=1"
   40:          foreach x $pattern {
   41:            puts $out "OPTS += -D$x"
   42:          }
   43:          set seen_opt 1
   44:       }
   45:     } else {
   46:       puts $out $line
   47:     }
   48:   }
   49:   close $out
   50: }
   51: 
   52: # Run a test
   53: #
   54: proc scenario {id title pattern} {
   55:   global makefilename target scene
   56:   if {$scene!="all" && $scene!=$id && $scene!=$title} return
   57:   puts "**************** $title ***************"
   58:   generate_makefile $pattern
   59:   exec make -f $makefilename clean >@stdout 2>@stdout
   60:   exec make -f $makefilename $target >@stdout 2>@stdout
   61: }
   62: 
   63: ###############################################################################
   64: # Add new scenarios here
   65: #
   66: scenario 0 {Default} {}
   67: scenario 1 {Debug} {
   68:   SQLITE_DEBUG=1
   69:   SQLITE_MEMDEBUG=1
   70: }
   71: scenario 2 {Everything} {
   72:   SQLITE_DEBUG=1
   73:   SQLITE_MEMDEBUG=1
   74:   SQLITE_ENABLE_MEMORY_MANAGEMENT=1
   75:   SQLITE_ENABLE_COLUMN_METADATA=1
   76:   SQLITE_ENABLE_LOAD_EXTENSION=1 HAVE_DLOPEN=1
   77:   SQLITE_ENABLE_MEMORY_MANAGEMENT=1
   78: }
   79: scenario 3 {Customer-1} {
   80:   SQLITE_DEBUG=1 SQLITE_MEMDEBUG=1
   81:   SQLITE_THREADSAFE=1 SQLITE_OS_UNIX=1
   82:   SQLITE_DISABLE_LFS=1
   83:   SQLITE_DEFAULT_AUTOVACUUM=1
   84:   SQLITE_DEFAULT_PAGE_SIZE=1024
   85:   SQLITE_MAX_PAGE_SIZE=4096
   86:   SQLITE_DEFAULT_CACHE_SIZE=64
   87:   SQLITE_DEFAULT_TEMP_CACHE_SIZE=32
   88:   SQLITE_TEMP_STORE=3
   89:   SQLITE_OMIT_PROGRESS_CALLBACK=1
   90:   SQLITE_OMIT_LOAD_EXTENSION=1
   91:   SQLITE_OMIT_VIRTUALTABLE=1
   92:   SQLITE_ENABLE_IOTRACE=1
   93: }
   94: scenario 4 {Small-Cache} {
   95:   SQLITE_DEBUG=1 SQLITE_MEMDEBUG=1
   96:   SQLITE_THREADSAFE=1 SQLITE_OS_UNIX=1
   97:   SQLITE_DEFAULT_AUTOVACUUM=1
   98:   SQLITE_DEFAULT_PAGE_SIZE=1024
   99:   SQLITE_MAX_PAGE_SIZE=2048
  100:   SQLITE_DEFAULT_CACHE_SIZE=13
  101:   SQLITE_DEFAULT_TEMP_CACHE_SIZE=11
  102:   SQLITE_TEMP_STORE=1
  103: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>