diff options
| author | Ted Ross <tross@apache.org> | 2009-11-25 19:21:20 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2009-11-25 19:21:20 +0000 |
| commit | 3ea3d77c5247fe1ae4bd4b801dc8f4ae763f8220 (patch) | |
| tree | e4eb26cc4e1bc33721bff6ba16a9b2f7c8faa518 /qpid/cpp/examples/verify | |
| parent | 8b804ca1645b09885ff2f3eb9a8540c842db92a2 (diff) | |
| download | qpid-python-3ea3d77c5247fe1ae4bd4b801dc8f4ae763f8220.tar.gz | |
QPID-2219 - Example tests hang when run in a vpath build
Verify scripts updated to operate in vpath builds.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@884231 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/examples/verify')
| -rwxr-xr-x | qpid/cpp/examples/verify | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/qpid/cpp/examples/verify b/qpid/cpp/examples/verify index 08dcf327a7..da37857b1a 100755 --- a/qpid/cpp/examples/verify +++ b/qpid/cpp/examples/verify @@ -75,13 +75,28 @@ outputs() { done } +function normalize() { + local path=${1//\/.\//\/}\/ + while [[ $path =~ ([^/][^/]*/\.\./) ]] + do + path=${path/${BASH_REMATCH[0]}/} + done + echo $path | sed 's/\/$//' +} + verify() { FAIL= - if [ -d $1 ]; then dir=$1; script=verify; - else dir=`dirname $1`; script=`basename $1`; fi - cd $dir || return 1 + arg=$(normalize $1) + srcdir=$(normalize $2) + builddir=$(normalize $3) + if [ -d $arg ]; then dir=$arg; script=verify; + else dir=`dirname $arg`; script=`basename $arg`; fi + + # if the example is in the "cpp" area, make sure we run from the build directory, not the source dir. + rundir=${dir/$srcdir\/cpp/$builddir/} + cd $rundir || return 1 rm -f *.out - { source ./$script && diff -ac $script.out $script.in ; } || fail + { source $dir/$script && diff -ac $script.out $dir/$script.in ; } || fail test -z "$FAIL" && rm -f *.out return $FAIL } @@ -100,8 +115,12 @@ if [ -n "$QPIDD" ] ; then trap "$QPIDD -q" EXIT fi +topsrcdir=$1 +topbuilddir=$2 +shift 2 + for example in "$@"; do - echo "== $example " - if ( verify $example; ) then echo "PASS"; else echo "FAIL"; RET=1; fi + echo "== $(normalize $example)" + if ( verify $example $topsrcdir $topbuilddir; ) then echo "PASS"; else echo "FAIL"; RET=1; fi done exit $RET |
