summaryrefslogtreecommitdiff
path: root/test-upgrade
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-04-26 16:56:34 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-04-26 16:56:34 +0200
commit40bc2a12c6ac34caf5de3c68bf4319fa41666221 (patch)
tree9061726f7a44f8f93627ab2137c9440f7fdbe629 /test-upgrade
parentbd3ce4d1c33b53b26a7de54e4a701d90640ceac7 (diff)
0.3.0 release updates0.3.0
Diffstat (limited to 'test-upgrade')
-rwxr-xr-xtest-upgrade93
1 files changed, 93 insertions, 0 deletions
diff --git a/test-upgrade b/test-upgrade
new file mode 100755
index 0000000..29705da
--- /dev/null
+++ b/test-upgrade
@@ -0,0 +1,93 @@
+#! /usr/bin/env bash
+
+# Test build2 toolchain (and brep) upgrade. The old packages come from
+# cppget.org/alpha and the new ones from cppget.org/queue. Run from build2/
+# root.
+#
+# Usage: test-upgrade [options] <old-toolchain>
+#
+# -c <option>|<module>|<var>
+# Specify additional options, modules, or configuration variables to pass
+# to the bpkg create command. For example:
+#
+usage="usage: $0 -t <old-toolchain>"
+
+owd=`pwd`
+trap "{ cd $owd; exit 1; }" ERR
+set -o errtrace # Trap in functions.
+
+function info () { echo "$*" 1>&2; }
+function error () { info "$*"; exit 1; }
+
+cfg=/tmp/upgrade-cfg
+ins=/tmp/upgrade-install
+toolchain=
+co=() # Use a bash array to handle arguments with spaces (say "-Ifoo -Ibar").
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ -c)
+ shift
+ co=("${co[@]}" "$1")
+ shift
+ ;;
+ *)
+ toolchain=${1%/}
+ shift
+ break
+ ;;
+ esac
+done
+
+if [ -z "$toolchain" ]; then
+ error $usage
+fi
+
+ob="$toolchain/bin/b"
+if [ ! -x $ob ]; then
+ error "$ob does not exist or is not executable"
+fi
+obo="--build $ob"
+
+obpkg="$toolchain/bin/bpkg"
+if [ ! -x $obpkg ]; then
+ error "$obpkg does not exist or is not executable"
+fi
+
+# First create the configuration and build old packages using the old
+# toolchain.
+#
+$obpkg $obo create -d $cfg --wipe "${co[@]}"
+$obpkg add -d $cfg cppget.org/repository/1/alpha
+$obpkg fetch -d $cfg
+$obpkg $obo build -d $cfg --yes build2 bpkg brep
+
+# Now upgrade to new packages but still using the old toolchain.
+#
+$obpkg add -d $cfg cppget.org/repository/1/queue
+$obpkg fetch -d $cfg
+$obpkg $obo build -d $cfg --yes build2 bpkg brep
+
+# Install the new packages still using the old toolchain.
+#
+$obpkg $obo install -d $cfg config.install.root=$ins \
+ config.bin.rpath=$ins/lib build2 bpkg brep
+
+$ins/bin/b --version 1>&2
+$ins/bin/bpkg --version 1>&2
+$ins/bin/brep-load --version 1>&2
+
+# Check the use of the new toolchain on the old configuration.
+#
+nb="$ins/bin/b"
+nbo="--build $nb"
+nbpkg="$ins/bin/bpkg"
+
+$nbpkg $nbo clean -d $cfg build2 bpkg brep
+$nbpkg $nbo build -d $cfg --yes build2 bpkg brep
+$nbpkg $nbo install -d $cfg config.install.root=$ins \
+ config.bin.rpath=$ins/lib build2 bpkg brep
+
+$ins/bin/b --version 1>&2
+$ins/bin/bpkg --version 1>&2
+$ins/bin/brep-load --version 1>&2