summaryrefslogtreecommitdiffstats
path: root/tools/h5diff
diff options
context:
space:
mode:
authorJonathan Kim <jkm@hdfgroup.org>2012-03-22 19:35:41 (GMT)
committerJonathan Kim <jkm@hdfgroup.org>2012-03-22 19:35:41 (GMT)
commitb462f48e9b308886b6ed455a4aae7cbf0b8a2749 (patch)
treec5c70cb10b5e53322bd089ecfa2b422bf70cfe68 /tools/h5diff
parentd6f8aa5c53fb890730befcbf985a7fa9aa38c0ec (diff)
downloadhdf5-b462f48e9b308886b6ed455a4aae7cbf0b8a2749.zip
hdf5-b462f48e9b308886b6ed455a4aae7cbf0b8a2749.tar.gz
hdf5-b462f48e9b308886b6ed455a4aae7cbf0b8a2749.tar.bz2
[svn-r22124] Purpose:
Fix for HDFFV-7837 - h5diff: incorrect behavior with exclude-path option when unique object exist only in one file Description: If unique objects exists only in one file and try to exclude the unique objects with --exclude-path option, h5diff missed excluding some objects. Fixed to exclude objects correctly in such case. Test cases were added and tagged with jira#. Merged from HDF5 trunk r22114. 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.txt18
-rw-r--r--tools/h5diff/h5diffgentest.c100
-rw-r--r--tools/h5diff/testfiles/h5diff_485.txt11
-rw-r--r--tools/h5diff/testfiles/h5diff_486.txt11
-rw-r--r--tools/h5diff/testfiles/h5diff_487.txt12
-rw-r--r--tools/h5diff/testfiles/h5diff_exclude3-1.h5bin0 -> 4792 bytes
-rw-r--r--tools/h5diff/testfiles/h5diff_exclude3-2.h5bin0 -> 2176 bytes
-rwxr-xr-xtools/h5diff/testh5diff.sh11
8 files changed, 162 insertions, 1 deletions
diff --git a/tools/h5diff/CMakeLists.txt b/tools/h5diff/CMakeLists.txt
index f178f19..dfd1800 100644
--- a/tools/h5diff/CMakeLists.txt
+++ b/tools/h5diff/CMakeLists.txt
@@ -139,6 +139,9 @@ IF (BUILD_TESTING)
h5diff_482.txt
h5diff_483.txt
h5diff_484.txt
+ h5diff_485.txt
+ h5diff_486.txt
+ h5diff_487.txt
h5diff_50.txt
h5diff_51.txt
h5diff_52.txt
@@ -253,6 +256,8 @@ IF (BUILD_TESTING)
h5diff_exclude1-2.h5
h5diff_exclude2-1.h5
h5diff_exclude2-2.h5
+ h5diff_exclude3-1.h5
+ h5diff_exclude3-2.h5
h5diff_comp_vl_strs.h5
h5diff_attr_v_level1.h5
h5diff_attr_v_level2.h5
@@ -490,6 +495,9 @@ IF (BUILD_TESTING)
# different structure and obj names
SET (EXCLUDE_FILE2_1 h5diff_exclude2-1.h5)
SET (EXCLUDE_FILE2_2 h5diff_exclude2-2.h5)
+ # Only one file contains unique objs. Common objs are same.
+ SET (EXCLUDE_FILE3_1 h5diff_exclude3-1.h5)
+ SET (EXCLUDE_FILE3_2 h5diff_exclude3-2.h5)
# compound type with multiple vlen string types
SET (COMP_VL_STRS_FILE h5diff_comp_vl_strs.h5)
# container types (array,vlen) with multiple nested compound types
@@ -1359,6 +1367,16 @@ ADD_H5_TEST (h5diff_483 1 -v --exclude-path "/group1" ${EXCLUDE_FILE2_1} ${EXCLU
# Exclude from group compare
ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUDE_FILE1_2} /group1)
+#
+# Only one file contains unique objs. Common objs are same.
+# (HDFFV-7837)
+#
+ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5)
+ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5)
+ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5)
+
+
+
# ##############################################################################
# # diff various multiple vlen and fixed strings in a compound type dataset
# ##############################################################################
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index d58e1b4..b57c98a 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -77,6 +77,9 @@ hsize_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
/* different structure and obj names */
#define EXCLUDE_FILE2_1 "h5diff_exclude2-1.h5"
#define EXCLUDE_FILE2_2 "h5diff_exclude2-2.h5"
+/* only one file has unique objs */
+#define EXCLUDE_FILE3_1 "h5diff_exclude3-1.h5"
+#define EXCLUDE_FILE3_2 "h5diff_exclude3-2.h5"
/* compound type with multiple vlen string types */
#define COMP_VL_STRS_FILE "h5diff_comp_vl_strs.h5"
/* attribute compre with verbose level */
@@ -144,6 +147,7 @@ static int test_group_recurse(const char *fname1, const char *fname2);
static int test_group_recurse2(void);
static int test_exclude_obj1(const char *fname1, const char *fname2);
static int test_exclude_obj2(const char *fname1, const char *fname2);
+static int test_exclude_obj3(const char *fname1, const char *fname2);
static int test_comp_vlen_strings(const char *fname1, const char *grp_name, int is_file_new);
static int test_attributes_verbose_level(const char *fname1, const char *fname2);
static int test_enums(const char *fname);
@@ -213,6 +217,7 @@ int main(void)
test_exclude_obj1(EXCLUDE_FILE1_1, EXCLUDE_FILE1_2);
test_exclude_obj2(EXCLUDE_FILE2_1, EXCLUDE_FILE2_2);
+ test_exclude_obj3(EXCLUDE_FILE3_1, EXCLUDE_FILE3_2);
/* diff various multiple vlen and fixlen string types in a compound dataset */
test_comp_vlen_strings(COMP_VL_STRS_FILE, "group", 1);
@@ -3344,6 +3349,100 @@ out:
/*-------------------------------------------------------------------------
*
+* Purpose: Create test files for excluding obj.
+* Only one file contains unique objs. Common objs are same.
+* Test : exclude unique objs to verify the rest are same
+* - HDFFV-7837
+*
+* Programmer: Jonathan Kim (Mar, 19, 2012)
+*
+*-------------------------------------------------------------------------*/
+static int test_exclude_obj3(const char *fname1, const char *fname2)
+{
+ hid_t fid1=0;
+ hid_t fid2=0;
+ hid_t gid1=0;
+ hsize_t dims2[2] = {2,4};
+ int data1[4][2] = {{0,0},{0,0},{0,0},{0,0}};
+ herr_t status = SUCCEED;
+
+ /*-----------------------------------------------------------------------
+ * Create file(s)
+ *------------------------------------------------------------------------*/
+ fid1 = H5Fcreate (fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ fid2 = H5Fcreate (fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if (fid2 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Fcreate failed.\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+
+ /*-----------------------------------------------------------------------
+ * Group
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (gid1 < 0)
+ {
+ fprintf(stderr, "Error: %s> H5Gcreate2 failed.\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /*-----------------------------------------------------------------------
+ * Datasets
+ *------------------------------------------------------------------------*/
+ /* file1 */
+ status = write_dset(fid1,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ status = write_dset(gid1,2,dims2,"dset",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname1);
+ status = FAIL;
+ goto out;
+ }
+
+ /* file2 */
+ status = write_dset(fid2,2,dims2,"dset1",H5T_NATIVE_INT,data1);
+ if (status == FAIL)
+ {
+ fprintf(stderr, "Error: %s> write_dset failed\n", fname2);
+ status = FAIL;
+ goto out;
+ }
+
+out:
+ /*-----------------------------------------------------------------------
+ * Close
+ *-----------------------------------------------------------------------*/
+ if(fid1)
+ H5Fclose(fid1);
+ if(fid2)
+ H5Fclose(fid2);
+ if(gid1)
+ H5Gclose(gid1);
+
+ return status;
+}
+
+/*-------------------------------------------------------------------------
+*
* Purpose: Create test files for multiple variable length string/string array
* along with fixed length string/string array types in
* a compound type dataset.
@@ -4717,7 +4816,6 @@ static void test_non_comparables (const char * fname, int make_diffs)
int rank_attr;
char data1_str[DIM_ARRY][STR_SIZE]= {"ab","cd","ef"};
herr_t status = SUCCEED;
- int i;
void *dset_data_ptr1=NULL;
void *dset_data_ptr2=NULL;
void *dset_data_ptr3=NULL;
diff --git a/tools/h5diff/testfiles/h5diff_485.txt b/tools/h5diff/testfiles/h5diff_485.txt
new file mode 100644
index 0000000..4175809
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_485.txt
@@ -0,0 +1,11 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_486.txt b/tools/h5diff/testfiles/h5diff_486.txt
new file mode 100644
index 0000000..4175809
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_486.txt
@@ -0,0 +1,11 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+EXIT CODE: 0
diff --git a/tools/h5diff/testfiles/h5diff_487.txt b/tools/h5diff/testfiles/h5diff_487.txt
new file mode 100644
index 0000000..8555a71
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_487.txt
@@ -0,0 +1,12 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x /group1
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+EXIT CODE: 1
diff --git a/tools/h5diff/testfiles/h5diff_exclude3-1.h5 b/tools/h5diff/testfiles/h5diff_exclude3-1.h5
new file mode 100644
index 0000000..f9cc83d
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_exclude3-1.h5
Binary files differ
diff --git a/tools/h5diff/testfiles/h5diff_exclude3-2.h5 b/tools/h5diff/testfiles/h5diff_exclude3-2.h5
new file mode 100644
index 0000000..f811905
--- /dev/null
+++ b/tools/h5diff/testfiles/h5diff_exclude3-2.h5
Binary files differ
diff --git a/tools/h5diff/testh5diff.sh b/tools/h5diff/testh5diff.sh
index 2e2feb9..27fb253 100755
--- a/tools/h5diff/testh5diff.sh
+++ b/tools/h5diff/testh5diff.sh
@@ -111,6 +111,8 @@ $SRC_H5DIFF_TESTFILES/h5diff_exclude1-1.h5
$SRC_H5DIFF_TESTFILES/h5diff_exclude1-2.h5
$SRC_H5DIFF_TESTFILES/h5diff_exclude2-1.h5
$SRC_H5DIFF_TESTFILES/h5diff_exclude2-2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude3-1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_exclude3-2.h5
$SRC_H5DIFF_TESTFILES/h5diff_comp_vl_strs.h5
$SRC_H5DIFF_TESTFILES/compounds_array_vlen1.h5
$SRC_H5DIFF_TESTFILES/compounds_array_vlen2.h5
@@ -1027,6 +1029,15 @@ TOOLTEST h5diff_483.txt -v --exclude-path "/group1" h5diff_exclude2-1.h5 h5diff_
# Exclude from group compare
TOOLTEST h5diff_484.txt -v --exclude-path "/dset3" h5diff_exclude1-1.h5 h5diff_exclude1-2.h5 /group1
+#
+# Only one file contains unique objs. Common objs are same.
+# (HDFFV-7837)
+#
+TOOLTEST h5diff_485.txt -v --exclude-path "/group1" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5
+TOOLTEST h5diff_486.txt -v --exclude-path "/group1" h5diff_exclude3-2.h5 h5diff_exclude3-1.h5
+TOOLTEST h5diff_487.txt -v --exclude-path "/group1/dset" h5diff_exclude3-1.h5 h5diff_exclude3-2.h5
+
+
# ##############################################################################
# # diff various multiple vlen and fixed strings in a compound type dataset
# ##############################################################################