summaryrefslogtreecommitdiffstats
path: root/tool/merge-test.tcl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:11 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 14:07:11 +0000
commit63847496f14c813a5d80efd5b7de0f1294ffe1e3 (patch)
tree01c7571c7c762ceee70638549a99834fdd7c411b /tool/merge-test.tcl
parentInitial commit. (diff)
downloadsqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.tar.xz
sqlite3-63847496f14c813a5d80efd5b7de0f1294ffe1e3.zip
Adding upstream version 3.45.1.upstream/3.45.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tool/merge-test.tcl')
-rw-r--r--tool/merge-test.tcl99
1 files changed, 99 insertions, 0 deletions
diff --git a/tool/merge-test.tcl b/tool/merge-test.tcl
new file mode 100644
index 0000000..2010d67
--- /dev/null
+++ b/tool/merge-test.tcl
@@ -0,0 +1,99 @@
+#!/usr/bin/tcl
+#
+# Run this script to test to see that the latest trunk changes can be
+# merged into LTS branches without breaking anything.
+#
+# To Use:
+#
+# * Copy this script into a directory above the sqlite checkout
+# * Run "fossil update trunk" and "fossil revert"
+# * Run "tclsh ../merge-test.tcl" (in other words run this script)
+#
+# Operation:
+#
+# This script changes to each LTS branch to be tested, merges the latest
+# trunk changes into the branch (without committing them) and then
+# runs "make test". Any errors are stored in local files.
+#
+# Limitations:
+#
+# Some LTS branches are not synced directly from trunk but rather from
+# other LTS branches. These other branches cannot be tested because
+# there is no good way to generate the intermediate merges.
+#
+###############################################################################
+
+# Run a shell command contained in arguments. Put the return code in
+# global variable ::res and the output string in global variable ::result
+#
+proc safeexec {args} {
+ global res result
+ set res [catch "exec $args" result]
+}
+
+# Run the shell command contained in arguments. Print an error and exit
+# if anything goes wrong.
+#
+proc mustbeok {args} {
+ global res result
+ set res [catch "exec $args" result]
+ if {$res} {
+ puts "FAILED: $args"
+ puts $result
+ exit 1
+ }
+}
+
+# Write $content into a file named $filename. The file is overwritten if it
+# already exist. The file is create if it does not already exist.
+#
+proc writefile {filename content} {
+ set fd [open $filename wb]
+ puts $fd $content
+ close $fd
+}
+
+# Run the merge-test
+#
+foreach {branch configopts} {
+ begin-concurrent {--enable-json1}
+ begin-concurrent-pnu {--enable-json1}
+ wal2 {--enable-all}
+ reuse-schema {--enable-all}
+} {
+ puts $branch
+ set errorfile ${branch}-error.txt
+ mustbeok fossil revert
+ mustbeok fossil up $branch
+ safeexec fossil merge trunk
+ if {$res} {
+ puts " merge failed - see $errorfile"
+ writefile $errorfile $result
+ } else {
+ puts " merge ok"
+ safeexec ./configure --enable-debug {*}$configopts
+ if {$res} {
+ puts " configure failed - see $errorfile"
+ writefile $errorfile $result
+ } else {
+ puts " configure ok"
+ safeexec make fuzzcheck sqlite3 testfixture
+ if {$res} {
+ puts " build failed - see $errorfile"
+ writefile $errorfile $result
+ } else {
+ puts " build ok"
+ safeexec make test
+ if {$res} {
+ puts " test failed - see $errorfile"
+ writefile $errorfile $result
+ } else {
+ puts " test ok"
+ }
+ }
+ }
+ }
+}
+mustbeok fossil revert
+mustbeok fossil up trunk
+puts "reset back to trunk"