summaryrefslogtreecommitdiffstats
path: root/tools/h5jam/testh5jam.sh.in
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2011-08-16 20:41:47 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2011-08-16 20:41:47 (GMT)
commite703a6a2a4c6e6ee443d2e2af08fe61479789f79 (patch)
treeaae3f2453e6c8a536c2596868ebfde3fdf20dec5 /tools/h5jam/testh5jam.sh.in
parent8d80bf4a93a2de494e710eb9719483178ad215e8 (diff)
downloadhdf5-e703a6a2a4c6e6ee443d2e2af08fe61479789f79.zip
hdf5-e703a6a2a4c6e6ee443d2e2af08fe61479789f79.tar.gz
hdf5-e703a6a2a4c6e6ee443d2e2af08fe61479789f79.tar.bz2
[svn-r21236] Purpose:
Work for: HDFFV-7515 - GMQS: h5unjam - incorrect help page and should display when no file is given. and HDFFV-5941 - h5jam: specifying a user block file with a proper HDF5 magic number will result in a corrupted HDF5 file. Description: - Revised command help pages of h5jam and h5unjam. The descriptions were not up to date and some were missing. (HDFFV-7515) - Fixed h5jam not to allow specifying an HDF5 formatted file as input file for -u (user block file) option, because the original HDF5 file will not be accessible if allows. (HDFFV-5941) Tested: jam (linux32-LE), koala (linux64-LE), heiwa (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Cmake (jam, Wondows)
Diffstat (limited to 'tools/h5jam/testh5jam.sh.in')
-rw-r--r--tools/h5jam/testh5jam.sh.in65
1 files changed, 62 insertions, 3 deletions
diff --git a/tools/h5jam/testh5jam.sh.in b/tools/h5jam/testh5jam.sh.in
index 4508767..14b381c 100644
--- a/tools/h5jam/testh5jam.sh.in
+++ b/tools/h5jam/testh5jam.sh.in
@@ -83,6 +83,7 @@ $SRC_H5JAM_TESTFILES/u512.txt
$SRC_H5JAM_TESTFILES/u513.txt
$SRC_H5JAM_TESTFILES/h5jam-help.txt
$SRC_H5JAM_TESTFILES/h5unjam-help.txt
+$SRC_H5JAM_TESTFILES/h5jam-ub-nohdf5.txt
"
#
@@ -115,8 +116,7 @@ COPY_TESTFILES_TO_TESTDIR()
#
TESTING() {
SPACES=" "
- echo "Testing $* $SPACES"
- #echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
+ echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Print a line-line message left justified in a field of 70 characters
@@ -446,6 +446,51 @@ UNJAMTEST () {
}
+#
+# TOOLTEST_OUTPUT < JAM | UNJAM > expect-output.txt exit-code options
+#
+# Only verify stdout/stderr output from h5jam and j5unjam
+#
+
+TOOLTEST_OUTPUT() {
+ if [ "$1" == "JAM" ]; then
+ TOOLCMD=$JAM_BIN/$JAM
+ elif [ "$1" == "UNJAM" ]; then
+ TOOLCMD=$JAM_BIN/$UNJAM
+ fi
+ shift
+ expect="$TESTDIR/$1"
+ actual="$TESTDIR/`basename $1 .ls`.out"
+ actual_err="$TESTDIR/`basename $1 .ls`.err"
+ shift
+ retvalexpect=$1
+ shift
+
+ TESTING h5jam $@
+ (
+ cd $TESTDIR
+ $TOOLCMD "$@"
+ ) >$actual 2>$actual_err
+
+ # 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.
+ echo " CREATED"
+ cp $actual $expect
+ rm -f $actual $actual_err
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ rm -f $actual $actual_err
+ else
+ echo "*FAILED*"
+ 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 ###
@@ -454,7 +499,15 @@ UNJAMTEST () {
# prepare for test
COPY_TESTFILES_TO_TESTDIR
-# test start
+#-------------------------------
+# Testing h5jam
+#-------------------------------
+# help page
+TOOLTEST_OUTPUT JAM h5jam-help.txt 0 -h
+
+# don't allow HDF5 format file as an user block file
+TOOLTEST_OUTPUT JAM h5jam-ub-nohdf5.txt 1 -i tall.h5 -u tall.h5 -o tall-tmp.h5
+
JAMTEST $TESTDIR/u10.txt $TESTDIR/tall.h5 ta2.h5
CHECKFILE $TESTDIR/tall.h5 ta2.h5
CLEANUP ta2.h5
@@ -568,6 +621,12 @@ JAMTEST $TESTDIR/u513.txt tay9.h5 --clobber
CHECKFILE $TESTDIR/tall.h5 tay9.h5
CLEANUP tay9.h5
+#---------------------------------
+# Testing h5unjam
+#---------------------------------
+# help page
+TOOLTEST_OUTPUT UNJAM h5unjam-help.txt 0 -h
+
SETUP $TESTDIR/twithub.h5 tai1.h5
UNJAMTEST tai1.h5 o10.txt taa1.h5
CHECKFILE $TESTDIR/tall.h5 taa1.h5