summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2013-04-09 23:18:29 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2013-04-09 23:18:29 (GMT)
commitf56cc4156ec09d434b4f474afe5ed5b3786c5fe5 (patch)
tree04c71800e236564d469cd88256728825e3928baa /tools
parent0b7490e7e4f2121b15fe01daa1cce318dab36ad9 (diff)
downloadhdf5-f56cc4156ec09d434b4f474afe5ed5b3786c5fe5.zip
hdf5-f56cc4156ec09d434b4f474afe5ed5b3786c5fe5.tar.gz
hdf5-f56cc4156ec09d434b4f474afe5ed5b3786c5fe5.tar.bz2
[svn-r23568] Bring revision 22634:22690 from trunk to revise_chunks.
h5committested.
Diffstat (limited to 'tools')
-rw-r--r--tools/h5diff/CMakeLists.txt7
-rw-r--r--tools/h5diff/h5diffgentest.c17
-rw-r--r--tools/h5diff/testfiles/h5diff_59.txt11
-rw-r--r--tools/h5diff/testfiles/h5diff_dtypes.h5bin10776 -> 11416 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh5
-rw-r--r--tools/h5dump/CMakeLists.txt71
-rw-r--r--tools/h5dump/testh5dump.sh.in57
-rw-r--r--tools/lib/h5diff.h5
-rw-r--r--tools/lib/h5diff_attr.c8
-rw-r--r--tools/lib/h5diff_dset.c24
-rw-r--r--tools/lib/h5diff_util.c42
11 files changed, 113 insertions, 134 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index 3357b97..903564f 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -202,6 +202,7 @@ IF (BUILD_TESTING)
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_56.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_57.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_58.txt
+ ${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_59.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_500.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_501.txt
${HDF5_TOOLS_H5DIFF_SOURCE_DIR}/testfiles/h5diff_502.txt
@@ -702,6 +703,8 @@ IF (BUILD_TESTING)
h5diff_57.out.err
h5diff_58.out
h5diff_58.out.err
+ h5diff_59.out
+ h5diff_59.out.err
h5diff_500.out
h5diff_500.out.err
h5diff_501.out
@@ -960,6 +963,10 @@ ADD_H5_TEST (h5diff_57 0 -v ${FILE4} ${FILE4} dset7a dset7b)
# 5.8 (region reference)
ADD_H5_TEST (h5diff_58 1 -v ${FILE7} ${FILE8} refreg)
+# test for both dset and attr with same type but with different size
+# ( HDDFV-7942 )
+ADD_H5_TEST (h5diff_59 0 -v ${FILE4} ${FILE4} dset11a dset11b)
+
# ##############################################################################
# # Error messages
# ##############################################################################
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index fb44eb4..8cf1014 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -771,6 +771,7 @@ int test_datatypes(const char *fname)
{
hid_t fid1;
+ hid_t dset;
hsize_t dims[2]={3,2};
herr_t status;
char buf1a[3][2] = {{1,1},{1,1},{1,1}};
@@ -802,6 +803,9 @@ int test_datatypes(const char *fname)
unsigned int buf10a[3][2] = {{UIMAX,1},{1,1},{1,1}};
unsigned int buf10b[3][2] = {{UIMAX-1,1},{3,4},{5,6}};
+ unsigned short buf11a[3][2] = {{204,205},{2,3},{1,1}};
+ unsigned int buf11b[3][2] = {{204,205},{2,3},{1,1}};
+
/*-------------------------------------------------------------------------
* Create a file
@@ -892,6 +896,19 @@ int test_datatypes(const char *fname)
write_dset(fid1,2,dims,"dset10a",H5T_NATIVE_UINT,buf10a);
write_dset(fid1,2,dims,"dset10b",H5T_NATIVE_UINT,buf10b);
+ /*-------------------------------------------------------------------------
+ * Same type class, different size
+ *-------------------------------------------------------------------------
+ */
+ write_dset(fid1,2,dims,"dset11a",H5T_STD_U16LE,buf11a);
+ dset=H5Dopen (fid1, "dset11a", H5P_DEFAULT);
+ write_attr(dset,2,dims,"attr",H5T_STD_U16LE,buf11a);
+ H5Dclose (dset);
+
+ write_dset(fid1,2,dims,"dset11b",H5T_STD_U32LE,buf11b);
+ dset=H5Dopen (fid1, "dset11b", H5P_DEFAULT);
+ write_attr(dset,2,dims,"attr",H5T_STD_U32LE,buf11b);
+ H5Dclose (dset);
/*-------------------------------------------------------------------------
* Close
diff --git a/tools/h5diff/testfiles/h5diff_59.txt b/tools/h5diff/testfiles/h5diff_59.txt
new file mode 100644
index 0000000..aeefa3a
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_59.txt
@@ -0,0 +1,11 @@
+dataset: </dset11a> and </dset11b>
+Warning: different storage datatype
+</dset11a> has file datatype H5T_STD_U16LE
+</dset11b> has file datatype H5T_STD_U32LE
+Warning: different storage datatype
+<attr> has file datatype H5T_STD_U16LE
+<attr> has file datatype H5T_STD_U32LE
+attribute: <attr of </dset11a>> and <attr of </dset11b>>
+0 differences found
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_dtypes.h5 b/tools/h5diff/testfiles/h5diff_dtypes.h5
index 7c3cd9d..ffa5264 100644
--- a/tools/h5diff/testfiles/h5diff_dtypes.h5
+++ b/tools/h5diff/testfiles/h5diff_dtypes.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 8be8a54..02dacd8 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -236,6 +236,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_55.txt
$SRC_H5DIFF_TESTFILES/h5diff_56.txt
$SRC_H5DIFF_TESTFILES/h5diff_57.txt
$SRC_H5DIFF_TESTFILES/h5diff_58.txt
+$SRC_H5DIFF_TESTFILES/h5diff_59.txt
$SRC_H5DIFF_TESTFILES/h5diff_500.txt
$SRC_H5DIFF_TESTFILES/h5diff_501.txt
$SRC_H5DIFF_TESTFILES/h5diff_502.txt
@@ -628,6 +629,10 @@ TOOLTEST h5diff_57.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset7a dset7b
# 5.8 (region reference)
TOOLTEST h5diff_58.txt -v h5diff_dset1.h5 h5diff_dset2.h5 refreg
+# test for both dset and attr with same type but with different size
+# ( HDDFV-7942 )
+TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b
+
# ##############################################################################
# # Error messages
# ##############################################################################
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 1482327..302f854 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -780,35 +780,6 @@ IF (BUILD_TESTING)
ENDIF (HDF5_ENABLE_USING_MEMCHECKER)
ENDMACRO (ADD_XML_H5_TEST file)
- # --------------------------------------------------------------------
- # See which filters are usable (and skip tests for filters we
- # don't have). Do this by searching H5pubconf.h to see which
- # filters are defined.
- # --------------------------------------------------------------------
- IF (H5_HAVE_FILTER_DEFLATE)
- SET (USE_FILTER_DEFLATE "true")
- ENDIF (H5_HAVE_FILTER_DEFLATE)
-
- IF (H5_HAVE_FILTER_SZIP)
- SET (USE_FILTER_SZIP "true")
- ENDIF (H5_HAVE_FILTER_SZIP)
-
- IF (H5_HAVE_FILTER_SHUFFLE)
- SET (USE_FILTER_SHUFFLE "true")
- ENDIF (H5_HAVE_FILTER_SHUFFLE)
-
- IF (H5_HAVE_FILTER_FLETCHER32)
- SET (USE_FILTER_FLETCHER32 "true")
- ENDIF (H5_HAVE_FILTER_FLETCHER32)
-
- IF (H5_HAVE_FILTER_NBIT)
- SET (USE_FILTER_NBIT "true")
- ENDIF (H5_HAVE_FILTER_NBIT)
-
- IF (H5_HAVE_FILTER_SCALEOFFSET)
- SET (USE_FILTER_SCALEOFFSET "true")
- ENDIF (H5_HAVE_FILTER_SCALEOFFSET)
-
##############################################################################
##############################################################################
### T H E T E S T S HDF5_ENABLE_USING_MEMCHECKER ###
@@ -1298,53 +1269,25 @@ IF (BUILD_TESTING)
# tests for filters
# SZIP
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SZIP)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SZIP)
- ADD_SKIP_H5_TEST (tszip 0 ${TESTTYPE} --enable-error-stack -H -p -d szip tfilters.h5)
+ ADD_H5_TEST (tszip 0 --enable-error-stack -H -p -d szip tfilters.h5)
# deflate
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_DEFLATE)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_DEFLATE)
- ADD_SKIP_H5_TEST (tdeflate 0 ${TESTTYPE} --enable-error-stack -H -p -d deflate tfilters.h5)
+ ADD_H5_TEST (tdeflate 0 --enable-error-stack -H -p -d deflate tfilters.h5)
# shuffle
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SHUFFLE)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SHUFFLE)
- ADD_SKIP_H5_TEST (tshuffle 0 ${TESTTYPE} --enable-error-stack -H -p -d shuffle tfilters.h5)
+ ADD_H5_TEST (tshuffle 0 --enable-error-stack -H -p -d shuffle tfilters.h5)
# fletcher32
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_FLETCHER32)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_FLETCHER32)
- ADD_SKIP_H5_TEST (tfletcher32 0 ${TESTTYPE} --enable-error-stack -H -p -d fletcher32 tfilters.h5)
+ ADD_H5_TEST (tfletcher32 0 --enable-error-stack -H -p -d fletcher32 tfilters.h5)
# nbit
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_NBIT)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_NBIT)
- ADD_SKIP_H5_TEST (tnbit 0 ${TESTTYPE} --enable-error-stack -H -p -d nbit tfilters.h5)
+ ADD_H5_TEST (tnbit 0 --enable-error-stack -H -p -d nbit tfilters.h5)
# scaleoffset
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SCALEOFFSET)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SCALEOFFSET)
- ADD_SKIP_H5_TEST (tscaleoffset 0 ${TESTTYPE} --enable-error-stack -H -p -d scaleoffset tfilters.h5)
+ ADD_H5_TEST (tscaleoffset 0 --enable-error-stack -H -p -d scaleoffset tfilters.h5)
# all
- SET (TESTTYPE "TEST")
- IF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
- SET (TESTTYPE "SKIP")
- ENDIF (NOT USE_FILTER_SZIP OR NOT USE_FILTER_SHUFFLE OR NOT USE_FILTER_FLETCHER32 OR NOT USE_FILTER_DEFLATE OR NOT USE_FILTER_NBIT OR NOT USE_FILTER_SCALEOFFSET)
- ADD_SKIP_H5_TEST (tallfilters 0 ${TESTTYPE} --enable-error-stack -H -p -d all tfilters.h5)
+ ADD_H5_TEST (tallfilters 0 --enable-error-stack -H -p -d all tfilters.h5)
# user defined
ADD_H5_TEST (tuserfilter 0 --enable-error-stack -H -p -d myfilter tfilters.h5)
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 0ca6aa9..f969876 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -15,14 +15,6 @@
#
# Tests for the h5dump tool
-# Determine which filters are available
-USE_FILTER_SZIP="@USE_FILTER_SZIP@"
-USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@"
-USE_FILTER_SHUFFLE="@USE_FILTER_SHUFFLE@"
-USE_FILTER_FLETCHER32="@USE_FILTER_FLETCHER32@"
-USE_FILTER_NBIT="@USE_FILTER_NBIT@"
-USE_FILTER_SCALEOFFSET="@USE_FILTER_SCALEOFFSET@"
-
TESTNAME=h5dump
EXIT_SUCCESS=0
EXIT_FAILURE=1
@@ -881,54 +873,19 @@ TOOLTEST texceedsubblock.ddl --enable-error-stack -d 1d -k 1,3 taindices.h5
# tests for filters
# SZIP
-option="--enable-error-stack -H -p -d szip tfilters.h5"
-if test $USE_FILTER_SZIP != "yes"; then
- SKIP $option
-else
-TOOLTEST tszip.ddl $option
-fi
+TOOLTEST tszip.ddl --enable-error-stack -H -p -d szip tfilters.h5
# deflate
-option="--enable-error-stack -H -p -d deflate tfilters.h5"
-if test $USE_FILTER_DEFLATE != "yes"; then
- SKIP $option
-else
- TOOLTEST tdeflate.ddl $option
-fi
+TOOLTEST tdeflate.ddl --enable-error-stack -H -p -d deflate tfilters.h5
# shuffle
-option="--enable-error-stack -H -p -d shuffle tfilters.h5"
-if test $USE_FILTER_SHUFFLE != "yes"; then
- SKIP $option
-else
- TOOLTEST tshuffle.ddl $option
-fi
+TOOLTEST tshuffle.ddl --enable-error-stack -H -p -d shuffle tfilters.h5
# fletcher32
-option="--enable-error-stack -H -p -d fletcher32 tfilters.h5"
-if test $USE_FILTER_FLETCHER32 != "yes"; then
- SKIP $option
-else
- TOOLTEST tfletcher32.ddl $option
-fi
+TOOLTEST tfletcher32.ddl --enable-error-stack -H -p -d fletcher32 tfilters.h5
# nbit
-option="--enable-error-stack -H -p -d nbit tfilters.h5"
-if test $USE_FILTER_NBIT != "yes"; then
- SKIP $option
-else
- TOOLTEST tnbit.ddl $option
-fi
+TOOLTEST tnbit.ddl --enable-error-stack -H -p -d nbit tfilters.h5
# scaleoffset
-option="--enable-error-stack -H -p -d scaleoffset tfilters.h5"
-if test $USE_FILTER_SCALEOFFSET != "yes"; then
- SKIP $option
-else
- TOOLTEST tscaleoffset.ddl $option
-fi
+TOOLTEST tscaleoffset.ddl --enable-error-stack -H -p -d scaleoffset tfilters.h5
# all
-option="--enable-error-stack -H -p -d all tfilters.h5"
-if test $USE_FILTER_FLETCHER32 != "yes" -o $USE_FILTER_SZIP != "yes" -o $USE_FILTER_DEFLATE != "yes" -o $USE_FILTER_SHUFFLE != "yes" -o $USE_FILTER_NBIT != "yes" -o $USE_FILTER_SCALEOFFSET != "yes"; then
- SKIP $option
-else
- TOOLTEST tallfilters.ddl $option
-fi
+TOOLTEST tallfilters.ddl --enable-error-stack -H -p -d all tfilters.h5
# user defined
TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index f05d0de..2530805 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -180,6 +180,7 @@ hsize_t diff_attr(hid_t loc1_id,
*-------------------------------------------------------------------------
*/
+/* in h5diff_util.c */
void print_found(hsize_t nfound);
void print_type(hid_t type);
const char* diff_basename(const char *name);
@@ -187,6 +188,10 @@ const char* get_type(h5trav_type_t type);
const char* get_class(H5T_class_t tclass);
const char* get_sign(H5T_sign_t sign);
void print_dimensions (int rank, hsize_t *dims);
+herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
+ hid_t *m_tid1, hid_t *m_tid2,
+ size_t *m_size1, size_t *m_size2);
+/* in h5diff.c */
int print_objname(diff_opt_t *options, hsize_t nfound);
void do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_opt_t * opts);
void do_print_attrname (const char *attr, const char *path1, const char *path2);
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 85cd01f..144159a 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -405,6 +405,14 @@ hsize_t diff_attr(hid_t loc1_id,
continue;
}
+ /*-----------------------------------------------------------------
+ * "upgrade" the smaller memory size
+ *------------------------------------------------------------------
+ */
+ if (FAIL == match_up_memsize (ftype1_id, ftype2_id,
+ &mtype1_id, &mtype2_id,
+ &msize1, &msize2))
+ goto error;
/*---------------------------------------------------------------------
* read
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index da58cde..f9c7d1c 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -368,26 +368,10 @@ hsize_t diff_datasetid( hid_t did1,
*/
h5difftrace("upgrade the smaller memory size?\n");
- if(m_size1 != m_size2) {
- h5difftrace("m_size1 != m_size2\n");
- if(m_size1 < m_size2) {
- H5Tclose(m_tid1);
-
- if((m_tid1 = h5tools_get_native_type(f_tid2)) < 0)
- goto error;
-
- m_size1 = H5Tget_size(m_tid1);
- } /* end if */
- else {
- H5Tclose(m_tid2);
-
- if((m_tid2 = h5tools_get_native_type(f_tid1)) < 0)
- goto error;
-
- m_size2 = H5Tget_size(m_tid2);
- } /* end else */
- } /* end if */
- HDassert(m_size1 == m_size2);
+ if (FAIL == match_up_memsize (f_tid1, f_tid2,
+ &m_tid1, &m_tid2,
+ &m_size1, &m_size2))
+ goto error;
/* print names */
if(obj1_name)
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index 0d476b6..aefd641 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -311,4 +311,46 @@ void print_found(hsize_t nfound)
}
+/*-----------------------------------------------------------------
+ * Function: match_up_memsize
+ *
+ * Purpose: match smaller memory size up to bigger memory size
+ *------------------------------------------------------------------
+ */
+herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
+ hid_t *m_tid1, hid_t *m_tid2,
+ size_t *m_size1, size_t *m_size2)
+{
+ herr_t ret = SUCCEED;
+
+ if( (*m_size1) != (*m_size2) )
+ {
+ if( (*m_size1) < (*m_size2) )
+ {
+ H5Tclose( *m_tid1 );
+
+ if(( (*m_tid1) = h5tools_get_native_type(f_tid2_id)) < 0)
+ {
+ ret = FAIL;
+ goto out;
+ }
+
+ *m_size1 = H5Tget_size( *m_tid1 );
+ } /* end if */
+ else {
+ H5Tclose(*m_tid2);
+ if(( (*m_tid2) = h5tools_get_native_type(f_tid1_id)) < 0)
+ {
+ ret = FAIL;
+ goto out;
+ }
+
+ *m_size2 = H5Tget_size(*m_tid2);
+ } /* end else */
+ } /* end if */
+ HDassert( (*m_size1) == (*m_size2) );
+
+out:
+ return ret;
+}