diff options
author | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-03-15 18:08:47 (GMT) |
---|---|---|
committer | Pedro Vicente Nunes <pvn@hdfgroup.org> | 2006-03-15 18:08:47 (GMT) |
commit | e7fd69d4e585880979f9124ad67d5efdfc7ee05c (patch) | |
tree | 146048611f062f939dbd4daad5e623154e9fa36b /tools | |
parent | a2a98a8135c3efee38b04b1d07e4602cdff1f1ef (diff) | |
download | hdf5-e7fd69d4e585880979f9124ad67d5efdfc7ee05c.zip hdf5-e7fd69d4e585880979f9124ad67d5efdfc7ee05c.tar.gz hdf5-e7fd69d4e585880979f9124ad67d5efdfc7ee05c.tar.bz2 |
[svn-r12092] Purpose:
bug fix, new features
Description:
when comparing links , the output for the number of differences found was not being done
Solution:
print it
add 3 more tests that test the output of differences for 1) groups 2) datatypes 3) links
Platforms tested:
linux
Misc. update:
Diffstat (limited to 'tools')
25 files changed, 133 insertions, 58 deletions
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh index 12e3086..49ca6e9 100755 --- a/tools/h5diff/testh5diff.sh +++ b/tools/h5diff/testh5diff.sh @@ -281,22 +281,36 @@ TOOLTEST h5diff_18.txt file1.h5 file2.h5 -q # ############################################################################## # 2.0 -TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset group +TOOLTEST h5diff_20.txt file3.h5 file3.h5 -v dset g1 # 2.1 -TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset link +TOOLTEST h5diff_21.txt file3.h5 file3.h5 -v dset l1 # 2.2 -TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset type +TOOLTEST h5diff_22.txt file3.h5 file3.h5 -v dset t1 + +# ############################################################################## +# # compare groups, types, links (no differences and differences) +# ############################################################################## # 2.3 -TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v group group +TOOLTEST h5diff_23.txt file3.h5 file3.h5 -v g1 g1 # 2.4 -TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v type type +TOOLTEST h5diff_24.txt file3.h5 file3.h5 -v t1 t1 # 2.5 -TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v link link +TOOLTEST h5diff_25.txt file3.h5 file3.h5 -v l1 l1 + +# 2.6 +TOOLTEST h5diff_26.txt file3.h5 file3.h5 -v g1 g2 + +# 2.7 +TOOLTEST h5diff_27.txt file3.h5 file3.h5 -v t1 t2 + +# 2.8 +TOOLTEST h5diff_28.txt file3.h5 file3.h5 -v l1 l2 + # ############################################################################## diff --git a/tools/h5diff/testh5diff_basic.c b/tools/h5diff/testh5diff_basic.c index bebb70d..4036f29 100644 --- a/tools/h5diff/testh5diff_basic.c +++ b/tools/h5diff/testh5diff_basic.c @@ -14,12 +14,9 @@ #include "testh5diff.h" - /*UINT_MAX Maximum value for a variable of type unsigned int. 4294967295 */ #define UIMAX 4294967295u - - /* # ############################################################################## @@ -252,6 +249,8 @@ int test_basic(const char *file1, const char *file2) double data2[3][2] = {{1,1.1},{1.01,1.001},{1.0001,1}}; double data3[3][2] = {{100,110},{100,100},{100,100}}; double data4[3][2] = {{110,100},{90,80},{140,200}}; + int data5[3][2] = {{100,100},{100,100},{100,100}}; + int data6[3][2] = {{101,102},{103,104},{150,200}}; /*------------------------------------------------------------------------- * Create two files @@ -272,6 +271,10 @@ int test_basic(const char *file1, const char *file2) write_dset(group2_id,2,dims,"dset4",H5T_NATIVE_DOUBLE,data4); write_dset(group2_id,2,dims,"dset1",H5T_NATIVE_DOUBLE,data2); + /* integer relative */ + write_dset(group1_id,2,dims,"dset2",H5T_NATIVE_INT,data5); + write_dset(group1_id,2,dims,"dset4",H5T_NATIVE_INT,data6); + /*------------------------------------------------------------------------- * Close *------------------------------------------------------------------------- @@ -285,7 +288,8 @@ int test_basic(const char *file1, const char *file2) } /*------------------------------------------------------------------------- - * Compare different types: H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK + * Compare different HDF5 types (H5G_obj_t): + * H5G_DATASET, H5G_TYPE, H5G_GROUP, H5G_LINK *------------------------------------------------------------------------- */ @@ -293,17 +297,21 @@ int test_types(const char *file1, const char UNUSED *file2) { hid_t file1_id; - hid_t group_id; - hid_t type_id; + hid_t g1_id; + hid_t g2_id; + hid_t t1_id; + hid_t t2_id; herr_t status; hsize_t dims[1]={1}; - /* Compound datatype */ - typedef struct s_t + typedef struct s1_t { int a; float b; - } s_t; - + } s1_t; + typedef struct s2_t + { + int a; + } s2_t; /*------------------------------------------------------------------------- * Create one file @@ -321,28 +329,35 @@ int test_types(const char *file1, const char UNUSED *file2) * H5G_GROUP *------------------------------------------------------------------------- */ - group_id = H5Gcreate(file1_id, "group", 0); - status = H5Gclose(group_id); + g1_id = H5Gcreate(file1_id, "g1", 0); + status = H5Gclose(g1_id); + g2_id = H5Gcreate(file1_id, "g2", 0); + status = H5Gclose(g2_id); /*------------------------------------------------------------------------- * H5G_TYPE *------------------------------------------------------------------------- */ - /* Create a memory compound datatype */ - type_id = H5Tcreate (H5T_COMPOUND, sizeof(s_t)); - H5Tinsert(type_id, "a", HOFFSET(s_t, a), H5T_NATIVE_INT); - H5Tinsert(type_id, "b", HOFFSET(s_t, b), H5T_NATIVE_FLOAT); - /* Commit compound datatype and close it */ - H5Tcommit(file1_id, "type", type_id); - H5Tclose(type_id); + /* create and commit datatype 1 */ + t1_id = H5Tcreate (H5T_COMPOUND, sizeof(s1_t)); + H5Tinsert(t1_id, "a", HOFFSET(s1_t, a), H5T_NATIVE_INT); + H5Tinsert(t1_id, "b", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); + H5Tcommit(file1_id, "t1", t1_id); + H5Tclose(t1_id); + /* create and commit datatype 2 */ + t2_id = H5Tcreate (H5T_COMPOUND, sizeof(s2_t)); + H5Tinsert(t2_id, "a", HOFFSET(s2_t, a), H5T_NATIVE_INT); + H5Tcommit(file1_id, "t2", t2_id); + H5Tclose(t2_id); /*------------------------------------------------------------------------- * H5G_LINK *------------------------------------------------------------------------- */ - status = H5Glink(file1_id, H5G_LINK_SOFT, "dset", "link"); + status = H5Glink(file1_id, H5G_LINK_SOFT, "g1", "l1"); + status = H5Glink(file1_id, H5G_LINK_SOFT, "g2", "l2"); /*------------------------------------------------------------------------- * Close @@ -353,9 +368,6 @@ int test_types(const char *file1, const char UNUSED *file2) } - - - /*------------------------------------------------------------------------- * Datasets datatypes *------------------------------------------------------------------------- diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index b61cc60..3322d99 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1055,7 +1055,11 @@ diff (hid_t file1_id, nfound = (ret != 0) ? 1 : 0; if (print_objname (options, nfound)) - parallel_print("Soft Link: <%s> and <%s>\n", path1, path2); + parallel_print("Soft Link: <%s> and <%s>\n", path1, path2); + + /* always print the number of differences found in verbose mode */ + if (options->m_verbose) + print_found(nfound); HDfree (buf1); HDfree (buf2); diff --git a/tools/testfiles/file1.h5 b/tools/testfiles/file1.h5 Binary files differindex d8f3dac..51808c4 100644 --- a/tools/testfiles/file1.h5 +++ b/tools/testfiles/file1.h5 diff --git a/tools/testfiles/file2.h5 b/tools/testfiles/file2.h5 Binary files differindex b47d4ba..7c14cf3 100644 --- a/tools/testfiles/file2.h5 +++ b/tools/testfiles/file2.h5 diff --git a/tools/testfiles/file3.h5 b/tools/testfiles/file3.h5 Binary files differindex bf09dda..3c63d04 100644 --- a/tools/testfiles/file3.h5 +++ b/tools/testfiles/file3.h5 diff --git a/tools/testfiles/file4.h5 b/tools/testfiles/file4.h5 Binary files differindex 81dde1d..9b9ebdb 100644 --- a/tools/testfiles/file4.h5 +++ b/tools/testfiles/file4.h5 diff --git a/tools/testfiles/file5.h5 b/tools/testfiles/file5.h5 Binary files differindex b3d2d43..ffde01b 100644 --- a/tools/testfiles/file5.h5 +++ b/tools/testfiles/file5.h5 diff --git a/tools/testfiles/file6.h5 b/tools/testfiles/file6.h5 Binary files differindex efca139..795ab83 100644 --- a/tools/testfiles/file6.h5 +++ b/tools/testfiles/file6.h5 diff --git a/tools/testfiles/file7.h5 b/tools/testfiles/file7.h5 Binary files differindex 5785901..2f48a22 100644 --- a/tools/testfiles/file7.h5 +++ b/tools/testfiles/file7.h5 diff --git a/tools/testfiles/file8.h5 b/tools/testfiles/file8.h5 Binary files differindex 1083a35..d137911 100644 --- a/tools/testfiles/file8.h5 +++ b/tools/testfiles/file8.h5 diff --git a/tools/testfiles/h5diff_11.txt b/tools/testfiles/h5diff_11.txt index 056e486..8a2f3ee 100644 --- a/tools/testfiles/h5diff_11.txt +++ b/tools/testfiles/h5diff_11.txt @@ -3,3 +3,7 @@ Expected output for 'h5diff file1.h5 file2.h5' ############################# Dataset: </g1/dset1> and </g1/dset1> 4 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -v for a list of objects. diff --git a/tools/testfiles/h5diff_13.txt b/tools/testfiles/h5diff_13.txt index 53f44c1..d498276 100644 --- a/tools/testfiles/h5diff_13.txt +++ b/tools/testfiles/h5diff_13.txt @@ -9,3 +9,7 @@ position dset1 dset1 difference [ 1 1 ] 1.000000 1.001000 0.001000 [ 2 0 ] 1.000000 1.000100 0.000100 4 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -v for a list of objects. diff --git a/tools/testfiles/h5diff_17.txt b/tools/testfiles/h5diff_17.txt index 062bff5..115547c 100644 --- a/tools/testfiles/h5diff_17.txt +++ b/tools/testfiles/h5diff_17.txt @@ -6,9 +6,9 @@ file1 file2 --------------------------------------- x x /g1 x x /g1/dset1 - x /g1/dset2 + x x /g1/dset2 x /g1/dset3 - x /g1/dset4 + x x /g1/dset4 x /g2 Group: </g1> and </g1> @@ -21,5 +21,22 @@ position dset1 dset1 difference [ 1 1 ] 1.000000 1.001000 0.001000 [ 2 0 ] 1.000000 1.000100 0.000100 4 differences found +Dataset: </g1/dset2> and </g1/dset2> +Comparison not possible: </g1/dset2> is of class H5T_INTEGER and </g1/dset2> is of class H5T_FLOAT +Warning: Different storage datatype +</g1/dset2> has file datatype H5T_STD_I32LE +</g1/dset2> has file datatype H5T_IEEE_F64LE +Comparison not supported: </g1/dset2> has sign H5T_SGN_2 and </g1/dset2> has sign H5T_SGN_ERROR +0 differences found +Dataset: </g1/dset4> and </g1/dset4> +Comparison not possible: </g1/dset4> is of class H5T_INTEGER and </g1/dset4> is of class H5T_FLOAT +Warning: Different storage datatype +</g1/dset4> has file datatype H5T_STD_I32LE +</g1/dset4> has file datatype H5T_IEEE_F64LE +Comparison not supported: </g1/dset4> has sign H5T_SGN_2 and </g1/dset4> has sign H5T_SGN_ERROR +0 differences found Group: </> and </> 0 differences found +-------------------------------- +Some objects are not comparable +-------------------------------- diff --git a/tools/testfiles/h5diff_20.txt b/tools/testfiles/h5diff_20.txt index ea38ec2..fbc5774 100644 --- a/tools/testfiles/h5diff_20.txt +++ b/tools/testfiles/h5diff_20.txt @@ -1,7 +1,7 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 -v dset group' +Expected output for 'h5diff file3.h5 file3.h5 -v dset g1' ############################# -Comparison not possible: </dset> is of type H5G_DATASET and </group> is of type H5G_GROUP +Comparison not possible: </dset> is of type H5G_DATASET and </g1> is of type H5G_GROUP -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/testfiles/h5diff_21.txt b/tools/testfiles/h5diff_21.txt index 0d0c5c0..a6bb3c8 100644 --- a/tools/testfiles/h5diff_21.txt +++ b/tools/testfiles/h5diff_21.txt @@ -1,7 +1,7 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 -v dset link' +Expected output for 'h5diff file3.h5 file3.h5 -v dset l1' ############################# -Comparison not possible: </dset> is of type H5G_DATASET and </link> is of type H5G_LINK +Comparison not possible: </dset> is of type H5G_DATASET and </l1> is of type H5G_LINK -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/testfiles/h5diff_22.txt b/tools/testfiles/h5diff_22.txt index 6a1637e..3fea287 100644 --- a/tools/testfiles/h5diff_22.txt +++ b/tools/testfiles/h5diff_22.txt @@ -1,7 +1,7 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 -v dset type' +Expected output for 'h5diff file3.h5 file3.h5 -v dset t1' ############################# -Comparison not possible: </dset> is of type H5G_DATASET and </type> is of type H5G_TYPE +Comparison not possible: </dset> is of type H5G_DATASET and </t1> is of type H5G_TYPE -------------------------------- Some objects are not comparable -------------------------------- diff --git a/tools/testfiles/h5diff_23.txt b/tools/testfiles/h5diff_23.txt index d709dc6..684b8fd 100644 --- a/tools/testfiles/h5diff_23.txt +++ b/tools/testfiles/h5diff_23.txt @@ -1,5 +1,5 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 -v group group' +Expected output for 'h5diff file3.h5 file3.h5 -v g1 g1' ############################# -Group: </group> and </group> +Group: </g1> and </g1> 0 differences found diff --git a/tools/testfiles/h5diff_24.txt b/tools/testfiles/h5diff_24.txt index 467038a..228d2a0 100644 --- a/tools/testfiles/h5diff_24.txt +++ b/tools/testfiles/h5diff_24.txt @@ -1,5 +1,5 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 -v type type' +Expected output for 'h5diff file3.h5 file3.h5 -v t1 t1' ############################# -Datatype: </type> and </type> +Datatype: </t1> and </t1> 0 differences found diff --git a/tools/testfiles/h5diff_25.txt b/tools/testfiles/h5diff_25.txt index 237a685..a2e31a3 100644 --- a/tools/testfiles/h5diff_25.txt +++ b/tools/testfiles/h5diff_25.txt @@ -1,4 +1,5 @@ ############################# -Expected output for 'h5diff file3.h5 file3.h5 -v link link' +Expected output for 'h5diff file3.h5 file3.h5 -v l1 l1' ############################# -Soft Link: </link> and </link> +Soft Link: </l1> and </l1> +0 differences found diff --git a/tools/testfiles/h5diff_26.txt b/tools/testfiles/h5diff_26.txt new file mode 100644 index 0000000..318f057 --- /dev/null +++ b/tools/testfiles/h5diff_26.txt @@ -0,0 +1,5 @@ +############################# +Expected output for 'h5diff file3.h5 file3.h5 -v g1 g2' +############################# +Group: </g1> and </g2> +1 differences found diff --git a/tools/testfiles/h5diff_27.txt b/tools/testfiles/h5diff_27.txt new file mode 100644 index 0000000..8243396 --- /dev/null +++ b/tools/testfiles/h5diff_27.txt @@ -0,0 +1,5 @@ +############################# +Expected output for 'h5diff file3.h5 file3.h5 -v t1 t2' +############################# +Datatype: </t1> and </t2> +1 differences found diff --git a/tools/testfiles/h5diff_28.txt b/tools/testfiles/h5diff_28.txt new file mode 100644 index 0000000..e662b52 --- /dev/null +++ b/tools/testfiles/h5diff_28.txt @@ -0,0 +1,5 @@ +############################# +Expected output for 'h5diff file3.h5 file3.h5 -v l1 l2' +############################# +Soft Link: </l1> and </l2> +1 differences found diff --git a/tools/testfiles/h5diff_53.txt b/tools/testfiles/h5diff_53.txt index 814ae9a..5f4aeee 100644 --- a/tools/testfiles/h5diff_53.txt +++ b/tools/testfiles/h5diff_53.txt @@ -2,10 +2,15 @@ Expected output for 'h5diff file4.h5 file4.h5 -v dset3a dset4b' ############################# Dataset: </dset3a> and </dset4b> -position dset3a dset4b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found +Warning: Different storage datatype +</dset3a> has file datatype H5T_STD_I32LE +</dset4b> has file datatype H5T_STD_I64LE +Warning: Different storage datatype +</dset3a> has file datatype H5T_STD_I32LE +</dset4b> has file datatype H5T_STD_I64LE +position dset3a dset4b difference relative +------------------------------------------------------------------------ +[ 1 0 ] 1 3 2 2 +[ 1 1 ] 1 5 4 4 +[ 2 1 ] 65 417 352 5 +6 differences found diff --git a/tools/testfiles/h5diff_54.txt b/tools/testfiles/h5diff_54.txt index 65074cf..e08aece 100644 --- a/tools/testfiles/h5diff_54.txt +++ b/tools/testfiles/h5diff_54.txt @@ -2,10 +2,9 @@ Expected output for 'h5diff file4.h5 file4.h5 -v dset4a dset4b' ############################# Dataset: </dset4a> and </dset4b> -position dset4a dset4b difference ------------------------------------------------------------- -[ 1 0 ] 1 3 2 -[ 1 1 ] 1 4 3 -[ 2 0 ] 1 5 4 -[ 2 1 ] 1 6 5 -4 differences found +position dset4a dset4b difference relative +------------------------------------------------------------------------ +[ 1 0 ] 1 3 2 2 +[ 1 1 ] 1 5 4 4 +[ 2 1 ] 65 417 352 5 +6 differences found |