mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
[svn-r17542] New test:
Add new tests (tcheck_version, testcheck_version.sh) to verify H5check_version() does issue warnings and abort accordingly. Tests: H5committed tested plus jam serial tested.
This commit is contained in:
parent
541f147c91
commit
06a71c86a3
2
MANIFEST
2
MANIFEST
@ -879,8 +879,10 @@
|
||||
./test/tbad_msg_count.h5
|
||||
./test/tbogus.h5
|
||||
./test/tchecksum.c
|
||||
./test/tcheck_version.c
|
||||
./test/tconfig.c
|
||||
./test/tcoords.c
|
||||
./test/testcheck_version.sh.in
|
||||
./test/testerror.sh.in
|
||||
./test/testframe.c
|
||||
./test/testhdf5.c
|
||||
|
3
configure
vendored
3
configure
vendored
@ -28203,7 +28203,7 @@ if test -n "$TESTPARALLEL"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testerror.sh test/testlibinfo.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile"
|
||||
ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/testcheck_version.sh test/testerror.sh test/testlibinfo.sh testpar/Makefile testpar/testph5.sh perform/Makefile tools/Makefile tools/h5dump/Makefile tools/h5dump/testh5dump.sh tools/h5dump/testh5dumpxml.sh tools/h5ls/testh5ls.sh tools/h5import/Makefile tools/h5diff/Makefile tools/h5jam/Makefile tools/h5jam/testh5jam.sh tools/h5repack/Makefile tools/h5repack/h5repack.sh tools/h5ls/Makefile tools/h5copy/Makefile tools/lib/Makefile tools/misc/Makefile tools/misc/h5cc tools/misc/testh5repart.sh tools/h5stat/testh5stat.sh tools/h5stat/Makefile examples/Makefile examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/examples/Makefile c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/testh5fc.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/tools/Makefile hl/tools/gif2h5/Makefile hl/examples/Makefile hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile"
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
@ -29413,6 +29413,7 @@ do
|
||||
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
|
||||
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
|
||||
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
|
||||
"test/testcheck_version.sh") CONFIG_FILES="$CONFIG_FILES test/testcheck_version.sh" ;;
|
||||
"test/testerror.sh") CONFIG_FILES="$CONFIG_FILES test/testerror.sh" ;;
|
||||
"test/testlibinfo.sh") CONFIG_FILES="$CONFIG_FILES test/testlibinfo.sh" ;;
|
||||
"testpar/Makefile") CONFIG_FILES="$CONFIG_FILES testpar/Makefile" ;;
|
||||
|
@ -3992,6 +3992,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
|
||||
Makefile
|
||||
src/Makefile
|
||||
test/Makefile
|
||||
test/testcheck_version.sh
|
||||
test/testerror.sh
|
||||
test/testlibinfo.sh
|
||||
testpar/Makefile
|
||||
|
@ -24,7 +24,7 @@ include $(top_srcdir)/config/commence.am
|
||||
INCLUDES=-I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
|
||||
# Test script for error_test and err_compat
|
||||
TEST_SCRIPT = testerror.sh testlibinfo.sh
|
||||
TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh
|
||||
check_SCRIPTS = $(TEST_SCRIPT)
|
||||
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
|
||||
|
||||
@ -46,10 +46,11 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache cache_api \
|
||||
|
||||
# List programs to be built when testing here. error_test and err_compat are
|
||||
# built at the same time as the other tests, but executed by testerror.sh.
|
||||
# tcheck_version is used by testcheck_version.sh.
|
||||
# 'make check' doesn't run them directly, so they are not included in TEST_PROG.
|
||||
# Also build testmeta, which is used for timings test. It builds quickly,
|
||||
# and this lets automake keep all its test programs in one place.
|
||||
check_PROGRAMS=$(TEST_PROG) error_test err_compat testmeta
|
||||
check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version testmeta
|
||||
|
||||
|
||||
# These programs generate test files for the tests. They don't need to be
|
||||
|
@ -53,11 +53,11 @@ POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/testerror.sh.in $(srcdir)/testlibinfo.sh.in \
|
||||
$(top_srcdir)/config/commence.am \
|
||||
$(srcdir)/testcheck_version.sh.in $(srcdir)/testerror.sh.in \
|
||||
$(srcdir)/testlibinfo.sh.in $(top_srcdir)/config/commence.am \
|
||||
$(top_srcdir)/config/conclude.am COPYING
|
||||
check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \
|
||||
err_compat$(EXEEXT) testmeta$(EXEEXT)
|
||||
err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT)
|
||||
@BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_2)
|
||||
TESTS = $(check_PROGRAMS) $(check_SCRIPTS)
|
||||
subdir = test
|
||||
@ -67,7 +67,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs
|
||||
CONFIG_HEADER = $(top_builddir)/src/H5config.h
|
||||
CONFIG_CLEAN_FILES = testerror.sh testlibinfo.sh
|
||||
CONFIG_CLEAN_FILES = testcheck_version.sh testerror.sh testlibinfo.sh
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
LTLIBRARIES = $(noinst_LTLIBRARIES)
|
||||
libh5test_la_LIBADD =
|
||||
@ -314,6 +314,10 @@ stab_SOURCES = stab.c
|
||||
stab_OBJECTS = stab.$(OBJEXT)
|
||||
stab_LDADD = $(LDADD)
|
||||
stab_DEPENDENCIES = libh5test.la $(LIBHDF5)
|
||||
tcheck_version_SOURCES = tcheck_version.c
|
||||
tcheck_version_OBJECTS = tcheck_version.$(OBJEXT)
|
||||
tcheck_version_LDADD = $(LDADD)
|
||||
tcheck_version_DEPENDENCIES = libh5test.la $(LIBHDF5)
|
||||
am_testhdf5_OBJECTS = testhdf5.$(OBJEXT) tarray.$(OBJEXT) \
|
||||
tattr.$(OBJEXT) tchecksum.$(OBJEXT) tconfig.$(OBJEXT) \
|
||||
tfile.$(OBJEXT) tgenprop.$(OBJEXT) th5o.$(OBJEXT) \
|
||||
@ -367,8 +371,9 @@ SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c btree2.c \
|
||||
gen_noencoder.c gen_nullspace.c gen_udlinks.c getname.c \
|
||||
gheap.c hyperslab.c istore.c lheap.c links.c mf.c mount.c \
|
||||
mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \
|
||||
set_extent.c space_overflow.c stab.c $(testhdf5_SOURCES) \
|
||||
testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
|
||||
set_extent.c space_overflow.c stab.c tcheck_version.c \
|
||||
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
|
||||
vfd.c
|
||||
DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \
|
||||
btree2.c cache.c cache_api.c cmpd_dset.c cross_read.c dangle.c \
|
||||
dsets.c dt_arith.c dtransform.c dtypes.c earray.c enum.c \
|
||||
@ -379,8 +384,9 @@ DIST_SOURCES = $(libh5test_la_SOURCES) app_ref.c big.c bittests.c \
|
||||
gen_new_super.c gen_noencoder.c gen_nullspace.c gen_udlinks.c \
|
||||
getname.c gheap.c hyperslab.c istore.c lheap.c links.c mf.c \
|
||||
mount.c mtime.c ntypes.c objcopy.c ohdr.c pool.c reserved.c \
|
||||
set_extent.c space_overflow.c stab.c $(testhdf5_SOURCES) \
|
||||
testmeta.c $(ttsafe_SOURCES) unlink.c vfd.c
|
||||
set_extent.c space_overflow.c stab.c tcheck_version.c \
|
||||
$(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c \
|
||||
vfd.c
|
||||
ETAGS = etags
|
||||
CTAGS = ctags
|
||||
am__tty_colors = \
|
||||
@ -666,7 +672,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog cmpd_dset.h5 \
|
||||
INCLUDES = -I$(top_srcdir)/src -I$(top_builddir)/src
|
||||
|
||||
# Test script for error_test and err_compat
|
||||
TEST_SCRIPT = testerror.sh testlibinfo.sh
|
||||
TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh
|
||||
check_SCRIPTS = $(TEST_SCRIPT)
|
||||
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT)
|
||||
|
||||
@ -771,6 +777,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
testcheck_version.sh: $(top_builddir)/config.status $(srcdir)/testcheck_version.sh.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
testerror.sh: $(top_builddir)/config.status $(srcdir)/testerror.sh.in
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
|
||||
testlibinfo.sh: $(top_builddir)/config.status $(srcdir)/testlibinfo.sh.in
|
||||
@ -969,6 +977,9 @@ space_overflow$(EXEEXT): $(space_overflow_OBJECTS) $(space_overflow_DEPENDENCIES
|
||||
stab$(EXEEXT): $(stab_OBJECTS) $(stab_DEPENDENCIES)
|
||||
@rm -f stab$(EXEEXT)
|
||||
$(LINK) $(stab_OBJECTS) $(stab_LDADD) $(LIBS)
|
||||
tcheck_version$(EXEEXT): $(tcheck_version_OBJECTS) $(tcheck_version_DEPENDENCIES)
|
||||
@rm -f tcheck_version$(EXEEXT)
|
||||
$(LINK) $(tcheck_version_OBJECTS) $(tcheck_version_LDADD) $(LIBS)
|
||||
testhdf5$(EXEEXT): $(testhdf5_OBJECTS) $(testhdf5_DEPENDENCIES)
|
||||
@rm -f testhdf5$(EXEEXT)
|
||||
$(LINK) $(testhdf5_OBJECTS) $(testhdf5_LDADD) $(LIBS)
|
||||
@ -1050,6 +1061,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stab.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tarray.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tattr.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcheck_version.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tchecksum.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tconfig.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcoords.Po@am__quote@
|
||||
|
99
test/tcheck_version.c
Normal file
99
test/tcheck_version.c
Normal file
@ -0,0 +1,99 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Copyright by The HDF Group. *
|
||||
* 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 *
|
||||
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
||||
* of the source code distribution tree; Copyright.html can be found at the *
|
||||
* root level of an installed copy of the electronic HDF5 document set and *
|
||||
* is linked from the top-level documents page. It can also be found at *
|
||||
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
||||
* access to either file, you may request a copy from help@hdfgroup.org. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* This tests the h5check_version() function.
|
||||
*
|
||||
* The default is to call the h5check_version() with the version information
|
||||
* in the header file and should incur no warnings or abort.
|
||||
* Options provided to call it with incorrect versions to test
|
||||
* if it will indeed issue the warning message and aborts. With environment
|
||||
* variable $HDF5_DISABLE_VERSION_CHECK sets to 1, it should issue warnings
|
||||
* but no abort. If it is 2, no warning or abort.
|
||||
*
|
||||
* Programmer: Albert Cheng
|
||||
* September 20, 2009
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "hdf5.h"
|
||||
|
||||
#define progname "tcheck_version"
|
||||
|
||||
/* global variables */
|
||||
unsigned major = H5_VERS_MAJOR;
|
||||
unsigned minor = H5_VERS_MINOR;
|
||||
unsigned release = H5_VERS_RELEASE;
|
||||
|
||||
void
|
||||
showhelp(void)
|
||||
{
|
||||
printf("Usage: " progname " [-h] [-t<vers>]\n");
|
||||
printf("\t-h\tShow this page and version information\n");
|
||||
printf("\t-t<vers>: Test by changing (adding 1 to) the <vers> to trigger\n");
|
||||
printf("\t\t the warning. <vers> can be:\n");
|
||||
printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR);
|
||||
printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR);
|
||||
printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
parse(int ac, char **av)
|
||||
{
|
||||
char *pt;
|
||||
|
||||
while (--ac > 0){
|
||||
pt = *(++av);
|
||||
if (*pt != '-') {
|
||||
fprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
|
||||
exit(1);
|
||||
}else{
|
||||
switch(*(++pt)) {
|
||||
case 't': /* option -t */
|
||||
switch(*(++pt)) {
|
||||
case 'M':
|
||||
major++;
|
||||
break;
|
||||
case 'm':
|
||||
minor++;
|
||||
break;
|
||||
case 'r':
|
||||
release++;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av);
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
case 'h': /* help page */
|
||||
showhelp();
|
||||
exit(0);
|
||||
default:
|
||||
fprintf(stderr, "Unknown option(%s). Aborted.\n", *av);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int ac, char **av)
|
||||
{
|
||||
parse(ac, av);
|
||||
H5check_version(major, minor, release);
|
||||
return 0;
|
||||
}
|
188
test/testcheck_version.sh.in
Normal file
188
test/testcheck_version.sh.in
Normal file
@ -0,0 +1,188 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright by The HDF Group.
|
||||
# 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
|
||||
# the files COPYING and Copyright.html. COPYING can be found at the root
|
||||
# of the source code distribution tree; Copyright.html can be found at the
|
||||
# root level of an installed copy of the electronic HDF5 document set and
|
||||
# is linked from the top-level documents page. It can also be found at
|
||||
# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
||||
# access to either file, you may request a copy from help@hdfgroup.org.
|
||||
|
||||
#
|
||||
# Tests for the H5check_version function.
|
||||
#
|
||||
# Programmer: Albert Cheng
|
||||
# Sep 28, 2009
|
||||
|
||||
# Variables filled in by the configure process.
|
||||
# Determine the configure options of the hdf5 library and executables.
|
||||
Shared_Lib=@enable_shared@
|
||||
Static_Lib=@enable_static@
|
||||
Static_exec=@STATIC_EXEC@
|
||||
|
||||
|
||||
# Function definitions
|
||||
# Print a line-line message left justified in a field of 70 characters.
|
||||
#
|
||||
LINEMSG() {
|
||||
SPACES=" "
|
||||
echo "$* $SPACES" | cut -c1-70 | tr -d '\012'
|
||||
}
|
||||
|
||||
|
||||
# Print a "SKIP" message
|
||||
SKIP() {
|
||||
LINEMSG $*
|
||||
echo " -SKIP-"
|
||||
}
|
||||
|
||||
|
||||
# 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 generated according to the parameter values and compared
|
||||
# against actual output.
|
||||
# The expected and actual output files are removed unless $HDF5_NOCLEANUP
|
||||
# has a non-zero value.
|
||||
# $1: the set value of $HDF5_DISABLE_VERSION_CHECK. (unset means not to set
|
||||
# it at all.
|
||||
# $2: Change the version number(s) to cause a mismatch. (none means no
|
||||
# mismatch).
|
||||
#
|
||||
# Expected results:
|
||||
# Value of $HDF5_DISABLE_VERSION_CHECK
|
||||
# unset "" -1 0 1 2 3
|
||||
# Matched OK OK OK OK OK OK OK
|
||||
# Mismatched W/A W/A W/A W/A W2/OK OK W2/OK
|
||||
# Result codes:
|
||||
# OK: No warning, exit 0.
|
||||
# W/A: Warning, abort and exit non-0.
|
||||
# W2/OK: Different Warning, exit 0.
|
||||
#
|
||||
# Implemented only exit code matching. Still need to match output.
|
||||
TESTING() {
|
||||
DEBUGPRINT command is $0 $*
|
||||
TEST_NAME=tcheck_version # The test name
|
||||
TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
|
||||
|
||||
expect=expected_out
|
||||
actual=actual_out
|
||||
actual_err=actual_err_out
|
||||
arguments=
|
||||
|
||||
h5DisableVersion="$1"
|
||||
wrongversionnumbers="$2"
|
||||
|
||||
if [ "$h5DisableVersion" = unset ]; then
|
||||
envcmd="" # noop
|
||||
else
|
||||
envcmd="env HDF5_DISABLE_VERSION_CHECK=$h5DisableVersion"
|
||||
fi
|
||||
|
||||
if [ "$wrongversionnumbers" = none ]; then
|
||||
# OK: No warning, exit 0
|
||||
cp /dev/null $expect
|
||||
expected_code=0
|
||||
else
|
||||
arguments=-t"$wrongversionnumbers"
|
||||
case "$h5DisableVersion" in
|
||||
2) # OK: No warning, exit 0
|
||||
cp /dev/null $expect
|
||||
expected_code=0
|
||||
;;
|
||||
[13-9]|[1-9][0-9]*)
|
||||
# W2/OK: Different Warning, exit 0.
|
||||
cp /dev/null $expect #NEED FIX
|
||||
expected_code=0
|
||||
;;
|
||||
*) # W/A: Warning, abort and exit non-0.
|
||||
cp /dev/null $expect #NEED FIX
|
||||
expected_code=1 # non-zero since abort exit code maybe
|
||||
;; # machine dependent.
|
||||
esac
|
||||
fi
|
||||
|
||||
# Run test.
|
||||
LINEMSG $envcmd $TEST_NAME $arguments
|
||||
(
|
||||
echo "#############################"
|
||||
echo "Expected output for $TEST_ERR"
|
||||
echo "#############################"
|
||||
$envcmd $RUNSERIAL $TEST_BIN $arguments
|
||||
) >$actual 2>$actual_err
|
||||
ret_code=$?
|
||||
|
||||
if [ \( $expected_code -eq 0 -a $expected_code -eq $ret_code \) -o \
|
||||
\( $expected_code -ne 0 -a $ret_code -ne 0 \) ]; then
|
||||
echo " PASSED"
|
||||
else
|
||||
echo "*FAILED*"
|
||||
echo " Expected exit code ($expected_code) differs from actual code ($ret_code)"
|
||||
nerrors="`expr $nerrors + 1`"
|
||||
fi
|
||||
|
||||
# Clean up output file
|
||||
if test -z "$HDF5_NOCLEANUP"; then
|
||||
rm -f $expected_out $actual_out $actual_err
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Echo parameters for debugging if verbose mode is on.
|
||||
DEBUGPRINT() {
|
||||
if [ -n "$verbose" ]; then
|
||||
echo $*
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# MAIN Body
|
||||
nerrors=0
|
||||
H5_HAVE_EMBEDDED_LIBINFO=`grep '#define H5_HAVE_EMBEDDED_LIBINFO ' ../src/H5pubconf.h`
|
||||
|
||||
# The build (current) directory might be different than the source directory.
|
||||
if test -z "$srcdir"; then
|
||||
srcdir=.
|
||||
fi
|
||||
|
||||
# Skip the rest if embedded-libinfo is not enabled.
|
||||
if [ -z "$H5_HAVE_EMBEDDED_LIBINFO" ]; then
|
||||
echo "embedded-libinfo is not enabled. Test skipped."
|
||||
exit 0
|
||||
fi
|
||||
h5libsettings=../src/libhdf5.settings
|
||||
|
||||
# Figure out library version numbers from the header file.
|
||||
h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2`
|
||||
h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2`
|
||||
h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | cut -f2`
|
||||
DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease
|
||||
|
||||
|
||||
# Three Categories of tests:
|
||||
# Normal: where the version numbers all matched (wrong_version == none).
|
||||
# Mismatched version numbers (could be Major or minor version
|
||||
# or release numbers or a combination of all three.)
|
||||
# Test all the above with different values of the environment variable,
|
||||
# HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3
|
||||
|
||||
for val_disable_version_check in unset "" -1 0 1 2 3; do
|
||||
for wrong_version in none M m r Mm Mr mr; do
|
||||
TESTING "$val_disable_version_check" "$wrong_version"
|
||||
done
|
||||
done
|
||||
|
||||
|
||||
# Check and report results.
|
||||
if [ $nerrors -gt 0 ]; then
|
||||
echo "***$nerrors errors encountered***"
|
||||
exit 1
|
||||
else
|
||||
echo "No error encountered"
|
||||
exit 0
|
||||
fi
|
Loading…
Reference in New Issue
Block a user