summaryrefslogtreecommitdiffstats
path: root/tools/test/h5jam
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2018-05-04 21:37:14 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2018-05-04 21:37:14 (GMT)
commit2ad049a6411923653365962c826cf59cf801d0d7 (patch)
treee8f8441cf03001362edf75bae862ab5b4b93a658 /tools/test/h5jam
parent5f702f40b719a05bf2d271797179b368c5fd39c5 (diff)
parentcc2eea14f6a6532a201dde13af13353d4d73fd92 (diff)
downloadhdf5-2ad049a6411923653365962c826cf59cf801d0d7.zip
hdf5-2ad049a6411923653365962c826cf59cf801d0d7.tar.gz
hdf5-2ad049a6411923653365962c826cf59cf801d0d7.tar.bz2
Merge pull request #1045 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:1.10/master to 1.10/masterhdf5-1_10_2
* commit 'cc2eea14f6a6532a201dde13af13353d4d73fd92': (1014 commits) Commit release date changes. Fix typo in INSTALL_Cygwin.txt Update references and merge from 1_10 Corrected email address Commit Barbara's INSTALL* file updates. Commit Elena's RELEASE.txt edits and Les'/Lori's README.txt revision. ommit Elena's RELEASE.txt edits and Les'/Lori's README.txt revision. Remove stray '/'. Add subdirectory for CMake-HDF5-1.10.2.zip. Correct name of hl compile script Add directory in release CMake...tar.gz file. Minor edits in RELEASE.txt. Set version for HDF5 1.10.2 release. release branch should not generate headers Switch default build mode to production. Set version to 1.10.2-pre2.. HDFF5-1.10.2-pre1 releaseed. Add links for security bug fixes to RELEASE.txt. Fix VS2017 binary readme Couple fixes to the test routine for HDFFV-10425. Add test and release info for the fix to HDFFV-10425 test failure with H5DOwrite_chunk. Updated RELEASE.txt Remove known probelem that was fixed. ...
Diffstat (limited to 'tools/test/h5jam')
-rw-r--r--tools/test/h5jam/CMakeLists.txt5
-rw-r--r--tools/test/h5jam/CMakeTests.cmake28
-rw-r--r--tools/test/h5jam/Makefile.in86
-rw-r--r--tools/test/h5jam/h5jamgentest.c4
-rw-r--r--tools/test/h5jam/tellub.c6
-rw-r--r--tools/test/h5jam/testh5jam.sh.in438
6 files changed, 309 insertions, 258 deletions
diff --git a/tools/test/h5jam/CMakeLists.txt b/tools/test/h5jam/CMakeLists.txt
index 562b4f3..b623860 100644
--- a/tools/test/h5jam/CMakeLists.txt
+++ b/tools/test/h5jam/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 3.2.2)
+cmake_minimum_required (VERSION 3.10)
PROJECT (HDF5_TOOLS_TEST_H5JAM)
#-----------------------------------------------------------------------------
@@ -11,7 +11,6 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS)
add_executable (h5jamgentest ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/h5jamgentest.c)
- TARGET_NAMING (h5jamgentest STATIC)
TARGET_C_PROPERTIES (testhdf5 STATIC " " " ")
target_link_libraries (h5jamgentest ${HDF5_LIB_TARGET})
set_target_properties (h5jamgentest PROPERTIES FOLDER generator/tools)
@@ -20,13 +19,11 @@ INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
endif ()
add_executable (getub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/getub.c)
-TARGET_NAMING (getub STATIC)
TARGET_C_PROPERTIES (getub STATIC " " " ")
target_link_libraries (getub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (getub PROPERTIES FOLDER tools)
add_executable (tellub ${HDF5_TOOLS_TEST_H5JAM_SOURCE_DIR}/tellub.c)
-TARGET_NAMING (tellub STATIC)
TARGET_C_PROPERTIES (tellub STATIC " " " ")
target_link_libraries (tellub ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (tellub PROPERTIES FOLDER tools)
diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake
index ae6d440..66ff715 100644
--- a/tools/test/h5jam/CMakeTests.cmake
+++ b/tools/test/h5jam/CMakeTests.cmake
@@ -60,6 +60,13 @@
endif ()
else ()
add_test (
+ NAME H5JAM-${expectfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${expectfile}.out
+ ${expectfile}.out.err
+ )
+ add_test (
NAME H5JAM-${expectfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5jam>"
@@ -70,6 +77,7 @@
-D "TEST_REFERENCE=testfiles/${expectfile}.txt"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
+ set_tests_properties (H5JAM-${expectfile} PROPERTIES DEPENDS "H5JAM-${expectfile}-clear-objects")
endif ()
endmacro ()
@@ -86,6 +94,13 @@
endif ()
else ()
add_test (
+ NAME H5JAM-UNJAM-${expectfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${expectfile}.out
+ ${expectfile}.out.err
+ )
+ add_test (
NAME H5JAM-UNJAM-${expectfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5unjam>"
@@ -96,6 +111,7 @@
-D "TEST_REFERENCE=testfiles/${expectfile}.txt"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
+ set_tests_properties (H5JAM-UNJAM-${expectfile} PROPERTIES DEPENDS "H5JAM-UNJAM-${expectfile}-clear-objects")
endif ()
endmacro ()
@@ -103,6 +119,16 @@
# If using memchecker add tests without using scripts
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
+ NAME H5JAM-${testname}-CHECKFILE-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${actual}.new
+ ${actual}.new.err
+ ${actual}.out
+ ${actual}.out.err
+ )
+ set_tests_properties (H5JAM-${testname}-CHECKFILE-clear-objects PROPERTIES DEPENDS ${testdepends})
+ add_test (
NAME H5JAM-${testname}-CHECKFILE-H5DMP
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:h5dump>"
@@ -114,7 +140,7 @@
-D "TEST_SKIP_COMPARE=TRUE"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
- set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS ${testdepends})
+ set_tests_properties (H5JAM-${testname}-CHECKFILE-H5DMP PROPERTIES DEPENDS H5JAM-${testname}-CHECKFILE-clear-objects)
add_test (
NAME H5JAM-${testname}-CHECKFILE-H5DMP_CMP
COMMAND "${CMAKE_COMMAND}"
diff --git a/tools/test/h5jam/Makefile.in b/tools/test/h5jam/Makefile.in
index c49d716..a5dca35 100644
--- a/tools/test/h5jam/Makefile.in
+++ b/tools/test/h5jam/Makefile.in
@@ -435,6 +435,7 @@ AM_JAVAFLAGS = @AM_JAVAFLAGS@
AM_JNIFLAGS = @AM_JNIFLAGS@
AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@
AR = @AR@
+AR_FLAGS = @AR_FLAGS@
ASSERTS = @ASSERTS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -648,6 +649,7 @@ dvidir = @dvidir@
enable_shared = @enable_shared@
enable_static = @enable_static@
exec_prefix = @exec_prefix@
+fortran_linux_linker_option = @fortran_linux_linker_option@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -742,7 +744,7 @@ SCRIPT_DEPEND = ../../src/h5jam/h5jam$(EXEEXT) ../../src/h5jam/h5unjam$(EXEEXT)
LDADD = $(LIBH5TOOLS) $(LIBHDF5)
DISTCLEANFILES = testh5jam.sh
-# Automake needs to be taught how to build lib, dyn, progs and tests targets.
+# Automake needs to be taught how to build lib, progs and tests targets.
# These will be filled in automatically for the most part (e.g.,
# lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and
# EXTRA_TEST variables are supplied to allow the user to force targets to
@@ -750,15 +752,14 @@ DISTCLEANFILES = testh5jam.sh
LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \
$(noinst_LTLIBRARIES) $(check_LIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LIB)
-DYN = $(dyn_LTLIBRARIES)
PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \
$(EXTRA_PROG)
chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST)
-dyndir = $(libdir)
TEST_EXTENSIONS = .sh
SH_LOG_COMPILER = $(SHELL)
AM_SH_LOG_FLAGS =
+REALTIMEOUTPUT = $(realtimeOutput)
TEST_PROG_CHKEXE = $(TEST_PROG:=.chkexe_)
TEST_PROG_PARA_CHKEXE = $(TEST_PROG_PARA:=.chkexe_)
TEST_SCRIPT_CHKSH = $(TEST_SCRIPT:=.chkexe_)
@@ -1231,7 +1232,6 @@ help:
# lib/progs/tests targets recurse into subdirectories. build-* targets
# build files in this directory.
-build-dyn: $(DYN)
build-lib: $(LIB)
build-progs: $(LIB) $(PROGS)
build-tests: $(LIB) $(PROGS) $(chk_TESTS)
@@ -1239,7 +1239,7 @@ build-tests: $(LIB) $(PROGS) $(chk_TESTS)
# General rule for recursive building targets.
# BUILT_SOURCES contain targets that need to be built before anything else
# in the directory (e.g., for Fortran type detection)
-lib dyn progs tests check-s check-p :: $(BUILT_SOURCES)
+lib progs tests check-s check-p :: $(BUILT_SOURCES)
@$(MAKE) $(AM_MAKEFLAGS) build-$@ || exit 1;
@for d in X $(SUBDIRS); do \
if test $$d != X && test $$d != .; then \
@@ -1317,28 +1317,62 @@ $(TEST_PROG_CHKEXE) $(TEST_PROG_PARA_CHKEXE) dummy.chkexe_:
if $(top_srcdir)/bin/newer $(@:.chkexe_=.chkexe) $${tname}; then \
echo "No need to test $${tname} again."; \
else \
- echo "============================" > $${log}; \
- if test "X$(FORTRAN_API)" = "Xyes"; then \
- echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
- echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
- elif test "X$(CXX_API)" = "Xyes"; then \
- echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
- echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
- else \
- echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
- echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
- fi; \
- echo "============================" >> $${log}; \
- srcdir="$(srcdir)" \
- $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
- && touch $(@:.chkexe_=.chkexe) || \
- (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
- (cat $${log} && false) || exit 1; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "============================" | tee $${log}; \
+ else \
+ echo "============================" > $${log}; \
+ fi; \
+ if test "X$(FORTRAN_API)" = "Xyes"; then \
+ echo "Fortran API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
+ else \
+ echo "Fortran API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ fi; \
+ elif test "X$(CXX_API)" = "Xyes"; then \
+ echo "C++ API: Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log};\
+ else \
+ echo "C++ API: $(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log};\
+ fi; \
+ else \
+ echo "Testing $(HDF5_DRIVER) $${tname} $(TEST_FLAGS)"; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" | tee -a $${log}; \
+ else \
+ echo "$(HDF5_DRIVER) $${tname} $(TEST_FLAGS) Test Log" >> $${log}; \
+ fi; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "============================" | tee -a $${log}; \
+ else \
+ echo "============================" >> $${log}; \
+ fi; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ srcdir="$(srcdir)" \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) | tee -a $${log} 2>&1 \
+ && touch $(@:.chkexe_=.chkexe) || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ else \
+ srcdir="$(srcdir)" \
+ $(TIME) $(RUNEXEC) ./$${tname} $(TEST_FLAGS) >> $${log} 2>&1 \
+ && touch $(@:.chkexe_=.chkexe) || \
+ (test $$HDF5_Make_Ignore && echo "*** Error ignored") || \
+ (cat $${log} && false) || exit 1; \
+ fi; \
echo "" >> $${log}; \
- echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
- echo "============================" >> $${log}; \
- echo "Finished testing $${tname} $(TEST_FLAGS)"; \
- cat $${log}; \
+ if test -n "$(REALTIMEOUTPUT)"; then \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" | tee -a $${log}; \
+ echo "============================" | tee -a $${log}; \
+ else \
+ echo "Finished testing $${tname} $(TEST_FLAGS)" >> $${log}; \
+ echo "============================" >> $${log}; \
+ fi; \
+ if test -z "$(REALTIMEOUTPUT)"; then \
+ cat $${log}; \
+ fi; \
fi; \
fi
diff --git a/tools/test/h5jam/h5jamgentest.c b/tools/test/h5jam/h5jamgentest.c
index 8648f07..9f3d000 100644
--- a/tools/test/h5jam/h5jamgentest.c
+++ b/tools/test/h5jam/h5jamgentest.c
@@ -20,8 +20,6 @@
* trying it on a new platform, ...), you need to verify the correctness
* of the expected output and update the corresponding *.ddl files.
*/
-#include <assert.h>
-#include <limits.h>
#include "hdf5.h"
#include "H5private.h"
@@ -277,7 +275,7 @@ gent_ub(const char * filename, size_t ub_size, size_t ub_fill)
HDassert(ub_size <= BUF_SIZE);
- fd = HDopen(filename, O_RDWR, 0);
+ fd = HDopen(filename, O_RDWR);
HDassert(fd >= 0);
/* fill buf with pattern */
diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c
index fad14b7..8e4b3ac 100644
--- a/tools/test/h5jam/tellub.c
+++ b/tools/test/h5jam/tellub.c
@@ -11,12 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdio.h>
-
-#ifdef H5_HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
#include "hdf5.h"
#include "H5private.h"
#include "h5tools.h"
diff --git a/tools/test/h5jam/testh5jam.sh.in b/tools/test/h5jam/testh5jam.sh.in
index d3d7a9a..3ae180b 100644
--- a/tools/test/h5jam/testh5jam.sh.in
+++ b/tools/test/h5jam/testh5jam.sh.in
@@ -107,10 +107,10 @@ COPY_TESTFILES_TO_TESTDIR()
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
- $CP -f $tstfile $TESTDIR
+ $CP -f $tstfile $TESTDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
-
+
# Comment out this to CREATE expected file
exit $EXIT_FAILURE
fi
@@ -154,19 +154,19 @@ SKIP() {
echo " -SKIP-"
}
-#
+#
# COMPARE_FILES a.h5 b.h5
-# Compare two files, skipping the first line. This is used to
+# Compare two files, skipping the first line. This is used to
# compare the output of the dumper, skipping the file name which
# is different.
# The result is stored in 'compval'.
#
cmpval=0;
COMPARE_FILES() {
- $AWK 'NR > 1' $1 > $1.cmp
- $AWK 'NR > 1' $2 > $2.cmp
- $CMP $1.cmp $2.cmp
- cmpval=$?
+ $AWK 'NR > 1' $1 > $1.cmp
+ $AWK 'NR > 1' $2 > $2.cmp
+ $CMP $1.cmp $2.cmp
+ cmpval=$?
rm -f $1.cmp $2.cmp
}
@@ -174,10 +174,10 @@ COMPARE_FILES() {
# Clean up named files.
CLEANUP() {
if test -z "$HDF5_NOCLEANUP"; then
- for i in $*
- do
- rm -f $i
- done
+ for i in $*
+ do
+ rm -f $i
+ done
fi
}
@@ -190,7 +190,7 @@ CLEANUP() {
# the "cat" command.
#
SETUP() {
- cat < $1 > $2
+ cat < $1 > $2
}
#
@@ -233,7 +233,7 @@ CHECKFILE() {
}
#
-# CHECK_UB file.h5 user_block_file origfile.h5
+# CHECK_UB file.h5 user_block_file origfile.h5
#
# Check the user block in 'file.h5' is the same as
# 'user_block' (allowing for padding).
@@ -243,73 +243,73 @@ CHECKFILE() {
# and the test file compared to:
# cat compare_ub user_block_file.
#
-# This test uses './getub' to extract the user block from
+# This test uses './getub' to extract the user block from
# 'file.h5', which is compared to the file described above.
#
# The result is set in variable 'result1'.
#
result1=0;
CHECK_UB_1() {
- hfile="$1"
- ufile="$2"
-
- # check for third argument (the original file)
- origfile="";
- if [ -n "$3" ];
- then
- origfile="$3"
- fi
-
- # find the length of the user block to check
- s1=`cat $ufile | wc -c | sed -e 's/ //g'`
- if [ "$s1" = "0" ];
- then
- echo "File "$ufile" is empty"
- result1=1;
- fi
-
- # Get the size of the original user block, if any.
- if [ -n "$origfile" ];
- then
- # 'tellub' calls H5Fget_user_block to get the size
- # of the user block
- s2=`$JAM_BIN/tellub $origfile`
- if [ "$s2" = "0" ];
- then
- size=$s1;
- cmpfile=$ufile
- else
- cmpfile="tt2"
- size=`expr $s2 + $s1`
- $JAM_BIN/getub -c $s2 $origfile > $cmpfile
- cat $ufile >> $cmpfile
- fi
- else
- # assume no user block
- s2="0"
- size=$s1;
- cmpfile=$ufile
- fi
-
- # Extract 'size' bytes from the front of 'hfile'
- # Compare to 'cmpfile', result is set in result1
- tfile="tt1"
- $JAM_BIN/getub -c $size $hfile > $tfile
- res=`cmp $cmpfile $tfile`
- if [ "$?" != "0" ];
- then
- echo $res
- result1=1;
- else
- result1=0;
- fi
-
- # clean up
- rm -f $tfile
- if [ "$s2" != "0" ] ;
- then
- rm -f $cmpfile
- fi
+ hfile="$1"
+ ufile="$2"
+
+ # check for third argument (the original file)
+ origfile="";
+ if [ -n "$3" ];
+ then
+ origfile="$3"
+ fi
+
+ # find the length of the user block to check
+ s1=`cat $ufile | wc -c | sed -e 's/ //g'`
+ if [ "$s1" = "0" ];
+ then
+ echo "File "$ufile" is empty"
+ result1=1;
+ fi
+
+ # Get the size of the original user block, if any.
+ if [ -n "$origfile" ];
+ then
+ # 'tellub' calls H5Fget_user_block to get the size
+ # of the user block
+ s2=`$JAM_BIN/tellub $origfile`
+ if [ "$s2" = "0" ];
+ then
+ size=$s1;
+ cmpfile=$ufile
+ else
+ cmpfile="tt2"
+ size=`expr $s2 + $s1`
+ $JAM_BIN/getub -c $s2 $origfile > $cmpfile
+ cat $ufile >> $cmpfile
+ fi
+ else
+ # assume no user block
+ s2="0"
+ size=$s1;
+ cmpfile=$ufile
+ fi
+
+ # Extract 'size' bytes from the front of 'hfile'
+ # Compare to 'cmpfile', result is set in result1
+ tfile="tt1"
+ $JAM_BIN/getub -c $size $hfile > $tfile
+ res=`cmp $cmpfile $tfile`
+ if [ "$?" != "0" ];
+ then
+ echo $res
+ result1=1;
+ else
+ result1=0;
+ fi
+
+ # clean up
+ rm -f $tfile
+ if [ "$s2" != "0" ] ;
+ then
+ rm -f $cmpfile
+ fi
}
@@ -321,25 +321,25 @@ CHECK_UB_1() {
result2=0;
CHECK_NOUB() {
- hfile="$1"
-
- # call 'ubsize' to get the size of the user block
- ubsize=`$JAM_BIN/tellub $hfile`
-
- if [ "$?" != "0" ];
- then
- # error
- result2=1;
- else
- if [ "$ubsize" = "0" ];
- then
- # pass
- result2=0;
- else
- # fail
- result2=1;
- fi
- fi
+ hfile="$1"
+
+ # call 'ubsize' to get the size of the user block
+ ubsize=`$JAM_BIN/tellub $hfile`
+
+ if [ "$?" != "0" ];
+ then
+ # error
+ result2=1;
+ else
+ if [ "$ubsize" = "0" ];
+ then
+ # pass
+ result2=0;
+ else
+ # fail
+ result2=1;
+ fi
+ fi
}
# JAMTEST user_block file.h5 [--clobber] [ofile.h5]
@@ -351,119 +351,119 @@ CHECK_NOUB() {
# 3. check the user block is correct in the output (Check_UB)
# If the user block is correct, print "PASSED", else "*FAILED*"
JAMTEST() {
- ufile="$1"
- ifile="$2"
- compare_test="" # the file to test
- compare_orig="" # the comparison to test against
- cleanup=""
-
- # sort out the arguments for the test and the check
- do_clobber="no"
- if [ "$3" = "--clobber" ];
- then
- # clobber overwrites any existing user block
- do_clobber="yes"
- clobber="--clobber"
- compare_orig=""
- if [ -z "$4" ];
- then
- # output goes to infile, compare ubfile to infile
- ofile=""
- compare_test="$ifile"
- else
- # output goes to $4, compare ofile to ubfile
- ofile="$4"
- compare_test="$ofile"
- fi
- else
- clobber=""
- # add user block to existing ub, if any
- if [ -z "$3" ];
- then
- # output goes to infile, compare ubfile to infile
- ofile=""
- compare_test="$ifile"
- cp $ifile xxofile.h5
- compare_orig="xxofile.h5"
- cleanup="$cleanup $compare_orig"
- else
- # output goes to $3, compare ofile to ubfile
- ofile="$3"
- compare_test="$ofile"
- compare_orig="$ifile"
- fi
- fi
-
- # call 'jam' with the appropriate arguments
- if [ -n "$ofile" ];
- then
- TESTING h5jam -u `basename $ufile` -i `basename $ifile` -o `basename $ofile` $clobber
- $JAM_BIN/$JAM -u $ufile -i $ifile -o $ofile $clobber
- else
- TESTING jam -u `basename $ufile` -i `basename $ifile` $clobber
- $JAM_BIN/$JAM -u $ufile -i $ifile $clobber
- fi
-
- #echo "CHECK_UB_1 $compare_test $ufile $compare_orig"
- CHECK_UB_1 $compare_test $ufile $compare_orig
-
- if [ "$result1" = "0" ] ;
- then
- echo " PASSED"
- else
- echo " *FAILED*"
- nerrors="`expr $nerrors + 1`"
- fi
- CLEANUP $cleanup
+ ufile="$1"
+ ifile="$2"
+ compare_test="" # the file to test
+ compare_orig="" # the comparison to test against
+ cleanup=""
+
+ # sort out the arguments for the test and the check
+ do_clobber="no"
+ if [ "$3" = "--clobber" ];
+ then
+ # clobber overwrites any existing user block
+ do_clobber="yes"
+ clobber="--clobber"
+ compare_orig=""
+ if [ -z "$4" ];
+ then
+ # output goes to infile, compare ubfile to infile
+ ofile=""
+ compare_test="$ifile"
+ else
+ # output goes to $4, compare ofile to ubfile
+ ofile="$4"
+ compare_test="$ofile"
+ fi
+ else
+ clobber=""
+ # add user block to existing ub, if any
+ if [ -z "$3" ];
+ then
+ # output goes to infile, compare ubfile to infile
+ ofile=""
+ compare_test="$ifile"
+ cp $ifile xxofile.h5
+ compare_orig="xxofile.h5"
+ cleanup="$cleanup $compare_orig"
+ else
+ # output goes to $3, compare ofile to ubfile
+ ofile="$3"
+ compare_test="$ofile"
+ compare_orig="$ifile"
+ fi
+ fi
+
+ # call 'jam' with the appropriate arguments
+ if [ -n "$ofile" ];
+ then
+ TESTING h5jam -u `basename $ufile` -i `basename $ifile` -o `basename $ofile` $clobber
+ $JAM_BIN/$JAM -u $ufile -i $ifile -o $ofile $clobber
+ else
+ TESTING jam -u `basename $ufile` -i `basename $ifile` $clobber
+ $JAM_BIN/$JAM -u $ufile -i $ifile $clobber
+ fi
+
+ #echo "CHECK_UB_1 $compare_test $ufile $compare_orig"
+ CHECK_UB_1 $compare_test $ufile $compare_orig
+
+ if [ "$result1" = "0" ] ;
+ then
+ echo " PASSED"
+ else
+ echo " *FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ fi
+ CLEANUP $cleanup
}
-
+
# UNJAMTEST file.h5 [- | --delete] ofile
#
# Test the 'unjam' tool
#
###fix the working directory here and in jamtest
UNJAMTEST () {
- infile="$1"
- ofile="$3"
- if [ "$2" = "-" ];
- then
- uofile="uofile"
- TESTING h5unjam -i `basename $infile` -o `basename $ofile` "> "`basename $uofile`
- $JAM_BIN/$UNJAM -i $infile -o $ofile > $uofile
- else
- if [ "$2" = "--delete" ];
- then
- uofile="none"
- TESTING h5unjam -i `basename $infile` -o `basename $ofile` --delete
- $JAM_BIN/$UNJAM -i $infile -o $ofile --delete
-
- else
- uofile="$2"
- TESTING h5unjam -i `basename $infile` -u `basename $uofile` -o `basename $ofile`
- $JAM_BIN/$UNJAM -i $infile -u $uofile -o $ofile
- fi
- fi
-
- result1=0
- result2=0
- cleanup=""
- if [ "$uofile" != "none" ];
- then
- # sets result1
- CHECK_UB_1 $infile $uofile
- CLEANUP $uofile
- fi
-
- # sets result2
- CHECK_NOUB $ofile
-
- if [ "$result1" = "0" -a "$result2" = "0" ];
- then
- echo " PASSED"
- else
- echo " *FAILED*"
- nerrors="`expr $nerrors + 1`"
- fi
+ infile="$1"
+ ofile="$3"
+ if [ "$2" = "-" ];
+ then
+ uofile="uofile"
+ TESTING h5unjam -i `basename $infile` -o `basename $ofile` "> "`basename $uofile`
+ $JAM_BIN/$UNJAM -i $infile -o $ofile > $uofile
+ else
+ if [ "$2" = "--delete" ];
+ then
+ uofile="none"
+ TESTING h5unjam -i `basename $infile` -o `basename $ofile` --delete
+ $JAM_BIN/$UNJAM -i $infile -o $ofile --delete
+
+ else
+ uofile="$2"
+ TESTING h5unjam -i `basename $infile` -u `basename $uofile` -o `basename $ofile`
+ $JAM_BIN/$UNJAM -i $infile -u $uofile -o $ofile
+ fi
+ fi
+
+ result1=0
+ result2=0
+ cleanup=""
+ if [ "$uofile" != "none" ];
+ then
+ # sets result1
+ CHECK_UB_1 $infile $uofile
+ CLEANUP $uofile
+ fi
+
+ # sets result2
+ CHECK_NOUB $ofile
+
+ if [ "$result1" = "0" -a "$result2" = "0" ];
+ then
+ echo " PASSED"
+ else
+ echo " *FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ fi
}
@@ -500,28 +500,30 @@ TOOLTEST_OUTPUT() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- # combine stderr to stdout for output compare
+ # combine stderr to stdout for output compare
cat $actual_err >> $actual
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
- rm -f $actual $actual_sav $actual_err $actual_err_sav
+ echo " Expected result (*.ls) missing"
+ nerrors="`expr $nerrors + 1`"
+ rm -f $actual $actual_sav $actual_err $actual_err_sav
elif $CMP $expect $actual; then
echo " PASSED"
- rm -f $actual $actual_sav $actual_err $actual_err_sav
+ rm -f $actual $actual_sav $actual_err $actual_err_sav
else
echo "*FAILED*"
- echo " Expected result differs from actual result"
- nerrors="`expr $nerrors + 1`"
+ echo " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
}
##############################################################################
##############################################################################
-### T H E T E S T S ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
# prepare for test
@@ -550,19 +552,19 @@ CHECKFILE $TESTDIR/tall.h5 ta5.h5
CLEANUP ta5.h5
SETUP $TESTDIR/tall.h5 ta6.h5
-JAMTEST $TESTDIR/u10.txt ta6.h5
+JAMTEST $TESTDIR/u10.txt ta6.h5
CHECKFILE $TESTDIR/tall.h5 ta6.h5
CLEANUP ta6.h5
SETUP $TESTDIR/tall.h5 ta7.h5
-JAMTEST $TESTDIR/u511.txt ta7.h5
+JAMTEST $TESTDIR/u511.txt ta7.h5
CHECKFILE $TESTDIR/tall.h5 ta7.h5
CLEANUP ta7.h5
SETUP $TESTDIR/tall.h5 ta8.h5
-JAMTEST $TESTDIR/u512.txt ta8.h5
+JAMTEST $TESTDIR/u512.txt ta8.h5
CHECKFILE $TESTDIR/tall.h5 ta8.h5
CLEANUP ta8.h5
SETUP $TESTDIR/tall.h5 ta9.h5
-JAMTEST $TESTDIR/u513.txt ta9.h5
+JAMTEST $TESTDIR/u513.txt ta9.h5
CHECKFILE $TESTDIR/tall.h5 ta9.h5
CLEANUP ta9.h5
@@ -592,29 +594,29 @@ JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 tax9.h5
CHECKFILE $TESTDIR/tall.h5 tax9.h5
CLEANUP tax9.h5
-JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub.h5 --clobber taz2.h5
CHECKFILE $TESTDIR/tall.h5 taz2.h5
CLEANUP taz2.h5
JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub.h5 --clobber taz3.h5
CHECKFILE $TESTDIR/tall.h5 taz3.h5
CLEANUP taz3.h5
-JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub.h5 --clobber taz4.h5
CHECKFILE $TESTDIR/tall.h5 taz4.h5
CLEANUP taz4.h5
-JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub.h5 --clobber taz5.h5
CHECKFILE $TESTDIR/tall.h5 taz5.h5
CLEANUP taz5.h5
-JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
+JAMTEST $TESTDIR/u10.txt $TESTDIR/twithub513.h5 --clobber taz6.h5
CHECKFILE $TESTDIR/tall.h5 taz6.h5
CLEANUP taz6.h5
JAMTEST $TESTDIR/u511.txt $TESTDIR/twithub513.h5 --clobber taz7.h5
CHECKFILE $TESTDIR/tall.h5 taz7.h5
CLEANUP taz7.h5
-JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
+JAMTEST $TESTDIR/u512.txt $TESTDIR/twithub513.h5 --clobber taz8.h5
CHECKFILE $TESTDIR/tall.h5 taz8.h5
CLEANUP taz8.h5
-JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
+JAMTEST $TESTDIR/u513.txt $TESTDIR/twithub513.h5 --clobber taz9.h5
CHECKFILE $TESTDIR/tall.h5 taz9.h5
CLEANUP taz9.h5
@@ -653,7 +655,7 @@ CHECKFILE $TESTDIR/tall.h5 tay9.h5
CLEANUP tay9.h5
#---------------------------------
-# Testing h5unjam
+# Testing h5unjam
#---------------------------------
# help page
TOOLTEST_OUTPUT UNJAM h5unjam-help.txt 0 -h