Add tests for the new code on this branch.
[sqlite.git] / tool / soak1.tcl
blob846f905935c20e2a26cb74719a915ba838126718
1 #!/usr/bin/tclsh
3 # Usage:
5 # tclsh soak1.tcl local-makefile.mk ?target? ?scenario?
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".
11 # If ?target? is provided, that is the makefile target that is run.
12 # The default is "fulltest"
14 # If ?scenario? is provided, it is the name of a single scenario to
15 # be run. All other scenarios are skipped.
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}
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"
30 # Generate a makefile
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"
43 set seen_opt 1
45 } else {
46 puts $out $line
49 close $out
52 # Run a test
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
63 ###############################################################################
64 # Add new scenarios here
66 scenario 0 {Default} {}
67 scenario 1 {Debug} {
68 SQLITE_DEBUG=1
69 SQLITE_MEMDEBUG=1
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
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
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