merge-test.tcl 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/tcl
  2. #
  3. # Run this script to test to see that the latest trunk changes can be
  4. # merged into LTS branches without breaking anything.
  5. #
  6. # To Use:
  7. #
  8. # * Copy this script into a directory above the sqlite checkout
  9. # * Run "fossil update trunk" and "fossil revert"
  10. # * Run "tclsh ../merge-test.tcl" (in other words run this script)
  11. #
  12. # Operation:
  13. #
  14. # This script changes to each LTS branch to be tested, merges the latest
  15. # trunk changes into the branch (without committing them) and then
  16. # runs "make test". Any errors are stored in local files.
  17. #
  18. # Limitations:
  19. #
  20. # Some LTS branches are not synced directly from trunk but rather from
  21. # other LTS branches. These other branches cannot be tested because
  22. # there is no good way to generate the intermediate merges.
  23. #
  24. ###############################################################################
  25. # Run a shell command contained in arguments. Put the return code in
  26. # global variable ::res and the output string in global variable ::result
  27. #
  28. proc safeexec {args} {
  29. global res result
  30. set res [catch "exec $args" result]
  31. }
  32. # Run the shell command contained in arguments. Print an error and exit
  33. # if anything goes wrong.
  34. #
  35. proc mustbeok {args} {
  36. global res result
  37. set res [catch "exec $args" result]
  38. if {$res} {
  39. puts "FAILED: $args"
  40. puts $result
  41. exit 1
  42. }
  43. }
  44. # Write $content into a file named $filename. The file is overwritten if it
  45. # already exist. The file is create if it does not already exist.
  46. #
  47. proc writefile {filename content} {
  48. set fd [open $filename wb]
  49. puts $fd $content
  50. close $fd
  51. }
  52. # Run the merge-test
  53. #
  54. foreach {branch configopts} {
  55. begin-concurrent {--enable-json1}
  56. begin-concurrent-pnu {--enable-json1}
  57. wal2 {--enable-all}
  58. reuse-schema {--enable-all}
  59. } {
  60. puts $branch
  61. set errorfile ${branch}-error.txt
  62. mustbeok fossil revert
  63. mustbeok fossil up $branch
  64. safeexec fossil merge trunk
  65. if {$res} {
  66. puts " merge failed - see $errorfile"
  67. writefile $errorfile $result
  68. } else {
  69. puts " merge ok"
  70. safeexec ./configure --enable-debug {*}$configopts
  71. if {$res} {
  72. puts " configure failed - see $errorfile"
  73. writefile $errorfile $result
  74. } else {
  75. puts " configure ok"
  76. safeexec make fuzzcheck sqlite3 testfixture
  77. if {$res} {
  78. puts " build failed - see $errorfile"
  79. writefile $errorfile $result
  80. } else {
  81. puts " build ok"
  82. safeexec make test
  83. if {$res} {
  84. puts " test failed - see $errorfile"
  85. writefile $errorfile $result
  86. } else {
  87. puts " test ok"
  88. }
  89. }
  90. }
  91. }
  92. }
  93. mustbeok fossil revert
  94. mustbeok fossil up trunk
  95. puts "reset back to trunk"