diff options
author | Jonathan Kim <jkm@hdfgroup.org> | 2012-08-15 16:04:26 (GMT) |
---|---|---|
committer | Jonathan Kim <jkm@hdfgroup.org> | 2012-08-15 16:04:26 (GMT) |
commit | 231fc4d7818c037844aa8adb9f514da8e6c37fa9 (patch) | |
tree | e92f8eb7e6f2217c1808bd9dd00f1da9adfa1a2c /tools/h5diff | |
parent | d27ec1d3bd4740d7d962f26da9b2a19a27592273 (diff) | |
download | hdf5-231fc4d7818c037844aa8adb9f514da8e6c37fa9.zip hdf5-231fc4d7818c037844aa8adb9f514da8e6c37fa9.tar.gz hdf5-231fc4d7818c037844aa8adb9f514da8e6c37fa9.tar.bz2 |
[svn-r22684] Purpose:
Address HDFFV-7942 - h5diff: incorrect result for comparing attribute data with different type size in same class
Description:
When comparing attribute data values with same type class but different size, the result was incorrect. It was due to the size difference and got truncated.
Fixed to match up the smaller type size to big type size like what dataset does.
Tested:
jam (linux32-LE), koala (linux64-LE), ostrich (linuxppc64-BE), tejeda (mac32-LE), linew (solaris-BE), Windows (32-LE cmake), cmake (jam)
Diffstat (limited to 'tools/h5diff')
-rw-r--r-- | tools/h5diff/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tools/h5diff/h5diffgentest.c | 17 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_59.txt | 11 | ||||
-rw-r--r-- | tools/h5diff/testfiles/h5diff_dtypes.h5 | bin | 10776 -> 11416 bytes | |||
-rwxr-xr-x | tools/h5diff/testh5diff.sh | 5 |
5 files changed, 40 insertions, 0 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 c370f79..a1bf0b5 100644 --- a/tools/h5diff/h5diffgentest.c +++ b/tools/h5diff/h5diffgentest.c @@ -759,6 +759,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}}; @@ -790,6 +791,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 @@ -880,6 +884,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 Binary files differindex 7c3cd9d..ffa5264 100644 --- a/tools/h5diff/testfiles/h5diff_dtypes.h5 +++ b/tools/h5diff/testfiles/h5diff_dtypes.h5 diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 7e95e80..db37f24 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -234,6 +234,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 @@ -626,6 +627,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 # ############################################################################## |