summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/testfiles/tloop.dmp53
-rwxr-xr-xtools/testh5dump.sh5
-rw-r--r--tools/testh5toh437
3 files changed, 84 insertions, 11 deletions
diff --git a/tools/testfiles/tloop.dmp b/tools/testfiles/tloop.dmp
new file mode 100644
index 0000000..0f85156
--- /dev/null
+++ b/tools/testfiles/tloop.dmp
@@ -0,0 +1,53 @@
+File name: testfiles/tloop.hdf
+
+
+Vgroup:0
+ tag = 1965; reference = 2;
+ name = /; class = HDF5;
+ number of entries = 2;
+ number of attributes = 0
+Entries:-
+ #0 (Vgroup)
+ tag = 1965;reference = 3;
+ number of entries = 1;
+ name = g1; class = HDF5
+ number of attributes = 0
+ #1 (Vgroup)
+ tag = 1965;reference = 4;
+ number of entries = 1;
+ name = g1.1; class = HDF5
+ number of attributes = 0
+
+
+Vgroup:1
+ tag = 1965; reference = 3;
+ name = g1; class = HDF5;
+ number of entries = 1;
+ number of attributes = 0
+Entries:-
+ #0 (Vgroup)
+ tag = 1965;reference = 4;
+ number of entries = 1;
+ name = g1.1; class = HDF5
+ number of attributes = 0
+
+
+Vgroup:2
+ tag = 1965; reference = 4;
+ name = g1.1; class = HDF5;
+ number of entries = 1;
+ number of attributes = 0
+Entries:-
+ #0 (Vgroup)
+ tag = 1965;reference = 3;
+ number of entries = 1;
+ name = g1; class = HDF5
+ number of attributes = 0
+
+
+Graphical representation of the file:-
+(vg#: vgroup; vd: vdata)
+
+File name: testfiles/tloop.hdf
+
+File name: testfiles/tloop.hdf
diff --git a/tools/testh5dump.sh b/tools/testh5dump.sh
index 5645d60..6ad84e2 100755
--- a/tools/testh5dump.sh
+++ b/tools/testh5dump.sh
@@ -112,3 +112,8 @@ DUMP tall-3.ddl -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5
# test for loop detection
DUMP tloop-1.ddl tloop.h5
+
+if test "0" = "$nerrors"; then
+ echo "All h5dump tests passed."
+fi
+
diff --git a/tools/testh5toh4 b/tools/testh5toh4
index 87f3ef3..8f4b0a5 100644
--- a/tools/testh5toh4
+++ b/tools/testh5toh4
@@ -22,10 +22,10 @@ TESTING()
# 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.
+# expected output is given by adding a `.dmp' extension to the root of
+# the first argument to this function and the actual output file is
+# calculated by replacing the `.dmp' with `.tmp'. The actual output
+# is not removed if $HDF5_NOCLEANUP has a value.
CONVERT()
{
# Run h5toh4 convert.
@@ -48,7 +48,11 @@ CONVERT()
actual=`echo $h4file | $SED -e s/\.hdf/.tmp/`
expect=`echo $h4file | $SED -e s/\.hdf/.dmp/`
- $H4DUMP dumpvg $h4file > $actual
+ if test "testfiles/tloop.hdf" = "$h4file"; then
+ $H4DUMP dumpvg $h4file | head -50 > $actual
+ else
+ $H4DUMP dumpvg $h4file > $actual
+ fi
$H4DUMP dumpvd $h4file >> $actual
@@ -67,9 +71,9 @@ CONVERT()
if test "passed" = "$multirun"; then
echo "*FAILED*"
echo " Actual result (*.tmp) differs from expected result (*.dmp)"
+ nerrors="`expr $nerrors + 1`"
multirun=failed
fi
- nerrors="`expr $nerrors + 1`"
test yes = "$verbose" && $diff $expect $actual |sed 's/^/ /'
fi
@@ -77,6 +81,7 @@ CONVERT()
rm -f $expect-norm $actual-norm
if [ X = ${HDF5_NOCLEANUP:-X} ]; then
rm -f $actual
+ rm -f $h4file
fi
done
if test "passed" = "$multirun"; then
@@ -98,10 +103,12 @@ CONVERT()
actual=`echo $h4file | $SED -e s/\.hdf/.tmp/`
expect=`echo $h4file | $SED -e s/\.hdf/.dmp/`
- $H4DUMP dumpvg $h4file > $actual
-
+ if test "testfiles/tloop.hdf" = "$h4file"; then
+ $H4DUMP dumpvg $h4file | head -50 > $actual
+ else
+ $H4DUMP dumpvg $h4file > $actual
+ fi
$H4DUMP dumpvd $h4file >> $actual
-
$H4DUMP dumpsds $h4file >> $actual
@@ -125,6 +132,7 @@ CONVERT()
rm -f $expect-norm $actual-norm
if [ X = ${HDF5_NOCLEANUP:-X} ]; then
rm -f $actual
+ rm -f $h4file
fi
;;
@@ -168,6 +176,9 @@ CONVERT tcompound.h5
# test for converting all H5 objects at in same file.
CONVERT tall.h5
+# tests for converting H5 objects with loops.
+CONVERT tloop.h5
+
# test for converting extendable H5 datasets to H4 SDS's.
CONVERT tdset2.h5
@@ -190,6 +201,7 @@ CONVERT tslink.h5 tslink.hdf
CONVERT thlink.h5 thlink.hdf
CONVERT tcompound.h5 tcompound.hdf
CONVERT tall.h5 tall.hdf
+CONVERT tloop.h5 tloop.hdf
CONVERT tdset2.h5 tdset2.hdf
CONVERT tcompound2.h5 tcompound2.hdf
CONVERT tmany.h5 tmany.hdf
@@ -199,7 +211,10 @@ CONVERT tmany.h5 tmany.hdf
#
$RM ./testfiles/*.hdf ./testfiles/*.tmp
CONVERT -m tgroup.h5 tdset.h5 tattr.h5 tslink.h5 thlink.h5
-CONVERT -m tcompound.h5 tall.h5
+CONVERT -m tcompound.h5 tall.h5 tloop.h5
CONVERT -m tdset2.h5 tcompound2.h5 tmany.h5
-$RM ./testfiles/*.hdf ./testfiles/*.tmp
+
+if test "0" = "$nerrors"; then
+ echo "All h5toh4 tests passed."
+fi