3
# Copyright 2013-2014 IBM Corp.
5
# Licensed under the Apache License, Version 2.0 (the "License");
6
# you may not use this file except in compliance with the License.
7
# You may obtain a copy of the License at
9
# http://www.apache.org/licenses/LICENSE-2.0
11
# Unless required by applicable law or agreed to in writing, software
12
# distributed under the License is distributed on an "AS IS" BASIS,
13
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
# See the License for the specific language governing permissions and
16
# limitations under the License.
21
$VALGRIND "$1" $2 2>> $STDERR_OUT 1>> $STDOUT_OUT
23
echo "Fatal error, cannot execute binary '$1'. Did you make?";
31
echo "$0 ($CUR_TEST): test failed";
39
strip_version_from_result() {
40
VERSION=$(./make_version.sh $1)
41
sed -i "s/${VERSION}/VERSION/" $STDERR_OUT
42
sed -i "s/${VERSION}/VERSION/" $STDOUT_OUT
46
# Explicitly diff a file with an arbitrary result file
47
if [ "$#" -eq 1 ] ; then
48
if ! diff -u "$RESULT" "$1" ; then
51
# Otherwise just diff result.out with stdout and result.err with stderr
53
if ! diff -u "${RESULT}.out" "$STDOUT_OUT" ; then
56
if ! diff -u "${RESULT}.err" "$STDERR_OUT" ; then
63
if [ $# -ne 2 ] ; then
64
echo "Usage run_tests test_dir result_dir";
71
if [ ! -d "$res_path" ] ; then
72
echo "Result path isn't a valid directory";
76
export STDERR_OUT=$(mktemp --tmpdir external-test-stderr.XXXXXX);
77
export STDOUT_OUT=$(mktemp --tmpdir external-test-stdout.XXXXXX);
80
for the_test in $all_tests; do
81
export CUR_TEST=$(basename $the_test)
82
export RESULT="$res_path/$CUR_TEST"
86
if [ "$R" -ne 0 ] ; then
97
echo "$0 tests passed"