diff options
Diffstat (limited to 'test-upgrade')
-rwxr-xr-x | test-upgrade | 93 |
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 |