2003-09-25 03:35:48 +08:00
|
|
|
#! /bin/sh
|
|
|
|
#
|
2007-02-08 03:56:21 +08:00
|
|
|
# Copyright by The HDF Group.
|
2003-09-25 03:35:48 +08:00
|
|
|
# Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
2017-04-18 03:32:16 +08:00
|
|
|
# the COPYING file, which can be found at the root of the source code
|
|
|
|
# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
|
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
2003-09-25 03:35:48 +08:00
|
|
|
#
|
|
|
|
# Tests for test_error and err_compat
|
|
|
|
|
2012-08-24 00:07:43 +08:00
|
|
|
srcdir=@srcdir@
|
|
|
|
|
2007-08-22 05:08:27 +08:00
|
|
|
# Determine backward compatibility options eneabled
|
|
|
|
DEPRECATED_SYMBOLS="@DEPRECATED_SYMBOLS@"
|
|
|
|
|
2003-09-25 03:35:48 +08:00
|
|
|
CMP='cmp -s'
|
|
|
|
DIFF='diff -c'
|
|
|
|
|
2013-03-23 05:39:53 +08:00
|
|
|
# Skip plugin module to test missing filter
|
|
|
|
ENVCMD="env HDF5_PLUGIN_PRELOAD=::"
|
|
|
|
|
2003-09-25 03:35:48 +08:00
|
|
|
nerrors=0
|
|
|
|
verbose=yes
|
|
|
|
|
|
|
|
test -d ./testfiles || mkdir ./testfiles
|
|
|
|
|
|
|
|
# Print a line-line message left justified in a field of 70 characters
|
|
|
|
# beginning with the word "Testing".
|
|
|
|
#
|
|
|
|
TESTING() {
|
2007-08-22 05:08:27 +08:00
|
|
|
SPACES=" "
|
|
|
|
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
|
2003-09-25 03:35:48 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
# Run a test and print PASS or *FAIL*. If a test fails then increment
|
|
|
|
# the `nerrors' global variable and (if $verbose is set) display the
|
|
|
|
# difference between the actual output and the expected output. The
|
|
|
|
# expected output is given as the first argument to this function and
|
|
|
|
# the actual output file is calculated by replacing the `.ddl' with
|
|
|
|
# `.out'. The actual output is not removed if $HDF5_NOCLEANUP has a
|
|
|
|
# non-zero value.
|
|
|
|
#
|
|
|
|
TEST() {
|
2004-04-18 04:29:01 +08:00
|
|
|
TEST_ERR=$1 # The test name
|
|
|
|
TEST_ERR_BIN=`pwd`/$TEST_ERR # The path of the test binary
|
|
|
|
|
2003-09-25 03:35:48 +08:00
|
|
|
expect1="$srcdir/testfiles/$1_1"
|
|
|
|
expect2="$srcdir/testfiles/$1_2"
|
2004-04-14 23:50:42 +08:00
|
|
|
actual="./`basename $1`.out"
|
|
|
|
actual_err="./`basename $1`.err"
|
|
|
|
actual_ext="./`basename $1`.ext"
|
2004-04-18 04:29:01 +08:00
|
|
|
shift
|
2003-09-25 03:35:48 +08:00
|
|
|
|
|
|
|
# Run test.
|
2005-01-08 23:26:31 +08:00
|
|
|
TESTING $TEST_ERR
|
2003-09-25 03:35:48 +08:00
|
|
|
(
|
2013-03-23 05:39:53 +08:00
|
|
|
# Skip the plugin for testing missing filter.
|
|
|
|
$ENVCMD $RUNSERIAL $TEST_ERR_BIN
|
2003-09-25 03:35:48 +08:00
|
|
|
) >$actual 2>$actual_err
|
2003-09-30 04:35:00 +08:00
|
|
|
# Extract file name, line number, version and thread IDs because they may be different
|
2006-04-20 02:39:21 +08:00
|
|
|
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
|
|
|
|
-e 's/line [0-9]*/line (number)/' \
|
2006-05-13 02:29:49 +08:00
|
|
|
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
|
2006-04-20 02:39:21 +08:00
|
|
|
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
|
2010-09-22 00:46:38 +08:00
|
|
|
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
|
|
|
|
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
|
2006-04-20 02:39:21 +08:00
|
|
|
$actual_err > $actual_ext
|
2003-09-30 04:35:00 +08:00
|
|
|
cat $actual_ext >> $actual
|
2003-09-25 03:35:48 +08:00
|
|
|
|
|
|
|
if $CMP $expect1 $actual; then
|
|
|
|
echo " PASSED"
|
|
|
|
elif $CMP $expect2 $actual; then
|
|
|
|
echo " PASSED"
|
|
|
|
else
|
|
|
|
echo "*FAILED*"
|
|
|
|
echo " Expected result differs from actual result"
|
|
|
|
nerrors="`expr $nerrors + 1`"
|
2003-12-11 00:50:51 +08:00
|
|
|
test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /'
|
2003-09-25 03:35:48 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Clean up output file
|
|
|
|
if test -z "$HDF5_NOCLEANUP"; then
|
2003-09-30 04:35:00 +08:00
|
|
|
rm -f $actual $actual_err $actual_ext
|
2003-09-25 03:35:48 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2007-08-22 05:08:27 +08:00
|
|
|
# Print a "SKIP" message
|
|
|
|
SKIP() {
|
|
|
|
TESTING $@
|
|
|
|
echo " -SKIP-"
|
|
|
|
}
|
|
|
|
|
2003-09-25 03:35:48 +08:00
|
|
|
##############################################################################
|
|
|
|
##############################################################################
|
|
|
|
### T H E T E S T S ###
|
|
|
|
##############################################################################
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
# test for err_compat
|
2007-08-22 05:08:27 +08:00
|
|
|
if test $DEPRECATED_SYMBOLS != "yes"; then
|
|
|
|
SKIP err_compat
|
|
|
|
else
|
2003-09-25 03:35:48 +08:00
|
|
|
TEST err_compat
|
2007-08-22 05:08:27 +08:00
|
|
|
fi
|
2003-09-25 03:35:48 +08:00
|
|
|
|
2013-03-23 05:39:53 +08:00
|
|
|
# test for error_test. Skip the plugin for testing missing filter.
|
2003-09-25 03:35:48 +08:00
|
|
|
TEST error_test
|
|
|
|
|
|
|
|
if test $nerrors -eq 0 ; then
|
|
|
|
echo "All Error API tests passed."
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit $nerrors
|