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# 17set localmake [lindex $argv 0] 18set target [lindex $argv 1] 19set scene [lindex $argv 2] 20if {$target==""} {set target fulltest} 21if {$scene==""} {set scene all} 22 23set in [open $localmake] 24set maketxt [read $in] 25close $in 26regsub -all {\\\n} $maketxt {} maketxt 27#set makefilename "soak1-[expr {int(rand()*1000000000)}].mk" 28set makefilename "soak1.mk" 29 30# Generate a makefile 31# 32proc 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# 54proc 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# 66scenario 0 {Default} {} 67scenario 1 {Debug} { 68 SQLITE_DEBUG=1 69 SQLITE_MEMDEBUG=1 70} 71scenario 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} 79scenario 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} 94scenario 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} 104