summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2009-11-25 19:21:20 +0000
committerTed Ross <tross@apache.org>2009-11-25 19:21:20 +0000
commit3ea3d77c5247fe1ae4bd4b801dc8f4ae763f8220 (patch)
treee4eb26cc4e1bc33721bff6ba16a9b2f7c8faa518
parent8b804ca1645b09885ff2f3eb9a8540c842db92a2 (diff)
downloadqpid-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
-rw-r--r--qpid/cpp/examples/Makefile.am3
-rwxr-xr-xqpid/cpp/examples/verify31
-rwxr-xr-xqpid/cpp/examples/verify_all5
3 files changed, 30 insertions, 9 deletions
diff --git a/qpid/cpp/examples/Makefile.am b/qpid/cpp/examples/Makefile.am
index 8fb66c89b6..c6cc308d98 100644
--- a/qpid/cpp/examples/Makefile.am
+++ b/qpid/cpp/examples/Makefile.am
@@ -41,8 +41,9 @@ EXTRA_DIST = README.verify verify verify_all examples.sln CMakeLists.txt
# For older versions of automake
abs_top_srcdir = @abs_top_srcdir@
+abs_top_builddir = @abs_top_builddir@
# Verify the examples in the buid tree.
check-local:
- $(srcdir)/verify_all $(abs_top_srcdir)/.. $(top_builddir)/src/qpidd $(broker_args) $(exclude_examples_regexp)
+ $(srcdir)/verify_all $(abs_top_srcdir)/.. $(abs_top_builddir) $(broker_args) $(exclude_examples_regexp)
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
diff --git a/qpid/cpp/examples/verify_all b/qpid/cpp/examples/verify_all
index 71b4ffd438..baffd422ad 100755
--- a/qpid/cpp/examples/verify_all
+++ b/qpid/cpp/examples/verify_all
@@ -24,7 +24,8 @@
verify=`dirname $0`/verify
topsrcdir=$1
-qpidd=$2
+topbuilddir=$2
+qpidd=$topbuilddir/src/qpidd
broker_args=$3
exclude_regexp=$4
python=${QPID_PYTHON_DIR:-$topsrcdir/python}
@@ -50,4 +51,4 @@ else
{ cat $f | grep $exclude_regexp > /dev/null ; } || run_examples="$run_examples $f"
done
fi
-$verify $run_examples
+$verify $topsrcdir $topbuilddir $run_examples