soak1.tcl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. set in [open $localmake]
  23. set maketxt [read $in]
  24. close $in
  25. regsub -all {\\\n} $maketxt {} maketxt
  26. #set makefilename "soak1-[expr {int(rand()*1000000000)}].mk"
  27. set makefilename "soak1.mk"
  28. # Generate a makefile
  29. #
  30. proc generate_makefile {pattern} {
  31. global makefilename maketxt
  32. set out [open $makefilename w]
  33. set seen_opt 0
  34. foreach line [split $maketxt \n] {
  35. if {[regexp {^ *#? *OPTS[ =+]} $line]} {
  36. if {!$seen_opt} {
  37. puts $out "OPTS += -DSQLITE_NO_SYNC=1"
  38. foreach x $pattern {
  39. puts $out "OPTS += -D$x"
  40. }
  41. set seen_opt 1
  42. }
  43. } else {
  44. puts $out $line
  45. }
  46. }
  47. close $out
  48. }
  49. # Run a test
  50. #
  51. proc scenario {id title pattern} {
  52. global makefilename target scene
  53. if {$scene!="all" && $scene!=$id && $scene!=$title} return
  54. puts "**************** $title ***************"
  55. generate_makefile $pattern
  56. exec make -f $makefilename clean >@stdout 2>@stdout
  57. exec make -f $makefilename $target >@stdout 2>@stdout
  58. }
  59. ###############################################################################
  60. # Add new scenarios here
  61. #
  62. scenario 0 {Default} {}
  63. scenario 1 {Debug} {
  64. SQLITE_DEBUG=1
  65. SQLITE_MEMDEBUG=1
  66. }
  67. scenario 2 {Everything} {
  68. SQLITE_DEBUG=1
  69. SQLITE_MEMDEBUG=1
  70. SQLITE_ENABLE_MEMORY_MANAGEMENT=1
  71. SQLITE_ENABLE_COLUMN_METADATA=1
  72. SQLITE_ENABLE_LOAD_EXTENSION=1 HAVE_DLOPEN=1
  73. SQLITE_ENABLE_MEMORY_MANAGEMENT=1
  74. }
  75. scenario 3 {Customer-1} {
  76. SQLITE_DEBUG=1 SQLITE_MEMDEBUG=1
  77. SQLITE_THREADSAFE=1 SQLITE_OS_UNIX=1
  78. SQLITE_DISABLE_LFS=1
  79. SQLITE_DEFAULT_AUTOVACUUM=1
  80. SQLITE_DEFAULT_PAGE_SIZE=1024
  81. SQLITE_MAX_PAGE_SIZE=4096
  82. SQLITE_DEFAULT_CACHE_SIZE=64
  83. SQLITE_DEFAULT_TEMP_CACHE_SIZE=32
  84. SQLITE_TEMP_STORE=3
  85. SQLITE_OMIT_PROGRESS_CALLBACK=1
  86. SQLITE_OMIT_LOAD_EXTENSION=1
  87. SQLITE_OMIT_VIRTUALTABLE=1
  88. SQLITE_ENABLE_IOTRACE=1
  89. }
  90. scenario 4 {Small-Cache} {
  91. SQLITE_DEBUG=1 SQLITE_MEMDEBUG=1
  92. SQLITE_THREADSAFE=1 SQLITE_OS_UNIX=1
  93. SQLITE_DEFAULT_AUTOVACUUM=1
  94. SQLITE_DEFAULT_PAGE_SIZE=1024
  95. SQLITE_MAX_PAGE_SIZE=2048
  96. SQLITE_DEFAULT_CACHE_SIZE=13
  97. SQLITE_DEFAULT_TEMP_CACHE_SIZE=11
  98. SQLITE_TEMP_STORE=1
  99. }