establish default sqlcipher log level and target upon first activation
[sqlcipher.git] / tool / merge-test.tcl
blob2010d67657a9c46b8e1f26f0d42b62a4a49a1e14
1 #!/usr/bin/tcl
3 # Run this script to test to see that the latest trunk changes can be
4 # merged into LTS branches without breaking anything.
6 # To Use:
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)
12 # Operation:
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.
18 # Limitations:
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.
24 ###############################################################################
26 # Run a shell command contained in arguments. Put the return code in
27 # global variable ::res and the output string in global variable ::result
29 proc safeexec {args} {
30 global res result
31 set res [catch "exec $args" result]
34 # Run the shell command contained in arguments. Print an error and exit
35 # if anything goes wrong.
37 proc mustbeok {args} {
38 global res result
39 set res [catch "exec $args" result]
40 if {$res} {
41 puts "FAILED: $args"
42 puts $result
43 exit 1
47 # Write $content into a file named $filename. The file is overwritten if it
48 # already exist. The file is create if it does not already exist.
50 proc writefile {filename content} {
51 set fd [open $filename wb]
52 puts $fd $content
53 close $fd
56 # Run the merge-test
58 foreach {branch configopts} {
59 begin-concurrent {--enable-json1}
60 begin-concurrent-pnu {--enable-json1}
61 wal2 {--enable-all}
62 reuse-schema {--enable-all}
63 } {
64 puts $branch
65 set errorfile ${branch}-error.txt
66 mustbeok fossil revert
67 mustbeok fossil up $branch
68 safeexec fossil merge trunk
69 if {$res} {
70 puts " merge failed - see $errorfile"
71 writefile $errorfile $result
72 } else {
73 puts " merge ok"
74 safeexec ./configure --enable-debug {*}$configopts
75 if {$res} {
76 puts " configure failed - see $errorfile"
77 writefile $errorfile $result
78 } else {
79 puts " configure ok"
80 safeexec make fuzzcheck sqlite3 testfixture
81 if {$res} {
82 puts " build failed - see $errorfile"
83 writefile $errorfile $result
84 } else {
85 puts " build ok"
86 safeexec make test
87 if {$res} {
88 puts " test failed - see $errorfile"
89 writefile $errorfile $result
90 } else {
91 puts " test ok"
97 mustbeok fossil revert
98 mustbeok fossil up trunk
99 puts "reset back to trunk"