summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/testfiles/tall-1.ddl2
-rw-r--r--tools/testfiles/tall-2.ddl2
-rw-r--r--tools/testfiles/tall-3.ddl2
-rw-r--r--tools/testfiles/tattr-1.ddl2
-rw-r--r--tools/testfiles/tattr-2.ddl2
-rw-r--r--tools/testfiles/tattr-3.ddl2
-rw-r--r--tools/testfiles/tattr-4.ddl2
-rw-r--r--tools/testfiles/tcomp-1.ddl2
-rw-r--r--tools/testfiles/tcomp-2.ddl2
-rw-r--r--tools/testfiles/tcomp-3.ddl2
-rw-r--r--tools/testfiles/tcomp-4.ddl2
-rw-r--r--tools/testfiles/tdset-1.ddl2
-rw-r--r--tools/testfiles/tdset-2.ddl2
-rw-r--r--tools/testfiles/tdset-3.ddl2
-rw-r--r--tools/testfiles/tdset-4.ddl2
-rw-r--r--tools/testfiles/tgroup-1.ddl2
-rw-r--r--tools/testfiles/tgroup-2.ddl2
-rw-r--r--tools/testfiles/tgroup-3.ddl2
-rw-r--r--tools/testfiles/thlink-1.ddl2
-rw-r--r--tools/testfiles/thlink-2.ddl2
-rw-r--r--tools/testfiles/thlink-3.ddl2
-rw-r--r--tools/testfiles/thlink-4.ddl2
-rw-r--r--tools/testfiles/thlink-5.ddl2
-rw-r--r--tools/testfiles/tslink-1.ddl2
-rw-r--r--tools/testfiles/tslink-2.ddl2
-rwxr-xr-xtools/testh5dump.sh280
26 files changed, 110 insertions, 220 deletions
diff --git a/tools/testfiles/tall-1.ddl b/tools/testfiles/tall-1.ddl
index a0d24f8..9ea5a73 100644
--- a/tools/testfiles/tall-1.ddl
+++ b/tools/testfiles/tall-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump tall.h5'
+Expected output for 'h5dump tall.h5'
#############################
HDF5 "tall.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tall-2.ddl b/tools/testfiles/tall-2.ddl
index c23ae58..4d6002b 100644
--- a/tools/testfiles/tall-2.ddl
+++ b/tools/testfiles/tall-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -header -g /g1/g1.1 -a attr2 tall.h5'
+Expected output for 'h5dump -header -g /g1/g1.1 -a attr2 tall.h5'
#############################
HDF5 "tall.h5" {
GROUP "/g1/g1.1" {
diff --git a/tools/testfiles/tall-3.ddl b/tools/testfiles/tall-3.ddl
index a33c8d7..9c35fe1 100644
--- a/tools/testfiles/tall-3.ddl
+++ b/tools/testfiles/tall-3.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5'
+Expected output for 'h5dump -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5'
#############################
HDF5 "tall.h5" {
DATASET "/g2/dset2.1" {
diff --git a/tools/testfiles/tattr-1.ddl b/tools/testfiles/tattr-1.ddl
index 6604aa3..bdf4f3c 100644
--- a/tools/testfiles/tattr-1.ddl
+++ b/tools/testfiles/tattr-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump tattr.h5'
+Expected output for 'h5dump tattr.h5'
#############################
HDF5 "tattr.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tattr-2.ddl b/tools/testfiles/tattr-2.ddl
index ccccb8d..7b6a7c9 100644
--- a/tools/testfiles/tattr-2.ddl
+++ b/tools/testfiles/tattr-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -a attr1 attr3 tattr.h5'
+Expected output for 'h5dump -a attr1 attr3 tattr.h5'
#############################
HDF5 "tattr.h5" {
ATTRIBUTE "attr1" {
diff --git a/tools/testfiles/tattr-3.ddl b/tools/testfiles/tattr-3.ddl
index 42a133b..0ef4a4f 100644
--- a/tools/testfiles/tattr-3.ddl
+++ b/tools/testfiles/tattr-3.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -header -a attr2 tattr.h5'
+Expected output for 'h5dump -header -a attr2 tattr.h5'
#############################
HDF5 "tattr.h5" {
ATTRIBUTE "attr2" {
diff --git a/tools/testfiles/tattr-4.ddl b/tools/testfiles/tattr-4.ddl
index 3c5b849..a110bef 100644
--- a/tools/testfiles/tattr-4.ddl
+++ b/tools/testfiles/tattr-4.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -a attr4 tattr.h5'
+Expected output for 'h5dump -a attr4 tattr.h5'
#############################
HDF5 "tattr.h5" {
ATTRIBUTE "attr4" {
diff --git a/tools/testfiles/tcomp-1.ddl b/tools/testfiles/tcomp-1.ddl
index 172eb3e..d837aff 100644
--- a/tools/testfiles/tcomp-1.ddl
+++ b/tools/testfiles/tcomp-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump tcompound.h5'
+Expected output for 'h5dump tcompound.h5'
#############################
HDF5 "tcompound.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tcomp-2.ddl b/tools/testfiles/tcomp-2.ddl
index cbd3bbe..9b6bb89 100644
--- a/tools/testfiles/tcomp-2.ddl
+++ b/tools/testfiles/tcomp-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -t /type1 /type2 /group1/type3 tcompound.h5'
+Expected output for 'h5dump -t /type1 /type2 /group1/type3 tcompound.h5'
#############################
HDF5 "tcompound.h5" {
DATATYPE "/type1" {
diff --git a/tools/testfiles/tcomp-3.ddl b/tools/testfiles/tcomp-3.ddl
index 20a3661..c5fd1d4 100644
--- a/tools/testfiles/tcomp-3.ddl
+++ b/tools/testfiles/tcomp-3.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d /group2/dset5 -g /group1 tcompound.h5'
+Expected output for 'h5dump -d /group2/dset5 -g /group1 tcompound.h5'
#############################
HDF5 "tcompound.h5" {
DATASET "/group2/dset5" {
diff --git a/tools/testfiles/tcomp-4.ddl b/tools/testfiles/tcomp-4.ddl
index 2510c43..2ae8e4c 100644
--- a/tools/testfiles/tcomp-4.ddl
+++ b/tools/testfiles/tcomp-4.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -t /#3432:0 -g /group2 tcompound.h5'
+Expected output for 'h5dump -t /#3432:0 -g /group2 tcompound.h5'
#############################
HDF5 "tcompound.h5" {
DATATYPE "/#3432:0" {
diff --git a/tools/testfiles/tdset-1.ddl b/tools/testfiles/tdset-1.ddl
index b1757db..c5f4fb6 100644
--- a/tools/testfiles/tdset-1.ddl
+++ b/tools/testfiles/tdset-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump tdset.h5'
+Expected output for 'h5dump tdset.h5'
#############################
HDF5 "tdset.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tdset-2.ddl b/tools/testfiles/tdset-2.ddl
index e876103..177a10f 100644
--- a/tools/testfiles/tdset-2.ddl
+++ b/tools/testfiles/tdset-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d dset1 /dset2 tdset.h5'
+Expected output for 'h5dump -d dset1 /dset2 tdset.h5'
#############################
HDF5 "tdset.h5" {
DATASET "dset1" {
diff --git a/tools/testfiles/tdset-3.ddl b/tools/testfiles/tdset-3.ddl
index 7b6e802..86d640b 100644
--- a/tools/testfiles/tdset-3.ddl
+++ b/tools/testfiles/tdset-3.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d /dset1 -header tdset.h5'
+Expected output for 'h5dump -d /dset1 -header tdset.h5'
#############################
HDF5 "tdset.h5" {
DATASET "/dset1" {
diff --git a/tools/testfiles/tdset-4.ddl b/tools/testfiles/tdset-4.ddl
index 8e2ec9e..c86c776 100644
--- a/tools/testfiles/tdset-4.ddl
+++ b/tools/testfiles/tdset-4.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d dset3 tdset.h5'
+Expected output for 'h5dump -d dset3 tdset.h5'
#############################
HDF5 "tdset.h5" {
DATASET "dset3" {
diff --git a/tools/testfiles/tgroup-1.ddl b/tools/testfiles/tgroup-1.ddl
index a671b8e..d5f5eb4 100644
--- a/tools/testfiles/tgroup-1.ddl
+++ b/tools/testfiles/tgroup-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump tgroup.h5'
+Expected output for 'h5dump tgroup.h5'
#############################
HDF5 "tgroup.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tgroup-2.ddl b/tools/testfiles/tgroup-2.ddl
index cec0783..42011a7 100644
--- a/tools/testfiles/tgroup-2.ddl
+++ b/tools/testfiles/tgroup-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -g / tgroup.h5'
+Expected output for 'h5dump -g / tgroup.h5'
#############################
HDF5 "tgroup.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tgroup-3.ddl b/tools/testfiles/tgroup-3.ddl
index a133268..31ee9ce 100644
--- a/tools/testfiles/tgroup-3.ddl
+++ b/tools/testfiles/tgroup-3.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -g /g2 /y tgroup.h5'
+Expected output for 'h5dump -g /g2 /y tgroup.h5'
#############################
HDF5 "tgroup.h5" {
GROUP "/g2" {
diff --git a/tools/testfiles/thlink-1.ddl b/tools/testfiles/thlink-1.ddl
index 670f19f..43f8f3a 100644
--- a/tools/testfiles/thlink-1.ddl
+++ b/tools/testfiles/thlink-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump thlink.h5'
+Expected output for 'h5dump thlink.h5'
#############################
HDF5 "thlink.h5" {
GROUP "/" {
diff --git a/tools/testfiles/thlink-2.ddl b/tools/testfiles/thlink-2.ddl
index df2b6ab..fcf85e9 100644
--- a/tools/testfiles/thlink-2.ddl
+++ b/tools/testfiles/thlink-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d /g1/link2 /dset /g1/link1/link3 thlink.h5'
+Expected output for 'h5dump -d /g1/link2 /dset /g1/link1/link3 thlink.h5'
#############################
HDF5 "thlink.h5" {
DATASET "/g1/link2" {
diff --git a/tools/testfiles/thlink-3.ddl b/tools/testfiles/thlink-3.ddl
index 7658c2e..5522244 100644
--- a/tools/testfiles/thlink-3.ddl
+++ b/tools/testfiles/thlink-3.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d /dset /g1/link1/link3 /g1/link2 thlink.h5'
+Expected output for 'h5dump -d /dset /g1/link1/link3 /g1/link2 thlink.h5'
#############################
HDF5 "thlink.h5" {
DATASET "/dset" {
diff --git a/tools/testfiles/thlink-4.ddl b/tools/testfiles/thlink-4.ddl
index 5579fdb..bbdd723 100644
--- a/tools/testfiles/thlink-4.ddl
+++ b/tools/testfiles/thlink-4.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -g /g1 thlink.h5'
+Expected output for 'h5dump -g /g1 thlink.h5'
#############################
HDF5 "thlink.h5" {
GROUP "/g1" {
diff --git a/tools/testfiles/thlink-5.ddl b/tools/testfiles/thlink-5.ddl
index dc636d7..14277cc 100644
--- a/tools/testfiles/thlink-5.ddl
+++ b/tools/testfiles/thlink-5.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -d /dset -g /g2 -d /g1/link2 thlink.h5'
+Expected output for 'h5dump -d /dset -g /g2 -d /g1/link2 thlink.h5'
#############################
HDF5 "thlink.h5" {
DATASET "/dset" {
diff --git a/tools/testfiles/tslink-1.ddl b/tools/testfiles/tslink-1.ddl
index 10affa0..e0f24e0 100644
--- a/tools/testfiles/tslink-1.ddl
+++ b/tools/testfiles/tslink-1.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump tslink.h5'
+Expected output for 'h5dump tslink.h5'
#############################
HDF5 "tslink.h5" {
GROUP "/" {
diff --git a/tools/testfiles/tslink-2.ddl b/tools/testfiles/tslink-2.ddl
index aa84e15..0672707 100644
--- a/tools/testfiles/tslink-2.ddl
+++ b/tools/testfiles/tslink-2.ddl
@@ -1,5 +1,5 @@
#############################
-Expected output for '../h5dump -l slink2 tslink.h5'
+Expected output for 'h5dump -l slink2 tslink.h5'
#############################
HDF5 "tslink.h5" {
SOFTLINK "slink2" {
diff --git a/tools/testh5dump.sh b/tools/testh5dump.sh
index ea607d9..cb68db7 100755
--- a/tools/testh5dump.sh
+++ b/tools/testh5dump.sh
@@ -1,213 +1,103 @@
-#! /bin/sh
-# Test scripts for h5dump.
-# See the USAGE function for command usage.
+#!/bin/sh
+h5dump=h5dump # a relative name
+cmp='cmp -s'
+diff='diff -c'
-# Definitions of commands and variables
-CMD='../h5dump'
-RM='rm -f'
-DIFF=diff
-CMP='cmp -s'
-nerrors=0 # number of errors (0)
-quitonerr=0 # quit on error (not)
-noclean=0 # no cleaning temp. files (yes)
-only="" # dumper sub-command to test only
-except="" # dumper sub-command to test not
+nerrors=0
+verbose=yes
-
-# Definitions of functions/shorthands
-#
-
-# Print Usage of the command
-USAGE()
+# Print a line-line message left justified in a field of 70 characters
+# beginning with the word "Testing".
+TESTING()
{
- echo "Usage: $0 [-help] [-noclean] [-quit] [-except <command>] [-only <command>]"
- echo " -help: display help information"
- echo " -noclean: do not clean away temporary files"
- echo " -quit: quit immediately if any test fails"
- echo " -except: skip one specific command"
- echo " -only: test one specific command"
- echo "<command> can be one of {list, dumpsds, dumprig, dumpvd, dumpvg, dumpgr}"
+ SPACES=" "
+ echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\n'
}
-# Print message with formats according to message level ($1)
-MESG()
+# 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.
+DUMP()
{
- level=$1
+ expect=testfiles/$1
+ actual="testfiles/`basename $1 .ddl`.out"
shift
- case $level in
- 0)
- echo '============================='
- echo $*
- echo '============================='
- ;;
- 3)
- echo '-----------------------------'
- echo $*
- echo '-----------------------------'
- ;;
- 6)
- echo "*** $* ***"
- ;;
- *)
- echo "MESG(): Unknown level ($level)"
- exit 1
- ;;
- esac
-
-}
-
-# Run the test to produce an output file which is then
-# compared with the expected ($1) output.
-# Note that this can be used to produce the expected
-# output files by replace "$output" with "$expected"
-# in the run-the-test commands.
-TEST()
-{
- # parse the arguments
- output=tmp.out
- expected=testfiles/$1
- shift
- # print a id banner
- MESG 6 $@
- # run the test
- (
+ # Run test.
+ TESTING $h5dump $@
+ (
echo "#############################"
- echo "Expected output for '$CMD $@'"
+ echo "Expected output for '$h5dump $@'"
echo "#############################"
cd testfiles
- $CMD "$@"
- ) > $output
- $CMP $expected $output
- if [ $? -ne 0 ]
- then
- echo $DIFF $expected $output
- $DIFF $expected $output
- echo " <<< FAILED >>>"
- nerrors=`expr $nerrors + 1`
- if [ $quitonerr -gt 0 ];
- then
- FINISH
- fi
+ ../$h5dump "$@" 2>/dev/null
+ ) >$actual
+
+ # Results. We normalize the result to account for different output
+ # widths. That is, the test should succeed if the only
+ # differences are in white space. We have to do this the hard way
+ # because diff isn't always smart enough.
+ tr '\n' ' ' <$actual |tr -s ' \t' |fold >$actual-norm
+ tr '\n' ' ' <$expect |tr -s ' \t' |fold >$expect-norm
+
+ if $cmp $expect-norm $actual-norm; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Actual result (*.out) differs from expected result (*.ddl)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $diff $expect $actual |sed 's/^/ /'
fi
-# if [ $noclean -eq 0 ]
-# then
-# $RM $output
-# fi
-}
-
-# Report the result and exit
-FINISH()
-{
- if [ $nerrors -eq 0 ]
- then
- MESG 0 "All h5dump tests passed"
- else
- MESG 0 "h5dump tests failed: $nerrors"
+ # Clean up output file
+ rm -f $expect-norm $actual-norm
+ if [ X = ${HDF5_NOCLEANUP:-X} ]; then
+ rm -f $actual
fi
- exit $nerrors
}
-#===============
-# Main Body
-#===============
-
-# parse arguments
-while [ $# -gt 0 ]
-do
- case "$1" in
- "-quit")
- quitonerr=1
- ;;
- "-noclean")
- noclean=1
- ;;
- "-help")
- USAGE
- exit 0
- ;;
- "-only")
- shift
- case "$1" in
- "h5dump")
- only="$1"
- ;;
- *)
- echo "Unknown command: $1"
- USAGE
- exit 1
- ;;
- esac
- ;;
- "-except")
- shift
- case "$1" in
- "h5dump")
- except="$1"
- ;;
- *)
- echo "Unknown command: $1"
- USAGE
- exit 1
- ;;
- esac
- ;;
- * )
- echo "Unknow option: $1"
- USAGE
- exit 1
- ;;
- esac
- shift
-done
-
-# Print a beginning banner
-MESG 0 "Running h5dump tests"
-
-# Test command list
-TestCmd=h5dump
-TestName="Test command $TestCmd"
-if [ "$except" != $TestCmd -a \( -z "$only" -o "$only" = $TestCmd \) ]
-then
-MESG 3 "$TestName"
-TEST tgroup-1.ddl tgroup.h5
-TEST tgroup-2.ddl -g / tgroup.h5
-TEST tgroup-3.ddl -g /g2 /y tgroup.h5
-
-TEST tdset-1.ddl tdset.h5
-TEST tdset-2.ddl -d dset1 /dset2 tdset.h5
-TEST tdset-3.ddl -d /dset1 -header tdset.h5
-TEST tdset-4.ddl -d dset3 tdset.h5
-
-TEST tattr-1.ddl tattr.h5
-TEST tattr-2.ddl -a attr1 attr3 tattr.h5
-TEST tattr-3.ddl -header -a attr2 tattr.h5
-TEST tattr-4.ddl -a attr4 tattr.h5
-
-TEST tslink-1.ddl tslink.h5
-TEST tslink-2.ddl -l slink2 tslink.h5
-
-TEST thlink-1.ddl thlink.h5
-TEST thlink-2.ddl -d /g1/link2 /dset /g1/link1/link3 thlink.h5
-TEST thlink-3.ddl -d /dset /g1/link1/link3 /g1/link2 thlink.h5
-TEST thlink-4.ddl -g /g1 thlink.h5
-TEST thlink-5.ddl -d /dset -g /g2 -d /g1/link2 thlink.h5
-
-TEST tcomp-1.ddl tcompound.h5
-TEST tcomp-2.ddl -t /type1 /type2 /group1/type3 tcompound.h5
-TEST tcomp-3.ddl -d /group2/dset5 -g /group1 tcompound.h5
-TEST tcomp-4.ddl -t /#3432:0 -g /group2 tcompound.h5
-
-TEST tall-1.ddl tall.h5
-TEST tall-2.ddl -header -g /g1/g1.1 -a attr2 tall.h5
-TEST tall-3.ddl -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5
-
-else
-MESG 3 "$TestName <<<SKIPPED>>>"
-fi
-
-# End of test
-FINISH
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+DUMP tgroup-1.ddl tgroup.h5
+DUMP tgroup-2.ddl -g / tgroup.h5
+DUMP tgroup-3.ddl -g /g2 /y tgroup.h5
+
+DUMP tdset-1.ddl tdset.h5
+DUMP tdset-2.ddl -d dset1 /dset2 tdset.h5
+DUMP tdset-3.ddl -d /dset1 -header tdset.h5
+DUMP tdset-4.ddl -d dset3 tdset.h5
+
+DUMP tattr-1.ddl tattr.h5
+DUMP tattr-2.ddl -a attr1 attr3 tattr.h5
+DUMP tattr-3.ddl -header -a attr2 tattr.h5
+DUMP tattr-4.ddl -a attr4 tattr.h5
+
+DUMP tslink-1.ddl tslink.h5
+DUMP tslink-2.ddl -l slink2 tslink.h5
+
+DUMP thlink-1.ddl thlink.h5
+DUMP thlink-2.ddl -d /g1/link2 /dset /g1/link1/link3 thlink.h5
+DUMP thlink-3.ddl -d /dset /g1/link1/link3 /g1/link2 thlink.h5
+DUMP thlink-4.ddl -g /g1 thlink.h5
+DUMP thlink-5.ddl -d /dset -g /g2 -d /g1/link2 thlink.h5
+
+DUMP tcomp-1.ddl tcompound.h5
+DUMP tcomp-2.ddl -t /type1 /type2 /group1/type3 tcompound.h5
+DUMP tcomp-3.ddl -d /group2/dset5 -g /group1 tcompound.h5
+DUMP tcomp-4.ddl -t /#3432:0 -g /group2 tcompound.h5
+
+DUMP tall-1.ddl tall.h5
+DUMP tall-2.ddl -header -g /g1/g1.1 -a attr2 tall.h5
+DUMP tall-3.ddl -d /g2/dset2.1 -l /g1/g1.2/g1.2.1/slink tall.h5
+