summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-05 23:19:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-05 23:19:01 (GMT)
commit0de252524dfec1028bdd9241dbd4cca46535b93a (patch)
treecb9df4f6d8db74ee263e82459e562037c26de611
parent1fe94ec545b2ae92fefc16eb3d9864e52b12107d (diff)
downloadhdf5-0de252524dfec1028bdd9241dbd4cca46535b93a.zip
hdf5-0de252524dfec1028bdd9241dbd4cca46535b93a.tar.gz
hdf5-0de252524dfec1028bdd9241dbd4cca46535b93a.tar.bz2
[svn-r19179] Description:
Bring changes from Coverity branch back to trunk: r19079 & 19080: [BZ1942] h5dump -u to generate XML, it does not respect the -m option xml version of dump_data function didn't check for use of fp_format variable. Added new test expected file for committed bug 1942 r19103, 19104 & 19105: [BZ1821] h5repack -v did not display correct output for a selected compression. Needed new test for comparing output of -v option. Added new test file for solution to BZ1821 BZ1821 - Bring test changes from the shell script actually used. Tested on: Mac OS X/32 10.6.4 (amazon) debug & production (h5committested on branch)
-rw-r--r--MANIFEST3
-rw-r--r--config/cmake/runTest.cmake9
-rw-r--r--tools/h5dump/h5dump.c6
-rwxr-xr-xtools/h5dump/testh5dumpxml.sh.in3
-rw-r--r--tools/h5repack/CMakeLists.txt37
-rwxr-xr-xtools/h5repack/h5repack.sh.in39
-rw-r--r--tools/h5repack/h5repack_copy.c16
-rw-r--r--tools/testfiles/h5repack_filters.h5.ddl13
-rw-r--r--tools/testfiles/tfpformat.h5.xml59
9 files changed, 173 insertions, 12 deletions
diff --git a/MANIFEST b/MANIFEST
index e4efb7a..9d08d6d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1347,6 +1347,8 @@
./tools/testfiles/torderattr.h5
./tools/testfiles/tfpformat.ddl
./tools/testfiles/tfpformat.h5
+# h5dump h5repack validation
+./tools/testfiles/h5repack_filters.h5.ddl
# Expected output from h5ls tests
@@ -1419,6 +1421,7 @@
./tools/testfiles/tdset2.h5.xml
./tools/testfiles/tempty.h5.xml
./tools/testfiles/tenum.h5.xml
+./tools/testfiles/tfpformat.h5.xml
./tools/testfiles/tgroup.h5.xml
./tools/testfiles/thlink.h5.xml
./tools/testfiles/tloop.h5.xml
diff --git a/config/cmake/runTest.cmake b/config/cmake/runTest.cmake
index 4218671..227ef9b 100644
--- a/config/cmake/runTest.cmake
+++ b/config/cmake/runTest.cmake
@@ -17,6 +17,9 @@ ENDIF (NOT TEST_OUTPUT)
#IF (NOT TEST_EXPECT)
# MESSAGE (STATUS "Require TEST_EXPECT to be defined")
#ENDIF (NOT TEST_EXPECT)
+#IF (NOT TEST_FILTER)
+# MESSAGE (STATUS "Require TEST_FILTER to be defined")
+#ENDIF (NOT TEST_FILTER)
IF (NOT TEST_REFERENCE)
MESSAGE (FATAL_ERROR "Require TEST_REFERENCE to be defined")
ENDIF (NOT TEST_REFERENCE)
@@ -61,6 +64,12 @@ IF (TEST_MASK)
FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
ENDIF (TEST_MASK)
+IF (TEST_FILTER)
+ FILE (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+ STRING(REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}")
+ FILE (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ENDIF (TEST_FILTER)
+
IF (WIN32 AND NOT MINGW)
FILE (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
FILE (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index e4c5231..4abc0b0 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -5429,6 +5429,12 @@ xml_dump_data(hid_t obj_id, int obj_data, struct subset_t UNUSED * sset, int UNU
int depth;
int stdindent = COL; /* should be 3 */
+ if (fp_format)
+ {
+ outputformat->fmt_double = fp_format;
+ outputformat->fmt_float = fp_format;
+ }
+
if (nCols==0) {
outputformat->line_ncols = 65535;
outputformat->line_per_line = 1;
diff --git a/tools/h5dump/testh5dumpxml.sh.in b/tools/h5dump/testh5dumpxml.sh.in
index c4c8657..c9f1ad2 100755
--- a/tools/h5dump/testh5dumpxml.sh.in
+++ b/tools/h5dump/testh5dumpxml.sh.in
@@ -188,6 +188,9 @@ TOOLTEST torderattr2.h5.xml --xml -H --sort_by=name --sort_order=descending tord
TOOLTEST torderattr3.h5.xml --xml -H --sort_by=creation_order --sort_order=ascending torderattr.h5
TOOLTEST torderattr4.h5.xml --xml -H --sort_by=creation_order --sort_order=descending torderattr.h5
+# tests for floating point user defined printf format
+TOOLTEST tfpformat.h5.xml -u -m %.7f tfpformat.h5
+
if test $nerrors -eq 0 ; then
echo "All $TESTNAME tests passed."
diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt
index adec48a..31e4e90 100644
--- a/tools/h5repack/CMakeLists.txt
+++ b/tools/h5repack/CMakeLists.txt
@@ -142,6 +142,7 @@ IF (BUILD_TESTING)
tfamily00008.h5
tfamily00009.h5
tfamily00010.h5
+ h5repack_filters.h5.ddl
)
FOREACH (h5_file ${HDF5_REFERENCE_TEST_FILES})
@@ -166,10 +167,12 @@ IF (BUILD_TESTING)
)
ENDFOREACH (h5c_file ${HDF5_COMMON_TEST_FILES})
-
MACRO (ADD_H5_TEST testname testtype testfile)
IF (${testtype} STREQUAL "SKIP")
- MESSAGE (STATUS "SKIP ${testfile} ${ARGN}")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out.${testfile}"
+ )
ELSE (${testtype} STREQUAL "SKIP")
ADD_TEST (
NAME H5REPACK-${testname}
@@ -182,6 +185,28 @@ IF (BUILD_TESTING)
ENDIF (${testtype} STREQUAL "SKIP")
ENDMACRO (ADD_H5_TEST testname testfile testtype)
+ MACRO (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ IF (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${resultfile} ${PROJECT_BINARY_DIR}/testfiles/out.${resultfile}"
+ )
+ ELSE (${testtype} STREQUAL "SKIP")
+ ADD_TEST (
+ NAME H5REPACK-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repack>"
+ -D "TEST_ARGS:STRING=${ARGN};${PROJECT_BINARY_DIR}/testfiles/${resultfile};${PROJECT_BINARY_DIR}/testfiles/out.${resultfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_FILTER=${testfilter}"
+ -D "TEST_REFERENCE=${PROJECT_BINARY_DIR}/testfiles/${resultfile}.ddl"
+ -P "${HDF5_RESOURCES_DIR}/runTest.cmake"
+ )
+ ENDIF (${testtype} STREQUAL "SKIP")
+ ENDMACRO (ADD_H5_CMP_TEST file)
+
#
# The tests
# We use the files generated by h5repacktst
@@ -306,6 +331,14 @@ IF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE
SET (TESTTYPE "SKIP")
ENDIF (NOT USE_FILTER_SZIP_ENCODER OR NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE)
ADD_H5_TEST (all_filters ${TESTTYPE} ${arg})
+
+# verbose gzip with individual object
+SET (arg ${FILE11} -v -f /dset_deflate:GZIP=9)
+SET (TESTTYPE "TEST")
+IF (NOT USE_FILTER_DEFLATE)
+ SET (TESTTYPE "SKIP")
+ENDIF (NOT USE_FILTER_DEFLATE)
+ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
###########################################################
# the following tests assume the input files have filters
diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in
index 2b63fc0..636a4cd 100755
--- a/tools/h5repack/h5repack.sh.in
+++ b/tools/h5repack/h5repack.sh.in
@@ -183,6 +183,37 @@ TOOLTEST1()
fi
rm -f $outfile
}
+
+# Call h5repack and compare output to a text file for -v option
+#
+TOOLTESTV()
+{
+ expect="$srcdir/../testfiles/$1"
+ actual="../testfiles/`basename $1 .ddl`.out"
+ actual_err="../testfiles/`basename $1 .ddl`.err"
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+
+ infile=$srcdir/testfiles/$1
+ path=`pwd`
+ outfile=$path/out.$1
+ shift
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile >$actual 2>$actual_err
+ cat $actual_err >> $actual
+
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+# rm -f $actual $actual_err
+}
#
# The tests
@@ -286,6 +317,14 @@ if test $USE_FILTER_SZIP_ENCODER != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_F
else
TOOLTEST $arg
fi
+
+# verbose gzip with individual object
+arg="$FILE11 -v -f dset_deflate:GZIP=9"
+if test $USE_FILTER_DEFLATE != "yes" ; then
+ SKIP $arg
+else
+ TOOLTEST $arg
+fi
###########################################################
# the following tests assume the input files have filters
diff --git a/tools/h5repack/h5repack_copy.c b/tools/h5repack/h5repack_copy.c
index c3475aa..b736c22 100644
--- a/tools/h5repack/h5repack_copy.c
+++ b/tools/h5repack/h5repack_copy.c
@@ -686,19 +686,15 @@ int do_copy_objects(hid_t fidin,
req_filter = 1;
/* check if filters were requested for individual objects */
- for( u = 0; u < options->op_tbl->nelems; u++)
- {
+ for (u = 0; u < options->op_tbl->nelems; u++) {
int k;
- for( k = 0; k < options->op_tbl->objs[u].nfilters; k++)
- {
- if ( options->op_tbl->objs[u].filter->filtn > 0 )
- {
-
- req_filter = 1;
-
+ if (strcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) {
+ for (k = 0; k < options->op_tbl->objs[u].nfilters; k++) {
+ if (options->op_tbl->objs[u].filter->filtn > 0) {
+ req_filter = 1;
+ }
}
-
}
}
diff --git a/tools/testfiles/h5repack_filters.h5.ddl b/tools/testfiles/h5repack_filters.h5.ddl
new file mode 100644
index 0000000..36e65b9
--- /dev/null
+++ b/tools/testfiles/h5repack_filters.h5.ddl
@@ -0,0 +1,13 @@
+Objects to modify layout are...
+Objects to apply filter are...
+ </dset_deflate> with GZIP filter
+ </dset_deflate>...Found
+-----------------------------------------
+ Type Filter (Compression) Name
+-----------------------------------------
+ group /
+ dset /dset_all
+ dset GZIP (0.995:1) /dset_deflate
+ dset /dset_fletcher32
+ dset /dset_nbit
+ dset /dset_shuffle
diff --git a/tools/testfiles/tfpformat.h5.xml b/tools/testfiles/tfpformat.h5.xml
new file mode 100644
index 0000000..939d7b3
--- /dev/null
+++ b/tools/testfiles/tfpformat.h5.xml
@@ -0,0 +1,59 @@
+#############################
+Expected output for 'h5dump -u -m %.7f tfpformat.h5'
+#############################
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE HDF5-File PUBLIC "HDF5-File.dtd" "http://www.hdfgroup.org/DTDs/HDF5-File.dtd">
+<HDF5-File>
+<RootGroup OBJ-XID="xid_96" H5Path="/">
+ <Dataset Name="double" OBJ-XID="xid_800" H5Path= "/double" Parents="xid_96" H5ParentPaths="/">
+ <StorageLayout>
+ <ContiguousLayout/>
+ </StorageLayout>
+ <FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <FillValue>
+ <NoFill/>
+ </FillValue>
+ </FillValueInfo>
+ <Dataspace>
+ <SimpleDataspace Ndims="1">
+ <Dimension DimSize="6" MaxDimSize="6"/>
+ </SimpleDataspace>
+ </Dataspace>
+ <DataType>
+ <AtomicType>
+ <FloatType ByteOrder="LE" Size="8" SignBitLocation="63" ExponentBits="11" ExponentLocation="52" MantissaBits="52" MantissaLocation="0" />
+ </AtomicType>
+ </DataType>
+ <Data>
+ <DataFromFile>
+ -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000
+ </DataFromFile>
+ </Data>
+ </Dataset>
+ <Dataset Name="float" OBJ-XID="xid_1400" H5Path= "/float" Parents="xid_96" H5ParentPaths="/">
+ <StorageLayout>
+ <ContiguousLayout/>
+ </StorageLayout>
+ <FillValueInfo FillTime="FillIfSet" AllocationTime="Late">
+ <FillValue>
+ <NoFill/>
+ </FillValue>
+ </FillValueInfo>
+ <Dataspace>
+ <SimpleDataspace Ndims="1">
+ <Dimension DimSize="6" MaxDimSize="6"/>
+ </SimpleDataspace>
+ </Dataspace>
+ <DataType>
+ <AtomicType>
+ <FloatType ByteOrder="LE" Size="4" SignBitLocation="31" ExponentBits="8" ExponentLocation="23" MantissaBits="23" MantissaLocation="0" />
+ </AtomicType>
+ </DataType>
+ <Data>
+ <DataFromFile>
+ -0.1234567 0.1234567 0.0000000 0.0000000 0.0000000 0.0000000
+ </DataFromFile>
+ </Data>
+ </Dataset>
+</RootGroup>
+</HDF5-File>