summaryrefslogtreecommitdiff
path: root/cpp/examples/verify
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/examples/verify')
-rwxr-xr-xcpp/examples/verify48
1 files changed, 41 insertions, 7 deletions
diff --git a/cpp/examples/verify b/cpp/examples/verify
index 247e75d4a9..43e1206a0c 100755
--- a/cpp/examples/verify
+++ b/cpp/examples/verify
@@ -1,4 +1,25 @@
#!/bin/sh
+
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+
# Driver script to verify installed examples (also used for build tests.)
#
# Usage: verify example_dir [ example_dir ...]
@@ -9,7 +30,8 @@
#
QPID_DATA_DIR=
-export QPID_DATA_DIR
+QPID_NO_MODULE_DIR=1
+export QPID_DATA_DIR QPID_NO_MODULE_DIR
cleanup() {
test -n "$QPIDD" && $QPIDD -q # Private broker
@@ -54,13 +76,21 @@ outputs() {
done
}
+normalize() { echo `cd $1 && pwd`; }
+
verify() {
FAIL=
- if [ -d $1 ]; then dir=$1; script=verify;
- else dir=`dirname $1`; script=`basename $1`; fi
- cd $dir || return 1
+ arg=$1
+ srcdir=$(normalize $2)
+ builddir=$(normalize $3)
+ if [ -d $arg ]; then dir=$(normalize $arg); script=verify;
+ else dir=$(normalize `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
}
@@ -79,8 +109,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 "== $example"
+ if ( verify $example $topsrcdir $topbuilddir; ) then echo "PASS"; else echo "FAIL"; RET=1; fi
done
exit $RET