From c6b3059a92b61a119da49c04fbdcd54545d95242 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 13 Feb 2007 18:21:07 -0500 Subject: [svn-r13293] Description: Refactor h5copy testing script to abstract out some of the common behavior, obey the "HDF5_NOCLEANUP" environment variable, delete any output file left over from a previous run, add a "test variation" parameter to output file name for adding next sequence of test variations, etc. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) --- tools/h5copy/testh5copy.sh | 53 +++++++++++++++++++++++------------- tools/testfiles/h5copytst.a.out.ls | 55 ++++++++++++++++++++++++++++++++++++++ tools/testfiles/h5copytst.out.ls | 55 -------------------------------------- 3 files changed, 90 insertions(+), 73 deletions(-) create mode 100644 tools/testfiles/h5copytst.a.out.ls delete mode 100644 tools/testfiles/h5copytst.out.ls diff --git a/tools/h5copy/testh5copy.sh b/tools/h5copy/testh5copy.sh index af8fb4b..e0056ac 100644 --- a/tools/h5copy/testh5copy.sh +++ b/tools/h5copy/testh5copy.sh @@ -27,12 +27,10 @@ H5LS=h5ls # The h5ls tool name H5LS_ARGS=-vr # Arguments to the h5ls tool H5LS_BIN=`pwd`/../h5ls/$H5LS # The path of the h5ls tool binary -TESTFILE=$srcdir/../testfiles/h5copytst.h5 -FILEOUT=h5copytst.out.h5 - nerrors=0 verbose=yes +SRCFILE=h5copytst.h5 CMP='cmp -s' DIFF='diff -c' @@ -166,25 +164,44 @@ H5LSTEST() fi } -############################################################################## -### T H E T E S T S ### -############################################################################## - # Copy single datasets of various forms from one root group to another, # adding new object to the destination file each time -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s simple -d simple -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s chunk -d chunk -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s compact -d compact -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s compound -d compound -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s compressed -d compressed -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s named_vl -d named_vl -TOOLTEST -i $TESTFILE -o $FILEOUT -v -s nested_vl -d nested_vl - -# Verify that the file created above is correct -H5LSTEST $FILEOUT -rm -f $FILEOUT +# +# Assumed arguments: +# $1 is test "variation" +# $2 is group within source file +# $3 is group within destination file +SIMPLETEST() +{ + TESTFILE=$srcdir/../testfiles/$SRCFILE + FILEOUT="../testfiles/`basename $SRCFILE .h5`.$1.out.h5" + + # Remove any output file left over from previous test run + rm -f $FILEOUT + + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"simple -d "$3"simple + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"chunk -d "$3"chunk + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"compact -d "$3"compact + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"compound -d "$3"compound + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"compressed -d "$3"compressed + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"named_vl -d "$3"named_vl + TOOLTEST -i $TESTFILE -o $FILEOUT -v -s "$2"nested_vl -d "$3"nested_vl + + # Verify that the file created above is correct + H5LSTEST $FILEOUT + + # Remove output file created, if the "no cleanup" environment variable is + # not defined + if [ x$HDF5_NOCLEANUP = "x" ]; then + rm -f $FILEOUT + fi +} +############################################################################## +### T H E T E S T S ### +############################################################################## +SIMPLETEST a "" "" if test $nerrors -eq 0 ; then diff --git a/tools/testfiles/h5copytst.a.out.ls b/tools/testfiles/h5copytst.a.out.ls new file mode 100644 index 0000000..90b5dba --- /dev/null +++ b/tools/testfiles/h5copytst.a.out.ls @@ -0,0 +1,55 @@ +############################# +Expected output for 'h5ls ../testfiles/h5copytst.a.out.h5' +############################# +Opened "../testfiles/h5copytst.a.out.h5" with sec2 driver. +/chunk Dataset {6/6} + Location: 1:6216 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Chunks: {2} 8 bytes + Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization + Type: native int +/compact Dataset {6/6} + Location: 1:6344 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization + Type: native int +/compound Dataset {2/2} + Location: 1:8528 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization + Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/compressed Dataset {6/6} + Location: 1:12888 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Chunks: {2} 8 bytes + Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization + Filter-0: deflate-1 OPT {1} + Type: native int +/named_vl Dataset {2/2} + Location: 1:13104 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization + Type: shared-1:13056 variable length of + native int +/nested_vl Dataset {2/2} + Location: 1:27392 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization + Type: variable length of + variable length of + native int +/simple Dataset {6/6} + Location: 1:808 + Links: 1 + Modified: 2006-10-17 15:55:17 CDT + Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization + Type: native int diff --git a/tools/testfiles/h5copytst.out.ls b/tools/testfiles/h5copytst.out.ls deleted file mode 100644 index 81cc181..0000000 --- a/tools/testfiles/h5copytst.out.ls +++ /dev/null @@ -1,55 +0,0 @@ -############################# -Expected output for 'h5ls h5copytst.out.h5' -############################# -Opened "h5copytst.out.h5" with sec2 driver. -/chunk Dataset {6/6} - Location: 1:6216 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Chunks: {2} 8 bytes - Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization - Type: native int -/compact Dataset {6/6} - Location: 1:6344 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization - Type: native int -/compound Dataset {2/2} - Location: 1:8528 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Storage: 80 logical bytes, 80 allocated bytes, 100.00% utilization - Type: struct { - "str1" +0 20-byte null-terminated ASCII string - "str2" +20 20-byte null-terminated ASCII string - } 40 bytes -/compressed Dataset {6/6} - Location: 1:12888 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Chunks: {2} 8 bytes - Storage: 24 logical bytes, 42 allocated bytes, 57.14% utilization - Filter-0: deflate-1 OPT {1} - Type: native int -/named_vl Dataset {2/2} - Location: 1:13104 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization - Type: shared-1:13056 variable length of - native int -/nested_vl Dataset {2/2} - Location: 1:27392 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Storage: 16 logical bytes, 32 allocated bytes, 50.00% utilization - Type: variable length of - variable length of - native int -/simple Dataset {6/6} - Location: 1:808 - Links: 1 - Modified: 2006-10-17 15:55:17 CDT - Storage: 24 logical bytes, 24 allocated bytes, 100.00% utilization - Type: native int -- cgit v0.12