summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff.c179
-rw-r--r--tools/lib/h5diff.h177
-rw-r--r--tools/lib/h5diff_array.c4439
-rw-r--r--tools/lib/h5diff_attr.c163
-rw-r--r--tools/lib/h5diff_dset.c670
-rw-r--r--tools/lib/h5tools.c140
-rw-r--r--tools/lib/h5tools.h69
-rw-r--r--tools/lib/h5tools_dump.c531
-rw-r--r--tools/lib/h5tools_dump.h80
-rw-r--r--tools/lib/h5tools_str.c84
-rw-r--r--tools/lib/h5tools_str.h7
-rw-r--r--tools/lib/h5tools_utils.c2
-rw-r--r--tools/lib/h5tools_utils.h2
-rw-r--r--tools/lib/io_timer.c1
-rw-r--r--tools/libtest/h5tools_test_utils.c4
-rw-r--r--tools/src/h5copy/h5copy.c22
-rw-r--r--tools/src/h5diff/h5diff_common.c346
-rw-r--r--tools/src/h5diff/h5diff_main.c38
-rw-r--r--tools/src/h5diff/ph5diff_main.c2
-rw-r--r--tools/src/h5dump/h5dump.c101
-rw-r--r--tools/src/h5dump/h5dump.h39
-rw-r--r--tools/src/h5dump/h5dump_ddl.c70
-rw-r--r--tools/src/h5dump/h5dump_extern.h43
-rw-r--r--tools/src/h5dump/h5dump_xml.c30
-rw-r--r--tools/src/h5format_convert/h5format_convert.c172
-rw-r--r--tools/src/h5import/h5import.c6
-rw-r--r--tools/src/h5jam/h5jam.c82
-rw-r--r--tools/src/h5jam/h5unjam.c20
-rw-r--r--tools/src/h5ls/h5ls.c277
-rw-r--r--tools/src/h5repack/h5repack.h38
-rw-r--r--tools/src/h5repack/h5repack_copy.c84
-rw-r--r--tools/src/h5repack/h5repack_main.c71
-rw-r--r--tools/src/h5repack/h5repack_parse.c2
-rw-r--r--tools/src/h5repack/h5repack_refs.c1
-rw-r--r--tools/src/h5stat/h5stat.c22
-rw-r--r--tools/src/misc/h5clear.c9
-rw-r--r--tools/src/misc/h5debug.c3
-rw-r--r--tools/src/misc/h5mkgrp.c6
-rw-r--r--tools/src/misc/h5repart.c2
-rw-r--r--tools/test/h5copy/testh5copy.sh.in12
-rw-r--r--tools/test/h5diff/CMakeTests.cmake42
-rw-r--r--tools/test/h5diff/h5diff_plugin.sh.in117
-rw-r--r--tools/test/h5diff/h5diffgentest.c118
-rw-r--r--tools/test/h5diff/testfiles/h5diff_10.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_58_ref.txt12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_600.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_603.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_606.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_612.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_615.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_621.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_622.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_623.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_624.txt15
-rw-r--r--tools/test/h5diff/testfiles/h5diff_70.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_700.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_701.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_702.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_703.txt32
-rw-r--r--tools/test/h5diff/testfiles/h5diff_80.txt64
-rw-r--r--tools/test/h5diff/testfiles/h5diff_830.txt30
-rw-r--r--tools/test/h5diff/testfiles/h5diff_eps.txt17
-rw-r--r--tools/test/h5diff/testfiles/h5diff_eps1.h5bin0 -> 2272 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_eps2.h5bin0 -> 2272 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_reg.txt9
-rw-r--r--tools/test/h5diff/testfiles/h5diff_strings1.h5 (renamed from tools/test/h5diff/testfiles/diff_strings1.h5)bin4640 -> 4640 bytes
-rw-r--r--tools/test/h5diff/testfiles/h5diff_strings2.h5 (renamed from tools/test/h5diff/testfiles/diff_strings2.h5)bin4640 -> 4640 bytes
-rw-r--r--tools/test/h5diff/testh5diff.sh.in76
-rw-r--r--tools/test/h5dump/h5dump_plugin.sh.in28
-rw-r--r--tools/test/h5dump/h5dumpgentest.c10
-rw-r--r--tools/test/h5dump/testh5dump.sh.in381
-rw-r--r--tools/test/h5dump/testh5dumppbits.sh.in158
-rw-r--r--tools/test/h5dump/testh5dumpvds.sh.in172
-rw-r--r--tools/test/h5dump/testh5dumpxml.sh.in31
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err7
-rw-r--r--tools/test/h5format_convert/testh5fc.sh.in2
-rw-r--r--tools/test/h5jam/tellub.c46
-rw-r--r--tools/test/h5ls/h5ls_plugin.sh.in6
-rw-r--r--tools/test/h5repack/CMakeTests.cmake118
-rw-r--r--tools/test/h5repack/h5repack.sh.in294
-rw-r--r--tools/test/h5repack/h5repacktst.c10
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl28
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst26
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl28
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl6
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_src.h5bin0 -> 2184 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5bin0 -> 2168 bytes
-rw-r--r--tools/test/h5repack/testfiles/h5repack-help.txt3
-rw-r--r--tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl12
-rw-r--r--tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst13
-rw-r--r--tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl116
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst20
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl152
-rw-r--r--tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl150
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst32
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl187
-rw-r--r--tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl4
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl168
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst44
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl200
-rw-r--r--tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl52
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl77
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst53
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl127
-rw-r--r--tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl47
-rw-r--r--tools/test/misc/h5perf_gentest.c4
-rw-r--r--tools/test/misc/h5repart_gentest.c2
-rw-r--r--tools/test/misc/testfiles/h5mkgrp_version.txt.in2
-rw-r--r--tools/test/misc/testh5mkgrp.sh.in93
-rw-r--r--tools/test/perform/CMakeLists.txt2
-rw-r--r--tools/test/perform/chunk.c2
-rw-r--r--tools/test/perform/chunk_cache.c82
-rw-r--r--tools/test/perform/iopipe.c405
-rw-r--r--tools/test/perform/overhead.c2
-rw-r--r--tools/test/perform/perf_meta.c2
-rw-r--r--tools/testfiles/trefer_attrR.ddl6
-rw-r--r--tools/testfiles/trefer_extR.ddl6
120 files changed, 6679 insertions, 5590 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index e297c8f..8324714 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -29,7 +29,7 @@
H5_ATTR_PURE int
print_objname (diff_opt_t * opts, hsize_t nfound)
{
- return ((opts->m_verbose || nfound) && !opts->m_quiet) ? 1 : 0;
+ return ((opts->mode_verbose || nfound) && !opts->mode_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
@@ -45,7 +45,7 @@ do_print_objname (const char *OBJ, const char *path1, const char *path2, diff_op
* displaying any object or symbolic links. This improves
* readability of the output.
*/
- if (opts->m_verbose_level >= 1)
+ if (opts->mode_verbose_level >= 1)
parallel_print("\n");
parallel_print("%-7s: <%s> and <%s>\n", OBJ, path1, path2);
}
@@ -74,7 +74,7 @@ do_print_attrname (const char *attr, const char *path1, const char *path2)
static int
print_warn(diff_opt_t *opts)
{
- return ((opts->m_verbose)) ? 1: 0;
+ return ((opts->mode_verbose)) ? 1: 0;
}
@@ -141,7 +141,7 @@ is_valid_options(diff_opt_t *opts)
/*-----------------------------------------------
* no -q(quiet) with -v (verbose) or -r (report) */
- if(opts->m_quiet && (opts->m_verbose || opts->m_report)) {
+ if(opts->mode_quiet && (opts->mode_verbose || opts->mode_report)) {
parallel_print("Error: -q (quiet mode) cannot be added to verbose or report modes\n");
opts->err_stat = H5DIFF_ERR;
H5TOOLS_GOTO_DONE(0);
@@ -169,9 +169,9 @@ done:
* 0 - not excluded path
*------------------------------------------------------------------------*/
static int
-is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts)
+is_exclude_path (char *path, h5trav_type_t type, diff_opt_t *opts)
{
- struct exclude_path_list * exclude_path_ptr;
+ struct exclude_path_list *exclude_path_ptr;
int ret_cmp;
int ret_value = 0;
@@ -210,7 +210,7 @@ is_exclude_path (char * path, h5trav_type_t type, diff_opt_t *opts)
if (ret_cmp == 0) { /* found matching object */
/* excluded non-group object */
ret_value = 1;
- /* remember the type of this maching object.
+ /* remember the type of this matching object.
* if it's group, it can be used for excluding its member
* objects in this while() loop */
exclude_path_ptr->obj_type = type;
@@ -224,6 +224,71 @@ done:
return ret_value;
}
+/*-------------------------------------------------------------------------
+ * Function: is_exclude_attr
+ *
+ * Purpose: check if 'paths' are part of exclude path list
+ *
+ * Return:
+ * 1 - excluded path
+ * 0 - not excluded path
+ *------------------------------------------------------------------------*/
+static int
+is_exclude_attr (const char *path, h5trav_type_t type, diff_opt_t *opts)
+{
+ struct exclude_path_list *exclude_ptr;
+ int ret_cmp;
+ int ret_value = 0;
+
+ /* check if exclude attr option is given */
+ if (!opts->exclude_attr_path)
+ H5TOOLS_GOTO_DONE(0);
+
+ /* assign to local exclude list pointer */
+ exclude_ptr = opts->exclude_attr;
+
+ /* search objects in exclude list */
+ while (NULL != exclude_ptr) {
+ /* if exclude path is is group, exclude its members as well */
+ if (exclude_ptr->obj_type == H5TRAV_TYPE_GROUP) {
+ ret_cmp = HDstrncmp(exclude_ptr->obj_path, path,
+ HDstrlen(exclude_ptr->obj_path));
+ if (ret_cmp == 0) { /* found matching members */
+ size_t len_grp;
+
+ /* check if given path belong to an excluding group, if so
+ * exclude it as well.
+ * This verifies if “/grp1/dset1” is only under “/grp1”, but
+ * not under “/grp1xxx/” group.
+ */
+ len_grp = HDstrlen(exclude_ptr->obj_path);
+ if (path[len_grp] == '/') {
+ /* belong to excluded group! */
+ ret_value = 1;
+ break; /* while */
+ }
+ }
+ }
+ /* exclude target is not group, just exclude the object */
+ else {
+ ret_cmp = HDstrcmp(exclude_ptr->obj_path, path);
+ if (ret_cmp == 0) { /* found matching object */
+ /* excluded non-group object */
+ ret_value = 1;
+ /* remember the type of this matching object.
+ * if it's group, it can be used for excluding its member
+ * objects in this while() loop */
+ exclude_ptr->obj_type = type;
+ break; /* while */
+ }
+ }
+ exclude_ptr = exclude_ptr->next;
+ }
+
+done:
+ return ret_value;
+}
+
/*-------------------------------------------------------------------------
* Function: free_exclude_path_list
@@ -243,6 +308,25 @@ free_exclude_path_list(diff_opt_t *opts)
}
}
+
+/*-------------------------------------------------------------------------
+ * Function: free_exclude_attr_list
+ *
+ * Purpose: free exclude object attribute list from diff options
+ *------------------------------------------------------------------------*/
+static void
+free_exclude_attr_list(diff_opt_t *opts)
+{
+ struct exclude_path_list *curr = opts->exclude_attr;
+ struct exclude_path_list *next;
+
+ while (NULL != curr) {
+ next = curr->next;
+ HDfree(curr);
+ curr = next;
+ }
+}
+
/*-------------------------------------------------------------------------
* Function: build_match_list
*
@@ -288,6 +372,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
* All the objects belong to given groups are the candidates.
* So prepare to compare paths without the group names.
*/
+ H5TOOLS_DEBUG("objname1 = %s objname2 = %s ", objname1, objname2);
/* if obj1 is not root */
if (HDstrcmp (objname1,"/") != 0)
@@ -572,8 +657,8 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
*-------------------------------------------------------------------------
*/
/* open file 1 */
- if (opts->custom_vol_1) {
- if((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info_1), NULL)) < 0 ) {
+ if (opts->custom_vol[0]) {
+ if((fapl1_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info[0]), NULL)) < 0 ) {
parallel_print("h5diff: unable to create fapl for input file\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create input fapl\n");
}
@@ -587,8 +672,8 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
/* open file 2 */
- if (opts->custom_vol_2) {
- if((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info_2), NULL)) < 0 ) {
+ if (opts->custom_vol[1]) {
+ if((fapl2_id = h5tools_get_fapl(H5P_DEFAULT, &(opts->vol_info[1]), NULL)) < 0 ) {
parallel_print("h5diff: unable to create fapl for output file\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "unable to create output fapl\n");
}
@@ -627,6 +712,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
}
else
obj1fullname = HDstrdup(objname1);
+ H5TOOLS_DEBUG("obj1fullname = %s", obj1fullname);
/* make the given object2 fullpath, start with "/" */
if (HDstrncmp(objname2, "/", 1)) {
@@ -644,6 +730,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
}
else
obj2fullname = HDstrdup(objname2);
+ H5TOOLS_DEBUG("obj2fullname = %s", obj2fullname);
/*----------------------------------------------------------
* check if obj1 is root, group, single object or symlink
@@ -777,12 +864,12 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("h5diff ... dangling link");
if (opts->no_dangle_links) {
/* treat dangling link as error */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error");
}
else {
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", obj1fullname);
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
@@ -818,12 +905,12 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
H5TOOLS_DEBUG("h5diff ... dangling link");
if (opts->no_dangle_links) {
/* treat dangling link as error */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "treat dangling link as error");
}
else {
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", obj2fullname);
if (l_ret1 != 0 || l_ret2 != 0) {
nfound++;
@@ -857,8 +944,8 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
* comparing details of same objects.
*/
- if(!(opts->m_verbose || opts->m_report)) {
- H5TOOLS_DEBUG("h5diff NOT (opts->m_verbose || opts->m_report)");
+ if(!(opts->mode_verbose || opts->mode_report)) {
+ H5TOOLS_DEBUG("h5diff NOT (opts->mode_verbose || opts->mode_report)");
/* if no danglink links */
if (l_ret1 > 0 && l_ret2 > 0)
if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0)
@@ -929,9 +1016,14 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
/*------------------------------------------------------
* print the list
*/
- if(opts->m_verbose) {
+ if(opts->mode_verbose) {
unsigned u;
+ if(opts->mode_verbose_level > 2) {
+ parallel_print("file1: %s\n", fname1);
+ parallel_print("file2: %s\n", fname2);
+ }
+
parallel_print("\n");
/* if given objects is group under root */
if (HDstrcmp (obj1fullname,"/") || HDstrcmp (obj2fullname,"/"))
@@ -952,6 +1044,7 @@ h5diff(const char *fname1, const char *fname2, const char *objname1, const char
nfound = diff_match(file1_id, obj1fullname, info1_lp,
file2_id, obj2fullname, info2_lp,
match_list, opts);
+ H5TOOLS_DEBUG("diff_match nfound: %d - errstat:%d", nfound, opts->err_stat);
done:
opts->err_stat = opts->err_stat | ret_value;
@@ -1052,12 +1145,14 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*-------------------------------------------------------------------------
*/
+ H5TOOLS_DEBUG("exclude_path opts->contents:%d", opts->contents);
/* not valid compare used when --exclude-path option is used */
if (!opts->exclude_path) {
/* number of different objects */
if (info1->nused != info2->nused) {
opts->contents = 0;
}
+ H5TOOLS_DEBUG("opts->exclude_path opts->contents:%d", opts->contents);
}
/* objects in one file and not the other */
@@ -1066,6 +1161,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
opts->contents = 0;
break;
}
+ H5TOOLS_DEBUG("table->nobjs[%d] opts->contents:%d", i, opts->contents);
}
/*-------------------------------------------------------------------------
@@ -1138,9 +1234,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
opts->cmn_objs = 1;
if(!g_Parallel) {
H5TOOLS_DEBUG("diff paths - errstat:%d", opts->err_stat);
- nfound += diff(file1_id, obj1_fullpath,
- file2_id, obj2_fullpath,
- opts, &argdata);
+ nfound += diff(file1_id, obj1_fullpath, file2_id, obj2_fullpath, opts, &argdata);
} /* end if */
#ifdef H5_HAVE_PARALLEL
else {
@@ -1385,6 +1479,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
opts->err_stat = opts->err_stat | ret_value;
+ free_exclude_attr_list (opts);
+
/* free table */
if (table)
trav_table_free(table);
@@ -1409,7 +1505,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*-------------------------------------------------------------------------
*/
hsize_t
-diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t * opts, diff_args_t *argdata)
+diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts, diff_args_t *argdata)
{
int status = -1;
hid_t dset1_id = H5I_INVALID_HID;
@@ -1458,7 +1554,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
if (status == 0) {
if (opts->no_dangle_links) {
/* dangling link is error */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path1);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error");
}
@@ -1473,7 +1569,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
if (status == 0) {
if (opts->no_dangle_links) {
/* dangling link is error */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("Warning: <%s> is a dangling link.\n", path2);
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "dangling link is error");
}
@@ -1499,11 +1595,11 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
/* if objects are not the same type */
if (argdata->type[0] != argdata->type[1]) {
H5TOOLS_DEBUG("diff objects are not the same");
- if (opts->m_verbose||opts->m_list_not_cmp) {
+ if (opts->mode_verbose||opts->mode_list_not_cmp) {
parallel_print("Not comparable: <%s> is of type %s and <%s> is of type %s\n",
- path1, get_type(argdata->type[0]),
- path2, get_type(argdata->type[1]));
+ path1, get_type(argdata->type[0]), path2, get_type(argdata->type[1]));
}
+
opts->not_cmp = 1;
/* TODO: will need to update non-comparable is different
* opts->contents = 0;
@@ -1528,7 +1624,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
object_type == H5TRAV_TYPE_GROUP);
if (opts->follow_links || is_hard_link) {
/* print information is only verbose option is used */
- if(opts->m_verbose || opts->m_report) {
+ if(opts->mode_verbose || opts->mode_report) {
switch(object_type) {
case H5TRAV_TYPE_DATASET:
do_print_objname("dataset", path1, path2, opts);
@@ -1557,7 +1653,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
} /* switch(type)*/
print_found(nfound);
- } /* if(opts->m_verbose || opts->m_report) */
+ } /* if(opts->mode_verbose || opts->mode_report) */
/* exact same, so comparison is done */
H5TOOLS_GOTO_DONE(H5DIFF_NO_ERR);
@@ -1575,15 +1671,16 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed");
if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dopen2 failed");
+ H5TOOLS_DEBUG("paths: %s - %s", path1, path2);
/* verbose (-v) and report (-r) mode */
- if(opts->m_verbose || opts->m_report) {
+ if(opts->mode_verbose || opts->mode_report) {
do_print_objname("dataset", path1, path2, opts);
H5TOOLS_DEBUG("call diff_dataset 1:%s 2:%s ", path1, path2);
nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(opts->m_quiet) {
+ else if(opts->mode_quiet) {
nfound = diff_dataset(file1_id, file2_id, path1, path2, opts);
}
/* the rest (-c, none, ...) */
@@ -1603,7 +1700,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
* referenced object
*---------------------------------------------------------
*/
- if(path1) {
+ if(path1 && !is_exclude_attr(path1, object_type, opts)) {
H5TOOLS_DEBUG( "call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(dset1_id, dset2_id, path1, path2, opts);
}
@@ -1635,7 +1732,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
do_print_objname("datatype", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
print_found(nfound);
/*-----------------------------------------------------------------
@@ -1644,7 +1741,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
* referenced object
*-----------------------------------------------------------------
*/
- if(path1) {
+ if(path1 && !is_exclude_attr(path1, object_type, opts)) {
H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(type1_id, type2_id, path1, path2, opts);
}
@@ -1665,7 +1762,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
do_print_objname("group", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
print_found(nfound);
if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0)
@@ -1679,7 +1776,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
* referenced object
*-----------------------------------------------------------------
*/
- if(path1) {
+ if(path1 && !is_exclude_attr(path1, object_type, opts)) {
H5TOOLS_DEBUG("call diff_attr 1:%s 2:%s ", path1, path2);
nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts);
}
@@ -1707,7 +1804,7 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
do_print_objname("link", path1, path2, opts);
/* always print the number of differences found in verbose mode */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
print_found(nfound);
}
break;
@@ -1757,14 +1854,14 @@ diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_
} /* end else */
/* always print the number of differences found in verbose mode */
- if(opts->m_verbose)
+ if(opts->mode_verbose)
print_found(nfound);
}
break;
case H5TRAV_TYPE_UNKNOWN:
default:
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("Comparison not supported: <%s> and <%s> are of type %s\n",
path1, path2, get_type(object_type) );
opts->not_cmp = 1;
@@ -1786,7 +1883,7 @@ done:
}
/* path1 is dangling link */
else if (is_dangle_link1) {
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("obj1 <%s> is a dangling link.\n", path1);
nfound++;
if(print_objname(opts, nfound))
@@ -1794,7 +1891,7 @@ done:
}
/* path2 is dangling link */
else if (is_dangle_link2) {
- if(opts->m_verbose)
+ if(opts->mode_verbose)
parallel_print("obj2 <%s> is a dangling link.\n", path2);
nfound++;
if(print_objname(opts, nfound))
diff --git a/tools/lib/h5diff.h b/tools/lib/h5diff.h
index 37eb775..f44f653 100644
--- a/tools/lib/h5diff.h
+++ b/tools/lib/h5diff.h
@@ -18,23 +18,6 @@
#include "h5tools.h"
#include "h5trav.h"
-/*
- * Debug printf macros. The prefix allows output filtering by test scripts.
- */
-#ifdef H5DIFF_DEBUG
-#define h5difftrace(x) HDfprintf(stderr, "h5diff debug: " x)
-#define h5diffdebug2(x1, x2) HDfprintf(stderr, "h5diff debug: " x1, x2)
-#define h5diffdebug3(x1, x2, x3) HDfprintf(stderr, "h5diff debug: " x1, x2, x3)
-#define h5diffdebug4(x1, x2, x3, x4) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4)
-#define h5diffdebug5(x1, x2, x3, x4, x5) HDfprintf(stderr, "h5diff debug: " x1, x2, x3, x4, x5)
-#else
-#define h5difftrace(x)
-#define h5diffdebug2(x1, x2)
-#define h5diffdebug3(x1, x2, x3)
-#define h5diffdebug4(x1, x2, x3, x4)
-#define h5diffdebug5(x1, x2, x3, x4, x5)
-#endif
-
#define MAX_FILENAME 1024
/*-------------------------------------------------------------------------
@@ -58,6 +41,7 @@ struct exclude_path_list {
struct exclude_path_list *next;
};
+
/* Enumeration value for keeping track of whether an error occurred or differences were found */
typedef enum {
H5DIFF_NO_ERR, /* No error occurred */
@@ -66,31 +50,47 @@ typedef enum {
} diff_err_t;
typedef struct {
- int m_quiet; /* quiet mode: no output at all */
- int m_report; /* report mode: print the data */
- int m_verbose; /* verbose mode: print the data, list of objcets, warnings */
- int m_verbose_level; /* control verbose details */
- int d; /* delta, absolute value to compare */
- double delta; /* delta value */
- int p; /* relative error to compare*/
- int use_system_epsilon; /* flag to use system epsilon (1 or 0) */
- double percent; /* relative error value */
- int n; /* count, compare up to count */
- hsize_t count; /* count value */
- hbool_t follow_links; /* follow symbolic links */
- int no_dangle_links; /* return error when find dangling link */
- diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */
- int cmn_objs; /* do we have common objects */
- int not_cmp; /* are the objects comparable */
- int contents; /* equal contents */
- int do_nans; /* consider Nans while diffing floats */
- int m_list_not_cmp; /* list not comparable messages */
- int exclude_path; /* exclude path to an object */
- struct exclude_path_list * exclude; /* keep exclude path list */
- h5tools_vol_info_t vol_info_1; /* VOL information for input file */
- h5tools_vol_info_t vol_info_2; /* VOL information for output file */
- hbool_t custom_vol_1; /* Using a custom input VOL? */
- hbool_t custom_vol_2; /* Using a custom output VOL? */
+ int mode_quiet; /* quiet mode: no output at all */
+ int mode_report; /* report mode: print the data */
+ int mode_verbose; /* verbose mode: print the data, list of objcets, warnings */
+ int mode_verbose_level; /* control verbose details */
+ int mode_list_not_cmp; /* list not comparable messages */
+ int print_header; /* print header */
+ int print_percentage; /* print percentage */
+ int print_dims; /* print dimension index */
+ int delta_bool; /* delta, absolute value to compare */
+ double delta; /* delta value */
+ int use_system_epsilon; /* flag to use system epsilon (1 or 0) */
+ int percent_bool; /* relative error to compare*/
+ double percent; /* relative error value */
+ hbool_t follow_links; /* follow symbolic links */
+ int no_dangle_links; /* return error when find dangling link */
+ int cmn_objs; /* do we have common objects */
+ int not_cmp; /* are the objects comparable */
+ int contents; /* equal contents */
+ int do_nans; /* consider Nans while diffing floats */
+ int exclude_path; /* exclude path to an object */
+ int exclude_attr_path; /* exclude path to an object */
+ struct exclude_path_list *exclude; /* keep exclude path list */
+ struct exclude_path_list *exclude_attr; /* keep exclude attribute list */
+ int count_bool; /* count, compare up to count */
+ hsize_t count; /* count value */
+ diff_err_t err_stat; /* an error ocurred (2, error, 1, differences, 0, no error) */
+ hsize_t nelmts; /* total number of elements */
+ hsize_t hs_nelmts; /* number of elements to read at a time*/
+ int rank; /* dimensionality */
+ size_t m_size; /* m_size for diff */
+ hid_t m_tid; /* m_tid for diff */
+ hsize_t dims[H5S_MAX_RANK]; /* dimensions of object */
+ hsize_t p_min_idx[H5S_MAX_RANK]; /* min selected index */
+ hsize_t p_max_idx[H5S_MAX_RANK]; /* max selected index */
+ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */
+ hsize_t pos[H5S_MAX_RANK]; /* matrix position */
+ hsize_t sm_pos[H5S_MAX_RANK]; /* stripmine position */
+ char *obj_name[2]; /* name for object */
+ struct subset_t *sset[2]; /* subsetting parameters */
+ h5tools_vol_info_t vol_info[2]; /* VOL information for input file, output file */
+ hbool_t custom_vol[2]; /* Using a custom input, output VOL? */
} diff_opt_t;
@@ -103,18 +103,9 @@ typedef struct {
extern "C" {
#endif
-H5TOOLS_DLL hsize_t h5diff(const char *fname1,
- const char *fname2,
- const char *objname1,
- const char *objname2,
- diff_opt_t *opts);
+H5TOOLS_DLL hsize_t h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts);
-H5TOOLS_DLL hsize_t diff( hid_t file1_id,
- const char *path1,
- hid_t file2_id,
- const char *path2,
- diff_opt_t *opts,
- diff_args_t *argdata);
+H5TOOLS_DLL hsize_t diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t *opts, diff_args_t *argdata);
#ifdef H5_HAVE_PARALLEL
H5TOOLS_DLL void phdiff_dismiss_workers(void);
@@ -133,63 +124,29 @@ H5TOOLS_DLL void print_manager_output(void);
*/
-hsize_t diff_dataset( hid_t file1_id,
- hid_t file2_id,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *opts);
-
-hsize_t diff_datasetid( hid_t dset1_id,
- hid_t dset2_id,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *opts);
-
-
-hsize_t diff_match( hid_t file1_id, const char *grp1, trav_info_t *info1,
- hid_t file2_id, const char *grp2, trav_info_t *info2,
- trav_table_t *table, diff_opt_t *opts );
-
-hsize_t diff_array( void *_mem1,
- void *_mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- diff_opt_t *opts,
- const char *name1,
- const char *name2,
- hid_t m_type,
- hid_t container1_id,
- hid_t container2_id); /* dataset where the reference came from*/
-
-
-int diff_can_type( hid_t f_type1, /* file data type */
- hid_t f_type2, /* file data type */
- int rank1,
- int rank2,
- hsize_t *dims1,
- hsize_t *dims2,
- hsize_t *maxdim1,
- hsize_t *maxdim2,
- const char *obj1_name,
- const char *obj2_name,
- diff_opt_t *opts,
- int is_compound);
-
-hsize_t diff_attr_data(hid_t attr1_id,
- hid_t attr2_id,
- const char *attr1_name,
- const char *attr2_name,
- const char *path1,
- const char *path2,
- diff_opt_t *opts);
-
-hsize_t diff_attr(hid_t loc1_id,
- hid_t loc2_id,
- const char *path1,
- const char *path2,
- diff_opt_t *opts);
+hsize_t diff_dataset(hid_t file1_id, hid_t file2_id,
+ const char *obj1_name, const char *obj2_name, diff_opt_t *opts);
+
+hsize_t diff_datasetid(hid_t dset1_id, hid_t dset2_id,
+ const char *obj1_name, const char *obj2_name, diff_opt_t *opts);
+
+
+hsize_t diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
+ hid_t file2_id, const char *grp2, trav_info_t *info2,
+ trav_table_t *table, diff_opt_t *opts);
+
+hsize_t diff_array(void *_mem1, void *_mem2,
+ diff_opt_t *opts, hid_t container1_id, hid_t container2_id);
+
+int diff_can_type(hid_t f_type1, hid_t f_type2, int rank1, int rank2,
+ hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2,
+ diff_opt_t *opts, int is_compound);
+
+hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2,
+ const char *path1, const char *path2, diff_opt_t *opts);
+
+hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id,
+ const char *path1, const char *path2, diff_opt_t *opts);
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 52bae51..1a4c727 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -132,97 +132,39 @@ typedef struct mcomp_t {
* local prototypes
*-------------------------------------------------------------------------
*/
-static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id,
- hid_t region2_id, diff_opt_t *opts);
static hbool_t all_zero(const void *_mem, size_t size);
static int ull2float(unsigned long long ull_value, float *f_value);
-static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
- int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *opts, const char *obj1, const char *obj2, int *ph);
-static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
- hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *opts, const char *obj1, const char *obj2, int *ph);
+static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts);
+static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts);
static hbool_t equal_float(float value, float expected, diff_opt_t *opts);
static hbool_t equal_double(double value, double expected, diff_opt_t *opts);
#if H5_SIZEOF_LONG_DOUBLE !=0
static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts);
#endif
+
static int print_data(diff_opt_t *opts);
-static void print_pos(int *ph, int pp, hsize_t curr_pos, hsize_t *acc,
- hsize_t *pos, int rank, hsize_t *dims, const char *obj1,
- const char *obj2);
-static void print_char_pos(int *ph, int pp, hsize_t curr_pos, size_t u,
- hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims, const char *obj1,
- const char *obj2);
+static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u);
static void h5diff_print_char(char ch);
-static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx,
- int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos,
- diff_opt_t *opts, const char *obj1, const char *obj2,
- hid_t container1_id, hid_t container2_id, /*where the reference came from*/
- int *ph, /*print header */
- mcomp_t *members); /*compound members */
-static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
+
+static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t region2_id, diff_opt_t *opts);
+static hsize_t diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts,
+ hid_t container1_id, hid_t container2_id, mcomp_t *members);
+/* element diffs */
+static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
#if H5_SIZEOF_LONG_DOUBLE !=0
-static hsize_t diff_ldouble(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *opts,
- const char *obj1,
- const char *obj2,
- int *ph);
+static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
#endif
-static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
-static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph);
+static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
+static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts);
/*-------------------------------------------------------------------------
* NaN detection
@@ -260,26 +202,23 @@ static void close_member_types(mcomp_t *members);
*-------------------------------------------------------------------------
*/
-hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start,
- int rank, hsize_t *dims, diff_opt_t *opts, const char *name1, const char *name2,
- hid_t m_type, hid_t container1_id, hid_t container2_id)
+hsize_t
+diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_t container2_id)
{
hsize_t nfound = 0; /* number of differences found */
size_t size; /* size of datum */
unsigned char *mem1 = (unsigned char*) _mem1;
unsigned char *mem2 = (unsigned char*) _mem2;
- hsize_t acc[32]; /* accumulator position */
- hsize_t pos[32]; /* matrix position */
- int ph = 1; /* print header */
hsize_t i;
- int j;
mcomp_t members;
H5T_class_t type_class;
- H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
+ H5TOOLS_START_DEBUG(" - rank:%d hs_nelmts:%ld errstat:%d", opts->rank, opts->hs_nelmts, opts->err_stat);
+ opts->print_header = 1; /* enable print header */
+
/* get the size. */
- size = H5Tget_size(m_type);
- type_class = H5Tget_class(m_type);
+ size = H5Tget_size(opts->m_tid);
+ type_class = H5Tget_class(opts->m_tid);
/* Fast comparison first for atomic type by memcmp().
* It is OK not to list non-atomic type here because it will not be caught
@@ -289,24 +228,18 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start
type_class != H5T_COMPOUND &&
type_class != H5T_STRING &&
type_class != H5T_VLEN &&
- HDmemcmp(mem1, mem2, size*nelmts) == 0)
+ HDmemcmp(mem1, mem2, size * opts->hs_nelmts) == 0) {
+ H5TOOLS_ENDDEBUG(":Fast comparison - errstat:%d", opts->err_stat);
return 0;
-
- if (rank > 0) {
- acc[rank - 1] = 1;
- for (j = (rank - 2); j >= 0; j--) {
- acc[j] = acc[j + 1] * dims[j + 1];
- }
- for (j = 0; j < rank; j++)
- pos[j] = 0;
}
- H5TOOLS_DEBUG("diff_array type_class:%d", type_class);
+ H5TOOLS_DEBUG("type_class:%d", type_class);
switch (type_class) {
case H5T_NO_CLASS:
case H5T_TIME:
case H5T_NCLASSES:
default:
+ H5TOOLS_DEBUG("type_class:INVALID");
HDassert(0);
break;
@@ -315,37 +248,142 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start
*-------------------------------------------------------------------------
*/
case H5T_FLOAT:
- if (H5Tequal(m_type, H5T_NATIVE_FLOAT))
- nfound = diff_float(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_DOUBLE))
- nfound = diff_double(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
+ H5TOOLS_DEBUG("type_class:H5T_FLOAT");
+ if (H5Tequal(opts->m_tid, H5T_NATIVE_FLOAT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_float_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(float);
+ mem2 += sizeof(float);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_DOUBLE)){
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_double_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(double);
+ mem2 += sizeof(double);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
#if H5_SIZEOF_LONG_DOUBLE != 0
- else if (H5Tequal(m_type, H5T_NATIVE_LDOUBLE))
- nfound = diff_ldouble(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_LDOUBLE)) {
+ for ( i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ldouble_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(long double);
+ mem2 += sizeof(long double);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
#endif
break;
case H5T_INTEGER:
- if (H5Tequal(m_type, H5T_NATIVE_SCHAR))
- nfound = diff_schar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_UCHAR))
- nfound = diff_uchar(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_SHORT))
- nfound = diff_short(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_USHORT))
- nfound = diff_ushort(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_INT))
- nfound = diff_int(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_UINT))
- nfound = diff_uint(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_LONG))
- nfound = diff_long(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_ULONG))
- nfound = diff_ulong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_LLONG))
- nfound = diff_llong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
- else if (H5Tequal(m_type, H5T_NATIVE_ULLONG))
- nfound = diff_ullong(mem1, mem2, nelmts, hyper_start, rank, dims, acc, pos, opts, name1, name2, &ph);
+ H5TOOLS_DEBUG("type_class:H5T_INTEGER");
+ if (H5Tequal(opts->m_tid, H5T_NATIVE_SCHAR)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_schar_element(mem1, mem2, i, opts);
+ mem1 += sizeof(char);
+ mem2 += sizeof(char);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_UCHAR)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_uchar_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned char);
+ mem2 += sizeof(unsigned char);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_SHORT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_short_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(short);
+ mem2 += sizeof(short);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_USHORT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ushort_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned short);
+ mem2 += sizeof(unsigned short);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_INT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_int_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(int);
+ mem2 += sizeof(int);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_UINT)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_int_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned int);
+ mem2 += sizeof(unsigned int);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_LONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_long_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(long);
+ mem2 += sizeof(long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ulong_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned long);
+ mem2 += sizeof(unsigned long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_LLONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_llong_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(long long);
+ mem2 += sizeof(long long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
+ else if (H5Tequal(opts->m_tid, H5T_NATIVE_ULLONG)) {
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ nfound += diff_ullong_element(mem1, mem2, i, opts);
+
+ mem1 += sizeof(unsigned long long);
+ mem2 += sizeof(unsigned long long);
+ if (opts->count_bool && nfound >= opts->count)
+ return nfound;
+ } /* nelmts */
+ }
break;
/*-------------------------------------------------------------------------
@@ -360,13 +398,13 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start
case H5T_ARRAY:
case H5T_VLEN:
case H5T_REFERENCE:
+ H5TOOLS_DEBUG("type_class:OTHER");
HDmemset(&members, 0, sizeof(mcomp_t));
- get_member_types(m_type, &members);
- H5TOOLS_DEBUG("call diff_datum nelmts:%d - errstat:%d", nelmts, opts->err_stat);
- for (i = 0; i < nelmts; i++) {
- nfound += diff_datum(mem1 + i * size, mem2 + i * size, m_type, i, rank, dims, acc, pos, opts,
- name1, name2, container1_id, container2_id, &ph, &members);
- if (opts->n && nfound >= opts->count)
+ get_member_types(opts->m_tid, &members);
+ for (i = 0; i < opts->hs_nelmts; i++) {
+ H5TOOLS_DEBUG("opts->pos[%ld]:%ld - nelmts:%ld", i, opts->pos[i], opts->hs_nelmts);
+ nfound += diff_datum(mem1 + i * size, mem2 + i * size, i, opts, container1_id, container2_id, &members);
+ if (opts->count_bool && nfound >= opts->count)
break;
} /* i */
close_member_types(&members);
@@ -409,12 +447,7 @@ hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start
*-------------------------------------------------------------------------
*/
static hsize_t
-diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
- hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts,
- const char *obj1, const char *obj2,
- hid_t container1_id, hid_t container2_id,
- int *ph, /*print header */
- mcomp_t *members) /*compound members */
+diff_datum(void *_mem1, void *_mem2, hsize_t elemtno, diff_opt_t *opts, hid_t container1_id, hid_t container2_id, mcomp_t *members)
{
unsigned char *mem1 = (unsigned char*) _mem1;
unsigned char *mem2 = (unsigned char*) _mem2;
@@ -425,7 +458,6 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
size_t offset;
unsigned nmembs;
unsigned j;
- hsize_t nelmts;
size_t size = 0;
hbool_t iszero1;
hbool_t iszero2;
@@ -434,10 +466,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
hbool_t both_zero;
diff_err_t ret_value = opts->err_stat;
- H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
+ H5TOOLS_START_DEBUG("ph:%d elemtno:%d - errstat:%d", opts->print_header, elemtno, opts->err_stat);
- type_size = H5Tget_size(m_type);
- type_class = H5Tget_class(m_type);
+ type_size = H5Tget_size(opts->m_tid);
+ type_class = H5Tget_class(opts->m_tid);
/* Fast comparison first for atomic type by memcmp().
* It is OK not to list non-atomic type here because it will not be caught
@@ -450,7 +482,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
HDmemcmp(mem1, mem2, type_size) == 0)
H5TOOLS_GOTO_DONE(opts->err_stat);
- switch (H5Tget_class(m_type)) {
+ switch (H5Tget_class(opts->m_tid)) {
case H5T_NO_CLASS:
case H5T_TIME:
case H5T_NCLASSES:
@@ -463,18 +495,22 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
case H5T_COMPOUND:
- H5TOOLS_DEBUG("diff_datum H5T_COMPOUND");
+ H5TOOLS_DEBUG("H5T_COMPOUND");
{
- hid_t memb_type = H5I_INVALID_HID;
+ diff_opt_t cmpd_opts;
+
+ cmpd_opts = *opts;
nmembs = members->n;
for (j = 0; j < nmembs; j++) {
offset = members->offsets[j];
- memb_type = members->ids[j];
+ cmpd_opts.m_tid = members->ids[j];
- nfound += diff_datum(mem1 + offset, mem2 + offset, memb_type, idx,
- rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members->m[j]);
+ nfound += diff_datum(mem1 + offset, mem2 + offset, elemtno, &cmpd_opts, container1_id, container2_id, members->m[j]);
}
+ opts->err_stat = opts->err_stat | cmpd_opts.err_stat;
+ opts->print_header = cmpd_opts.print_header;
+ opts->not_cmp = cmpd_opts.not_cmp;
}
break;
@@ -483,7 +519,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
case H5T_STRING:
- H5TOOLS_DEBUG("diff_datum H5T_STRING");
+ H5TOOLS_DEBUG("H5T_STRING");
{
char *s = NULL;
char *sx = NULL;
@@ -492,12 +528,12 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
size_t size1;
size_t size2;
size_t sizex;
- size_t size_mtype = H5Tget_size(m_type);
- H5T_str_t pad = H5Tget_strpad(m_type);
+ size_t size_mtype = H5Tget_size(opts->m_tid);
+ H5T_str_t pad = H5Tget_strpad(opts->m_tid);
/* if variable length string */
- if (H5Tis_variable_str(m_type)) {
- H5TOOLS_DEBUG("diff_datum H5T_STRING variable");
+ if (H5Tis_variable_str(opts->m_tid)) {
+ H5TOOLS_DEBUG("H5T_STRING variable");
/* Get pointer to first string */
s1 = *(char **)((void *)mem1);
if (s1)
@@ -513,7 +549,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
size2 = 0;
}
else if (H5T_STR_NULLTERM == pad) {
- H5TOOLS_DEBUG("diff_datum H5T_STRING null term");
+ H5TOOLS_DEBUG("H5T_STRING null term");
/* Get pointer to first string */
s1 = (char*) mem1;
if (s1)
@@ -550,10 +586,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
* of length of strings.
* For now mimic the previous way.
*/
- H5TOOLS_DEBUG("diff_datum string size:%d", size1);
- H5TOOLS_DEBUG("diff_datum string size:%d", size2);
+ H5TOOLS_DEBUG("string size:%d", size1);
+ H5TOOLS_DEBUG("string size:%d", size2);
if (size1 != size2) {
- H5TOOLS_DEBUG("diff_datum string sizes difference");
+ H5TOOLS_DEBUG("string sizes difference");
nfound++;
}
if (size1 < size2) {
@@ -572,15 +608,13 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
/* check for NULL pointer for string */
if (s != NULL) {
/* try fast compare first */
- if (HDmemcmp(s, sx, size) == 0) {
- if (size1 != size2)
- if (print_data(opts))
- for (u = size; u < sizex; u++)
- character_compare(s + u, sx + u, idx, u, rank, dims, acc, pos, opts, obj1, obj2, ph);
+ if ((HDmemcmp(s, sx, size) == 0) && (size1 != size2)) {
+ for (u = size; u < sizex; u++)
+ character_compare(s + u, sx + u, elemtno, u, opts);
}
else
for (u = 0; u < size; u++)
- nfound += character_compare(s + u, sx + u, idx, u, rank, dims, acc, pos, opts, obj1, obj2, ph);
+ nfound += character_compare(s + u, sx + u, elemtno, u, opts);
} /* end check for NULL pointer for string */
}
break;
@@ -590,10 +624,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
case H5T_BITFIELD:
- H5TOOLS_DEBUG("diff_datum H5T_BITFIELD");
+ H5TOOLS_DEBUG("H5T_BITFIELD");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, idx, rank, dims, acc, pos, opts, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
break;
/*-------------------------------------------------------------------------
@@ -601,10 +635,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
case H5T_OPAQUE:
- H5TOOLS_DEBUG("diff_datum H5T_OPAQUE");
+ H5TOOLS_DEBUG("H5T_OPAQUE");
/* byte-by-byte comparison */
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, idx, rank, dims, acc, pos, opts, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
break;
/*-------------------------------------------------------------------------
@@ -617,7 +651,7 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
* compared, we convert both bit patterns to their corresponding
* enumeration constant and do a string comparison
*/
- H5TOOLS_DEBUG("diff_datum H5T_ENUM");
+ H5TOOLS_DEBUG("H5T_ENUM");
{
char enum_name1[1024];
char enum_name2[1024];
@@ -629,11 +663,11 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
/* If the enum value cannot be converted to a string
* it is set to an error string for later output.
*/
- err1 = H5Tenum_nameof(m_type, mem1, enum_name1, sizeof enum_name1);
+ err1 = H5Tenum_nameof(opts->m_tid, mem1, enum_name1, sizeof enum_name1);
if (err1 < 0)
HDsnprintf(enum_name1, sizeof(enum_name1), "**INVALID VALUE**");
- err2 = H5Tenum_nameof(m_type, mem2, enum_name2, sizeof enum_name2);
+ err2 = H5Tenum_nameof(opts->m_tid, mem2, enum_name2, sizeof enum_name2);
if (err2 < 0)
HDsnprintf(enum_name2, sizeof(enum_name2), "**INVALID VALUE**");
@@ -644,9 +678,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
* don't attempt to convert them - just report errors.
*/
nfound += 1;
+ opts->print_percentage = 0;
+ print_pos(opts, elemtno, 0);
if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(S_FORMAT, enum_name1, enum_name2);
}
}
@@ -654,15 +688,15 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
/* Both enum values were valid */
if (HDstrcmp(enum_name1, enum_name2) != 0) {
nfound = 1;
+ opts->print_percentage = 0;
+ print_pos(opts, elemtno, 0);
if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(S_FORMAT, enum_name1, enum_name2);
}
}
else {
for (u = 0; u < type_size; u++)
- nfound += character_compare_opt(mem1 + u, mem2 + u, idx, rank, dims, acc, pos, opts, obj1, obj2, ph);
+ nfound += character_compare_opt(mem1 + u, mem2 + u, elemtno, opts);
}
}
/* enable error reporting */
@@ -676,26 +710,32 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*/
case H5T_ARRAY:
{
- hid_t memb_type = H5I_INVALID_HID;
hsize_t adims[H5S_MAX_RANK];
int ndims;
+ diff_opt_t arr_opts;
+
+ H5TOOLS_DEBUG("H5T_ARRAY ph=%d", opts->print_header);
- H5TOOLS_DEBUG("diff_datum H5T_ARRAY");
+ arr_opts = *opts;
+ H5TOOLS_DEBUG("Check opts: hs_nelmts:%ld to %ld rank:%d to %ld", opts->hs_nelmts, arr_opts.hs_nelmts, opts->rank, arr_opts.rank);
/* get the array's base datatype for each element */
- memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
- ndims = H5Tget_array_ndims(m_type);
- H5Tget_array_dims2(m_type, adims);
+ arr_opts.m_tid = H5Tget_super(opts->m_tid);
+ size = H5Tget_size(arr_opts.m_tid);
+ ndims = H5Tget_array_ndims(opts->m_tid);
+ H5Tget_array_dims2(opts->m_tid, adims);
HDassert(ndims >= 1 && ndims <= H5S_MAX_RANK);
+ H5TOOLS_DEBUG("attr ph=%d", arr_opts.print_header);
/* calculate the number of array elements */
- for (u = 0, nelmts = 1; u < (unsigned) ndims; u++)
- nelmts *= adims[u];
- for (u = 0; u < nelmts; u++) {
- nfound += diff_datum(mem1 + u * size, mem2 + u * size, memb_type, idx,
- rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
- }
- H5Tclose(memb_type);
+ for (u = 0, arr_opts.hs_nelmts = 1; u < (unsigned) ndims; u++)
+ arr_opts.hs_nelmts *= adims[u];
+ for (u = 0; u < arr_opts.hs_nelmts; u++) {
+ nfound += diff_datum(mem1 + u * size, mem2 + u * size, elemtno, &arr_opts, container1_id, container2_id, members);
+ }
+ opts->err_stat = opts->err_stat | arr_opts.err_stat;
+ opts->print_header = arr_opts.print_header;
+ opts->not_cmp = arr_opts.not_cmp;
+ H5Tclose(arr_opts.m_tid);
}
break;
@@ -704,9 +744,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
case H5T_REFERENCE:
- H5TOOLS_DEBUG("diff_datum H5T_REFERENCE");
- iszero1 = all_zero(_mem1, H5Tget_size(m_type));
- iszero2 = all_zero(_mem2, H5Tget_size(m_type));
+ H5TOOLS_DEBUG("H5T_REFERENCE");
+ iszero1 = all_zero(_mem1, H5Tget_size(opts->m_tid));
+ iszero2 = all_zero(_mem2, H5Tget_size(opts->m_tid));
if (iszero1 != iszero2) {
nfound++;
H5TOOLS_GOTO_DONE(opts->err_stat);
@@ -714,13 +754,17 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
else if (!iszero1 && !iszero2) {
hid_t obj1_id = H5I_INVALID_HID;
hid_t obj2_id = H5I_INVALID_HID;
+ diff_opt_t ref_opts;
/*-------------------------------------------------------------------------
* H5T_STD_REF
* Reference
*-------------------------------------------------------------------------
*/
- if (H5Tequal(m_type, H5T_STD_REF)) {
+ ref_opts = *opts;
+ ref_opts.obj_name[0] = NULL;
+ ref_opts.obj_name[1] = NULL;
+ if (H5Tequal(ref_opts.m_tid, H5T_STD_REF)) {
/* if (type_size == H5R_STD_REF_SIZE) */
hid_t region1_id = H5I_INVALID_HID;
hid_t region2_id = H5I_INVALID_HID;
@@ -730,66 +774,67 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
H5O_type_t obj2_type = -1; /* Object type */
H5R_type_t ref_type; /* Reference type */
- H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF");
+ H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF");
ref_type = H5Rget_type(ref1_buf);
switch (ref_type) {
case H5R_OBJECT1:
H5TOOLS_DEBUG("ref_type is H5R_OBJECT1");
- if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed");
- }
- if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed");
- }
-
- /* check object type */
- if (obj1_type != obj2_type) {
- parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
- opts->not_cmp = 1;
- H5TOOLS_GOTO_DONE(opts->err_stat);
- }
-
- if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Ropen_object object 1 failed");
- }
- if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Ropen_object object 2 failed");
- }
-
- switch (obj1_type) {
- case H5O_TYPE_DATASET:
- nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
- break;
-
- case H5O_TYPE_GROUP:
- case H5O_TYPE_NAMED_DATATYPE:
- case H5O_TYPE_MAP:
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- if (opts->m_verbose)
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
- opts->not_cmp = 1;
- break;
- } /* end switch */
- if(obj1_id >= 0)
- if(H5Oclose(obj1_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed");
+ if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) >= 0) {
+ if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) >= 0) {
+ /* check object type */
+ if (obj1_type == obj2_type) {
+ switch (obj1_type) {
+ case H5O_TYPE_DATASET:
+ if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ nfound = diff_datasetid(obj1_id, obj2_id, opts->obj_name[0], opts->obj_name[1], &ref_opts);
+ if(H5Dclose(obj2_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Dclose H5R_OBJECT1 failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Ropen_object object 2 failed");
+ }
+ if(H5Dclose(obj1_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Dclose H5R_OBJECT1 failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Ropen_object object 1 failed");
+ }
+ break;
+
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_NAMED_DATATYPE:
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ if (ref_opts.mode_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ break;
+ } /* end switch */
+ }
+ else {
+ parallel_print("Different object types referenced: <%s> and <%s>", opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ ref_opts.err_stat = H5DIFF_ERR;
+ }
}
- if(obj2_id >= 0)
- if(H5Oclose(obj2_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Oclose H5R_OBJECT1 failed");
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed");
}
- if(H5Rdestroy(ref2_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed");
- if(H5Rdestroy(ref1_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT1 failed");
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed");
+ }
break;
case H5R_DATASET_REGION1:
H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
@@ -797,149 +842,143 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, &ref_opts);
if(H5Sclose(region2_id) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION1 failed");
}
if(H5Sclose(region1_id) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION1 failed");
}
- if(H5Oclose(obj2_id) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed");
+ if(H5Dclose(obj2_id) < 0)
+ H5TOOLS_INFO("H5Oclose H5R_DATASET_REGION1 failed");
}
else {
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed");
}
- if(H5Oclose(obj1_id) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Oclose H5R_DATASET_REGION1 failed");
+ if(H5Dclose(obj1_id) < 0)
+ H5TOOLS_INFO("H5Oclose H5R_DATASET_REGION1 failed");
}
else {
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_object H5R_DATASET_REGION1 failed");
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed");
}
- if(H5Rdestroy(ref2_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed");
- if(H5Rdestroy(ref1_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION1 failed");
break;
case H5R_OBJECT2:
H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
- if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed");
- }
- if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed");
- }
-
- /* check object type */
- if (obj1_type != obj2_type) {
- parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
- opts->not_cmp = 1;
- H5TOOLS_GOTO_DONE(opts->err_stat);
- }
-
- if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Ropen_object object 1 failed");
- }
- if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Ropen_object object 2 failed");
- }
-
- switch (obj1_type) {
- case H5O_TYPE_DATASET:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : DATASET");
- nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
- break;
-
- case H5O_TYPE_GROUP:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : GROUP");
- if (opts->m_verbose)
- parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", obj1, obj2);
- opts->not_cmp = 1;
- break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : NAMED");
- if (opts->m_verbose)
- parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", obj1, obj2);
- opts->not_cmp = 1;
- break;
-
- case H5O_TYPE_MAP:
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- if (opts->m_verbose)
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
- opts->not_cmp = 1;
- break;
- } /* end switch */
- if(obj1_id >= 0)
- if(H5Oclose(obj1_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
+ if (H5Rget_obj_type3(ref1_buf, H5P_DEFAULT, &obj1_type) >= 0) {
+ if (H5Rget_obj_type3(ref2_buf, H5P_DEFAULT, &obj2_type) >= 0) {
+ /* check object type */
+ if (obj1_type == obj2_type) {
+ if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ switch (obj1_type) {
+ case H5O_TYPE_DATASET:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : DATASET");
+ nfound = diff_datasetid(obj1_id, obj2_id, opts->obj_name[0], opts->obj_name[1], &ref_opts);
+ break;
+
+ case H5O_TYPE_GROUP:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : GROUP");
+ if (ref_opts.mode_verbose)
+ parallel_print("Warning: Comparison not possible of group object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT2 : NAMED");
+ if (ref_opts.mode_verbose)
+ parallel_print("Warning: Comparison not possible of named datatypes object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ if (ref_opts.mode_verbose)
+ parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ break;
+ } /* end switch */
+ if(H5Oclose(obj2_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Ropen_object object 2 failed");
+ }
+ if(H5Oclose(obj1_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Ropen_object object 1 failed");
+ }
+ }
+ else {
+ parallel_print("Different object types referenced: <%s> and <%s>", opts->obj_name[0], opts->obj_name[1]);
+ ref_opts.not_cmp = 1;
+ ref_opts.err_stat = H5DIFF_ERR;
+ }
}
- if(obj2_id >= 0)
- if(H5Oclose(obj2_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rget_obj_type3 object 2 failed");
}
- if(H5Rdestroy(ref2_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed");
- if(H5Rdestroy(ref1_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_OBJECT2 failed");
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Rget_obj_type3 object 1 failed");
+ }
break;
case H5R_DATASET_REGION2:
H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2");
/* if (obj_id < 0) - could mean that no reference was written do not throw failure */
- obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT);
- obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT);
- if((obj1_id < 0) || (obj2_id < 0)) {
- H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed");
+ if((obj1_id = H5Ropen_object(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 object 1 failed");
}
else {
- H5TOOLS_DEBUG("open_region - H5R_DATASET_REGION2");
- if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) {
- H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
- }
- else {
- if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) {
- H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
- }
- else {
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
- }
- if(H5Sclose(region2_id) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed");
+ if((obj2_id = H5Ropen_object(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ H5TOOLS_DEBUG("open_region - H5R_DATASET_REGION2");
+ if((region1_id = H5Ropen_region(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (h5tools_is_zero(ref1_buf, H5Tget_size(H5T_STD_REF))) {
+ H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
}
- else
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed");
- } /* end else to if (h5tools_is_zero(... */
- if(H5Sclose(region1_id) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Sclose H5R_DATASET_REGION2 failed");
- }
- else
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed");
- if (obj1_id >= 0)
- if(H5Dclose(obj1_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
+ else {
+ if((region2_id = H5Ropen_region(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (h5tools_is_zero(ref2_buf, H5Tget_size(H5T_STD_REF))) {
+ H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
+ }
+ else {
+ nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, &ref_opts);
+ }
+ if(H5Sclose(region2_id) < 0)
+ H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed");
+ }
+ else
+ H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed");
+ } /* end else to if (h5tools_is_zero(... */
+ if(H5Sclose(region1_id) < 0)
+ H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed");
}
- if (obj2_id >= 0)
+ else
+ H5TOOLS_ERROR(H5DIFF_ERR, "H5Ropen_region H5R_DATASET_REGION2 failed");
if(H5Dclose(obj2_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
+ ref_opts.err_stat = H5DIFF_ERR;
H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
}
- if(H5Rdestroy(ref1_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed");
- if(H5Rdestroy(ref2_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_DATASET_REGION2 failed");
+ }
+ else {
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 object 2 failed");
+ }
+ if(H5Dclose(obj1_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
+ }
}
break;
case H5R_ATTR:
@@ -948,44 +987,42 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
char name2[ATTR_NAME_MAX];
H5TOOLS_DEBUG("ref_type is H5R_ATTR");
- if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- parallel_print("Warning: Cannot open referenced attribute: attribute 1\n");
- H5TOOLS_INFO("H5Ropen_attr object 1 failed");
- }
- if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
- parallel_print("Warning: Cannot open referenced attribute: attribute 2\n");
- H5TOOLS_INFO("H5Ropen_attr object 2 failed");
- }
-
- if((obj1_id < 0) || (obj2_id < 0)) {
- H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed");
- }
- else {
- /* get name */
- if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name first attribute failed");
- /* get name */
- if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_name second attribute failed");
-
- H5TOOLS_DEBUG("H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2);
- nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, NULL, NULL, opts);
- }
+ if((obj1_id = H5Ropen_attr(ref1_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if((obj2_id = H5Ropen_attr(ref2_buf, H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ /* get name */
+ if(H5Aget_name(obj1_id, (size_t)ATTR_NAME_MAX, name1) >= 0) {
+ /* get name */
+ if(H5Aget_name(obj2_id, (size_t)ATTR_NAME_MAX, name2) >= 0) {
+ H5TOOLS_DEBUG("H5R_ATTR diff_attr_data - name1=%s, name2=%s", name1, name2);
+ nfound = diff_attr_data(obj1_id, obj2_id, name1, name2, opts->obj_name[0], opts->obj_name[1], &ref_opts);
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Aget_name second attribute failed");
+ }
+ }
+ else {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Aget_name first attribute failed");
+ }
- if(obj1_id >= 0)
- if(H5Aclose(obj1_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
+ if(H5Aclose(obj2_id) < 0) {
+ ref_opts.err_stat = H5DIFF_ERR;
+ H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
+ }
}
- if(obj2_id >= 0)
- if(H5Aclose(obj2_id) < 0) {
- opts->err_stat = H5DIFF_ERR;
+ else {
+ parallel_print("Warning: Cannot open referenced attribute2\n");
+ H5TOOLS_INFO("H5Ropen_attr object 2 failed");
+ }
+ if(H5Aclose(obj1_id) < 0) {
H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
}
- if(H5Rdestroy(ref2_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed");
- if(H5Rdestroy(ref1_buf) < 0)
- H5TOOLS_ERROR(H5DIFF_ERR, "H5Rdestroy H5R_ATTR failed");
+ }
+ else {
+ parallel_print("Warning: Cannot open referenced attribute1\n");
+ H5TOOLS_INFO("H5Ropen_attr object 1 failed");
+ }
}
break;
case H5R_BADTYPE:
@@ -993,43 +1030,20 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
default:
break;
} /* end switch */
- H5TOOLS_DEBUG("diff_datum H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, opts->err_stat);
+ if(H5Rdestroy(ref2_buf) < 0)
+ H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed");
+ if(H5Rdestroy(ref1_buf) < 0)
+ H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1 failed");
+ H5TOOLS_DEBUG("H5T_REFERENCE - H5T_STD_REF complete nfound:%d - errstat:%d", nfound, ref_opts.err_stat);
}
/*-------------------------------------------------------------------------
* H5T_STD_REF_DSETREG
* Dataset region reference
*-------------------------------------------------------------------------
*/
- else if (H5Tequal(m_type, H5T_STD_REF_DSETREG)) {
+ else if (H5Tequal(ref_opts.m_tid, H5T_STD_REF_DSETREG)) {
/* if (type_size == H5R_DSET_REG_REF_BUF_SIZE) */
- hid_t region1_id = H5I_INVALID_HID;
- hid_t region2_id = H5I_INVALID_HID;
-
- H5TOOLS_INFO("H5T_STD_REF_DSETREG reference type");
-
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rdereference2 object 1 failed");
- }
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rdereference2 object 2 failed");
- }
- if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_region object 1 failed");
- }
- if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_region object 2 failed");
- }
-
- nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts);
-
- H5Oclose(obj1_id);
- H5Oclose(obj2_id);
- H5Sclose(region1_id);
- H5Sclose(region2_id);
+ H5TOOLS_DEBUG("H5T_STD_REF_DSETREG");
}/*dataset reference*/
/*-------------------------------------------------------------------------
@@ -1037,52 +1051,15 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
* Object references. get the type and OID of the referenced object
*-------------------------------------------------------------------------
*/
- else if (H5Tequal(m_type, H5T_STD_REF_OBJ)) {
+ else if (H5Tequal(ref_opts.m_tid, H5T_STD_REF_OBJ)) {
/* if (type_size == H5R_OBJ_REF_BUF_SIZE) */
- H5O_type_t obj1_type;
- H5O_type_t obj2_type;
-
- H5TOOLS_INFO("H5T_STD_REF_OBJ reference type");
-
- if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type2 object 1 failed");
- }
- if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rget_obj_type2 object 2 failed");
- }
-
- /* check object type */
- if (obj1_type != obj2_type) {
- parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2);
- opts->not_cmp = 1;
- H5TOOLS_GOTO_DONE(opts->err_stat);
- }
-
- if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rdereference2 object 1 failed");
- }
- if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) {
- opts->err_stat = H5DIFF_ERR;
- H5TOOLS_INFO("H5Rdereference2 object 2 failed");
- }
-
- /* compare */
- if (obj1_type == H5O_TYPE_DATASET)
- nfound = diff_datasetid(obj1_id, obj2_id, NULL, NULL, opts);
- else {
- if (opts->m_verbose)
- parallel_print("Warning: Comparison not possible of object types referenced: <%s> and <%s>\n", obj1, obj2);
- opts->not_cmp = 1;
- }
-
- H5Oclose(obj1_id);
- H5Oclose(obj2_id);
+ H5TOOLS_DEBUG("H5T_STD_REF_OBJ");
}/*object reference*/
+ opts->print_header = ref_opts.print_header;
+ opts->not_cmp = ref_opts.not_cmp;
+ opts->err_stat = ref_opts.err_stat | ret_value;
}/*is zero*/
- H5TOOLS_DEBUG("diff_datum H5T_REFERENCE complete");
+ H5TOOLS_DEBUG("H5T_REFERENCE complete");
break;
/*-------------------------------------------------------------------------
@@ -1091,21 +1068,26 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*/
case H5T_VLEN:
{
- hid_t memb_type = H5I_INVALID_HID;
+ diff_opt_t vl_opts;
+
+ H5TOOLS_DEBUG("H5T_VLEN");
- H5TOOLS_DEBUG("diff_datum H5T_VLEN");
+ vl_opts = *opts;
/* get the VL sequences's base datatype for each element */
- memb_type = H5Tget_super(m_type);
- size = H5Tget_size(memb_type);
+ vl_opts.m_tid = H5Tget_super(opts->m_tid);
+ size = H5Tget_size(vl_opts.m_tid);
/* get the number of sequence elements */
- nelmts = ((hvl_t *)((void *)mem1))->len;
+ vl_opts.hs_nelmts = ((hvl_t *)((void *)mem1))->len;
- for (j = 0; j < nelmts; j++)
- nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, idx, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
- rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
+ for (j = 0; j < vl_opts.hs_nelmts; j++)
+ nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, elemtno, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
+ &vl_opts, container1_id, container2_id, members);
+ opts->print_header = vl_opts.print_header;
+ opts->not_cmp = vl_opts.not_cmp;
+ opts->err_stat = opts->err_stat | vl_opts.err_stat;
- H5Tclose(memb_type);
+ H5Tclose(vl_opts.m_tid);
}
break;
@@ -1114,81 +1096,16 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
case H5T_INTEGER:
- H5TOOLS_DEBUG("diff_datum H5T_INTEGER");
- type_sign = H5Tget_sign(m_type);
+ H5TOOLS_DEBUG("H5T_INTEGER");
+ type_sign = H5Tget_sign(opts->m_tid);
/*-------------------------------------------------------------------------
* H5T_NATIVE_SCHAR
*-------------------------------------------------------------------------
*/
if (type_size == 1 && type_sign != H5T_SGN_NONE) {
- char temp1_char;
- char temp2_char;
-
if(type_size != sizeof(char))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not char size");
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (ABS(temp1_char-temp2_char) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER(temp1_char, temp2_char);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER(temp1_char, temp2_char);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
- }
- nfound++;
- }
- }
- else if (temp1_char != temp2_char) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
- }
+ nfound += diff_schar_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_SCHAR*/
/*-------------------------------------------------------------------------
@@ -1196,75 +1113,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 1 && type_sign == H5T_SGN_NONE) {
- unsigned char temp1_uchar;
- unsigned char temp2_uchar;
-
if(type_size != sizeof(unsigned char))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned char size");
-
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
- }
- else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
- }
- nfound++;
- }
- }
- else if (temp1_uchar != temp2_uchar) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
- }
+ nfound += diff_uchar_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_UCHAR*/
/*-------------------------------------------------------------------------
@@ -1272,75 +1123,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 2 && type_sign != H5T_SGN_NONE) {
- short temp1_short;
- short temp2_short;
-
if(type_size != sizeof(short))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not short size");
-
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (ABS(temp1_short - temp2_short) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER(temp1_short, temp2_short);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER(temp1_short, temp2_short);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
- }
- nfound++;
- }
- }
- else if (temp1_short != temp2_short) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
- }
+ nfound += diff_short_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_SHORT*/
/*-------------------------------------------------------------------------
@@ -1348,75 +1133,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 2 && type_sign == H5T_SGN_NONE) {
- unsigned short temp1_ushort;
- unsigned short temp2_ushort;
-
if(type_size != sizeof(unsigned short))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned short size");
-
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
- }
- else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
- }
- nfound++;
- }
- }
- else if (temp1_ushort != temp2_ushort) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
- }
+ nfound += diff_ushort_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_USHORT*/
/*-------------------------------------------------------------------------
@@ -1424,75 +1143,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 4 && type_sign != H5T_SGN_NONE) {
- int temp1_int;
- int temp2_int;
-
if(type_size != sizeof(int))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not int size");
-
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (ABS(temp1_int-temp2_int) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER(temp1_int, temp2_int);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER(temp1_int, temp2_int);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
- }
- nfound++;
- }
- }
- else if (temp1_int != temp2_int) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
- }
+ nfound += diff_int_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_INT*/
/*-------------------------------------------------------------------------
@@ -1500,75 +1153,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 4 && type_sign == H5T_SGN_NONE) {
- unsigned int temp1_uint;
- unsigned int temp2_uint;
-
if(type_size != sizeof(unsigned int))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned int size");
-
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (PDIFF(temp1_uint, temp2_uint) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER_UNSIGN(signed int, temp1_uint, temp2_uint);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER_UNSIGN(signed int, temp1_uint, temp2_uint);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
- }
- else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
- }
- nfound++;
- }
- }
- else if (temp1_uint != temp2_uint) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
- }
+ nfound += diff_uint_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_UINT*/
/*-------------------------------------------------------------------------
@@ -1576,75 +1163,9 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 8 && type_sign != H5T_SGN_NONE) {
- long temp1_long;
- long temp2_long;
-
if(type_size != sizeof(long))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long size");
-
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (ABS(temp1_long-temp2_long) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER(temp1_long, temp2_long);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER(temp1_long, temp2_long);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
- }
- nfound++;
- }
- }
- else if (temp1_long != temp2_long) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
- }
+ nfound += diff_long_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_LONG*/
/*-------------------------------------------------------------------------
@@ -1652,76 +1173,30 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == 8 && type_sign == H5T_SGN_NONE) {
- unsigned long temp1_ulong;
- unsigned long temp2_ulong;
-
if(type_size != sizeof(unsigned long))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long size");
+ nfound += diff_ulong_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_ULONG*/
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
- /* -d and !-p */
- if (opts->d && !opts->p) {
- if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
- }
- }
- /* !-d and -p */
- else if (!opts->d && opts->p) {
- PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
- }
- nfound++;
- }
- }
- /* -d and -p */
- else if (opts->d && opts->p) {
- PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LLONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 16 && type_sign != H5T_SGN_NONE) {
+ if(type_size != sizeof(long long))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long long size");
+ nfound += diff_llong_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_LLONG*/
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
- }
- else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
- }
- nfound++;
- }
- }
- else if (temp1_ulong != temp2_ulong) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
- }
- } /*H5T_NATIVE_ULONG*/
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_ULLONG
+ *-------------------------------------------------------------------------
+ */
+ else if (type_size == 16 && type_sign == H5T_SGN_NONE) {
+ if(type_size != sizeof(unsigned long long))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not unsigned long long size");
+ nfound += diff_ullong_element(mem1, mem2, elemtno, opts);
+ } /*H5T_NATIVE_ULLONG*/
break; /* H5T_INTEGER class */
/*-------------------------------------------------------------------------
@@ -1733,319 +1208,21 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
* H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
*/
- H5TOOLS_DEBUG("diff_datum H5T_FLOAT");
+ H5TOOLS_DEBUG("H5T_FLOAT");
if (type_size == 4) {
- float temp1_float;
- float temp2_float;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
-
if(type_size != sizeof(float))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not float size");
-
- HDmemcpy(&temp1_float, mem1, sizeof(float));
- HDmemcpy(&temp2_float, mem2, sizeof(float));
-
- /* logic for detecting NaNs is different with opts -d, -p and no opts */
-
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
- if (opts->d && !opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_float);
- isnan2 = HDisnan(temp2_float);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- if (ABS(temp1_float-temp2_float) > (float) opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!opts->d && opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_float);
- isnan2 = HDisnan(temp2_float);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_float, temp2_float);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
- (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if (opts->d && opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_float);
- isnan2 = HDisnan(temp2_float);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_float, temp2_float);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
- (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- } /*H5T_NATIVE_FLOAT*/
-
+ nfound += diff_float_element(mem1, mem2, elemtno, opts);
+ }
/*-------------------------------------------------------------------------
* H5T_NATIVE_DOUBLE
*-------------------------------------------------------------------------
*/
else if (type_size == 8) {
- double temp1_double;
- double temp2_double;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
-
if(type_size != sizeof(double))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not double size");
-
- HDmemcpy(&temp1_double, mem1, sizeof(double));
- HDmemcpy(&temp2_double, mem2, sizeof(double));
-
- /* logic for detecting NaNs is different with opts -d, -p and no opts */
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
- if (opts->d && !opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- } /* opts->d && !opts->p */
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!opts->d && opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double, temp2_double);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if (opts->d && opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double, temp2_double);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent &&
- ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- } /*H5T_NATIVE_DOUBLE*/
-
+ nfound += diff_double_element(mem1, mem2, elemtno, opts);
+ }
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
/*-------------------------------------------------------------------------
@@ -2053,157 +1230,10 @@ diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t idx, int rank,
*-------------------------------------------------------------------------
*/
else if (type_size == H5_SIZEOF_LONG_DOUBLE) {
- long double temp1_double;
- long double temp2_double;
- hbool_t isnan1 = FALSE;
- hbool_t isnan2 = FALSE;
-
if(type_size != sizeof(long double)) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Type size is not long double size");
}
-
- HDmemcpy(&temp1_double, mem1, sizeof(long double));
- HDmemcpy(&temp2_double, mem2, sizeof(long double));
-
- /* logic for detecting NaNs is different with options -d, -p and no options */
-
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
- if (opts->d && !opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- } /* NaN */
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!opts->d && opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
- }
- nfound++;
- }
- } /* NaN */
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if (opts->d && opts->p) {
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double,temp2_double);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
- }
- nfound++;
- }
- } /* NaN */
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
- else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
- if (print_data(opts)) {
- print_pos(ph, 0, idx, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
+ nfound += diff_ldouble_element(mem1, mem2, elemtno, opts);
} /*H5T_NATIVE_LDOUBLE*/
#endif /* H5_SIZEOF_LONG_DOUBLE */
@@ -2320,8 +1350,8 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
npoints1 = H5Sget_select_elem_npoints(region1_id);
npoints2 = H5Sget_select_elem_npoints(region2_id);
} H5E_END_TRY;
- H5TOOLS_DEBUG("diff_region blocks: 1=%ld-2=%ld", nblocks1, nblocks2);
- H5TOOLS_DEBUG("diff_region points: 1=%ld-2=%ld", npoints1, npoints2);
+ H5TOOLS_DEBUG("blocks: 1=%ld-2=%ld", nblocks1, nblocks2);
+ H5TOOLS_DEBUG("points: 1=%ld-2=%ld", npoints1, npoints2);
if (nblocks1 != nblocks2 || npoints1 != npoints2 || ndims1 != ndims2) {
opts->not_cmp = 1;
@@ -2369,7 +1399,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
}
/* print differences if found */
- if (nfound_b && opts->m_verbose) {
+ if (nfound_b && opts->mode_verbose) {
H5O_info2_t oi1, oi2;
char *obj1_str = NULL, *obj2_str = NULL;
@@ -2437,7 +1467,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
}
}
- if (nfound_p && opts->m_verbose) {
+ if (nfound_p && opts->mode_verbose) {
parallel_print("Region points\n");
for (i = 0; i < npoints1; i++) {
hsize_t pt1, pt2;
@@ -2497,8 +1527,7 @@ done:
*-------------------------------------------------------------------------
*/
-static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
- int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
+static hsize_t character_compare(char *mem1, char *mem2, hsize_t elemtno, size_t u, diff_opt_t *opts)
{
hsize_t nfound = 0; /* differences found */
char temp1_uchar;
@@ -2506,12 +1535,14 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
- H5TOOLS_START_DEBUG(" %d=%d",temp1_uchar,temp2_uchar);
+ H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar);
if (temp1_uchar != temp2_uchar) {
if (print_data(opts)) {
- print_char_pos(ph, 0, i, u, acc, pos, rank, dims, obj1, obj2);
- parallel_print(" ");
+ opts->print_percentage = 0;
+ opts->print_dims = 1;
+ print_pos(opts, elemtno, u);
+ parallel_print(" ");
h5diff_print_char(temp1_uchar);
parallel_print(" ");
h5diff_print_char(temp2_uchar);
@@ -2532,1953 +1563,1455 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
*-------------------------------------------------------------------------
*/
-static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2,
- hsize_t i, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
+static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, hsize_t elemtno, diff_opt_t *opts)
{
hsize_t nfound = 0; /* differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
+ hbool_t both_zero = FALSE;
double per;
- hbool_t both_zero;
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ H5TOOLS_START_DEBUG(" %d=%d", temp1_uchar, temp2_uchar);
/* -d and !-p */
- if (opts->d && !opts->p) {
+ if (opts->delta_bool && !opts->percent_bool) {
if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elemtno, 0);
if (print_data(opts)) {
- print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
+ else if (!opts->delta_bool && opts->percent_bool) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elemtno, 0);
if (print_data(opts)) {
- print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
+ else if (opts->delta_bool && opts->percent_bool) {
PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elemtno, 0);
if (print_data(opts)) {
- print_pos(ph, 1, i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
nfound++;
}
}
else if (temp1_uchar != temp2_uchar) {
+ opts->print_percentage = 0;
+ print_pos(opts, elemtno, 0);
if (print_data(opts)) {
- print_pos(ph, 0, i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
nfound++;
}
+ H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero);
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_float
+ * Function: diff_float_element
*
- * Purpose: diff a H5T_NATIVE_FLOAT type
+ * Purpose: diff a single H5T_NATIVE_FLOAT type
*
* Return: number of differences found
*
*-------------------------------------------------------------------------
*/
-static hsize_t diff_float(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
-
+static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
float temp1_float;
float temp2_float;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
+
+ HDmemcpy(&temp1_float, mem1, sizeof(float));
+ HDmemcpy(&temp2_float, mem2, sizeof(float));
+
+ /* logic for detecting NaNs is different with opts -d, -p and no opts */
+
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
*/
+ if (opts->delta_bool && !opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_float);
+ isnan2 = HDisnan(temp2_float);
+ }
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_float, mem1, sizeof(float));
- HDmemcpy(&temp2_float, mem2, sizeof(float));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_float);
- isnan2 = HDisnan(temp2_float);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- if ((double) ABS(temp1_float - temp2_float) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ if ((double) ABS(temp1_float - temp2_float) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
nfound++;
-
}
- mem1 += sizeof(float);
- mem2 += sizeof(float);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_float, mem1, sizeof(float));
- HDmemcpy(&temp2_float, mem2, sizeof(float));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_float);
- isnan2 = HDisnan(temp2_float);
- }
- /* both not NaN, do the comparison */
- if ((!isnan1 && !isnan2)) {
- PER(temp1_float, temp2_float);
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_float);
+ isnan2 = HDisnan(temp2_float);
+ }
+ /* both not NaN, do the comparison */
+ if ((!isnan1 && !isnan2)) {
+ PER(temp1_float, temp2_float);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
- (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
+ nfound++;
}
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
+ (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
}
nfound++;
-
}
- mem1 += sizeof(float);
- mem2 += sizeof(float);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_float, mem1, sizeof(float));
- HDmemcpy(&temp2_float, mem2, sizeof(float));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_float);
- isnan2 = HDisnan(temp2_float);
- }
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_float);
+ isnan2 = HDisnan(temp2_float);
+ }
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_float, temp2_float);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_float, temp2_float);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
- }
- else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
- (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P_NOTCOMP, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
-
+ nfound++;
}
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ else if (per > opts->percent && (double) ABS(temp1_float - temp2_float) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ parallel_print(F_FORMAT_P, (double) temp1_float, (double) temp2_float,
+ (double) ABS(temp1_float - temp2_float), (double) ABS(1 - temp2_float / temp1_float));
}
nfound++;
-
}
- mem1 += sizeof(float);
- mem2 += sizeof(float);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
+ }
+ nfound++;
+ }
}
-
/*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_float, mem1, sizeof(float));
- HDmemcpy(&temp2_float, mem2, sizeof(float));
-
- if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
- }
- nfound++;
+ if (equal_float(temp1_float, temp2_float, opts) == FALSE) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, (double) temp1_float, (double) temp2_float, (double) ABS(temp1_float - temp2_float));
}
-
- mem1 += sizeof(float);
- mem2 += sizeof(float);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ nfound++;
+ }
}
+ H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero);
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_double
+ * Function: diff_double_element
*
- * Purpose: diff a H5T_NATIVE_DOUBLE type
+ * Purpose: diff a single H5T_NATIVE_DOUBLE type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_double(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
-
+static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
double temp1_double;
double temp2_double;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
- /*-------------------------------------------------------------------------
- * -d and !-p
- *-------------------------------------------------------------------------
- */
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(double));
- HDmemcpy(&temp2_double, mem2, sizeof(double));
+ HDmemcpy(&temp1_double, mem1, sizeof(double));
+ HDmemcpy(&temp2_double, mem2, sizeof(double));
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
+ /*-------------------------------------------------------------------------
+ * -d and !-p
+ *-------------------------------------------------------------------------
+ */
+ if (opts->delta_bool && !opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_double);
+ isnan2 = HDisnan(temp2_double);
+ }
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
- mem1 += sizeof(double);
- mem2 += sizeof(double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
- * !-d and -p
- *-------------------------------------------------------------------------
- */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(double));
- HDmemcpy(&temp2_double, mem2, sizeof(double));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double, temp2_double);
+ * !-d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (!opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_double);
+ isnan2 = HDisnan(temp2_double);
+ }
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, temp1_double, temp2_double,
- ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
+ nfound++;
}
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
nfound++;
-
}
- mem1 += sizeof(double);
- mem2 += sizeof(double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
- * -d and -p
- *-------------------------------------------------------------------------
- */
- else if (opts->d && opts->p) {
-
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(double));
- HDmemcpy(&temp2_double, mem2, sizeof(double));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
+ * -d and -p
+ *-------------------------------------------------------------------------
+ */
+ else if (opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_double);
+ isnan2 = HDisnan(temp2_double);
+ }
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double, temp2_double);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double, temp2_double);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, temp1_double, temp2_double,
- ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
+ nfound++;
}
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(F_FORMAT_P, temp1_double, temp2_double,
+ ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
- mem1 += sizeof(double);
- mem2 += sizeof(double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ }
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
- * no -d and -p
- *-------------------------------------------------------------------------
- */
+ * no -d and -p
+ *-------------------------------------------------------------------------
+ */
else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(double));
- HDmemcpy(&temp2_double, mem2, sizeof(double));
-
- if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
+ if (equal_double(temp1_double, temp2_double, opts) == FALSE) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
-
- mem1 += sizeof(double);
- mem2 += sizeof(double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ nfound++;
+ }
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_ldouble
+ * Function: diff_ldouble_element
*
- * Purpose: diff a H5T_NATIVE_LDOUBLE type
+ * Purpose: diff a single H5T_NATIVE_LDOUBLE type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
#if H5_SIZEOF_LONG_DOUBLE !=0
-static hsize_t diff_ldouble(unsigned char *mem1,
- unsigned char *mem2,
- hsize_t nelmts,
- hsize_t hyper_start,
- int rank,
- hsize_t *dims,
- hsize_t *acc,
- hsize_t *pos,
- diff_opt_t *opts,
- const char *obj1,
- const char *obj2,
- int *ph)
-
+static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
long double temp1_double;
long double temp2_double;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
hbool_t isnan1 = FALSE;
hbool_t isnan2 = FALSE;
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
+
+ HDmemcpy(&temp1_double, mem1, sizeof(long double));
+ HDmemcpy(&temp2_double, mem2, sizeof(long double));
+
+ /* logic for detecting NaNs is different with options -d, -p and no options */
+
/*-------------------------------------------------------------------------
* -d and !-p
*-------------------------------------------------------------------------
*/
+ if (opts->delta_bool && !opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_double);
+ isnan2 = HDisnan(temp2_double);
+ }
- if (opts->d && !opts->p) {
- for ( i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(long double));
- HDmemcpy(&temp2_double, mem2, sizeof(long double));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
-
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- if (ABS(temp1_double-temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- }
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ if (ABS(temp1_double-temp2_double) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
nfound++;
-
}
- mem1 += sizeof(long double);
- mem2 += sizeof(long double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ } /* NaN */
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
+ }
}
-
/*-------------------------------------------------------------------------
* !-d and -p
*-------------------------------------------------------------------------
*/
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(long double));
- HDmemcpy(&temp2_double, mem2, sizeof(long double));
+ else if (!opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_double);
+ isnan2 = HDisnan(temp2_double);
+ }
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double, temp2_double);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double,temp2_double);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, temp1_double, temp2_double,
- ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
+ nfound++;
}
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 0, hyper_start+i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
- mem1 += sizeof(long double);
- mem2 += sizeof(long double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ } /* NaN */
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
* -d and -p
*-------------------------------------------------------------------------
*/
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(long double));
- HDmemcpy(&temp2_double, mem2, sizeof(long double));
-
- /*-------------------------------------------------------------------------
- * detect NaNs
- *-------------------------------------------------------------------------
- */
- if (opts->do_nans) {
- isnan1 = HDisnan(temp1_double);
- isnan2 = HDisnan(temp2_double);
- }
+ else if (opts->delta_bool && opts->percent_bool) {
+ /*-------------------------------------------------------------------------
+ * detect NaNs
+ *-------------------------------------------------------------------------
+ */
+ if (opts->do_nans) {
+ isnan1 = HDisnan(temp1_double);
+ isnan2 = HDisnan(temp2_double);
+ }
- /* both not NaN, do the comparison */
- if (!isnan1 && !isnan2) {
- PER(temp1_double, temp2_double);
+ /* both not NaN, do the comparison */
+ if (!isnan1 && !isnan2) {
+ PER(temp1_double,temp2_double);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- else if (per > opts->percent && ABS(temp1_double - temp2_double) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1-temp2_double / temp1_double));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LD_FORMAT_P_NOTCOMP, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
}
+ nfound++;
}
- /* only one is NaN, assume difference */
- else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ else if (per > opts->percent && ABS(temp1_double-temp2_double) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LD_FORMAT_P, temp1_double, temp2_double, ABS(temp1_double - temp2_double), ABS(1 - temp2_double / temp1_double));
}
nfound++;
}
- mem1 += sizeof(long double);
- mem2 += sizeof(long double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* i */
+ } /* NaN */
+ /* only one is NaN, assume difference */
+ else if ((isnan1 && !isnan2) || (!isnan1 && isnan2)) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
+ }
}
/*-------------------------------------------------------------------------
* no -d and -p
*-------------------------------------------------------------------------
*/
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_double, mem1, sizeof(long double));
- HDmemcpy(&temp2_double, mem2, sizeof(long double));
-
- if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(F_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
- }
- nfound++;
- }
- mem1 += sizeof(long double);
- mem2 += sizeof(long double);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (equal_ldouble(temp1_double, temp2_double, opts) == FALSE) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LD_FORMAT, temp1_double, temp2_double, ABS(temp1_double - temp2_double));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
#endif /* H5_SIZEOF_LONG_DOUBLE */
/*-------------------------------------------------------------------------
- * Function: diff_schar
+ * Function: diff_schar_element
*
- * Purpose: diff a H5T_NATIVE_SCHAR type
+ * Purpose: diff a single H5T_NATIVE_SCHAR type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_schar(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
-
+static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
char temp1_char;
char temp2_char;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
+ HDmemcpy(&temp1_char, mem1, sizeof(char));
+ HDmemcpy(&temp2_char, mem2, sizeof(char));
- if (ABS(temp1_char-temp2_char) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (ABS(temp1_char-temp2_char) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
- mem1 += sizeof(char);
- mem2 += sizeof(char);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER(temp1_char, temp2_char);
- PER(temp1_char, temp2_char);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
}
- mem1 += sizeof(char);
- mem2 += sizeof(char);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
-
- PER(temp1_char, temp2_char);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER(temp1_char, temp2_char);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
}
- else if (per > opts->percent && ABS(temp1_char-temp2_char) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && ABS(temp1_char - temp2_char) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_char, temp2_char, ABS(temp1_char - temp2_char), per);
}
- mem1 += sizeof(char);
- mem2 += sizeof(char);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_char, mem1, sizeof(char));
- HDmemcpy(&temp2_char, mem2, sizeof(char));
-
- if (temp1_char != temp2_char) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
- }
- nfound++;
- }
-
- mem1 += sizeof(char);
- mem2 += sizeof(char);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_char != temp2_char) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_char, temp2_char, ABS(temp1_char - temp2_char));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_uchar
+ * Function: diff_uchar_element
*
- * Purpose: diff a H5T_NATIVE_UCHAR type
+ * Purpose: diff a single H5T_NATIVE_UCHAR type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_uchar(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned char temp1_uchar;
unsigned char temp2_uchar;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
+ HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
+ HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
- mem1 += sizeof(unsigned char);
- mem2 += sizeof(unsigned char);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
- mem1 += sizeof(unsigned char);
- mem2 += sizeof(unsigned char);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed char, temp1_uchar, temp2_uchar);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
}
- else if (per > opts->percent && PDIFF(temp1_uchar,temp2_uchar) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && PDIFF(temp1_uchar, temp2_uchar) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar), per);
}
- mem1 += sizeof(unsigned char);
- mem2 += sizeof(unsigned char);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
- HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
-
- if (temp1_uchar != temp2_uchar) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
- }
- nfound++;
- }
-
- mem1 += sizeof(unsigned char);
- mem2 += sizeof(unsigned char);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_uchar != temp2_uchar) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_uchar, temp2_uchar, PDIFF(temp1_uchar, temp2_uchar));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_short
+ * Function: diff_short_element
*
* Purpose: diff a H5T_NATIVE_SHORT type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_short(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_short_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
short temp1_short;
short temp2_short;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (ABS(temp1_short-temp2_short) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
+ HDmemcpy(&temp1_short, mem1, sizeof(short));
+ HDmemcpy(&temp2_short, mem2, sizeof(short));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (ABS(temp1_short - temp2_short) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
- mem1 += sizeof(short);
- mem2 += sizeof(short);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- PER(temp1_short, temp2_short);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER(temp1_short, temp2_short);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
}
- mem1 += sizeof(short);
- mem2 += sizeof(short);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- PER(temp1_short, temp2_short);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER(temp1_short, temp2_short);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
}
- else if (per > opts->percent && ABS(temp1_short-temp2_short) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && ABS(temp1_short - temp2_short) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_short, temp2_short, ABS(temp1_short - temp2_short), per);
}
- mem1 += sizeof(short);
- mem2 += sizeof(short);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_short, mem1, sizeof(short));
- HDmemcpy(&temp2_short, mem2, sizeof(short));
-
- if (temp1_short != temp2_short) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
- }
- nfound++;
- }
-
- mem1 += sizeof(short);
- mem2 += sizeof(short);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_short != temp2_short) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_short, temp2_short, ABS(temp1_short - temp2_short));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_ushort
+ * Function: diff_ushort_element
*
- * Purpose: diff a H5T_NATIVE_USHORT type
+ * Purpose: diff a single H5T_NATIVE_USHORT type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ushort(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
-
+static hsize_t diff_ushort_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned short temp1_ushort;
unsigned short temp2_ushort;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (PDIFF(temp1_ushort,temp2_ushort) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
+ HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
+ HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
- mem1 += sizeof(unsigned short);
- mem2 += sizeof(unsigned short);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
- PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
}
- mem1 += sizeof(unsigned short);
- mem2 += sizeof(unsigned short);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
-
- PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed short, temp1_ushort, temp2_ushort);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
}
- else if (per > opts->percent && PDIFF(temp1_ushort,temp2_ushort) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && PDIFF(temp1_ushort, temp2_ushort) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort), per);
}
- mem1 += sizeof(unsigned short);
- mem2 += sizeof(unsigned short);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short));
- HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short));
-
- if (temp1_ushort != temp2_ushort) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
- }
- nfound++;
- }
-
- mem1 += sizeof(unsigned short);
- mem2 += sizeof(unsigned short);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_ushort != temp2_ushort) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_ushort, temp2_ushort, PDIFF(temp1_ushort, temp2_ushort));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_int
+ * Function: diff_int_element
*
- * Purpose: diff a H5T_NATIVE_INT type
+ * Purpose: diff a single H5T_NATIVE_INT type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_int(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_int_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
int temp1_int;
int temp2_int;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (ABS(temp1_int-temp2_int) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
+ HDmemcpy(&temp1_int, mem1, sizeof(int));
+ HDmemcpy(&temp2_int, mem2, sizeof(int));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (ABS(temp1_int-temp2_int) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
- mem1 += sizeof(int);
- mem2 += sizeof(int);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- PER(temp1_int, temp2_int);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER(temp1_int, temp2_int);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
}
- mem1 += sizeof(int);
- mem2 += sizeof(int);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- PER(temp1_int, temp2_int);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER(temp1_int, temp2_int);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P_NOTCOMP, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
}
- else if (per > opts->percent && ABS(temp1_int-temp2_int) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && ABS(temp1_int - temp2_int) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT_P, temp1_int, temp2_int, ABS(temp1_int - temp2_int), per);
}
- mem1 += sizeof(int);
- mem2 += sizeof(int);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_int, mem1, sizeof(int));
- HDmemcpy(&temp2_int, mem2, sizeof(int));
-
- if (temp1_int != temp2_int) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
- }
- nfound++;
- }
+ else if (temp1_int != temp2_int) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(I_FORMAT, temp1_int, temp2_int, ABS(temp1_int - temp2_int));
+ }
+ nfound++;
+ }
- mem1 += sizeof(int);
- mem2 += sizeof(int);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
- }
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_uint
+ * Function: diff_uint_element
*
- * Purpose: diff a H5T_NATIVE_UINT type
+ * Purpose: diff a single H5T_NATIVE_UINT type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_uint(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_uint_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned int temp1_uint;
unsigned int temp2_uint;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (PDIFF(temp1_uint,temp2_uint) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
+ HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
+ HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (PDIFF(temp1_uint, temp2_uint) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
- mem1 += sizeof(unsigned int);
- mem2 += sizeof(unsigned int);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- PER_UNSIGN(signed int, temp1_uint, temp2_uint);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed int, temp1_uint, temp2_uint);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
}
- mem1 += sizeof(unsigned int);
- mem2 += sizeof(unsigned int);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- PER_UNSIGN(signed int, temp1_uint, temp2_uint);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed int, temp1_uint, temp2_uint);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(UI_FORMAT_P_NOTCOMP, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
}
- else if (per > opts->percent
- && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && PDIFF(temp1_uint,temp2_uint) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(UI_FORMAT_P, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint), per);
}
- mem1 += sizeof(unsigned int);
- mem2 += sizeof(unsigned int);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int));
- HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int));
-
- if (temp1_uint != temp2_uint) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(I_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
- }
- nfound++;
- }
-
- mem1 += sizeof(unsigned int);
- mem2 += sizeof(unsigned int);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_uint != temp2_uint) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(UI_FORMAT, temp1_uint, temp2_uint, PDIFF(temp1_uint, temp2_uint));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_long
+ * Function: diff_long_element
*
- * Purpose: diff a H5T_NATIVE_LONG type
+ * Purpose: diff a single H5T_NATIVE_LONG type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_long(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_long_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
long temp1_long;
long temp2_long;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (ABS(temp1_long-temp2_long) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
- }
- mem1 += sizeof(long);
- mem2 += sizeof(long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ HDmemcpy(&temp1_long, mem1, sizeof(long));
+ HDmemcpy(&temp2_long, mem2, sizeof(long));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (ABS(temp1_long-temp2_long) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- PER(temp1_long, temp2_long);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER(temp1_long, temp2_long);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
}
- mem1 += sizeof(long);
- mem2 += sizeof(long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- PER(temp1_long, temp2_long);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER(temp1_long, temp2_long);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LI_FORMAT_P_NOTCOMP, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
}
- else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && ABS(temp1_long-temp2_long) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LI_FORMAT_P, temp1_long, temp2_long, ABS(temp1_long - temp2_long), per);
}
- mem1 += sizeof(long);
- mem2 += sizeof(long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_long, mem1, sizeof(long));
- HDmemcpy(&temp2_long, mem2, sizeof(long));
-
- if (temp1_long != temp2_long) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
- }
- nfound++;
- }
-
- mem1 += sizeof(long);
- mem2 += sizeof(long);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_long != temp2_long) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LI_FORMAT, temp1_long, temp2_long, ABS(temp1_long - temp2_long));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_ulong
+ * Function: diff_ulong_element
*
- * Purpose: diff a H5T_NATIVE_ULONG type
+ * Purpose: diff a single H5T_NATIVE_ULONG type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ulong(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_ulong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned long temp1_ulong;
unsigned long temp2_ulong;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
- }
- mem1 += sizeof(unsigned long);
- mem2 += sizeof(unsigned long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
+ HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (PDIFF(temp1_ulong, temp2_ulong) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
}
- mem1 += sizeof(unsigned long);
- mem2 += sizeof(unsigned long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
- PER_UNSIGN(signed long, temp1_ulong, temp2_ulong);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULI_FORMAT_P_NOTCOMP, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
}
- else if (per > opts->percent
- && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && PDIFF(temp1_ulong,temp2_ulong) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULI_FORMAT_P, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong), per);
}
- mem1 += sizeof(unsigned long);
- mem2 += sizeof(unsigned long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
- else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long));
- HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long));
-
- if (temp1_ulong != temp2_ulong) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
- }
- nfound++;
- }
-
- mem1 += sizeof(unsigned long);
- mem2 += sizeof(unsigned long);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ else if (temp1_ulong != temp2_ulong) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULI_FORMAT, temp1_ulong, temp2_ulong, PDIFF(temp1_ulong, temp2_ulong));
+ }
+ nfound++;
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_llong
+ * Function: diff_llong_element
*
- * Purpose: diff a H5T_NATIVE_LLONG type
+ * Purpose: diff a single H5T_NATIVE_LLONG type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_llong(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims,
- hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1,
- const char *obj2, int *ph)
+static hsize_t diff_llong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
long long temp1_llong;
long long temp2_llong;
- hsize_t i;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (ABS( temp1_llong-temp2_llong) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
- }
- nfound++;
+ HDmemcpy(&temp1_llong, mem1, sizeof(long long));
+ HDmemcpy(&temp2_llong, mem2, sizeof(long long));
+
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (ABS( temp1_llong-temp2_llong) > opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
- mem1 += sizeof(long long);
- mem2 += sizeof(long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- PER(temp1_llong, temp2_llong);
+ else if (!opts->delta_bool && opts->percent_bool) {
+ PER(temp1_llong, temp2_llong);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
nfound++;
}
else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
}
nfound++;
}
- mem1 += sizeof(long long);
- mem2 += sizeof(long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
- }
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- PER(temp1_llong, temp2_llong);
+ else if (opts->delta_bool && opts->percent_bool) {
+ PER(temp1_llong, temp2_llong);
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
- }
- nfound++;
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LLI_FORMAT_P_NOTCOMP, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
- else if (per > opts->percent
- && ABS(temp1_llong-temp2_llong) > opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && ABS(temp1_llong-temp2_llong) > opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LLI_FORMAT_P, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong),per);
}
- mem1 += sizeof(long long);
- mem2 += sizeof(long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_llong, mem1, sizeof(long long));
- HDmemcpy(&temp2_llong, mem2, sizeof(long long));
-
- if (temp1_llong != temp2_llong) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
- }
- nfound++;
+ if (temp1_llong != temp2_llong) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(LLI_FORMAT, temp1_llong, temp2_llong, ABS(temp1_llong - temp2_llong));
}
-
- mem1 += sizeof(long long);
- mem2 += sizeof(long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ nfound++;
+ }
}
+ H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
+
return nfound;
}
/*-------------------------------------------------------------------------
- * Function: diff_ullong
+ * Function: diff_ullong_element
*
- * Purpose: diff a H5T_NATIVE_ULLONG type
+ * Purpose: diff a single H5T_NATIVE_ULLONG type
*
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-static hsize_t diff_ullong(unsigned char *mem1, unsigned char *mem2,
- hsize_t nelmts, hsize_t hyper_start, int rank, hsize_t *dims, hsize_t *acc,
- hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2, int *ph)
-
+static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
{
hsize_t nfound = 0; /* number of differences found */
unsigned long long temp1_ullong;
unsigned long long temp2_ullong;
- hsize_t i;
float f1, f2;
double per;
- hbool_t both_zero;
+ hbool_t both_zero = FALSE;
- /* -d and !-p */
- if (opts->d && !opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
+ H5TOOLS_START_DEBUG("delta_bool:%d - percent_bool:%d", opts->delta_bool, opts->percent_bool);
- if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
+ HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
+ HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
+
+ /* -d and !-p */
+ if (opts->delta_bool && !opts->percent_bool) {
+ if (PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
}
- mem1 += sizeof(unsigned long long);
- mem2 += sizeof(unsigned long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* !-d and -p */
- else if (!opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- ull2float(temp1_ullong, &f1);
- ull2float(temp2_ullong, &f2);
- PER(f1, f2);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
+ else if (!opts->delta_bool && opts->percent_bool) {
+ ull2float(temp1_ullong, &f1);
+ ull2float(temp2_ullong, &f2);
+ PER(f1, f2);
+
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
}
- else if (per > opts->percent) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong,temp2_ullong), per);
}
- mem1 += sizeof(unsigned long long);
- mem2 += sizeof(unsigned long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
/* -d and -p */
- else if (opts->d && opts->p) {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- ull2float(temp1_ullong, &f1);
- ull2float(temp2_ullong, &f2);
- PER(f1, f2);
-
- if (not_comparable && !both_zero) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P_NOTCOMP,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
+ else if (opts->delta_bool && opts->percent_bool) {
+ ull2float(temp1_ullong, &f1);
+ ull2float(temp2_ullong, &f2);
+ PER(f1, f2);
+
+ if (not_comparable && !both_zero) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULLI_FORMAT_P_NOTCOMP, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
}
- else if (per > opts->percent
- && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
- if (print_data(opts)) {
- print_pos(ph, 1, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT_P,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong),per);
- }
- nfound++;
+ nfound++;
+ }
+ else if (per > opts->percent && PDIFF(temp1_ullong,temp2_ullong) > (unsigned long long) opts->delta) {
+ opts->print_percentage = 1;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULLI_FORMAT_P, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong), per);
}
- mem1 += sizeof(unsigned long long);
- mem2 += sizeof(unsigned long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
+ nfound++;
}
}
else {
- for (i = 0; i < nelmts; i++) {
- HDmemcpy(&temp1_ullong, mem1, sizeof(unsigned long long));
- HDmemcpy(&temp2_ullong, mem2, sizeof(unsigned long long));
-
- if (temp1_ullong != temp2_ullong) {
- if (print_data(opts)) {
- print_pos(ph, 0, hyper_start + i, acc, pos, rank, dims, obj1, obj2);
- parallel_print(SPACES);
- parallel_print(ULLI_FORMAT,temp1_ullong,temp2_ullong,PDIFF(temp1_ullong,temp2_ullong));
- }
- nfound++;
+ if (temp1_ullong != temp2_ullong) {
+ opts->print_percentage = 0;
+ print_pos(opts, elem_idx, 0);
+ if (print_data(opts)) {
+ parallel_print(ULLI_FORMAT, temp1_ullong, temp2_ullong, PDIFF(temp1_ullong, temp2_ullong));
}
-
- mem1 += sizeof(unsigned long long);
- mem2 += sizeof(unsigned long long);
- if (opts->n && nfound >= opts->count)
- return nfound;
- } /* nelmts */
+ nfound++;
+ }
}
+ H5TOOLS_ENDDEBUG(": %d zero:%d", nfound, both_zero);
return nfound;
}
@@ -4681,7 +3214,7 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) {
static
int print_data(diff_opt_t *opts)
{
- return ((opts->m_report || opts->m_verbose) && !opts->m_quiet) ? 1 : 0;
+ return ((opts->mode_report || opts->mode_verbose) && !opts->mode_quiet) ? 1 : 0;
}
/*-------------------------------------------------------------------------
@@ -4691,25 +3224,24 @@ int print_data(diff_opt_t *opts)
*-------------------------------------------------------------------------
*/
static
-void print_header(int pp, /* print percentage */
- int rank, hsize_t *dims, const char *obj1, const char *obj2)
+void print_header(diff_opt_t *opts)
{
/* print header */
parallel_print("%-16s", "size:");
- print_dimensions(rank, dims);
+ print_dimensions(opts->rank, opts->dims);
parallel_print("%-11s", "");
- print_dimensions(rank, dims);
+ print_dimensions(opts->rank, opts->dims);
parallel_print("\n");
- if (pp) {
+ if (opts->print_percentage) {
parallel_print("%-15s %-15s %-15s %-15s %-15s\n", "position",
- (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference", "relative");
+ opts->obj_name[0], opts->obj_name[1], "difference", "relative");
parallel_print(
"------------------------------------------------------------------------\n");
}
else {
parallel_print("%-15s %-15s %-15s %-20s\n", "position",
- (obj1 != NULL) ? obj1 : " ", (obj2 != NULL) ? obj2 : " ", "difference");
+ opts->obj_name[0], opts->obj_name[1], "difference");
parallel_print(
"------------------------------------------------------------\n");
}
@@ -4722,77 +3254,94 @@ void print_header(int pp, /* print percentage */
*-------------------------------------------------------------------------
*/
static
-void print_pos(int *ph, /* print header */
- int pp, /* print percentage */
- hsize_t curr_pos, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
- const char *obj1, const char *obj2)
+void print_pos(diff_opt_t *opts, hsize_t idx, size_t u)
{
- int i;
-
- /* print header */
- if (*ph == 1) {
- *ph = 0;
-
- print_header(pp, rank, dims, obj1, obj2);
- } /* end print header */
-
- for (i = 0; i < rank; i++) {
- pos[i] = curr_pos / acc[i];
- curr_pos -= acc[i] * pos[i];
- }
- HDassert(curr_pos == 0);
+ int i,j;
+
+ H5TOOLS_START_DEBUG(" -- idx:%ld", idx);
+
+ if (print_data(opts)) {
+ /* print header */
+ if (opts->print_header == 1) {
+ opts->print_header = 0;
+
+ print_header(opts);
+ } /* end print header */
+
+ H5TOOLS_DEBUG("rank=%d", opts->rank);
+ if(opts->rank > 0) {
+ hsize_t curr_pos = idx;
+
+ parallel_print("[ ");
+ H5TOOLS_DEBUG("do calc_acc_pos[%ld] nelmts:%d - errstat:%d", i, opts->hs_nelmts, opts->err_stat);
+
+ if (opts->sset[0] != NULL) {
+ /* Subsetting is used - calculate total position */
+ hsize_t elmnt_cnt = 1;
+ hsize_t dim_cnt = 0; /* previous dim size */
+ hsize_t str_cnt = 0; /* previous dim stride */
+ hsize_t curr_idx = idx; /* calculated running position */
+ hsize_t str_idx = 0;
+ hsize_t blk_idx = 0;
+ hsize_t cnt_idx = 0;
+ hsize_t hs_idx = 0;
+ j = opts->rank-1;
+ do {
+ cnt_idx = opts->sset[0]->count.data[j]; /* Count value for current dim */
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - count:%ld", j, curr_pos, curr_idx, cnt_idx);
+ blk_idx = opts->sset[0]->block.data[j]; /* Block value for current dim */
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - block:%ld", j, curr_pos, curr_idx, blk_idx);
+ hs_idx = cnt_idx * blk_idx; /* hyperslab area value for current dim */
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - hs:%ld", j, curr_pos, curr_idx, hs_idx);
+ str_idx = opts->sset[0]->stride.data[j]; /* Stride value for current dim */
+ H5TOOLS_DEBUG("... sset loop:%d with curr_pos:%ld (curr_idx:%ld) - stride:%ld", j, curr_pos, curr_idx, str_idx);
+ elmnt_cnt *= opts->dims[j]; /* Total number of elements in dimension */
+ H5TOOLS_DEBUG("... sset loop:%d with elmnt_cnt:%ld", j, elmnt_cnt);
+ if (str_idx > blk_idx)
+ curr_idx += dim_cnt * (str_idx - blk_idx); /* */
+ else if (curr_idx >= hs_idx)
+ curr_idx += dim_cnt * str_cnt;
+ H5TOOLS_DEBUG("... sset loop:%d with idx:%ld (curr_idx:%ld) - stride:%ld", j, idx, curr_idx, str_idx);
+ dim_cnt = elmnt_cnt; /* */
+ if (str_idx > blk_idx)
+ str_cnt = str_idx - blk_idx; /* */
+ else
+ str_cnt = str_idx; /* */
+ H5TOOLS_DEBUG("... sset loop:%d with dim_cnt:%ld - str_cnt:%ld", j, dim_cnt, str_cnt);
+ j--;
+ } while (curr_idx >= elmnt_cnt && j >= 0);
+ curr_pos = curr_idx; /* New current position */
+ H5TOOLS_DEBUG("pos loop:%d,%d with elmnt_cnt:%ld - curr_pos:%ld", i, j, elmnt_cnt, curr_pos);
+ } /* if (opts->sset[0] != NULL) */
+ /*
+ * Calculate the number of elements represented by a unit change in a
+ * certain index position.
+ */
+ calc_acc_pos((unsigned)opts->rank, curr_pos, opts->acc, opts->pos);
- if (rank > 0) {
- parallel_print("[ ");
- for (i = 0; i < rank; i++) {
- parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]);
- parallel_print(" ");
+ for (i = 0; i < opts->rank; i++) {
+ H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld opts->sm_pos=%ld", i, opts->pos[i], opts->sm_pos[i]);
+ opts->pos[i] += (unsigned long) opts->sm_pos[i];
+ H5TOOLS_DEBUG("pos loop:%d with opts->pos=%ld", i, opts->pos[i]);
+ parallel_print(HSIZE_T_FORMAT, (unsigned long long)opts->pos[i]);
+ parallel_print(" ");
+ }
+ parallel_print("]");
}
- parallel_print("]");
- }
- else
- parallel_print(" ");
-}
-
-/*-------------------------------------------------------------------------
- * Function: print_char_pos
- *
- * Purpose: print character position in string
- *-------------------------------------------------------------------------
- */
-static
-void print_char_pos(int *ph, /* print header */
- int pp, /* print percentage */
- hsize_t curr_pos, size_t u, hsize_t *acc, hsize_t *pos, int rank, hsize_t *dims,
- const char *obj1, const char *obj2)
-{
- int i;
-
- /* print header */
- if (*ph == 1) {
- *ph = 0;
-
- print_header(pp, rank, dims, obj1, obj2);
- } /* end print header */
-
- for (i = 0; i < rank; i++) {
- pos[i] = curr_pos / acc[i];
- curr_pos -= acc[i] * pos[i];
- }
- HDassert(curr_pos == 0);
-
- parallel_print("[ ");
- if (rank > 0) {
- for (i = 0; i < rank; i++) {
- parallel_print(HSIZE_T_FORMAT, (unsigned long long)pos[i]);
- parallel_print(" ");
+ else {
+ if (opts->print_dims) {
+ parallel_print("[ ");
+ parallel_print("%zu", u);
+ parallel_print("]");
+ opts->print_dims = 0;
+ }
+ else
+ parallel_print(" ");
}
-
+ parallel_print(SPACES);
}
- else
- parallel_print("%zu", u);
- parallel_print("]");
+ H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 5ad29fc..48663e2 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -137,7 +137,7 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta
* Parameter:
* table_out [OUT] : return the list
*------------------------------------------------------------------------*/
-static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
+static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts)
{
table_attrs_t *table_lp = NULL;
H5O_info2_t oinfo1, oinfo2; /* Object info */
@@ -171,8 +171,8 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
* build the list
*/
while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) {
- H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
- H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
+ H5TOOLS_DEBUG("list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
+ H5TOOLS_DEBUG("list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
/*------------------
* open attribute1 */
@@ -226,7 +226,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
infile[0] = 1;
infile[1] = 0;
while(curr1 < oinfo1.num_attrs) {
- H5TOOLS_DEBUG("build_match_list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
+ H5TOOLS_DEBUG("list_attrs 1: %ld - %ld", curr1, oinfo1.num_attrs);
/*------------------
* open attribute1 */
@@ -235,7 +235,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* get name */
if(H5Aget_name(attr1_id, (size_t)ATTR_NAME_MAX, name1) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name first attribute failed");
- H5TOOLS_DEBUG("build_match_list_attrs #1 name - %s", name1);
+ H5TOOLS_DEBUG("list_attrs 1 name - %s", name1);
table_attr_mark_exist(infile, name1, table_lp);
table_lp->nattrs_only1++;
@@ -250,7 +250,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
infile[0] = 0;
infile[1] = 1;
while(curr2 < oinfo2.num_attrs) {
- H5TOOLS_DEBUG("build_match_list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
+ H5TOOLS_DEBUG("list_attrs 2: %ld - %ld", curr2, oinfo2.num_attrs);
/*------------------
* open attribute2 */
if((attr2_id = H5Aopen_by_idx(loc2_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -258,7 +258,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/* get name */
if(H5Aget_name(attr2_id, (size_t)ATTR_NAME_MAX, name2) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Aget_name second attribute failed");
- H5TOOLS_DEBUG("build_match_list_attrs #2 name - %s", name2);
+ H5TOOLS_DEBUG("list_attrs 2 name - %s", name2);
table_attr_mark_exist(infile, name2, table_lp);
table_lp->nattrs_only2++;
@@ -272,7 +272,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
/*------------------------------------------------------
* print the list
*/
- if(opts->m_verbose_level == 2) {
+ if(opts->mode_verbose_level == 2) {
/* if '-v2' is detected */
parallel_print(" obj1 obj2\n");
parallel_print(" --------------------------------------\n");
@@ -284,7 +284,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
} /* end for */
}
- if(opts->m_verbose_level >= 1)
+ if(opts->mode_verbose_level >= 1)
parallel_print("Attributes status: %d common, %d only in obj1, %d only in obj2\n",
table_lp->nattrs - table_lp->nattrs_only1 - table_lp->nattrs_only2,
table_lp->nattrs_only1, table_lp->nattrs_only2);
@@ -313,7 +313,8 @@ done:
*-------------------------------------------------------------------------
*/
-hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts)
+hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id,
+ const char *name1, const char *name2, const char *path1, const char *path2, diff_opt_t *opts)
{
hid_t space1_id = H5I_INVALID_HID; /* space ID */
hid_t space2_id = H5I_INVALID_HID; /* space ID */
@@ -327,19 +328,15 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
void *buf2 = NULL; /* data buffer */
hbool_t buf1hasdata = FALSE; /* buffer has data */
hbool_t buf2hasdata = FALSE; /* buffer has data */
- hsize_t nelmts1; /* number of elements in dataset */
int rank1; /* rank of dataset */
int rank2; /* rank of dataset */
hsize_t dims1[H5S_MAX_RANK]; /* dimensions of dataset */
hsize_t dims2[H5S_MAX_RANK]; /* dimensions of dataset */
- char np1[512];
- char np2[512];
hsize_t nfound = 0;
- int j;
+ size_t sz;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
-
/* get the datatypes */
if((ftype1_id = H5Aget_type(attr1_id)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
@@ -383,11 +380,33 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
* check for comparable TYPE and SPACE
*----------------------------------------------------------------------
*/
- H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE");
+ H5TOOLS_DEBUG("Check for comparable TYPE and SPACE");
+
+ H5TOOLS_DEBUG("attr_names: %s - %s", name1, name2);
+ if (name1) {
+ sz = HDstrlen(name1);
+ H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz);
+ if (sz > 0) {
+ opts->obj_name[0] = (char *)HDmalloc(sz + 1);
+ HDstrncpy(opts->obj_name[0], name1, sz + 1);
+ }
+ }
+ if (name2) {
+ sz = HDstrlen(name2);
+ H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz);
+ if (sz > 0) {
+ opts->obj_name[1] = (char *)HDmalloc(sz + 1);
+ HDstrncpy(opts->obj_name[1], name2, sz + 1);
+ }
+ }
+ H5TOOLS_DEBUG("attr_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
/* pass dims1 and dims2 for maxdims as well since attribute's maxdims
* are always same */
- if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, name1, name2, opts, 0) == 1) {
+ if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, opts, 0) == 1) {
+
+ int j;
+
/*-----------------------------------------------------------------
* "upgrade" the smaller memory size
*------------------------------------------------------------------
@@ -395,17 +414,26 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed");
- H5TOOLS_DEBUG("diff_attr_data read");
+ H5TOOLS_DEBUG("initialize read");
/*---------------------------------------------------------------------
- * read
+ * initialize diff_opt_t structure for dimensions
*----------------------------------------------------------------------
*/
- nelmts1 = 1;
- for(j = 0; j < rank1; j++)
- nelmts1 *= dims1[j];
+ opts->nelmts = 1;
+ for(j = 0; j < rank1; j++) {
+ opts->dims[j] = dims1[j];
+ opts->nelmts *= dims1[j];
+ }
+ opts->rank = rank1;
+ init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx);
- buf1 = (void *)HDcalloc((size_t)(nelmts1), msize1);
- buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2);
+ /*---------------------------------------------------------------------
+ * read
+ *----------------------------------------------------------------------
+ */
+ buf1 = (void *)HDcalloc((size_t)(opts->nelmts), msize1);
+ buf2 = (void *)HDcalloc((size_t)(opts->nelmts), msize2);
+ H5TOOLS_DEBUG("attr buffer size %ld * %ld", opts->nelmts, msize1);
if(buf1 == NULL || buf2 == NULL) {
parallel_print("cannot read into memory\n");
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "buffer allocation failed");
@@ -416,6 +444,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
}
else
buf1hasdata = TRUE;
+ H5TOOLS_DEBUG("attr H5Aread 1");
if(H5Aread(attr2_id, mtype2_id, buf2) < 0) {
parallel_print("Failed reading attribute2 %s\n", name2);
@@ -423,49 +452,80 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
}
else
buf2hasdata = TRUE;
+ H5TOOLS_DEBUG("attr H5Aread 2");
/* format output string */
- HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
- HDsnprintf(np2, sizeof(np1), "%s of <%s>", name2, path2);
+ if (opts->obj_name[0] != NULL)
+ HDfree(opts->obj_name[0]);
+ opts->obj_name[0] = NULL;
+ if (opts->obj_name[1] != NULL)
+ HDfree(opts->obj_name[1]);
+ opts->obj_name[1] = NULL;
+
+ H5TOOLS_DEBUG("attr_names: %s - %s : %s - %s", name1, name2, path1, path2);
+ if (name1) {
+ sz = HDstrlen(name1) + HDstrlen(path1) + 7;
+ H5TOOLS_DEBUG("attr1_name: %s - %d", name1, sz);
+ opts->obj_name[0] = (char *)HDcalloc(sz + 1, sizeof(char));
+ HDsnprintf(opts->obj_name[0], sz, "%s of <%s>", name1, path1);
+ opts->obj_name[0][sz] = '\0';
+ }
+ if (name2) {
+ sz = HDstrlen(name2) + HDstrlen(path2) + 7;
+ H5TOOLS_DEBUG("attr2_name: %s - %d", name2, sz);
+ opts->obj_name[1] = (char *)HDcalloc(sz + 1, sizeof(char));
+ HDsnprintf(opts->obj_name[1], sz, "%s of <%s>", name2, path2);
+ opts->obj_name[1][sz] = '\0';
+ }
/*---------------------------------------------------------------------
* array compare
*----------------------------------------------------------------------
*/
- H5TOOLS_DEBUG("diff_attr_data array compare %s - %s", name1, name1);
+ H5TOOLS_DEBUG("array compare %s - %s", opts->obj_name[0], opts->obj_name[1]);
+
+ opts->hs_nelmts = opts->nelmts;
+ opts->m_tid = mtype1_id;
+
+ /* initialize the current stripmine position; this is necessary to print the array indices */
+ for (j = 0; j < opts->rank; j++)
+ opts->sm_pos[j] = (hsize_t)0;
/* always print name */
/* verbose (-v) and report (-r) mode */
- if(opts->m_verbose || opts->m_report) {
- do_print_attrname("attribute", np1, np2);
+ if(opts->mode_verbose || opts->mode_report) {
+ do_print_attrname("attribute", opts->obj_name[0], opts->obj_name[1]);
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id);
print_found(nfound);
}
/* quiet mode (-q), just count differences */
- else if(opts->m_quiet) {
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ else if(opts->mode_quiet) {
+ nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id);
}
/* the rest (-c, none, ...) */
else {
- nfound = diff_array(buf1, buf2, nelmts1, (hsize_t) 0, rank1,
- dims1, opts, np1, np2, mtype1_id, attr1_id, attr2_id);
+ nfound = diff_array(buf1, buf2, opts, attr1_id, attr2_id);
/* print info if compatible and difference found */
if (nfound) {
- do_print_attrname("attribute", np1, np2);
+ do_print_attrname("attribute", opts->obj_name[0], opts->obj_name[1]);
print_found(nfound);
} /* end if */
} /* end else */
}
- H5TOOLS_DEBUG("diff_attr_data check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat);
+ H5TOOLS_DEBUG("check for comparable TYPE and SPACE complete nfound:%d - errstat:%d", nfound, opts->err_stat);
/*----------------------------------------------------------------------
* close
*----------------------------------------------------------------------
*/
+ if (opts->obj_name[0] != NULL)
+ HDfree(opts->obj_name[0]);
+ opts->obj_name[0] = NULL;
+ if (opts->obj_name[1] != NULL)
+ HDfree(opts->obj_name[1]);
+ opts->obj_name[1] = NULL;
/* Free buf1 and buf2, check both VLEN-data VLEN-string to reclaim any
* VLEN memory first */
@@ -543,28 +603,32 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p
unsigned u; /* Local index variable */
hsize_t nfound = 0;
hsize_t nfound_total = 0;
+ diff_opt_t attr_opts;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
+ attr_opts = *opts;
+ attr_opts.obj_name[0] = NULL;
+ attr_opts.obj_name[1] = NULL;
- if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) {
+ if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, &attr_opts) < 0) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "build_match_list_attrs failed");
}
- H5TOOLS_DEBUG("build_match_list_attrs - errstat:%d", opts->err_stat);
+ H5TOOLS_DEBUG("check match_list_attrs - opts->contents:%d - errstat:%d", attr_opts.contents, attr_opts.err_stat);
/* if detect any unique extra attr */
if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) {
- H5TOOLS_DEBUG("diff_attr attributes only in one file");
+ H5TOOLS_DEBUG("attributes only in one file");
/* exit will be 1 */
- opts->contents = 0;
+ attr_opts.contents = 0;
}
- H5TOOLS_DEBUG("match_list_attrs info - errstat:%d", opts->err_stat);
+ H5TOOLS_DEBUG("match_list_attrs info - opts->contents:%d", attr_opts.contents);
for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) {
- H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, opts->err_stat);
+ H5TOOLS_DEBUG("match_list_attrs loop[%d] - errstat:%d", u, attr_opts.err_stat);
if((match_list_attrs->attrs[u].exist[0]) && (match_list_attrs->attrs[u].exist[1])) {
name1 = name2 = match_list_attrs->attrs[u].name;
- H5TOOLS_DEBUG("diff_attr name - %s", name1);
+ H5TOOLS_DEBUG("name - %s", name1);
/*--------------
* attribute 1 */
@@ -576,8 +640,8 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p
if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aopen second attribute failed");
- H5TOOLS_DEBUG("diff_attr got attributes");
- nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, opts);
+ H5TOOLS_DEBUG("got attributes");
+ nfound = diff_attr_data(attr1_id, attr2_id, name1, name2, path1, path2, &attr_opts);
if(H5Aclose(attr1_id) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Aget_type first attribute failed");
if(H5Aclose(attr2_id) < 0)
@@ -588,7 +652,10 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p
} /* u */
done:
- opts->err_stat = opts->err_stat | ret_value;
+ opts->print_header = attr_opts.print_header;
+ opts->contents = attr_opts.contents;
+ opts->not_cmp = attr_opts.not_cmp;
+ opts->err_stat = attr_opts.err_stat | ret_value;
H5E_BEGIN_TRY {
table_attrs_free(match_list_attrs);
diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c
index cea20a8..944440e 100644
--- a/tools/lib/h5diff_dset.c
+++ b/tools/lib/h5diff_dset.c
@@ -27,7 +27,8 @@
* Return: Number of differences found
*-------------------------------------------------------------------------
*/
-hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
+hsize_t
+diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
int status = -1;
hid_t did1 = H5I_INVALID_HID;
@@ -35,9 +36,15 @@ hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, cons
hid_t dcpl1 = H5I_INVALID_HID;
hid_t dcpl2 = H5I_INVALID_HID;
hsize_t nfound = 0;
+ diff_opt_t diff_opts;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
+ diff_opts = *opts;
+ diff_opts.obj_name[0] = NULL;
+ diff_opts.obj_name[1] = NULL;
+
+ H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name);
/*-------------------------------------------------------------------------
* open the handles
*-------------------------------------------------------------------------
@@ -64,20 +71,22 @@ hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, cons
* 2) the internal filters might be turned off
*-------------------------------------------------------------------------
*/
- H5TOOLS_DEBUG("diff_dataset h5tools_canreadf then diff_datasetid");
- if ((status = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) &&
- (status = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1))
- nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, opts);
+ H5TOOLS_DEBUG("h5tools_canreadf then diff_datasetid");
+ if ((status = h5tools_canreadf((opts->mode_verbose ? obj1_name : NULL), dcpl1) == 1) &&
+ (status = h5tools_canreadf((opts->mode_verbose ? obj2_name : NULL), dcpl2) == 1))
+ nfound = diff_datasetid(did1, did2, obj1_name, obj2_name, &diff_opts);
else if (status < 0) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "h5tools_canreadf failed");
}
else {
ret_value = 1;
- opts->not_cmp = 1;
+ diff_opts.not_cmp = 1;
}
done:
- opts->err_stat = opts->err_stat | ret_value;
+ opts->print_header = diff_opts.print_header;
+ opts->not_cmp = diff_opts.not_cmp;
+ opts->err_stat = diff_opts.err_stat | ret_value;
/* disable error reporting */
H5E_BEGIN_TRY {
@@ -143,36 +152,31 @@ done:
*
*-------------------------------------------------------------------------
*/
-hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
+hsize_t
+diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
hid_t sid1 = H5I_INVALID_HID;
hid_t sid2 = H5I_INVALID_HID;
hid_t f_tid1 = H5I_INVALID_HID;
hid_t f_tid2 = H5I_INVALID_HID;
- hid_t dam_tid = H5I_INVALID_HID; /* m_tid for diff_array function */
hid_t m_tid1 = H5I_INVALID_HID;
hid_t m_tid2 = H5I_INVALID_HID;
hid_t dcpl1 = H5I_INVALID_HID;
hid_t dcpl2 = H5I_INVALID_HID;
H5D_layout_t stl1 = -1;
H5D_layout_t stl2 = -1;
- size_t dam_size; /* m_size for diff_array function */
size_t m_size1;
size_t m_size2;
H5T_sign_t sign1;
H5T_sign_t sign2;
int rank1;
int rank2;
- hsize_t danelmts; /* nelmts for diff_array function */
hsize_t nelmts1;
hsize_t nelmts2;
- hsize_t *dadims; /* dims for diff_array function */
hsize_t dims1[H5S_MAX_RANK];
hsize_t dims2[H5S_MAX_RANK];
hsize_t maxdim1[H5S_MAX_RANK];
hsize_t maxdim2[H5S_MAX_RANK];
- const char *name1 = NULL; /* relative names */
- const char *name2 = NULL;
hsize_t storage_size1;
hsize_t storage_size2;
hsize_t nfound = 0; /* number of differences found */
@@ -181,9 +185,10 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
void *buf2 = NULL;
void *sm_buf1 = NULL;
void *sm_buf2 = NULL;
- hid_t sm_space = H5I_INVALID_HID; /*stripmine data space */
+ hid_t sm_space1 = H5I_INVALID_HID; /*stripmine data space */
+ hid_t sm_space2 = H5I_INVALID_HID; /*stripmine data space */
size_t need; /* bytes needed for malloc */
- int i;
+ int i, j;
unsigned int vl_data1 = 0; /*contains VL datatypes */
unsigned int vl_data2 = 0; /*contains VL datatypes */
diff_err_t ret_value = opts->err_stat;
@@ -233,13 +238,15 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
*/
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed");
- if((dcpl2 = H5Dget_create_plist(did2)) < 0)
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed");
-
if((stl1 = H5Pget_layout(dcpl1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed");
+ H5Pclose(dcpl1);
+
+ if((dcpl2 = H5Dget_create_plist(did2)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_create_plist failed");
if((stl2 = H5Pget_layout(dcpl2)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Pget_layout failed");
+ H5Pclose(dcpl2);
/*-------------------------------------------------------------------------
* check for empty datasets
@@ -253,27 +260,46 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
if(storage_size1 == 0 || storage_size2 == 0) {
if(stl1 == H5D_VIRTUAL || stl2 == H5D_VIRTUAL) {
- if((opts->m_verbose||opts->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->mode_verbose||opts->mode_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name);
}
else {
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name)
parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name);
can_compare = 0;
opts->not_cmp = 1;
}
}
+ H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name);
+ opts->obj_name[0] = NULL;
+ if (obj1_name) {
+ j = (int)HDstrlen(obj1_name);
+ H5TOOLS_DEBUG("obj1_name: %s - %d", obj1_name, j);
+ if (j > 0) {
+ opts->obj_name[0] = (char *)HDmalloc((size_t)j + 1);
+ HDstrncpy(opts->obj_name[0], obj1_name, (size_t)j + 1);
+ }
+ }
+
+
+ opts->obj_name[1] = NULL;
+ if (obj2_name) {
+ j = (int)HDstrlen(obj2_name);
+ H5TOOLS_DEBUG("obj2_name: %s - %d", obj2_name, j);
+ if (j > 0) {
+ opts->obj_name[1] = (char *)HDmalloc((size_t)j + 1);
+ HDstrncpy(opts->obj_name[1], obj2_name, (size_t)j + 1);
+ }
+ }
+
/*-------------------------------------------------------------------------
* check for comparable TYPE and SPACE
*-------------------------------------------------------------------------
*/
- if (diff_can_type(f_tid1, f_tid2, rank1, rank2,
- dims1, dims2, maxdim1, maxdim2,
- obj1_name, obj2_name,
- opts, 0) != 1)
+ if (diff_can_type(f_tid1, f_tid2, rank1, rank2, dims1, dims2, maxdim1, maxdim2, opts, 0) != 1)
can_compare = 0;
- H5TOOLS_DEBUG("diff_can_type - errstat:%d", opts->err_stat);
+ H5TOOLS_DEBUG("diff_can_type returned errstat:%d", opts->err_stat);
/*-------------------------------------------------------------------------
* memory type and sizes
@@ -312,7 +338,7 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
sign2 = H5Tget_sign(m_tid2);
if(sign1 != sign2) {
H5TOOLS_DEBUG("sign1 != sign2");
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && obj1_name && obj2_name) {
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
}
@@ -360,41 +386,56 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
*------------------------------------------------------------------
*/
H5TOOLS_DEBUG("NOT H5T_ARRAY, upgrade the smaller memory size?");
- if (FAIL == match_up_memsize (f_tid1, f_tid2,
- &m_tid1, &m_tid2,
- &m_size1, &m_size2))
+ if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2))
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "match_up_memsize failed");
H5TOOLS_DEBUG("m_size: %ld - %ld", m_size1, m_size2);
- dadims = dims1;
- dam_size = m_size1;
- dam_tid = m_tid1;
- danelmts = nelmts1;
+ opts->rank = rank1;
+ for(i = 0; i < rank1; i++)
+ opts->dims[i] = dims1[i];
+ opts->m_size = m_size1;
+ opts->m_tid = m_tid1;
+ opts->nelmts = nelmts1;
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
}
else {
H5TOOLS_DEBUG("Array dims: %d - %d", dims1[0], dims2[0]);
/* Compare the smallest array, but create the largest buffer */
if(m_size1 <= m_size2) {
- dadims = dims1;
- dam_size = m_size1;
- dam_tid = m_tid1;
- danelmts = nelmts1;
+ opts->rank = rank1;
+ for(i = 0; i < rank1; i++)
+ opts->dims[i] = dims1[i];
+ opts->m_size = m_size1;
+ opts->m_tid = m_tid1;
+ opts->nelmts = nelmts1;
need = (size_t)(nelmts2 * m_size2); /* bytes needed */
}
else {
- dadims = dims2;
- dam_size = m_size2;
- dam_tid = m_tid2;
- danelmts = nelmts2;
+ opts->rank = rank2;
+ for(i = 0; i < rank2; i++)
+ opts->dims[i] = dims2[i];
+ opts->m_size = m_size2;
+ opts->m_tid = m_tid2;
+ opts->nelmts = nelmts2;
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
}
}
+ opts->hs_nelmts = opts->nelmts;
+ H5TOOLS_DEBUG("need: %ld", need);
/* print names */
+ H5TOOLS_DEBUG("obj_names: %s - %s", obj1_name, obj2_name);
+
+ if (opts->obj_name[0] != NULL)
+ HDfree(opts->obj_name[0]);
+ opts->obj_name[0] = NULL;
+ if (opts->obj_name[1] != NULL)
+ HDfree(opts->obj_name[1]);
+ opts->obj_name[1] = NULL;
+
if(obj1_name)
- name1 = diff_basename(obj1_name);
+ opts->obj_name[0] = HDstrdup(diff_basename(obj1_name));
if(obj2_name)
- name2 = diff_basename(obj2_name);
- H5TOOLS_DEBUG("obj_names: %s - %s", name1, name2);
+ opts->obj_name[1] = HDstrdup(diff_basename(obj2_name));
+ H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
H5TOOLS_DEBUG("read/compare");
@@ -407,7 +448,14 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
buf2 = HDmalloc(need);
} /* end if */
- if(buf1 != NULL && buf2 != NULL) {
+ /* Assume entire data space to be printed */
+ init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx);
+
+ for(i = 0; i < opts->rank; i++) {
+ opts->p_max_idx[i] = opts->dims[i];
+ }
+
+ if(buf1 != NULL && buf2 != NULL && opts->sset[0] == NULL && opts->sset[1] == NULL) {
H5TOOLS_DEBUG("buf1 != NULL && buf2 != NULL");
H5TOOLS_DEBUG("H5Dread did1");
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
@@ -416,10 +464,13 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
+ /* initialize the current stripmine position; this is necessary to print the array indices */
+ for (j = 0; j < opts->rank; j++)
+ opts->sm_pos[j] = (hsize_t)0;
+
/* array diff */
- nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims,
- opts, name1, name2, dam_tid, did1, did2);
- H5TOOLS_DEBUG("diff_array nfound:%d - errstat:%d", nfound, opts->err_stat);
+ nfound = diff_array(buf1, buf2, opts, did1, did2);
+ H5TOOLS_DEBUG("diff_array ret nfound:%d - errstat:%d", nfound, opts->err_stat);
/* reclaim any VL memory, if necessary */
H5TOOLS_DEBUG("check vl_data1:%d", vl_data1);
@@ -438,111 +489,369 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
}
} /* end if */
else { /* possibly not enough memory, read/compare by hyperslabs */
- size_t p_type_nbytes = dam_size; /*size of memory type */
- hsize_t p_nelmts = danelmts; /*total selected elmts */
- hsize_t elmtno; /*counter */
- int carry; /*counter carry value */
+ hsize_t elmtno; /* counter */
+ int carry; /* counter carry value */
/* stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
- hsize_t sm_nbytes; /*bytes per stripmine */
- hsize_t sm_nelmts; /*elements per stripmine*/
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_block[H5S_MAX_RANK]; /* stripmine block size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hsize_t sm_nelmts1; /* elements per stripmine */
+ hsize_t sm_nelmts2; /* elements per stripmine */
+ hssize_t ssm_nelmts; /* elements temp */
/* hyperslab info */
- hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */
- hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
- hsize_t hs_nelmts; /*elements in request */
- hsize_t zero[8]; /*vector of zeros */
+ hsize_t hs_offset1[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_count1[H5S_MAX_RANK]; /* number of blocks */
+ hsize_t hs_block1[H5S_MAX_RANK]; /* size of blocks */
+ hsize_t hs_stride1[H5S_MAX_RANK]; /* stride */
+ hsize_t hs_size1[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_offset2[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_count2[H5S_MAX_RANK]; /* number of blocks */
+ hsize_t hs_block2[H5S_MAX_RANK]; /* size of blocks */
+ hsize_t hs_stride2[H5S_MAX_RANK]; /* stride */
+ hsize_t hs_size2[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_nelmts1 = 0; /* elements in request */
+ hsize_t hs_nelmts2 = 0; /* elements in request */
+ hsize_t zero[8]; /* vector of zeros */
+ hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
+ hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */
+
+ H5TOOLS_DEBUG("reclaim any VL memory and free unused buffers");
+ if(buf1 != NULL) {
+ /* reclaim any VL memory, if necessary */
+ if(vl_data1)
+ H5Treclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
+ HDfree(buf1);
+ buf1 = NULL;
+ }
+ if(buf2 != NULL) {
+ /* reclaim any VL memory, if necessary */
+ if(vl_data2)
+ H5Treclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
+ HDfree(buf2);
+ buf2 = NULL;
+ }
+
+ /* the stripmine loop */
+ HDmemset(hs_offset1, 0, sizeof hs_offset1);
+ HDmemset(hs_stride1, 0, sizeof hs_stride1);
+ HDmemset(hs_count1, 0, sizeof hs_count1);
+ HDmemset(hs_block1, 0, sizeof hs_block1);
+ HDmemset(hs_size1, 0, sizeof hs_size1);
+ HDmemset(hs_offset2, 0, sizeof hs_offset2);
+ HDmemset(hs_stride2, 0, sizeof hs_stride2);
+ HDmemset(hs_count2, 0, sizeof hs_count2);
+ HDmemset(hs_block2, 0, sizeof hs_block2);
+ HDmemset(hs_size2, 0, sizeof hs_size2);
+ HDmemset(zero, 0, sizeof zero);
+
+ /* if subsetting was requested - initialize the subsetting variables */
+ H5TOOLS_DEBUG("compare by hyperslabs: opts->nelmts=%ld - opts->m_size=%ld", opts->nelmts, opts->m_size);
+ if (opts->sset[0] != NULL) {
+ H5TOOLS_DEBUG("opts->sset[0] != NULL");
+
+ /* Check for valid settings - default if not specified */
+ if(!opts->sset[0]->start.data || !opts->sset[0]->stride.data || !opts->sset[0]->count.data || !opts->sset[0]->block.data) {
+ /* they didn't specify a ``stride'' or ``block''. default to 1 in all
+ * dimensions */
+ if(!opts->sset[0]->start.data) {
+ /* default to (0, 0, ...) for the start coord */
+ opts->sset[0]->start.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->start.len = (unsigned)rank1;
+ }
+
+ if(!opts->sset[0]->stride.data) {
+ opts->sset[0]->stride.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->stride.len = (unsigned)rank1;
+ for (i = 0; i < rank1; i++)
+ opts->sset[0]->stride.data[i] = 1;
+ }
+
+ if(!opts->sset[0]->count.data) {
+ opts->sset[0]->count.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->count.len = (unsigned)rank1;
+ for (i = 0; i < rank1; i++)
+ opts->sset[0]->count.data[i] = 1;
+ }
+
+ if(!opts->sset[0]->block.data) {
+ opts->sset[0]->block.data = (hsize_t *)HDcalloc((size_t)rank1, sizeof(hsize_t));
+ opts->sset[0]->block.len = (unsigned)rank1;
+ for (i = 0; i < rank1; i++)
+ opts->sset[0]->block.data[i] = 1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for block overlap
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < rank1; i++) {
+ if(opts->sset[0]->count.data[i] > 1) {
+ if(opts->sset[0]->stride.data[i] < opts->sset[0]->block.data[i]) {
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "wrong subset selection[0]; blocks overlap");
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ }
+
+ /* Reset the total number of elements to the subset from the command */
+ opts->nelmts = 1;
+ for (i = 0; i < rank1; i++) {
+ hs_offset1[i] = opts->sset[0]->start.data[i];
+ hs_stride1[i] = opts->sset[0]->stride.data[i];
+ hs_count1[i] = opts->sset[0]->count.data[i];
+ hs_block1[i] = opts->sset[0]->block.data[i];
+ opts->nelmts *= hs_count1[i] * hs_block1[i];
+ hs_size1[i] = 0;
+ H5TOOLS_DEBUG("[%d]hs_offset1:%ld, hs_stride1:%ld, hs_count1:%ld, hs_block1:%ld", i, hs_offset1[i], hs_stride1[i], hs_count1[i], hs_block1[i]);
+ }
+ }
+ if (opts->sset[1] != NULL) {
+ H5TOOLS_DEBUG("opts->sset[1] != NULL");
+
+ /* Check for valid settings - default if not specified */
+ if(!opts->sset[1]->start.data || !opts->sset[1]->stride.data || !opts->sset[1]->count.data || !opts->sset[1]->block.data) {
+ /* they didn't specify a ``stride'' or ``block''. default to 1 in all
+ * dimensions */
+ if(!opts->sset[1]->start.data) {
+ /* default to (0, 0, ...) for the start coord */
+ opts->sset[1]->start.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->start.len = (unsigned)rank2;
+ }
+
+ if(!opts->sset[1]->stride.data) {
+ opts->sset[1]->stride.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->stride.len = (unsigned)rank2;
+ for (i = 0; i < rank2; i++)
+ opts->sset[1]->stride.data[i] = 1;
+ }
+
+ if(!opts->sset[1]->count.data) {
+ opts->sset[1]->count.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->count.len = (unsigned)rank2;
+ for (i = 0; i < rank2; i++)
+ opts->sset[1]->count.data[i] = 1;
+ }
+
+ if(!opts->sset[1]->block.data) {
+ opts->sset[1]->block.data = (hsize_t *)HDcalloc((size_t)rank2, sizeof(hsize_t));
+ opts->sset[1]->block.len = (unsigned)rank2;
+ for (i = 0; i < rank2; i++)
+ opts->sset[1]->block.data[i] = 1;
+ }
+
+ /*-------------------------------------------------------------------------
+ * check for block overlap
+ *-------------------------------------------------------------------------
+ */
+ for(i = 0; i < rank2; i++) {
+ if(opts->sset[1]->count.data[i] > 1) {
+ if(opts->sset[1]->stride.data[i] < opts->sset[1]->block.data[i]) {
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "wrong subset selection[1]; blocks overlap");
+ } /* end if */
+ } /* end if */
+ } /* end for */
+ }
+
+ for (i = 0; i < rank2; i++) {
+ hs_offset2[i] = opts->sset[1]->start.data[i];
+ hs_stride2[i] = opts->sset[1]->stride.data[i];
+ hs_count2[i] = opts->sset[1]->count.data[i];
+ hs_block2[i] = opts->sset[1]->block.data[i];
+ hs_size2[i] = 0;
+ H5TOOLS_DEBUG("[%d]hs_offset2:%ld, hs_stride2:%ld, hs_count2:%ld, hs_block2:%ld", i, hs_offset2[i], hs_stride2[i], hs_count2[i], hs_block2[i]);
+ }
+ }
/*
* determine the strip mine size and allocate a buffer. The strip mine is
* a hyperslab whose size is manageable.
*/
- sm_nbytes = p_type_nbytes;
-
- for(i = rank1; i > 0; --i) {
- hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
-
- if(size == 0) /* datum size > H5TOOLS_BUFSIZE */
- size = 1;
- sm_size[i - 1] = MIN(dadims[i - 1], size);
- sm_nbytes *= sm_size[i - 1];
- H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes);
- } /* end for */
-
- /* malloc return code should be verified.
- * If fail, need to handle the error.
- * This else branch should be recoded as a separate function.
- * Note that there are many "goto error" within this branch
- * that fails to address freeing other objects created here.
- * E.g., sm_space.
- */
- if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL)
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "HDmalloc failed");
- if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL)
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "HDmalloc failed");
+ sm_nbytes = opts->m_size;
+ if(opts->rank > 0) {
+ for (i = opts->rank; i > 0; --i) {
+ hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
+ size = 1;
+ H5TOOLS_DEBUG("opts->dims[%d]: %ld - size: %ld", i - 1, opts->dims[i - 1], size);
+ if (opts->sset[1] != NULL) {
+ sm_size[i - 1] = MIN(hs_block1[i - 1] * hs_count1[i - 1], size);
+ sm_block[i - 1] = MIN(hs_block1[i - 1], sm_size[i - 1]);
+ }
+ else {
+ sm_size[i - 1] = MIN(opts->dims[i - 1], size);
+ sm_block[i - 1] = sm_size[i - 1];
+ }
+ H5TOOLS_DEBUG("sm_size[%d]: %ld - sm_block:%ld", i - 1, sm_size[i - 1], sm_block[i - 1]);
+ sm_nbytes *= sm_size[i - 1];
+ H5TOOLS_DEBUG("sm_nbytes: %ld", sm_nbytes);
+ }
+ }
- sm_nelmts = sm_nbytes / p_type_nbytes;
- sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
+ H5TOOLS_DEBUG("opts->nelmts: %ld", opts->nelmts);
+ for(elmtno = 0; elmtno < opts->nelmts; elmtno += opts->hs_nelmts) {
+ H5TOOLS_DEBUG("elmtno: %ld - hs_nelmts1: %ld", elmtno, hs_nelmts1);
- /* the stripmine loop */
- HDmemset(hs_offset, 0, sizeof hs_offset);
- HDmemset(zero, 0, sizeof zero);
+ if(NULL == (sm_buf1 = (unsigned char *)HDmalloc((size_t) sm_nbytes)))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine");
+ if(NULL == (sm_buf2 = (unsigned char *)HDmalloc((size_t) sm_nbytes)))
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "Could not allocate buffer for strip-mine");
- for(elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
/* calculate the hyperslab size */
- if(rank1 > 0) {
- for(i = 0, hs_nelmts = 1; i < rank1; i++) {
- hs_size[i] = MIN(dadims[i] - hs_offset[i], sm_size[i]);
- hs_nelmts *= hs_size[i];
- } /* end for */
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
- H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed");
- if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ /* initialize subset */
+ if(opts->rank > 0) {
+ if (opts->sset[0] != NULL) {
+ H5TOOLS_DEBUG("sset1 has data");
+ /* calculate the potential number of elements */
+ for(i = 0; i < rank1; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i, opts->dims[i], hs_offset1[i], sm_block[i]);
+ hs_size1[i] = MIN(opts->dims[i] - hs_offset1[i], sm_block[i]);
+ H5TOOLS_DEBUG("hs_size1[%d]: %ld", i, hs_size1[i]);
+ }
+ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, hs_stride1, hs_count1, hs_size1) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid1 failed");
+ }
+ else {
+ for(i = 0, hs_nelmts1 = 1; i < rank1; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset1: %ld - sm_block: %ld", i, opts->dims[i], hs_offset1[i], sm_block[i]);
+ hs_size1[i] = MIN(opts->dims[i] - hs_offset1[i], sm_block[i]);
+ H5TOOLS_DEBUG("hs_size1[%d]: %ld", i, hs_size1[i]);
+ hs_nelmts1 *= hs_size1[i];
+ H5TOOLS_DEBUG("hs_nelmts1:%ld *= hs_size1[%d]: %ld", hs_nelmts1, i, hs_size1[i]);
+ }
+ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset1, NULL, hs_size1, NULL) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid1 failed");
+ }
+
+ if((ssm_nelmts = H5Sget_select_npoints(sid1)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_npoints failed");
+ sm_nelmts1 = (hsize_t)ssm_nelmts;
+ H5TOOLS_DEBUG("sm_nelmts1: %ld", sm_nelmts1);
+ hs_nelmts1 = sm_nelmts1;
+
+ if((sm_space1 = H5Screate_simple(1, &sm_nelmts1, NULL)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Screate_simple failed");
+
+ if(H5Sselect_hyperslab(sm_space1, H5S_SELECT_SET, zero, NULL, &sm_nelmts1, NULL) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed");
- if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
+
+ if (opts->sset[1] != NULL) {
+ H5TOOLS_DEBUG("sset2 has data");
+ for(i = 0; i < rank2; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i, opts->dims[i], hs_offset2[i], sm_block[i]);
+ hs_size2[i] = MIN(opts->dims[i] - hs_offset2[i], sm_block[i]);
+ H5TOOLS_DEBUG("hs_size2[%d]: %ld", i, hs_size2[i]);
+ }
+ if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, hs_stride2, hs_count2, hs_size2) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid2 failed");
+ }
+ else {
+ for(i = 0, hs_nelmts2 = 1; i < rank2; i++) {
+ H5TOOLS_DEBUG("[%d]opts->dims: %ld - hs_offset2: %ld - sm_block: %ld", i, opts->dims[i], hs_offset2[i], sm_block[i]);
+ hs_size2[i] = MIN(opts->dims[i] - hs_offset2[i], sm_block[i]);
+ H5TOOLS_DEBUG("hs_size2[%d]: %ld", i, hs_size2[i]);
+ hs_nelmts2 *= hs_size2[i];
+ H5TOOLS_DEBUG("hs_nelmts2:%ld *= hs_size2[%d]: %ld", hs_nelmts2, i, hs_size2[i]);
+ }
+ if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset2, NULL, hs_size2, NULL) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab sid2 failed");
+ }
+
+ if((ssm_nelmts = H5Sget_select_npoints(sid2)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_npoints failed");
+ sm_nelmts2 = (hsize_t)ssm_nelmts;
+ H5TOOLS_DEBUG("sm_nelmts2: %ld", sm_nelmts2);
+ hs_nelmts2 = sm_nelmts2;
+
+ if((sm_space2 = H5Screate_simple(1, &sm_nelmts2, NULL)) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Screate_simple failed");
+
+ if(H5Sselect_hyperslab(sm_space2, H5S_SELECT_SET, zero, NULL, &sm_nelmts2, NULL) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sselect_hyperslab failed");
- } /* end if */
+ }
else
- hs_nelmts = 1;
+ hs_nelmts1 = 1;
+ opts->hs_nelmts = hs_nelmts1;
+ H5TOOLS_DEBUG("hs_nelmts: %ld", opts->hs_nelmts);
- if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0)
+ /* read the data */
+ if(H5Dread(did1, m_tid1, sm_space1, sid1, H5P_DEFAULT, sm_buf1) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
- if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0)
+ if(H5Dread(did2, m_tid2, sm_space2, sid2, H5P_DEFAULT, sm_buf2) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dread failed");
+ /* print array indices. get the lower bound of the hyperslab and calculate
+ the element position at the start of hyperslab */
+ if(H5Sget_select_bounds(sid1, low, high) < 0)
+ H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Sget_select_bounds failed");
+ /* initialize the current stripmine position; this is necessary to print the array indices */
+ for (j = 0; j < opts->rank; j++)
+ opts->sm_pos[j] = low[j];
+
+ /* Assume entire data space to be printed */
+ init_acc_pos((unsigned)opts->rank, opts->dims, opts->acc, opts->pos, opts->p_min_idx);
+
/* get array differences. in the case of hyperslab read, increment the number of differences
found in each hyperslab and pass the position at the beginning for printing */
- nfound += diff_array(sm_buf1, sm_buf2, hs_nelmts, elmtno, rank1,
- dadims, opts, name1, name2, dam_tid, did1, did2);
-
- /* reclaim any VL memory, if necessary */
- if(vl_data1)
- H5Treclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
- if(vl_data2)
- H5Treclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2);
+ nfound += diff_array(sm_buf1, sm_buf2, opts, did1, did2);
+
+ if(sm_buf1 != NULL) {
+ /* reclaim any VL memory, if necessary */
+ if(vl_data1)
+ H5Treclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1);
+ HDfree(sm_buf1);
+ sm_buf1 = NULL;
+ }
+ if(sm_buf2 != NULL) {
+ /* reclaim any VL memory, if necessary */
+ if(vl_data2)
+ H5Treclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2);
+ HDfree(sm_buf2);
+ sm_buf2 = NULL;
+ }
+
+ H5Sclose(sm_space1);
+ H5Sclose(sm_space2);
/* calculate the next hyperslab offset */
- for(i = rank1, carry = 1; i > 0 && carry; --i) {
- hs_offset[i - 1] += hs_size[i - 1];
- if(hs_offset[i - 1] == dadims[i - 1])
- hs_offset[i - 1] = 0;
+ for(i = opts->rank, carry = 1; i > 0 && carry; --i) {
+ if (opts->sset[0] != NULL) {
+ H5TOOLS_DEBUG("[%d]hs_size1:%ld - hs_block1:%ld - hs_stride1:%ld", i-1, hs_size1[i-1], hs_block1[i - 1], hs_stride1[i - 1]);
+ if(hs_size1[i - 1] >= hs_block1[i - 1]) {
+ hs_offset1[i - 1] += hs_size1[i - 1];
+ }
+ else {
+ hs_offset1[i - 1] += hs_stride1[i - 1];
+ }
+ }
+ else
+ hs_offset1[i - 1] += hs_size1[i - 1];
+ H5TOOLS_DEBUG("[%d]hs_offset1:%ld - opts->dims:%ld", i-1, hs_offset1[i-1], opts->dims[i - 1]);
+ if(hs_offset1[i - 1] >= opts->dims[i - 1])
+ hs_offset1[i - 1] = 0;
else
carry = 0;
- } /* i */
- } /* elmtno */
- if(sm_buf1 != NULL) {
- HDfree(sm_buf1);
- sm_buf1 = NULL;
- }
- if(sm_buf2 != NULL) {
- HDfree(sm_buf2);
- sm_buf2 = NULL;
- }
-
- H5Sclose(sm_space);
+ H5TOOLS_DEBUG("[%d]hs_offset1:%ld", i-1, hs_offset1[i-1]);
+ if (opts->sset[1] != NULL) {
+ H5TOOLS_DEBUG("[%d]hs_size2:%ld - hs_block2:%ld - hs_stride2:%ld", i-1, hs_size2[i-1], hs_block2[i - 1], hs_stride2[i - 1]);
+ if(hs_size2[i - 1] >= hs_block2[i - 1]) {
+ hs_offset2[i - 1] += hs_size2[i - 1];
+ }
+ else {
+ hs_offset2[i - 1] += hs_stride2[i - 1];
+ }
+ }
+ else
+ hs_offset2[i - 1] += hs_size2[i - 1];
+ H5TOOLS_DEBUG("[%d]hs_offset2:%ld - opts->dims:%ld", i-1, hs_offset2[i-1], opts->dims[i - 1]);
+ if(hs_offset2[i - 1] >= opts->dims[i - 1])
+ hs_offset2[i - 1] = 0;
+ H5TOOLS_DEBUG("[%d]hs_offset2:%ld", i-1, hs_offset2[i-1]);
+ }
+ } /* elmtno for loop */
} /* hyperslab read */
- H5TOOLS_DEBUG("can_compare complete");
+ H5TOOLS_DEBUG("can compare complete");
} /*can_compare*/
@@ -550,12 +859,20 @@ hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char
* close
*-------------------------------------------------------------------------
*/
- H5TOOLS_DEBUG("reclaim any VL memory - errstat:%d", opts->err_stat);
done:
opts->err_stat = opts->err_stat | ret_value;
+ H5TOOLS_DEBUG("free names - errstat:%d", opts->err_stat);
/* free */
+ if (opts->obj_name[0] != NULL)
+ HDfree(opts->obj_name[0]);
+ opts->obj_name[0] = NULL;
+ if (opts->obj_name[1] != NULL)
+ HDfree(opts->obj_name[1]);
+ opts->obj_name[1] = NULL;
+
+ H5TOOLS_DEBUG("reclaim any VL memory");
if(buf1 != NULL) {
/* reclaim any VL memory, if necessary */
if(vl_data1)
@@ -570,26 +887,31 @@ done:
HDfree(buf2);
buf2 = NULL;
}
+ H5TOOLS_DEBUG("reclaim any stripmine VL memory");
if(sm_buf1 != NULL) {
/* reclaim any VL memory, if necessary */
if(vl_data1)
- H5Treclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
+ H5Treclaim(m_tid1, sm_space1, H5P_DEFAULT, sm_buf1);
HDfree(sm_buf1);
sm_buf1 = NULL;
}
if(sm_buf2 != NULL) {
/* reclaim any VL memory, if necessary */
if(vl_data2)
- H5Treclaim(m_tid2, sm_space, H5P_DEFAULT, sm_buf2);
+ H5Treclaim(m_tid2, sm_space2, H5P_DEFAULT, sm_buf2);
HDfree(sm_buf2);
sm_buf2 = NULL;
}
+ H5TOOLS_DEBUG("close ids");
/* disable error reporting */
H5E_BEGIN_TRY {
H5Sclose(sid1);
H5Sclose(sid2);
- H5Sclose(sm_space);
+ H5Sclose(sm_space1);
+ H5Sclose(sm_space2);
+ H5Pclose(dcpl1);
+ H5Pclose(dcpl2);
H5Tclose(f_tid1);
H5Tclose(f_tid2);
H5Tclose(m_tid1);
@@ -613,10 +935,9 @@ done:
*-------------------------------------------------------------------------
*/
-int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
- hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2,
- const char *obj1_name, const char *obj2_name,
- diff_opt_t *opts, int is_compound)
+int
+diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2, hsize_t *dims1, hsize_t *dims2,
+ hsize_t *maxdim1, hsize_t *maxdim2, diff_opt_t *opts, int is_compound)
{
H5T_class_t tclass1;
H5T_class_t tclass2;
@@ -635,19 +956,21 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
if((tclass2 = H5Tget_class(f_tid2)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Tget_class second object failed");
+ H5TOOLS_DEBUG("obj_names: %s - %s", opts->obj_name[0], opts->obj_name[1]);
if(tclass1 != tclass2) {
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
if(is_compound) {
parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n",
- obj1_name, get_class(tclass1),
- obj2_name, get_class(tclass2));
+ opts->obj_name[0], get_class(tclass1),
+ opts->obj_name[1], get_class(tclass2));
}
else {
parallel_print("Not comparable: <%s> is of class %s and <%s> is of class %s\n",
- obj1_name, get_class(tclass1),
- obj2_name, get_class(tclass2));
+ opts->obj_name[0], get_class(tclass1),
+ opts->obj_name[1], get_class(tclass2));
}
}
+
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
}
@@ -658,10 +981,11 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
*/
switch (tclass1) {
case H5T_TIME:
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
parallel_print("Not comparable: <%s> and <%s> are of class %s\n",
- obj1_name, obj2_name, get_class(tclass2));
+ opts->obj_name[0], opts->obj_name[1], get_class(tclass2));
} /* end if */
+
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
break;
@@ -679,7 +1003,7 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
case H5T_NO_CLASS:
case H5T_NCLASSES:
default:
- H5TOOLS_DEBUG("diff_can_type class - %s", get_class(tclass1));
+ H5TOOLS_DEBUG("class - %s", get_class(tclass1));
break;
} /* end switch */
@@ -687,15 +1011,15 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
* check for equal file datatype; warning only
*-------------------------------------------------------------------------
*/
- if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->m_verbose) && obj1_name && obj2_name) {
+ if((H5Tequal(f_tid1, f_tid2) == 0) && (opts->mode_verbose) && opts->obj_name[0] && opts->obj_name[1]) {
H5T_class_t cl = H5Tget_class(f_tid1);
parallel_print("Warning: different storage datatype\n");
if(cl == H5T_INTEGER || cl == H5T_FLOAT) {
- parallel_print("<%s> has file datatype ", obj1_name);
+ parallel_print("<%s> has file datatype ", opts->obj_name[0]);
print_type(f_tid1);
parallel_print("\n");
- parallel_print("<%s> has file datatype ", obj2_name);
+ parallel_print("<%s> has file datatype ", opts->obj_name[1]);
print_type(f_tid2);
parallel_print("\n");
}
@@ -706,18 +1030,19 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
*-------------------------------------------------------------------------
*/
if(rank1 != rank2) {
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
- parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ parallel_print("Not comparable: <%s> has rank %d, dimensions ", opts->obj_name[0], rank1);
print_dimensions(rank1, dims1);
parallel_print(", max dimensions ");
print_dimensions(rank1, maxdim1);
parallel_print("\n" );
- parallel_print("and <%s> has rank %d, dimensions ", obj2_name, rank2);
+ parallel_print("and <%s> has rank %d, dimensions ", opts->obj_name[1], rank2);
print_dimensions(rank2, dims2);
parallel_print(", max dimensions ");
print_dimensions(rank2, maxdim2);
parallel_print("\n");
}
+
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
}
@@ -740,20 +1065,21 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
*-------------------------------------------------------------------------
*/
if(dim_diff == 1) {
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
- parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ parallel_print("Not comparable: <%s> has rank %d, dimensions ", opts->obj_name[0], rank1);
print_dimensions(rank1, dims1);
if(maxdim1 && maxdim2) {
parallel_print(", max dimensions ");
print_dimensions(rank1, maxdim1);
parallel_print("\n" );
- parallel_print("and <%s> has rank %d, dimensions ", obj2_name, rank2);
+ parallel_print("and <%s> has rank %d, dimensions ", opts->obj_name[1], rank2);
print_dimensions(rank2, dims2);
parallel_print(", max dimensions ");
print_dimensions(rank2, maxdim2);
parallel_print("\n");
}
}
+
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
}
@@ -762,13 +1088,13 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
* maximum dimensions; just give a warning
*-------------------------------------------------------------------------
*/
- if(maxdim1 && maxdim2 && maxdim_diff == 1 && obj1_name) {
- if(opts->m_verbose) {
+ if(maxdim1 && maxdim2 && maxdim_diff == 1 && opts->obj_name[0]) {
+ if(opts->mode_verbose) {
parallel_print( "Warning: different maximum dimensions\n");
- parallel_print("<%s> has max dimensions ", obj1_name);
+ parallel_print("<%s> has max dimensions ", opts->obj_name[0]);
print_dimensions(rank1, maxdim1);
parallel_print("\n");
- parallel_print("<%s> has max dimensions ", obj2_name);
+ parallel_print("<%s> has max dimensions ", opts->obj_name[1]);
print_dimensions(rank2, maxdim2);
parallel_print("\n");
}
@@ -777,16 +1103,17 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
if(tclass1 == H5T_STRING) {
htri_t vstrtype1 = -1;
htri_t vstrtype2 = -1;
- H5TOOLS_DEBUG("diff_can_type end - H5T_STRING");
+ H5TOOLS_DEBUG(" - H5T_STRING");
vstrtype1 = H5Tis_variable_str(f_tid1);
vstrtype2 = H5Tis_variable_str(f_tid2);
/* no compare if either one but not both are variable string type */
if (vstrtype1 != vstrtype2) {
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name)
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1])
parallel_print("Not comparable: <%s> or <%s> is of mixed string type\n",
- obj1_name, obj2_name);
+ opts->obj_name[0], opts->obj_name[1]);
+
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
}
@@ -798,17 +1125,18 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
int j;
hid_t memb_type1 = H5I_INVALID_HID;
hid_t memb_type2 = H5I_INVALID_HID;
- H5TOOLS_DEBUG("diff_can_type end - H5T_COMPOUND");
+ H5TOOLS_DEBUG(" - H5T_COMPOUND");
nmembs1 = H5Tget_nmembers(f_tid1);
nmembs2 = H5Tget_nmembers(f_tid2);
if(nmembs1 != nmembs2) {
- if((opts->m_verbose || opts->m_list_not_cmp) && obj1_name && obj2_name) {
- parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1);
- parallel_print("<%s> has %d members ", obj2_name, nmembs2);
+ if((opts->mode_verbose || opts->mode_list_not_cmp) && opts->obj_name[0] && opts->obj_name[1]) {
+ parallel_print("Not comparable: <%s> has %d members ", opts->obj_name[0], nmembs1);
+ parallel_print("<%s> has %d members ", opts->obj_name[1], nmembs2);
parallel_print("\n");
}
+
opts->not_cmp = 1;
H5TOOLS_GOTO_DONE(0);
}
@@ -817,9 +1145,7 @@ int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j);
memb_type2 = H5Tget_member_type(f_tid2, (unsigned)j);
- if (diff_can_type(memb_type1, memb_type2, rank1, rank2,
- dims1, dims2, maxdim1, maxdim2, obj1_name, obj2_name,
- opts, 1) != 1) {
+ if (diff_can_type(memb_type1, memb_type2, rank1, rank2, dims1, dims2, maxdim1, maxdim2, opts, 1) != 1) {
opts->not_cmp = 1;
H5Tclose(memb_type1);
H5Tclose(memb_type2);
@@ -838,19 +1164,17 @@ done:
}
+#if defined (H5DIFF_DEBUG_UNUSED)
+/* this function is not currently used, but could be useful */
/*-------------------------------------------------------------------------
* Function: print_sizes
*
* Purpose: Print datatype sizes
*-------------------------------------------------------------------------
*/
-#if defined (H5DIFF_DEBUG)
-void print_sizes( const char *obj1,
- const char *obj2,
- hid_t f_tid1,
- hid_t f_tid2,
- hid_t m_tid1,
- hid_t m_tid2 )
+void print_sizes( const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2);
+
+void print_sizes( const char *obj1, const char *obj2, hid_t f_tid1, hid_t f_tid2, hid_t m_tid1, hid_t m_tid2)
{
size_t f_size1, f_size2; /* size of type in file */
size_t m_size1, m_size2; /* size of type in memory */
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index cc51e2c..55c69a7 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -29,28 +29,37 @@ int H5tools_INDENT_g = 0;
/* global variables */
+H5E_auto2_t lib_func;
+H5E_auto2_t tools_func;
+void *lib_edata;
+void *tools_edata;
+
hid_t H5tools_ERR_STACK_g = H5I_INVALID_HID;
hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID;
hid_t H5E_tools_g = H5I_INVALID_HID;
hid_t H5E_tools_min_id_g = H5I_INVALID_HID;
hid_t H5E_tools_min_info_id_g = H5I_INVALID_HID;
hid_t H5E_tools_min_dbg_id_g = H5I_INVALID_HID;
-int compound_data;
+
FILE *rawattrstream = NULL; /* should initialize to stdout but gcc moans about it */
FILE *rawdatastream = NULL; /* should initialize to stdout but gcc moans about it */
FILE *rawinstream = NULL; /* should initialize to stdin but gcc moans about it */
FILE *rawoutstream = NULL; /* should initialize to stdout but gcc moans about it */
FILE *rawerrorstream = NULL; /* should initialize to stderr but gcc moans about it */
+
int bin_output; /* binary output */
int bin_form = 0; /* binary form, default NATIVE */
int region_output; /* region output */
int oid_output; /* oid output */
int data_output; /* data output */
int attr_data_output; /* attribute data output */
+int compound_data;
+
unsigned packed_bits_num; /* number of packed bits to display */
unsigned packed_data_offset; /* offset of packed bits to display */
unsigned packed_data_length; /* length of packed bits to display */
unsigned long long packed_data_mask; /* mask in which packed bits to display */
+
int enable_error_stack = 0; /* re-enable error stack; disable=0 enable=1 */
/* sort parameters */
@@ -103,6 +112,10 @@ const char *drivernames[] = {
void
h5tools_init(void)
{
+ /* Disable error reporting */
+ H5Eget_auto2(H5E_DEFAULT, &lib_func, &lib_edata);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
if (!h5tools_init_g) {
H5TOOLS_INIT_ERROR();
@@ -121,6 +134,29 @@ h5tools_init(void)
h5tools_init_g++;
}
+
+ /* Disable tools error reporting */
+ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: h5tools_error_report
+ *
+ * Purpose: Enable error stack reporting after command line is parsed.
+ *
+ * Return: None
+ *-------------------------------------------------------------------------
+ */
+void
+h5tools_error_report(void)
+{
+ if (h5tools_init_g) {
+ if (enable_error_stack > 0) {
+ H5Eset_auto2(H5E_DEFAULT, lib_func, lib_edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+ }
+ }
}
/*-------------------------------------------------------------------------
@@ -137,16 +173,11 @@ h5tools_init(void)
void
h5tools_close(void)
{
- H5E_auto2_t tools_func;
- void *tools_edata;
-
if (h5tools_init_g) {
/* special case where only data is output to stdout */
if ((rawoutstream == NULL) && rawdatastream && (rawdatastream == stdout))
HDfprintf(rawdatastream, "\n");
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
-
if (tools_func)
H5Eprint2(H5tools_ERR_STACK_g, rawerrorstream);
@@ -184,6 +215,10 @@ h5tools_close(void)
/* Clean up the reference path table, if it's been used */
term_ref_path_table();
+ /* Restore error stacks from init */
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+ H5Eset_auto2(H5E_DEFAULT, lib_func, lib_edata);
+
H5TOOLS_CLOSE_ERROR();
/* Shut down the library */
@@ -1090,8 +1125,8 @@ done:
*-------------------------------------------------------------------------
*/
void
-h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hsize_t elmtno, int secnum)
+h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hsize_t elmtno, int secnum)
{
h5tools_str_t prefix;
h5tools_str_t str; /*temporary for indentation */
@@ -1119,7 +1154,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
H5TOOLS_DEBUG("after CR elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims);
/* Calculate new prefix */
- h5tools_str_prefix(&prefix, info, elmtno, ctx->ndims, ctx);
+ h5tools_str_prefix(&prefix, info, elmtno, ctx);
H5TOOLS_DEBUG("prefix=%s - str=%s", prefix.s, str.s);
/* Write new prefix to output */
@@ -1186,8 +1221,8 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
*-------------------------------------------------------------------------
*/
void
-h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum)
+h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hsize_t elmtno, hsize_t *ptdata, int secnum)
{
h5tools_str_t prefix;
h5tools_str_t str; /*temporary for indentation */
@@ -1211,7 +1246,7 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
}
/* Calculate new prefix */
- h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx->ndims, ctx->p_max_idx, ctx);
+ h5tools_str_region_prefix(&prefix, info, elmtno, ptdata, ctx);
/* Write new prefix to output */
if (ctx->indent_level > 0)
@@ -1284,9 +1319,8 @@ h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
*-------------------------------------------------------------------------
*/
hbool_t
-h5tools_render_element(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
- size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
+h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
char *s = NULL;
@@ -1455,9 +1489,8 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
*-------------------------------------------------------------------------
*/
hbool_t
-h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
- size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
+h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter)
{
hbool_t dimension_break = TRUE;
char *s = NULL;
@@ -1474,8 +1507,10 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* If the element would split on multiple lines if printed at our
* current location...
*/
- if (info->line_multi_new == 1 && (ctx->cur_column + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols) {
+ if (info->line_multi_new == 1 &&
+ (ctx->cur_column + h5tools_count_ncols(s) +
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols) {
if (ctx->prev_multiline) {
/*
* ... and the previous element also occupied more than one
@@ -1484,7 +1519,8 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
ctx->need_prefix = TRUE;
}
else if ((ctx->prev_prefix_len + h5tools_count_ncols(s) +
- HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) <= ncols) {
/*
* ...but *could* fit on one line otherwise, then we
* should end the current line and start this element on its
@@ -1515,7 +1551,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* beginning of the line.
*/
if (info->line_multi_new == 1 && ctx->prev_multiline &&
- (ctx->cur_column + h5tools_count_ncols(s) + HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols)
+ (ctx->cur_column + h5tools_count_ncols(s) +
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = TRUE;
/*
@@ -1543,7 +1581,9 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
* this check to happen for the first line
*/
if ((!info->skip_first || local_elmt_counter) &&
- (ctx->cur_column + HDstrlen(section) + HDstrlen(OPT(info->elmt_suf2, " ")) + HDstrlen(OPT(info->line_suf, ""))) > ncols)
+ (ctx->cur_column + HDstrlen(section) +
+ HDstrlen(OPT(info->elmt_suf2, " ")) +
+ HDstrlen(OPT(info->line_suf, ""))) > ncols)
ctx->need_prefix = 1;
/*
@@ -1589,27 +1629,65 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
*-------------------------------------------------------------------------
*/
void
-init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
+init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx)
{
int i;
unsigned j;
H5TOOLS_START_DEBUG("");
- if(ctx->ndims > 0) {
- ctx->acc[ctx->ndims - 1] = 1;
- for (i = ((int)ctx->ndims - 2); i >= 0; i--) {
- ctx->acc[i] = ctx->acc[i + 1] * dims[i + 1];
- H5TOOLS_DEBUG("ctx->acc[%d]=%ld", i, ctx->acc[i]);
+ for (i = 0; (unsigned)i < ndims; i++)
+ p_min_idx[i] = 0;
+
+ if(ndims > 0) {
+ acc[ndims - 1] = 1;
+ for (i = ((int)ndims - 2); i >= 0; i--) {
+ acc[i] = acc[i + 1] * dims[i + 1];
+ H5TOOLS_DEBUG("acc[%d]=%ld", i, acc[i]);
}
- for (j = 0; j < ctx->ndims; j++)
- ctx->pos[j] = 0;
+ for (j = 0; j < ndims; j++)
+ pos[j] = 0;
}
H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
+ * Function: calc_acc_pos
+ *
+ * Purpose: Calculate the number of elements represented by a unit change
+ * in a certain index position.
+ *
+ * Return: void
+ *-------------------------------------------------------------------------
+ */
+hsize_t
+calc_acc_pos(unsigned ndims, hsize_t elmtno, hsize_t *acc, hsize_t *pos)
+{
+ int i;
+ hsize_t curr_pos = elmtno;
+
+ H5TOOLS_START_DEBUG("");
+
+ if(ndims > 0) {
+ for(i = 0; i < (int)ndims; i++) {
+ if(curr_pos > 0) {
+ H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, acc[i]);
+ pos[i] = curr_pos / acc[i];
+ curr_pos -= acc[i] * pos[i];
+ }
+ else
+ pos[i] = 0;
+ H5TOOLS_DEBUG("curr_pos=%ld - pos[%d]=%ld - acc[%d]=%ld", curr_pos, i, pos[i], i, acc[i]);
+ }
+ }
+
+ H5TOOLS_ENDDEBUG("");
+
+ return curr_pos;
+}
+
+/*-------------------------------------------------------------------------
* Function: render_bin_output
*
* Purpose: Write one element of memory buffer to a binary file stream
diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h
index 2b6fffb..7d3f40a 100644
--- a/tools/lib/h5tools.h
+++ b/tools/lib/h5tools.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, July 23, 1998
*
* Purpose: Support functions for the various tools.
@@ -570,9 +570,6 @@ typedef struct h5tools_vfd_info_t {
const char *name;
} h5tools_vfd_info_t;
-H5TOOLS_DLLVAR const char *volnames[];
-H5TOOLS_DLLVAR const char *drivernames[];
-
/* This enum should match the entries in the above 'volnames'
* since they are indices into the 'volnames' array. */
typedef enum {
@@ -603,14 +600,22 @@ typedef enum {
#include "h5tools_str.h"
-H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat;
-H5TOOLS_DLLVAR const h5tools_dump_header_t h5tools_standardformat;
-H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format;
#ifdef __cplusplus
extern "C" {
#endif
+H5TOOLS_DLLVAR const char *volnames[];
+H5TOOLS_DLLVAR const char *drivernames[];
+
+H5TOOLS_DLLVAR h5tool_format_t h5tools_dataformat;
+H5TOOLS_DLLVAR const h5tools_dump_header_t h5tools_standardformat;
+H5TOOLS_DLLVAR const h5tools_dump_header_t* h5tools_dump_header_format;
+H5TOOLS_DLLVAR H5E_auto2_t lib_func;
+H5TOOLS_DLLVAR H5E_auto2_t tools_func;
+H5TOOLS_DLLVAR void *lib_edata;
+H5TOOLS_DLLVAR void *tools_edata;
+
H5TOOLS_DLLVAR unsigned packed_bits_num; /* number of packed bits to display */
H5TOOLS_DLLVAR unsigned packed_data_offset; /* offset of packed bits to display */
H5TOOLS_DLLVAR unsigned packed_data_length; /* length of packed bits to display */
@@ -644,14 +649,17 @@ H5TOOLS_DLLVAR int enable_error_stack; /* re-enable error stack; disable=0 e
/* Definitions of useful routines */
H5TOOLS_DLL void h5tools_init(void);
H5TOOLS_DLL void h5tools_close(void);
+
+H5TOOLS_DLL void h5tools_error_report(void);
H5TOOLS_DLL int h5tools_set_data_output_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_attr_output_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_input_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_output_file(const char *fname, int is_bin);
H5TOOLS_DLL int h5tools_set_error_file(const char *fname, int is_bin);
-H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info,
- h5tools_vfd_info_t *vfd_info);
-H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id, char *drivername, size_t drivername_size);
+
+H5TOOLS_DLL hid_t h5tools_get_fapl(hid_t prev_fapl_id, h5tools_vol_info_t *vol_info, h5tools_vfd_info_t *vfd_info);
+H5TOOLS_DLL herr_t h5tools_get_vfd_name(hid_t fapl_id,
+ char *drivername, size_t drivername_size);
H5TOOLS_DLL hid_t h5tools_fopen(const char *fname, unsigned flags, hid_t fapl,
hbool_t use_specific_driver, char *drivername, size_t drivername_size);
H5TOOLS_DLL hid_t h5tools_get_little_endian_type(hid_t type);
@@ -659,36 +667,29 @@ H5TOOLS_DLL hid_t h5tools_get_big_endian_type(hid_t type);
H5TOOLS_DLL htri_t h5tools_detect_vlen(hid_t tid);
H5TOOLS_DLL htri_t h5tools_detect_vlen_str(hid_t tid);
H5TOOLS_DLL hbool_t h5tools_is_obj_same(hid_t loc_id1, const char *name1, hid_t loc_id2, const char *name2);
-H5TOOLS_DLL void init_acc_pos(h5tools_context_t *ctx, hsize_t *dims);
+H5TOOLS_DLL void init_acc_pos(unsigned ndims, hsize_t *dims, hsize_t *acc, hsize_t *pos, hsize_t *p_min_idx);
+H5TOOLS_DLL hsize_t calc_acc_pos(unsigned ndims, hsize_t elemtno, hsize_t *acc, hsize_t *pos);
H5TOOLS_DLL hbool_t h5tools_is_zero(const void *_mem, size_t size);
H5TOOLS_DLL int h5tools_canreadf(const char* name, hid_t dcpl_id);
H5TOOLS_DLL int h5tools_can_encode(H5Z_filter_t filtn);
-H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hsize_t elmtno, int secnum);
-H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hsize_t elmtno, hsize_t *ptdata, int secnum);
+H5TOOLS_DLL void h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hsize_t elmtno, int secnum);
+H5TOOLS_DLL void h5tools_region_simple_prefix(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hsize_t elmtno, hsize_t *ptdata, int secnum);
H5TOOLS_DLL int render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t nelmts);
-H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
- hid_t container, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata);
-H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, hid_t container);
-H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
- FILE* stream, hid_t container, unsigned ndims, hid_t type_id, hsize_t npoints);
-H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id,
- FILE *stream, hid_t container);
-
-H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, h5tools_str_t *buffer, hsize_t *curr_pos,
- size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter);
-H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, /*in,out*/
- h5tools_str_t *buffer, /*string into which to render */
- hsize_t *curr_pos, /*total data element position*/
- size_t ncols, hsize_t *ptdata,
- hsize_t local_elmt_counter, /*element counter*/
- hsize_t elmt_counter);
+H5TOOLS_DLL int render_bin_output_region_data_blocks(hid_t region_id, FILE *stream, hid_t container,
+ unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata);
+H5TOOLS_DLL hbool_t render_bin_output_region_blocks(hid_t region_space, hid_t region_id, FILE *stream, hid_t container);
+H5TOOLS_DLL int render_bin_output_region_data_points(hid_t region_space, hid_t region_id, FILE* stream, hid_t container,
+ unsigned ndims, hid_t type_id, hsize_t npoints);
+H5TOOLS_DLL hbool_t render_bin_output_region_points(hid_t region_space, hid_t region_id, FILE *stream, hid_t container);
+
+H5TOOLS_DLL hbool_t h5tools_render_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols, hsize_t local_elmt_counter, hsize_t elmt_counter);
+H5TOOLS_DLL hbool_t h5tools_render_region_element(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, h5tools_str_t *buffer,
+ hsize_t *curr_pos, size_t ncols, hsize_t *ptdata, hsize_t local_elmt_counter, hsize_t elmt_counter);
#ifdef __cplusplus
}
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index b59ae93..b1be577 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -253,9 +253,8 @@ h5tools_dump_init(void)
*-------------------------------------------------------------------------
*/
int
-h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
- h5tools_context_t *ctx, /* in,out */
- unsigned flags, hsize_t nelmts, hid_t type, void *_mem)
+h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, /* in,out */
+ hid_t container, unsigned flags, hsize_t nelmts, hid_t type, void *_mem)
{
unsigned char *mem = (unsigned char*) _mem;
hsize_t i; /* element counter */
@@ -568,9 +567,11 @@ h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_for
ctx.indent_level++;
if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
/* assume entire data space to be printed */
+ init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx);
+
+ /* reset data space to be printed */
for (indx = 0; indx < (unsigned)ctx.ndims; indx++)
ctx.p_min_idx[indx] = start[indx];
- init_acc_pos(&ctx, total_size);
/* print the data */
region_flags = START_OF_DATA;
@@ -939,9 +940,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
/* assume entire data space to be printed */
- for (indx = 0; indx < ctx.ndims; indx++)
- ctx.p_min_idx[indx] = 0;
- init_acc_pos(&ctx, total_size);
+ init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx);
/* print the data */
region_flags = START_OF_DATA;
@@ -1253,7 +1252,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
size_t j; /* counters */
hsize_t zero[1] = {0}; /* vector of zeros */
unsigned int flags; /* buffer extent flags */
- hsize_t elmtno; /* elemnt index */
hsize_t low[H5S_MAX_RANK]; /* low bound of hyperslab */
hsize_t high[H5S_MAX_RANK]; /* higher bound of hyperslab */
size_t p_type_nbytes; /* size of memory type */
@@ -1274,9 +1272,6 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
if ((size_t) ctx->ndims > NELMTS(sm_size))
H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed");
- if (ctx->ndims > 0)
- init_acc_pos(ctx, total_size);
-
size_row_block = ctx->sset->block.data[row_dim];
/* Check if we have VL data in the dataset's datatype */
@@ -1347,27 +1342,25 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
for (i = 0; i < ctx->ndims; i++)
ctx->p_max_idx[i] = ctx->p_min_idx[i] + MIN(total_size[i], sm_size[i]);
- /* print array indices. get the lower bound of the hyperslab and calulate
- the element position at the start of hyperslab */
+ /* print array indices. get the lower bound of the hyperslab and calculate
+ the element position at the start of hyperslab */
if(H5Sget_select_bounds(f_space, low, high) < 0)
H5TOOLS_THROW(FAIL, "H5Sget_select_bounds failed");
- elmtno = 0;
+ /* initialize the current stripmine position; this is necessary to print the array indices */
+ ctx->sm_pos = 0;
for (i = 0; i < (size_t) ctx->ndims - 1; i++) {
hsize_t offset = 1; /* accumulation of the previous dimensions */
for (j = i + 1; j < (size_t) ctx->ndims; j++)
offset *= total_size[j];
- elmtno += low[i] * offset;
+ ctx->sm_pos += low[i] * offset;
}
- elmtno += low[ctx->ndims - 1];
+ ctx->sm_pos += low[ctx->ndims - 1];
- /* initialize the current stripmine position; this is necessary to print the array
- indices */
- ctx->sm_pos = elmtno;
ctx->need_prefix = TRUE;
- if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, sm_nelmts, p_type, sm_buf) < 0)
+ if(h5tools_dump_simple_data(stream, info, ctx, dset, flags, sm_nelmts, p_type, sm_buf) < 0)
H5TOOLS_THROW(FAIL, "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
@@ -1571,9 +1564,8 @@ static herr_t
h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type)
{
int sndims;
- hid_t f_space = H5I_INVALID_HID; /* file data space */
- size_t i; /* counters */
- hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
hbool_t past_catch = FALSE;
herr_t ret_value = SUCCEED;
@@ -1586,12 +1578,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
ctx->ndims = (unsigned)sndims;
/* assume entire data space to be printed */
- if (ctx->ndims > 0)
- for (i = 0; i < (size_t) ctx->ndims; i++)
- ctx->p_min_idx[i] = 0;
-
if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
H5TOOLS_THROW(FAIL, "H5Sget_simple_extent_dims failed");
+ init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx);
+
ctx->size_last_dim = total_size[ctx->ndims - 1];
/* Set the compound datatype field list for display */
@@ -1623,38 +1613,37 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
-h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
- hid_t dset, hid_t p_type)
+h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type)
{
- hid_t f_space = H5I_INVALID_HID; /* file data space */
- hsize_t elmtno; /* counter */
- size_t i; /* counter */
- int sndims; /* rank of dataspace */
- int carry; /* counter carry value */
- hsize_t zero[8]; /* vector of zeros */
- unsigned int flags; /* buffer extent flags */
- hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
- hbool_t past_catch = FALSE;
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ hsize_t elmtno; /* counter */
+ size_t i = 0; /* counter */
+ int sndims; /* rank of dataspace */
+ int carry; /* counter carry value */
+ hsize_t zero[8]; /* vector of zeros */
+ unsigned int flags; /* buffer extent flags */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hbool_t past_catch = FALSE;
/* Print info */
- size_t p_type_nbytes; /* size of memory type */
- hsize_t p_nelmts; /* total selected elmts */
+ size_t p_type_nbytes; /* size of memory type */
+ hsize_t p_nelmts; /* total selected elmts */
/* Stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
- hsize_t sm_nbytes; /* bytes per stripmine */
- hsize_t sm_nelmts; /* elements per stripmine*/
- unsigned char *sm_buf = NULL; /* buffer for raw data */
- hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hsize_t sm_nelmts; /* elements per stripmine*/
+ unsigned char *sm_buf = NULL; /* buffer for raw data */
+ hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
/* Hyperslab info */
- hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
- hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
- hsize_t hs_nelmts; /* elements in request */
+ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_nelmts; /* elements in request */
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
- int ret_value = 0;
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ int ret_value = 0;
H5TOOLS_START_DEBUG("");
if (H5I_INVALID_HID == (f_space = H5Dget_space(dset)))
@@ -1670,11 +1659,8 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
H5TOOLS_GOTO_ERROR((-1), "ctx->ndims > NELMTS(sm_size) failed");
/* Assume entire data space to be printed */
- if (ctx->ndims > 0)
- for (i = 0; i < (size_t)ctx->ndims; i++)
- ctx->p_min_idx[i] = 0;
-
H5Sget_simple_extent_dims(f_space, total_size, NULL);
+ init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx);
/* calculate the number of elements we're going to print */
p_nelmts = 1;
@@ -1720,8 +1706,6 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
H5TOOLS_DEBUG("sm_nelmts size:%ld", sm_nelmts);
- if (ctx->ndims > 0)
- init_acc_pos(ctx, total_size);
H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims);
/* The stripmine loop */
@@ -1762,7 +1746,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
indices */
ctx->sm_pos = elmtno;
- if(h5tools_dump_simple_data(stream, info, dset, ctx, flags, hs_nelmts, p_type, sm_buf) < 0)
+ if(h5tools_dump_simple_data(stream, info, ctx, dset, flags, hs_nelmts, p_type, sm_buf) < 0)
H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
@@ -1841,11 +1825,8 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
H5TOOLS_THROW((-1), "ctx->ndims > NELMTS(ctx->p_min_idx) failed");
/* Assume entire data space to be printed */
- if (ctx->ndims > 0)
- for (i = 0; i < (size_t)ctx->ndims; i++)
- ctx->p_min_idx[i] = 0;
-
H5Sget_simple_extent_dims(f_space, total_size, NULL);
+ init_acc_pos(ctx->ndims, total_size, ctx->acc, ctx->pos, ctx->p_min_idx);
/* calculate the number of elements we're going to print */
p_nelmts = 1;
@@ -1868,14 +1849,12 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
alloc_size = p_nelmts * H5Tget_size(p_type);
HDassert(alloc_size == (hsize_t)((size_t)alloc_size)); /*check for overflow*/
if (NULL != (buf = (unsigned char *)HDmalloc((size_t)alloc_size))) {
- if (ctx->ndims > 0)
- init_acc_pos(ctx, total_size);
H5TOOLS_DEBUG("ctx->ndims:%d", ctx->ndims);
H5TOOLS_DEBUG("Read the data");
/* Read the data */
if (H5Aread(attr_id, p_type, buf) >= 0) {
- if(h5tools_dump_simple_data(stream, info, attr_id, ctx, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0)
+ if(h5tools_dump_simple_data(stream, info, ctx, attr_id, START_OF_DATA | END_OF_DATA, p_nelmts, p_type, buf) < 0)
H5TOOLS_ERROR((-1), "h5tools_dump_simple_data failed");
/* Reclaim any VL memory, if necessary */
@@ -3987,6 +3966,226 @@ h5tools_dump_subsetting_header(FILE *stream, const h5tool_format_t *info, h5tool
}
/*-------------------------------------------------------------------------
+ * Function: dump_reference
+ *
+ * Purpose: Dump reference data
+ *
+ * Return: void
+ *-------------------------------------------------------------------------
+ */
+void
+h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, H5R_ref_t *ref_buf, int ndims)
+{
+ hid_t new_obj_id = H5I_INVALID_HID;
+ hid_t new_obj_sid = H5I_INVALID_HID;
+ hsize_t elmt_counter = 0; /*counts the # elements printed. */
+ size_t ncols = 80; /* available output width */
+ int i;
+ hsize_t curr_pos = 0; /* total data element position */
+ h5tools_str_t buffer; /* string into which to render */
+ h5tools_context_t datactx; /* print context */
+
+ H5TOOLS_START_DEBUG("");
+
+ datactx = *ctx; /* print context */
+ /* Assume entire data space to be printed */
+ datactx.need_prefix = TRUE;
+
+ HDmemset(&buffer, 0, sizeof(h5tools_str_t));
+ for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) {
+ H5O_type_t obj_type = -1; /* Object type */
+ H5R_type_t ref_type; /* Reference type */
+
+ H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos);
+
+ datactx.need_prefix = TRUE;
+ h5tools_str_reset(&buffer);
+ H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i);
+ h5tools_str_sprint(&buffer, info, container, H5T_STD_REF, &ref_buf[i], &datactx);
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims);
+
+ ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]);
+ switch (ref_type) {
+ case H5R_OBJECT1:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT1");
+ if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) {
+ switch (obj_type) {
+ case H5O_TYPE_DATASET:
+ if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ datactx.indent_level++;
+ h5tools_dump_data(stream, info, &datactx, new_obj_id, TRUE);
+ //h5tools_dump_dset(stream, info, &datactx, new_obj_id);
+ datactx.indent_level--;
+ if(H5Dclose(new_obj_id) < 0)
+ H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed");
+ }
+ else
+ H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed");
+ break;
+
+ case H5O_TYPE_GROUP:
+ case H5O_TYPE_NAMED_DATATYPE:
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ break;
+ } /* end switch */
+ }
+ else
+ H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed");
+ break;
+ case H5R_DATASET_REGION1:
+ H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
+ if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ datactx.indent_level++;
+ h5tools_dump_data(stream, info, &datactx, new_obj_id, TRUE);
+ //h5tools_dump_dset(stream, info, &datactx, new_obj_id);
+ datactx.indent_level--;
+ if(H5Dclose(new_obj_id) < 0)
+ H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed");
+ }
+ else
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed");
+ break;
+ case H5R_OBJECT2:
+ H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
+ if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) {
+ switch (obj_type) {
+ case H5O_TYPE_GROUP:
+ break;
+
+ case H5O_TYPE_DATASET:
+ if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ datactx.indent_level++;
+ h5tools_dump_data(stream, info, &datactx, new_obj_id, TRUE);
+ //h5tools_dump_dset(stream, info, &datactx, new_obj_id);
+ datactx.indent_level--;
+ if(H5Oclose(new_obj_id) < 0)
+ H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
+ }
+ else
+ H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed");
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ break;
+
+ case H5O_TYPE_MAP:
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ break;
+ } /* end switch */
+ }
+ else
+ H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed");
+ break;
+ case H5R_DATASET_REGION2:
+ H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2");
+
+ if (info->line_ncols > 0)
+ ncols = info->line_ncols;
+
+ /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */
+ if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed");
+ else {
+ if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) {
+ H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " {");
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+
+ datactx.need_prefix = TRUE;
+ datactx.indent_level++;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "NULL");
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ datactx.indent_level--;
+ datactx.need_prefix = TRUE;
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "}");
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ }
+ else {
+ H5S_sel_type region_type;
+
+ region_type = H5Sget_select_type(new_obj_sid);
+ if(region_type == H5S_SEL_POINTS) {
+ /* Print point information */
+ H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2");
+ h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx,
+ &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
+ }
+ else if(region_type == H5S_SEL_HYPERSLABS) {
+ /* Print block information */
+ H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2");
+ h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx,
+ &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
+ }
+ else
+ H5TOOLS_INFO("invalid region type");
+ } /* end else to if (h5tools_is_zero(... */
+ if(H5Sclose(new_obj_sid) < 0)
+ H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed");
+ }
+ else
+ H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed");
+ if(H5Dclose(new_obj_id) < 0)
+ H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
+ }
+ break;
+ case H5R_ATTR:
+ H5TOOLS_DEBUG("ref_type is H5R_ATTR");
+ if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
+ h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ if(H5Aclose(new_obj_id) < 0)
+ H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
+ }
+ else {
+ H5TOOLS_DEBUG("NULL H5R_ATTR");
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, " {");
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+
+ datactx.need_prefix = TRUE;
+ datactx.indent_level++;
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "NULL");
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+ datactx.indent_level--;
+ datactx.need_prefix = TRUE;
+
+ h5tools_str_reset(&buffer);
+ h5tools_str_append(&buffer, "}");
+ h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
+
+ H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed");
+ }
+ break;
+ case H5R_BADTYPE:
+ case H5R_MAXTYPE:
+ default:
+ break;
+ } /* end switch */
+
+ if(H5Rdestroy(&ref_buf[i]) < 0)
+ H5TOOLS_INFO("H5Rdestroy failed");
+
+ H5TOOLS_DEBUG("finished reference loop:%d",i);
+ } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */
+
+ h5tools_str_close(&buffer);
+
+ H5TOOLS_ENDDEBUG("");
+}
+
+/*-------------------------------------------------------------------------
* Function: dump_data
*
* Purpose: Dump attribute, obj_data is FALSE, or dataset data, obj_data is TRUE
@@ -3999,13 +4198,9 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
{
H5S_class_t space_type;
int ndims;
- size_t i;
hid_t space = H5I_INVALID_HID;
hid_t f_type = H5I_INVALID_HID;
- hid_t new_obj_id = H5I_INVALID_HID;
- hid_t new_obj_sid = H5I_INVALID_HID;
hsize_t total_size[H5S_MAX_RANK];
- hsize_t elmt_counter = 0; /*counts the # elements printed. */
int status = -1;
h5tools_context_t datactx; /* print context */
h5tools_str_t buffer; /* string into which to render */
@@ -4070,13 +4265,9 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
H5TOOLS_DEBUG("ndims=%d - datactx.ndims=%d", ndims, datactx.ndims);
/* Assume entire data space to be printed */
- if (datactx.ndims > 0)
- for (i = 0; i < (size_t)datactx.ndims; i++)
- datactx.p_min_idx[i] = 0;
-
H5Sget_simple_extent_dims(space, total_size, NULL);
- if (datactx.ndims > 0)
- init_acc_pos(&datactx, total_size);
+ init_acc_pos(datactx.ndims, total_size, datactx.acc, datactx.pos, datactx.p_min_idx);
+
datactx.need_prefix = TRUE;
if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
@@ -4094,197 +4285,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
H5TOOLS_GOTO_DONE_NO_RET();
}
}
- for (i = 0; i < (size_t)ndims; i++, datactx.cur_elmt++, elmt_counter++) {
- H5O_type_t obj_type = -1; /* Object type */
- H5R_type_t ref_type; /* Reference type */
-
- H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos);
-
- datactx.need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i);
- h5tools_str_sprint(&buffer, &outputformat, obj_id, H5T_STD_REF, &ref_buf[i], &datactx);
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims);
-
- ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]);
- switch (ref_type) {
- case H5R_OBJECT1:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT1");
- if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) {
- switch (obj_type) {
- case H5O_TYPE_DATASET:
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- datactx.indent_level++;
- h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE);
- datactx.indent_level--;
- if(H5Dclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed");
- break;
-
- case H5O_TYPE_GROUP:
- case H5O_TYPE_NAMED_DATATYPE:
- case H5O_TYPE_MAP:
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- break;
- } /* end switch */
- }
- else
- H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed");
- break;
- case H5R_DATASET_REGION1:
- H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- datactx.indent_level++;
- h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE);
- datactx.indent_level--;
- if(H5Dclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed");
- break;
- case H5R_OBJECT2:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
- if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) {
- switch (obj_type) {
- case H5O_TYPE_GROUP:
- break;
-
- case H5O_TYPE_DATASET:
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- datactx.indent_level++;
- h5tools_dump_data(stream, &outputformat, &datactx, new_obj_id, TRUE);
- datactx.indent_level--;
- if(H5Oclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed");
- break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- break;
-
- case H5O_TYPE_MAP:
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- break;
- } /* end switch */
- }
- else
- H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed");
- break;
- case H5R_DATASET_REGION2:
- H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2");
-
- if (outputformat.line_ncols > 0)
- ncols = outputformat.line_ncols;
-
- /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0)
- H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed");
- else {
- if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) {
- H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " {");
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- datactx.indent_level++;
- datactx.need_prefix = TRUE;
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- datactx.indent_level--;
- datactx.need_prefix = TRUE;
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "}");
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- H5S_sel_type region_type;
-
- region_type = H5Sget_select_type(new_obj_sid);
- if(region_type == H5S_SEL_POINTS) {
- /* Print point information */
- H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2");
- h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, &outputformat, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
- }
- else if(region_type == H5S_SEL_HYPERSLABS) {
- /* Print block information */
- H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2");
- h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, &outputformat, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
- }
- else
- H5TOOLS_INFO("invalid region type");
- } /* end else to if (h5tools_is_zero(... */
- if(H5Sclose(new_obj_sid) < 0)
- H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed");
- if(H5Dclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
- }
- break;
- case H5R_ATTR:
- H5TOOLS_DEBUG("ref_type is H5R_ATTR");
- if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- h5tools_dump_region_attribute(new_obj_id, stream, &outputformat, &datactx,
- &buffer, &curr_pos, ncols, i, elmt_counter);
- if(H5Aclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
- }
- else {
- H5TOOLS_DEBUG("NULL H5R_ATTR");
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " {");
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- datactx.indent_level++;
- datactx.need_prefix = TRUE;
-
- datactx.indent_level++;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- datactx.indent_level--;
-
- datactx.indent_level--;
- datactx.need_prefix = TRUE;
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "}");
- h5tools_render_element(stream, &outputformat, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed");
- }
- break;
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- break;
- } /* end switch */
-
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_INFO("H5Rdestroy failed");
-
- H5TOOLS_DEBUG("finished reference loop:%d",i);
- } /* end for(i = 0; i < ndims; i++, datactx->cur_elmt++, elmt_counter++) */
+ h5tools_dump_reference(stream, &outputformat, &datactx, obj_id, ref_buf, ndims);
HDfree(ref_buf);
}
ctx->indent_level--;
diff --git a/tools/lib/h5tools_dump.h b/tools/lib/h5tools_dump.h
index 2cd0bc1..add2e46 100644
--- a/tools/lib/h5tools_dump.h
+++ b/tools/lib/h5tools_dump.h
@@ -36,63 +36,53 @@ H5TOOLS_DLLVAR table_t *h5dump_type_table; /*type table reference for datatype
/* Definitions of useful routines */
H5TOOLS_DLL void h5tools_dump_init(void);
-H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t dset);
-H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t obj_id);
-H5TOOLS_DLL int h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t container,
- h5tools_context_t *ctx/*in,out*/, unsigned flags,
- hsize_t nelmts, hid_t type, void *_mem);
-H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t type);
-H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t space);
-H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, const char *attr_name, hid_t attr_id);
-H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t oid);
-H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t dcpl, hid_t type_id, hid_t obj_id);
-H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/, hid_t obj_id);
-H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx, hid_t obj_id, int obj_data);
+H5TOOLS_DLL int h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t dset);
+H5TOOLS_DLL int h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t obj_id);
+H5TOOLS_DLL int h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t container, unsigned flags, hsize_t nelmts, hid_t type, void *_mem);
+H5TOOLS_DLL void h5tools_dump_datatype(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t type);
+H5TOOLS_DLL void h5tools_dump_dataspace(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t space);
+H5TOOLS_DLL void h5tools_dump_attribute(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ const char *attr_name, hid_t attr_id);
+H5TOOLS_DLL void h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t oid);
+H5TOOLS_DLL void h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t dcpl, hid_t type_id, hid_t obj_id);
+H5TOOLS_DLL void h5tools_dump_comment(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ hid_t obj_id);
+H5TOOLS_DLL void h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hid_t obj_id, int obj_data);
+H5TOOLS_DLL void h5tools_dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
+ hid_t container, H5R_ref_t *ref_buf, int ndims);
H5TOOLS_DLL hbool_t h5tools_dump_region_attribute(hid_t region_id,
- FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/,
- h5tools_str_t *buffer/*string into which to render */,
- hsize_t *curr_pos/*total data element position*/,
- size_t ncols, hsize_t region_elmt_counter/*element counter*/,
- hsize_t elmt_counter);
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter);
H5TOOLS_DLL hbool_t h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/,
- h5tools_str_t *buffer/*string into which to render */,
- hsize_t *curr_pos/*total data element position*/,
- size_t ncols, hsize_t region_elmt_counter/*element counter*/,
- hsize_t elmt_counter);
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter);
H5TOOLS_DLL hbool_t h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
- FILE *stream, const h5tool_format_t *info,
- h5tools_context_t *ctx/*in,out*/,
- h5tools_str_t *buffer/*string into which to render */,
- hsize_t *curr_pos/*total data element position*/,
- size_t ncols, hsize_t region_elmt_counter/*element counter*/,
- hsize_t elmt_counter);
+ FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+ h5tools_str_t *buffer, hsize_t *curr_pos, size_t ncols, hsize_t region_elmt_counter, hsize_t elmt_counter);
-H5TOOLS_DLL int h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer/*in,out*/,
- const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+H5TOOLS_DLL int h5tools_print_datatype(FILE *stream,
+ h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
hid_t type, int object_search);
H5TOOLS_DLL int h5tools_print_dataspace(h5tools_str_t *buffer/*in,out*/,
hid_t space);
-H5TOOLS_DLL int h5tools_print_enum(FILE *stream, h5tools_str_t *buffer/*in,out*/,
- const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+H5TOOLS_DLL int h5tools_print_enum(FILE *stream,
+ h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
hid_t type);
-H5TOOLS_DLL void h5tools_print_fill_value(h5tools_str_t *buffer/*in,out*/,
- const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
+H5TOOLS_DLL void h5tools_print_fill_value(
+ h5tools_str_t *buffer/*in,out*/, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/,
hid_t dcpl, hid_t type_id, hid_t obj_id);
H5TOOLS_DLL void h5tools_print_packed_bits(h5tools_str_t *buffer/*in,out*/, hid_t type);
+
#ifdef __cplusplus
}
#endif
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 5c777a9..1c573a7 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -278,47 +278,28 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt)
* Purpose: Renders the line prefix value into string STR.
*
* Return: Success: Pointer to the prefix.
- *
* Failure: NULL
- *
- * Programmer: Robb Matzke
- * Thursday, July 23, 1998
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
- hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx)
+h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno,
+ h5tools_context_t *ctx)
{
size_t i = 0;
- hsize_t curr_pos = elmtno;
H5TOOLS_START_DEBUG("");
H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims);
h5tools_str_reset(str);
- H5TOOLS_DEBUG("ndims=%d", ndims);
- if(ndims > 0) {
- /*
- * Calculate the number of elements represented by a unit change in a
- * certain index position.
- */
- for(i = 0; i < (size_t) ndims; i++) {
- H5TOOLS_DEBUG("curr_pos=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->acc[i]);
- ctx->pos[i] = curr_pos / ctx->acc[i];
- curr_pos -= ctx->acc[i] * ctx->pos[i];
- H5TOOLS_DEBUG("curr_pos=%ld - ctx->pos[%d]=%ld - ctx->acc[%d]=%ld", curr_pos, i, ctx->pos[i], i, ctx->acc[i]);
- }
- HDassert(curr_pos == 0);
-
+ calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos);
+ if(ctx->ndims > 0) {
/* Print the index values */
- for(i = 0; i < (size_t) ndims; i++) {
+ for(i = 0; i < (size_t) ctx->ndims; i++) {
if (i)
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT),
- (hsize_t) ctx->pos[i]);
-
+ h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) ctx->pos[i]);
}
}
else /* Scalar */
@@ -338,52 +319,35 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
*
* Return: Success: Pointer to the prefix.
* Failure: NULL
- *
- * In/Out:
- * h5tools_context_t *ctx
- * h5tools_str_t *str
*-------------------------------------------------------------------------
*/
char *
-h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, unsigned ndims, hsize_t max_idx[],
- h5tools_context_t *ctx)
+h5tools_str_region_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info, hsize_t elmtno,
+ hsize_t *ptdata, h5tools_context_t *ctx)
{
size_t i = 0;
- hsize_t curr_pos = elmtno;
- hsize_t p_prod[H5S_MAX_RANK];
-
- h5tools_str_reset(str);
- if(ndims > 0) {
- /*
- * Calculate the number of elements represented by a unit change in a
- * certain index position.
- */
- for(i = ndims - 1, p_prod[ndims - 1] = 1; i > 0; --i)
- p_prod[i - 1] = (max_idx[i]) * p_prod[i];
+ H5TOOLS_START_DEBUG("");
- for(i = 0; i < (size_t) ndims; i++) {
- if(curr_pos > 0) {
- ctx->pos[i] = curr_pos / p_prod[i];
- curr_pos -= p_prod[i] * ctx->pos[i];
- }
- else
- ctx->pos[i] = 0;
- ctx->pos[i] += (unsigned long) ptdata[ctx->sm_pos+i];
- }
+ H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims);
+ h5tools_str_reset(str);
+ calc_acc_pos(ctx->ndims, elmtno, ctx->acc, ctx->pos);
+ if(ctx->ndims > 0) {
/* Print the index values */
- for(i = 0; i < (size_t) ndims; i++) {
- if(i)
+ for(i = 0; i < (size_t) ctx->ndims; i++) {
+ ctx->pos[i] += (unsigned long) ptdata[ctx->sm_pos+i];
+ if (i)
h5tools_str_append(str, "%s", OPT(info->idx_sep, ","));
h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) ctx->pos[i]);
-
}
- } /* if (ndims > 0) */
+ }
else /* Scalar */
- h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t) 0);
+ h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)0);
+ H5TOOLS_DEBUG("str=%s", str->s);
+
+ H5TOOLS_ENDDEBUG("");
/* Add prefix and suffix to the index */
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
@@ -708,6 +672,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if(info->raw) {
size_t i;
+ H5TOOLS_DEBUG("info->raw");
if(1 == nsize)
h5tools_str_append(str, OPT(info->fmt_raw, "0x%02x"), ucp_vp[0]);
else
@@ -718,8 +683,11 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
}
else {
- if((type_class = H5Tget_class(type)) < 0)
+ H5TOOLS_DEBUG("H5Tget_class(type)");
+ if((type_class = H5Tget_class(type)) < 0) {
+ H5TOOLS_ENDDEBUG(" with %s", "NULL");
return NULL;
+ }
switch (type_class) {
case H5T_FLOAT:
H5TOOLS_DEBUG("H5T_FLOAT");
diff --git a/tools/lib/h5tools_str.h b/tools/lib/h5tools_str.h
index 02bfe40..65446ee 100644
--- a/tools/lib/h5tools_str.h
+++ b/tools/lib/h5tools_str.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
+ * Programmer: Bill Wendling
* Monday, 19. February 2001
*/
#ifndef H5TOOLS_STR_H__
@@ -31,13 +31,12 @@ H5TOOLS_DLL char *h5tools_str_reset(h5tools_str_t *str);
H5TOOLS_DLL char *h5tools_str_trunc(h5tools_str_t *str, size_t size);
H5TOOLS_DLL char *h5tools_str_fmt(h5tools_str_t *str, size_t start, const char *fmt);
H5TOOLS_DLL char *h5tools_str_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, unsigned ndims, h5tools_context_t *ctx);
+ hsize_t elmtno, h5tools_context_t *ctx);
/*
* new functions needed to display region reference data
*/
H5TOOLS_DLL char *h5tools_str_region_prefix(h5tools_str_t *str, const h5tool_format_t *info,
- hsize_t elmtno, hsize_t *ptdata, unsigned ndims,
- hsize_t max_idx[], h5tools_context_t *ctx);
+ hsize_t elmtno, hsize_t *ptdata, h5tools_context_t *ctx);
H5TOOLS_DLL void h5tools_str_dump_space_slabs(h5tools_str_t *, hid_t, const h5tool_format_t *, h5tools_context_t *ctx);
H5TOOLS_DLL void h5tools_str_dump_space_blocks(h5tools_str_t *, hid_t, const h5tool_format_t *);
H5TOOLS_DLL void h5tools_str_dump_space_points(h5tools_str_t *, hid_t, const h5tool_format_t *);
diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 2d53030..63b3041 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -902,7 +902,7 @@ tmpfile(void)
* link_info->trg_path must be freed out of this function
*-------------------------------------------------------------------------*/
int
-H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
+H5tools_get_symlink_info(hid_t file_id, const char *linkpath, h5tool_link_info_t *link_info, hbool_t get_obj_type)
{
htri_t l_ret;
H5O_info2_t trg_oinfo;
diff --git a/tools/lib/h5tools_utils.h b/tools/lib/h5tools_utils.h
index a05f883..2cd2eae 100644
--- a/tools/lib/h5tools_utils.h
+++ b/tools/lib/h5tools_utils.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Bill Wendling <wendling@ncsa.uiuc.edu>
+ * Programmer: Bill Wendling
* Tuesday, 6. March 2001
*
* Purpose: Support functions for the various tools.
diff --git a/tools/lib/io_timer.c b/tools/lib/io_timer.c
index 472824b..5c0c31d 100644
--- a/tools/lib/io_timer.c
+++ b/tools/lib/io_timer.c
@@ -23,7 +23,6 @@
*/
#include "H5private.h"
-#include "hdf5.h"
#include "io_timer.h"
diff --git a/tools/libtest/h5tools_test_utils.c b/tools/libtest/h5tools_test_utils.c
index 12360a7..244fd43 100644
--- a/tools/libtest/h5tools_test_utils.c
+++ b/tools/libtest/h5tools_test_utils.c
@@ -1003,6 +1003,7 @@ test_set_configured_fapl(void)
hid_t fapl_id = H5I_INVALID_HID;
other_fa_t wrong_fa = {0x432, 0xf82, 0x9093};
+#ifdef H5_HAVE_ROS3_VFD
H5FD_ros3_fapl_t ros3_anon_fa = {1, FALSE, "", "", ""};
H5FD_ros3_fapl_t ros3_auth_fa = {
1, /* fapl version */
@@ -1011,6 +1012,8 @@ test_set_configured_fapl(void)
"12345677890abcdef", /* simulate access key ID */
"oiwnerwe9u0234nJw0-aoj+dsf", /* simulate secret key */
};
+#endif /* H5_HAVE_ROS3_VFD */
+#ifdef H5_HAVE_LIBHDFS
H5FD_hdfs_fapl_t hdfs_fa = {
1, /* fapl version */
"", /* namenode name */
@@ -1019,6 +1022,7 @@ test_set_configured_fapl(void)
"", /* user name */
2048, /* stream buffer size */
};
+#endif /* H5_HAVE_LIBHDFS */
unsigned n_cases = 7; /* number of common testcases */
testcase cases[] = {
{ "(common) should fail: no fapl id",
diff --git a/tools/src/h5copy/h5copy.c b/tools/src/h5copy/h5copy.c
index 8805d08..a6e4d4e 100644
--- a/tools/src/h5copy/h5copy.c
+++ b/tools/src/h5copy/h5copy.c
@@ -207,17 +207,13 @@ static int parse_flag(const char* s_flag, unsigned *flag)
int
main (int argc, const char *argv[])
{
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
hid_t fid_src = H5I_INVALID_HID;
hid_t fid_dst = H5I_INVALID_HID;
unsigned flag = 0;
unsigned verbose = 0;
unsigned parents = 0;
- hid_t ocpl_id = (-1); /* Object copy property list */
- hid_t lcpl_id = (-1); /* Link creation property list */
+ hid_t ocpl_id = H5I_INVALID_HID; /* Object copy property list */
+ hid_t lcpl_id = H5I_INVALID_HID; /* Link creation property list */
int opt;
int li_ret;
h5tool_link_info_t linkinfo;
@@ -226,17 +222,9 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
/* init linkinfo struct */
HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
@@ -330,10 +318,8 @@ main (int argc, const char *argv[])
leave(EXIT_FAILURE);
}
- if (enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
+ /* enable error reporting if command line option */
+ h5tools_error_report();
/*-------------------------------------------------------------------------
* open output file
diff --git a/tools/src/h5diff/h5diff_common.c b/tools/src/h5diff/h5diff_common.c
index e0e6f8c..8ed2d37 100644
--- a/tools/src/h5diff/h5diff_common.c
+++ b/tools/src/h5diff/h5diff_common.c
@@ -25,7 +25,7 @@ static int check_d_input(const char*);
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVrv:qn:d:p:NcelxE:S";
+static const char *s_opts = "hVrv:qn:d:p:NcelxE:A:S";
static struct long_options l_opts[] = {
{ "help", no_arg, 'h' },
{ "version", no_arg, 'V' },
@@ -41,6 +41,7 @@ static struct long_options l_opts[] = {
{ "follow-symlinks", no_arg, 'l' },
{ "no-dangling-links", no_arg, 'x' },
{ "exclude-path", require_arg, 'E' },
+ { "exclude-attribute", require_arg, 'A' },
{ "enable-error-stack", no_arg, 'S' },
{ "vol-value-1", require_arg, '1' },
{ "vol-name-1", require_arg, '2' },
@@ -55,7 +56,6 @@ static struct long_options l_opts[] = {
* Function: check_options
*
* Purpose: parse command line input
- *
*-------------------------------------------------------------------------
*/
static void check_options(diff_opt_t* opts)
@@ -67,7 +67,7 @@ static void check_options(diff_opt_t* opts)
/* check between -d , -p, --use-system-epsilon.
* These options are mutually exclusive.
*/
- if ((opts->d + opts->p + opts->use_system_epsilon) > 1) {
+ if ((opts->delta_bool + opts->percent_bool + opts->use_system_epsilon) > 1) {
HDprintf("%s error: -d, -p and --use-system-epsilon options are mutually-exclusive;\n", PROGRAMNAME);
HDprintf("use no more than one.\n");
HDprintf("Try '-h' or '--help' option for more information or see the %s entry in the 'HDF5 Reference Manual'.\n", PROGRAMNAME);
@@ -75,27 +75,139 @@ static void check_options(diff_opt_t* opts)
}
}
+#if TRILABS-227
+/*-------------------------------------------------------------------------
+ * Function: parse_hsize_list
+ *
+ * Purpose: Parse a list of comma or space separated integers and return
+ * them in a list. The string being passed into this function
+ * should be at the start of the list you want to parse. You are
+ * responsible for freeing the array returned from here.
+ *
+ * Lists in the so-called "terse" syntax are separated by
+ * semicolons (;). The lists themselves can be separated by
+ * either commas (,) or white spaces.
+ *
+ * Return: <none>
+ *-------------------------------------------------------------------------
+ */
+static void
+parse_hsize_list(const char *h_list, subset_d *d)
+{
+ hsize_t *p_list;
+ const char *ptr;
+ unsigned int size_count = 0;
+ unsigned int i = 0;
+ unsigned int last_digit = 0;
+
+ if (!h_list || !*h_list || *h_list == ';')
+ return;
+
+ H5TOOLS_START_DEBUG(" - h_list:%s", h_list);
+ /* count how many integers do we have */
+ for (ptr = h_list; ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
+ if (HDisdigit(*ptr)) {
+ if (!last_digit)
+ /* the last read character wasn't a digit */
+ size_count++;
+
+ last_digit = 1;
+ }
+ else
+ last_digit = 0;
+
+ if (size_count == 0) {
+ /* there aren't any integers to read */
+ H5TOOLS_ENDDEBUG("No integers to read");
+ return;
+ }
+ H5TOOLS_DEBUG("Number integers to read=%ld", size_count);
+
+ /* allocate an array for the integers in the list */
+ if((p_list = (hsize_t *)HDcalloc(size_count, sizeof(hsize_t))) == NULL)
+ H5TOOLS_INFO("Unable to allocate space for subset data");
+
+ for (ptr = h_list; i < size_count && ptr && *ptr && *ptr != ';' && *ptr != ']'; ptr++)
+ if(HDisdigit(*ptr)) {
+ /* we should have an integer now */
+ p_list[i++] = (hsize_t)HDstrtoull(ptr, NULL, 0);
+
+ while (HDisdigit(*ptr))
+ /* scroll to end of integer */
+ ptr++;
+ }
+ d->data = p_list;
+ d->len = size_count;
+ H5TOOLS_ENDDEBUG("");
+}
+
+/*-------------------------------------------------------------------------
+ * Function: parse_subset_params
+ *
+ * Purpose: Parse the so-called "terse" syntax for specifying subsetting parameters.
+ *
+ * Return: Success: struct subset_t object
+ * Failure: NULL
+ *-------------------------------------------------------------------------
+ */
+static struct subset_t *
+parse_subset_params(const char *dset)
+{
+ struct subset_t *s = NULL;
+ char *brace;
+
+ H5TOOLS_START_DEBUG(" - dset:%s", dset);
+ if ((brace = HDstrrchr(dset, '[')) != NULL) {
+ *brace++ = '\0';
+
+ s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
+ parse_hsize_list(brace, &s->start);
+
+ while (*brace && *brace != ';')
+ brace++;
+
+ if (*brace)
+ brace++;
+
+ parse_hsize_list(brace, &s->stride);
+
+ while (*brace && *brace != ';')
+ brace++;
+
+ if (*brace)
+ brace++;
+
+ parse_hsize_list(brace, &s->count);
+
+ while (*brace && *brace != ';')
+ brace++;
+
+ if (*brace)
+ brace++;
+
+ parse_hsize_list(brace, &s->block);
+ }
+ H5TOOLS_ENDDEBUG("");
+
+ return s;
+}
+#endif
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
* Purpose: parse command line input
- *
*-------------------------------------------------------------------------
*/
-void parse_command_line(int argc,
- const char* argv[],
- const char** fname1,
- const char** fname2,
- const char** objname1,
- const char** objname2,
- diff_opt_t* opts)
+void parse_command_line(int argc, const char* argv[], const char** fname1, const char** fname2, const char** objname1, const char** objname2, diff_opt_t* opts)
{
int i;
int opt;
struct exclude_path_list *exclude_head, *exclude_prev, *exclude_node;
+ struct exclude_path_list *exclude_attr_head, *exclude_attr_prev, *exclude_attr_node;
+ H5TOOLS_START_DEBUG("");
/* process the command-line */
HDmemset(opts, 0, sizeof (diff_opt_t));
@@ -106,15 +218,18 @@ void parse_command_line(int argc,
opts->do_nans = 1;
/* not Listing objects that are not comparable */
- opts->m_list_not_cmp = 0;
+ opts->mode_list_not_cmp = 0;
/* initially no not-comparable. */
/**this is bad in mixing option with results**/
- opts->not_cmp=0;
+ opts->not_cmp = 0;
/* init for exclude-path option */
exclude_head = NULL;
+ /* init for exclude-attribute option */
+ exclude_attr_head = NULL;
+
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
switch ((char)opt) {
@@ -134,7 +249,7 @@ void parse_command_line(int argc,
break;
case 'v':
- opts->m_verbose = 1;
+ opts->mode_verbose = 1;
/* This for loop is for handling style like
* -v, -v1, --verbose, --verbose=1.
*/
@@ -144,11 +259,11 @@ void parse_command_line(int argc,
*/
if (!strcmp (argv[i], "-v")) { /* no arg */
opt_ind--;
- opts->m_verbose_level = 0;
+ opts->mode_verbose_level = 0;
break;
}
else if (!strncmp (argv[i], "-v", (size_t)2)) {
- opts->m_verbose_level = atoi(&argv[i][2]);
+ opts->mode_verbose_level = atoi(&argv[i][2]);
break;
}
@@ -156,11 +271,11 @@ void parse_command_line(int argc,
* long opt
*/
if (!strcmp (argv[i], "--verbose")) { /* no arg */
- opts->m_verbose_level = 0;
+ opts->mode_verbose_level = 0;
break;
}
- else if ( !strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
- opts->m_verbose_level = atoi(&argv[i][10]);
+ else if (!strncmp (argv[i], "--verbose", (size_t)9) && argv[i][9]=='=') {
+ opts->mode_verbose_level = atoi(&argv[i][10]);
break;
}
}
@@ -168,11 +283,11 @@ void parse_command_line(int argc,
case 'q':
/* use quiet mode; supress the message "0 differences found" */
- opts->m_quiet = 1;
+ opts->mode_quiet = 1;
break;
case 'r':
- opts->m_report = 1;
+ opts->mode_report = 1;
break;
case 'l':
@@ -214,23 +329,47 @@ void parse_command_line(int argc,
}
break;
+ case 'A':
+ opts->exclude_attr_path = 1;
+
+ /* create linked list of excluding objects */
+ if( (exclude_attr_node = (struct exclude_path_list*) HDmalloc(sizeof(struct exclude_path_list))) == NULL) {
+ HDprintf("Error: lack of memory!\n");
+ h5diff_exit(EXIT_FAILURE);
+ }
+
+ /* init */
+ exclude_attr_node->obj_path = opt_arg;
+ exclude_attr_node->obj_type = H5TRAV_TYPE_UNKNOWN;
+ exclude_attr_prev = exclude_attr_head;
+
+ if (NULL == exclude_attr_head) {
+ exclude_attr_head = exclude_attr_node;
+ exclude_attr_head->next = NULL;
+ }
+ else {
+ while(NULL != exclude_attr_prev->next)
+ exclude_attr_prev = exclude_attr_prev->next;
+
+ exclude_attr_node->next = NULL;
+ exclude_attr_prev->next = exclude_attr_node;
+ }
+ break;
+
case 'd':
- opts->d = 1;
+ opts->delta_bool = 1;
- if (check_d_input(opt_arg) == - 1) {
+ if (check_d_input(opt_arg) == -1) {
HDprintf("<-d %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
}
opts->delta = HDatof(opt_arg);
-
- /* -d 0 is the same as default */
- if (H5_DBL_ABS_EQUAL(opts->delta, (double)0.0F))
- opts->d=0;
+ /* do not check against default, the DBL_EPSILON is being replaced by user */
break;
case 'p':
- opts->p = 1;
+ opts->percent_bool = 1;
if (check_p_input(opt_arg) == -1) {
HDprintf("<-p %s> is not a valid option\n", opt_arg);
usage();
@@ -240,12 +379,12 @@ void parse_command_line(int argc,
/* -p 0 is the same as default */
if (H5_DBL_ABS_EQUAL(opts->percent, (double)0.0F))
- opts->p = 0;
+ opts->percent_bool = 0;
break;
case 'n':
- opts->n = 1;
- if ( check_n_input(opt_arg) == -1) {
+ opts->count_bool = 1;
+ if (check_n_input(opt_arg) == -1) {
HDprintf("<-n %s> is not a valid option\n", opt_arg);
usage();
h5diff_exit(EXIT_FAILURE);
@@ -258,7 +397,7 @@ void parse_command_line(int argc,
break;
case 'c':
- opts->m_list_not_cmp = 1;
+ opts->mode_list_not_cmp = 1;
break;
case 'e':
@@ -266,35 +405,35 @@ void parse_command_line(int argc,
break;
case '1':
- opts->vol_info_1.type = VOL_BY_VALUE;
- opts->vol_info_1.u.value = (H5VL_class_value_t)HDatoi(opt_arg);
- opts->custom_vol_1 = TRUE;
+ opts->vol_info[0].type = VOL_BY_VALUE;
+ opts->vol_info[0].u.value = (H5VL_class_value_t)HDatoi(opt_arg);
+ opts->custom_vol[0] = TRUE;
break;
case '2':
- opts->vol_info_1.type = VOL_BY_NAME;
- opts->vol_info_1.u.name = opt_arg;
- opts->custom_vol_1 = TRUE;
+ opts->vol_info[0].type = VOL_BY_NAME;
+ opts->vol_info[0].u.name = opt_arg;
+ opts->custom_vol[0] = TRUE;
break;
case '3':
- opts->vol_info_1.info_string = opt_arg;
+ opts->vol_info[0].info_string = opt_arg;
break;
case '4':
- opts->vol_info_2.type = VOL_BY_VALUE;
- opts->vol_info_2.u.value = (H5VL_class_value_t)HDatoi(opt_arg);
- opts->custom_vol_2 = TRUE;
+ opts->vol_info[1].type = VOL_BY_VALUE;
+ opts->vol_info[1].u.value = (H5VL_class_value_t)HDatoi(opt_arg);
+ opts->custom_vol[1] = TRUE;
break;
case '5':
- opts->vol_info_2.type = VOL_BY_NAME;
- opts->vol_info_2.u.name = opt_arg;
- opts->custom_vol_2 = TRUE;
+ opts->vol_info[1].type = VOL_BY_NAME;
+ opts->vol_info[1].u.name = opt_arg;
+ opts->custom_vol[1] = TRUE;
break;
case '6':
- opts->vol_info_2.info_string = opt_arg;
+ opts->vol_info[1].info_string = opt_arg;
break;
}
}
@@ -306,30 +445,49 @@ void parse_command_line(int argc,
if (opts->exclude_path)
opts->exclude = exclude_head;
+ /* if exclude-attribute option is used, keep the exclude attr list */
+ if (opts->exclude_attr_path)
+ opts->exclude_attr = exclude_attr_head;
+
/* check for file names to be processed */
- if (argc <= opt_ind || argv[ opt_ind + 1 ] == NULL) {
+ if (argc <= opt_ind || argv[opt_ind + 1] == NULL) {
error_msg("missing file names\n");
usage();
h5diff_exit(EXIT_FAILURE);
}
- *fname1 = argv[ opt_ind ];
- *fname2 = argv[ opt_ind + 1 ];
- *objname1 = argv[ opt_ind + 2 ];
+ *fname1 = argv[opt_ind];
+ *fname2 = argv[opt_ind + 1];
+ *objname1 = argv[opt_ind + 2];
+ H5TOOLS_DEBUG("file1 = %s", *fname1);
+ H5TOOLS_DEBUG("file2 = %s", *fname2);
if (*objname1 == NULL) {
*objname2 = NULL;
+ H5TOOLS_ENDDEBUG("No obj names");
return;
}
+ H5TOOLS_DEBUG("objname1 = %s", *objname1);
- if (argv[ opt_ind + 3 ] != NULL) {
- *objname2 = argv[ opt_ind + 3 ];
+ if (argv[opt_ind + 3] != NULL) {
+ *objname2 = argv[opt_ind + 3];
}
else {
*objname2 = *objname1;
}
+ H5TOOLS_DEBUG("objname2 = %s", *objname2);
+
+ /*
+ * TRILABS-227 is complete except for an issue with printing indices
+ * the following calls will enable subsetting
+ */
+#if TRILABS-227
+ opts->sset[0] = parse_subset_params(*objname1);
+ opts->sset[1] = parse_subset_params(*objname2);
+#endif
+ H5TOOLS_ENDDEBUG("");
}
@@ -337,26 +495,25 @@ void parse_command_line(int argc,
* Function: print_info
*
* Purpose: print several information messages after h5diff call
- *
*-------------------------------------------------------------------------
*/
void print_info(diff_opt_t* opts)
{
- if (opts->m_quiet || opts->err_stat)
+ if (opts->mode_quiet || opts->err_stat)
return;
if (opts->cmn_objs == 0) {
HDprintf("No common objects found. Files are not comparable.\n");
- if (!opts->m_verbose)
+ if (!opts->mode_verbose)
HDprintf("Use -v for a list of objects.\n");
}
if (opts->not_cmp == 1) {
- if (opts->m_list_not_cmp == 0) {
+ if (opts->mode_list_not_cmp == 0) {
HDprintf("--------------------------------\n");
HDprintf("Some objects are not comparable\n");
HDprintf("--------------------------------\n");
- if (opts->m_verbose)
+ if (opts->mode_verbose)
HDprintf("Use -c for a list of objects without details of differences.\n");
else
HDprintf("Use -c for a list of objects.\n");
@@ -370,19 +527,10 @@ void print_info(diff_opt_t* opts)
* Purpose: check for valid input
*
* Return: 1 for ok, -1 for fail
- *
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
H5_ATTR_PURE static int
-check_n_input( const char *str )
+check_n_input(const char *str)
{
unsigned i;
char c;
@@ -406,24 +554,17 @@ check_n_input( const char *str )
* Purpose: check for a valid p option input
*
* Return: 1 for ok, -1 for fail
- *
- * Date: May 9, 2003
- *
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
-check_p_input( const char *str )
+check_p_input(const char *str)
{
double x;
/*
- the atof return value on a hexadecimal input is different
- on some systems; we do a character check for this
- */
+ * the atof return value on a hexadecimal input is different
+ * on some systems; we do a character check for this
+ */
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
@@ -440,24 +581,17 @@ check_p_input( const char *str )
* Purpose: check for a valid d option input
*
* Return: 1 for ok, -1 for fail
- *
- * Date: November 11, 2007
- *
- * Comments:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
-check_d_input( const char *str )
+check_d_input(const char *str)
{
double x;
/*
- the atof return value on a hexadecimal input is different
- on some systems; we do a character check for this
- */
+ * the atof return value on a hexadecimal input is different
+ * on some systems; we do a character check for this
+ */
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
@@ -474,7 +608,6 @@ check_d_input( const char *str )
* Purpose: print a usage message
*
* Return: void
- *
*-------------------------------------------------------------------------
*/
@@ -499,10 +632,9 @@ void usage(void)
PRINTVALSTREAM(rawoutstream, " Verbose mode with level. Print differences and list of objects.\n");
PRINTVALSTREAM(rawoutstream, " Level of detail depends on value of N:\n");
PRINTVALSTREAM(rawoutstream, " 0 : Identical to '-v' or '--verbose'.\n");
- PRINTVALSTREAM(rawoutstream, " 1 : All level 0 information plus one-line attribute\n");
- PRINTVALSTREAM(rawoutstream, " status summary.\n");
- PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute\n");
- PRINTVALSTREAM(rawoutstream, " status report.\n");
+ PRINTVALSTREAM(rawoutstream, " 1 : All level 0 information plus one-line attribute status summary.\n");
+ PRINTVALSTREAM(rawoutstream, " 2 : All level 1 information plus extended attribute status report.\n");
+ PRINTVALSTREAM(rawoutstream, " 3 : All level 2 information plus file names.\n");
PRINTVALSTREAM(rawoutstream, " -q, --quiet\n");
PRINTVALSTREAM(rawoutstream, " Quiet mode. Do not produce output.\n");
PRINTVALSTREAM(rawoutstream, " --enable-error-stack\n");
@@ -591,7 +723,14 @@ void usage(void)
PRINTVALSTREAM(rawoutstream, " excluded.\n");
PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
PRINTVALSTREAM(rawoutstream, "\n");
-
+ PRINTVALSTREAM(rawoutstream, " --exclude-attribute \"path/to/object/with/attribute\"\n");
+ PRINTVALSTREAM(rawoutstream, " Exclude attributes on the specified path to an object when comparing files or groups.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+ PRINTVALSTREAM(rawoutstream, " If there are multiple paths to an object, only the specified path(s)\n");
+ PRINTVALSTREAM(rawoutstream, " will be excluded; the comparison will include any path not explicitly\n");
+ PRINTVALSTREAM(rawoutstream, " excluded.\n");
+ PRINTVALSTREAM(rawoutstream, " This option can be used repeatedly to exclude multiple paths.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
PRINTVALSTREAM(rawoutstream, " Modes of output:\n");
PRINTVALSTREAM(rawoutstream, " Default mode: print the number of differences found and where they occured\n");
PRINTVALSTREAM(rawoutstream, " -r Report mode: print the above plus the differences\n");
@@ -622,7 +761,22 @@ void usage(void)
PRINTVALSTREAM(rawoutstream, " (The option --follow-symlinks overrides the default behavior when\n");
PRINTVALSTREAM(rawoutstream, " symbolic links are compared.).\n");
PRINTVALSTREAM(rawoutstream, "\n");
-
+ /*
+ * TRILABS-227 is complete except for an issue with printing indices
+ * the following will be needed for subsetting
+ PRINTVALSTREAM(rawoutstream, " Subsetting options:\n");
+ PRINTVALSTREAM(rawoutstream, " Subsetting is available by using the fcompact form of subsetting, as follows:\n");
+ PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;STRIDE;COUNT;BLOCK]\n");
+ PRINTVALSTREAM(rawoutstream, " It is not required to use all parameters, but until the last parameter value used,\n");
+ PRINTVALSTREAM(rawoutstream, " all of the semicolons (;) are required, even when a parameter value is not specified. Example:\n");
+ PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START;;COUNT;BLOCK]\n");
+ PRINTVALSTREAM(rawoutstream, " obj1 /foo/mydataset[START]\n");
+ PRINTVALSTREAM(rawoutstream, " The STRIDE, COUNT, and BLOCK parameters are optional and will default to 1 in\n");
+ PRINTVALSTREAM(rawoutstream, " each dimension. START is optional and will default to 0 in each dimension.\n");
+ PRINTVALSTREAM(rawoutstream, " Each of START, STRIDE, COUNT, and BLOCK must be a comma-separated list of integers with\n");
+ PRINTVALSTREAM(rawoutstream, " one integer for each dimension of the dataset.\n");
+ PRINTVALSTREAM(rawoutstream, "\n");
+*/
PRINTVALSTREAM(rawoutstream, " Exit code:\n");
PRINTVALSTREAM(rawoutstream, " 0 if no differences, 1 if differences found, 2 if error\n");
PRINTVALSTREAM(rawoutstream, "\n");
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index c5a0cbf..e14447d 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -26,7 +26,7 @@
* Return: An exit status of 0 means no differences were found, 1 means some
* differences were found.
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 9, 2003
*
@@ -69,10 +69,7 @@
int main(int argc, const char *argv[])
{
int ret;
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
+ int i;
const char *fname1 = NULL;
const char *fname2 = NULL;
const char *objname1 = NULL;
@@ -83,27 +80,17 @@ int main(int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
/*-------------------------------------------------------------------------
* process the command-line
*-------------------------------------------------------------------------
*/
parse_command_line(argc, argv, &fname1, &fname2, &objname1, &objname2, &opts);
- if (enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
+ /* enable error reporting if command line option */
+ h5tools_error_report();
/*-------------------------------------------------------------------------
* do the diff
@@ -130,6 +117,23 @@ int main(int argc, const char *argv[])
if (opts.err_stat)
ret = 2;
+ /* free any buffers */
+ for (i = 0; i < 2; i++) {
+ if (opts.sset[i]) {
+ if(opts.sset[i]->start.data)
+ HDfree(opts.sset[i]->start.data);
+ if(opts.sset[i]->stride.data)
+ HDfree(opts.sset[i]->stride.data);
+ if(opts.sset[i]->count.data)
+ HDfree(opts.sset[i]->count.data);
+ if(opts.sset[i]->block.data)
+ HDfree(opts.sset[i]->block.data);
+
+ HDfree(opts.sset[i]);
+ opts.sset[i]=NULL;
+ }
+ }
+
h5diff_exit(ret);
}
diff --git a/tools/src/h5diff/ph5diff_main.c b/tools/src/h5diff/ph5diff_main.c
index c473c8b..2336378 100644
--- a/tools/src/h5diff/ph5diff_main.c
+++ b/tools/src/h5diff/ph5diff_main.c
@@ -31,7 +31,7 @@ static void ph5diff_worker(int );
* Return: An exit status of 0 means no differences were found, 1 means some
* differences were found.
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 9, 2003
*
diff --git a/tools/src/h5dump/h5dump.c b/tools/src/h5dump/h5dump.c
index dfaff17..2b21b1c 100644
--- a/tools/src/h5dump/h5dump.c
+++ b/tools/src/h5dump/h5dump.c
@@ -655,12 +655,12 @@ parse_hsize_list(const char *h_list, subset_d *d)
*-------------------------------------------------------------------------
*/
static struct subset_t *
-parse_subset_params(char *dset)
+parse_subset_params(const char *dset)
{
struct subset_t *s = NULL;
char *brace;
- if (!disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
+ if (!dump_opts.disable_compact_subset && ((brace = HDstrrchr(dset, '[')) != NULL)) {
*brace++ = '\0';
s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t));
@@ -891,50 +891,50 @@ parse_command_line(int argc, const char *argv[])
parse_start:
switch ((char)opt) {
case 'R':
- display_region = TRUE;
+ dump_opts.display_region = TRUE;
region_output = TRUE;
break;
case 'B':
- display_bb = TRUE;
+ dump_opts.display_bb = TRUE;
last_was_dset = FALSE;
break;
case 'n':
- display_fi = TRUE;
+ dump_opts.display_fi = TRUE;
last_was_dset = FALSE;
if (opt_arg != NULL)
h5trav_set_verbose(HDatoi(opt_arg));
break;
case 'p':
- display_dcpl = TRUE;
+ dump_opts.display_dcpl = TRUE;
break;
case 'y':
- display_ai = FALSE;
+ dump_opts.display_ai = FALSE;
break;
case 'e':
- display_escape = TRUE;
+ dump_opts.display_escape = TRUE;
break;
case 'H':
- display_data = FALSE;
- display_attr_data = FALSE;
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = FALSE;
last_was_dset = FALSE;
break;
case 'A':
if (opt_arg != NULL) {
if(0 == HDatoi(opt_arg))
- include_attrs = FALSE;
+ dump_opts.include_attrs = FALSE;
}
else {
- display_data = FALSE;
- display_attr_data = TRUE;
+ dump_opts.display_data = FALSE;
+ dump_opts.display_attr_data = TRUE;
last_was_dset = FALSE;
}
break;
case 'i':
- display_oid = TRUE;
+ dump_opts.display_oid = TRUE;
last_was_dset = FALSE;
break;
case 'r':
- display_char = TRUE;
+ dump_opts.display_char = TRUE;
break;
case 'V':
print_version(h5tools_getprogname());
@@ -955,7 +955,7 @@ parse_start:
}
break;
case 'N':
- display_all = 0;
+ dump_opts.display_all = 0;
for (i = 0; i < argc; i++)
if (!hand[i].func) {
@@ -967,7 +967,7 @@ parse_start:
last_was_dset = FALSE;
break;
case 'a':
- display_all = 0;
+ dump_opts.display_all = 0;
for (i = 0; i < argc; i++)
if (!hand[i].func) {
@@ -979,7 +979,7 @@ parse_start:
last_was_dset = FALSE;
break;
case 'd':
- display_all = 0;
+ dump_opts.display_all = 0;
for (i = 0; i < argc; i++)
if (!hand[i].func) {
@@ -996,7 +996,7 @@ parse_start:
driver_name_g = opt_arg;
break;
case 'g':
- display_all = 0;
+ dump_opts.display_all = 0;
for (i = 0; i < argc; i++)
if (!hand[i].func) {
@@ -1008,7 +1008,7 @@ parse_start:
last_was_dset = FALSE;
break;
case 'l':
- display_all = 0;
+ dump_opts.display_all = 0;
for (i = 0; i < argc; i++)
if (!hand[i].func) {
@@ -1020,7 +1020,7 @@ parse_start:
last_was_dset = FALSE;
break;
case 't':
- display_all = 0;
+ dump_opts.display_all = 0;
for (i = 0; i < argc; i++)
if (!hand[i].func) {
@@ -1047,13 +1047,13 @@ parse_start:
}
}
else {
- if(display_attr_data && !display_data) {
+ if(dump_opts.display_attr_data && !dump_opts.display_data) {
if (h5tools_set_attr_output_file(opt_arg, 0) < 0) {
usage(h5tools_getprogname());
goto error;
}
}
- if(display_data || display_all) {
+ if(dump_opts.display_data || dump_opts.display_all) {
if (h5tools_set_data_output_file(opt_arg, 0) < 0) {
usage(h5tools_getprogname());
goto error;
@@ -1061,7 +1061,7 @@ parse_start:
}
}
- usingdasho = TRUE;
+ dump_opts.usingdasho = TRUE;
last_was_dset = FALSE;
outfname_g = opt_arg;
break;
@@ -1111,14 +1111,14 @@ parse_start:
usage(h5tools_getprogname());
goto error;
}
- display_packed_bits = TRUE;
+ dump_opts.display_packed_bits = TRUE;
break;
case 'v':
- display_vds_first = TRUE;
+ dump_opts.display_vds_first = TRUE;
break;
case 'G':
- vds_gap_size = HDatoi(opt_arg);
- if (vds_gap_size < 0) {
+ dump_opts.vds_gap_size = HDatoi(opt_arg);
+ if (dump_opts.vds_gap_size < 0) {
usage(h5tools_getprogname());
goto error;
}
@@ -1255,7 +1255,7 @@ end_collect:
enable_error_stack = 1;
break;
case 'C':
- disable_compact_subset = TRUE;
+ dump_opts.disable_compact_subset = TRUE;
break;
case 'h':
usage(h5tools_getprogname());
@@ -1357,14 +1357,10 @@ main(int argc, const char *argv[])
hid_t fid = H5I_INVALID_HID;
hid_t gid = H5I_INVALID_HID;
hid_t fapl_id = H5P_DEFAULT;
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
H5O_info2_t oi;
struct handler_t *hand = NULL;
int i;
unsigned u;
- void *edata;
- void *tools_edata;
char *fname = NULL;
h5tools_setprogname(PROGRAMNAME);
@@ -1373,17 +1369,9 @@ main(int argc, const char *argv[])
dump_function_table = &ddl_function_table;
dump_indent = 0;
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
if((hand = parse_command_line(argc, argv))==NULL) {
goto done;
}
@@ -1394,34 +1382,29 @@ main(int argc, const char *argv[])
goto done;
}
- if (enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
-
/* Check for conflicting options */
if (doxml_g) {
- if (!display_all) {
+ if (!dump_opts.display_all) {
error_msg("option \"%s\" not available for XML\n", "to display selected objects");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if (display_bb) {
+ else if (dump_opts.display_bb) {
error_msg("option \"%s\" not available for XML\n", "--boot-block");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if (display_oid == 1) {
+ else if (dump_opts.display_oid == 1) {
error_msg("option \"%s\" not available for XML\n", "--object-ids");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if (display_char == TRUE) {
+ else if (dump_opts.display_char == TRUE) {
error_msg("option \"%s\" not available for XML\n", "--string");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
- else if (usingdasho) {
+ else if (dump_opts.usingdasho) {
error_msg("option \"%s\" not available for XML\n", "--output");
h5tools_setstatus(EXIT_FAILURE);
goto done;
@@ -1439,6 +1422,10 @@ main(int argc, const char *argv[])
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
+
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
/* Initialize indexing options */
h5trav_set_index(sort_by, sort_order);
@@ -1584,7 +1571,7 @@ main(int argc, const char *argv[])
}
if (!doxml_g) {
- if (display_fi) {
+ if (dump_opts.display_fi) {
PRINTVALSTREAM(rawoutstream, "\n");
dump_fcontents(fid);
end_obj(h5tools_dump_header_format->fileend,h5tools_dump_header_format->fileblockend);
@@ -1592,11 +1579,11 @@ main(int argc, const char *argv[])
goto done;
}
- if (display_bb)
+ if (dump_opts.display_bb)
dump_fcpl(fid);
}
- if(display_all) {
+ if(dump_opts.display_all) {
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) {
error_msg("unable to open root group\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -1661,9 +1648,6 @@ main(int argc, const char *argv[])
/* To Do: clean up XML table */
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
-
leave(h5tools_getstatus());
done:
@@ -1693,9 +1677,6 @@ done:
/* To Do: clean up XML table */
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
-
leave(h5tools_getstatus());
} /* main */
diff --git a/tools/src/h5dump/h5dump.h b/tools/src/h5dump/h5dump.h
index ca1fef6..548af09 100644
--- a/tools/src/h5dump/h5dump.h
+++ b/tools/src/h5dump/h5dump.h
@@ -52,8 +52,8 @@ typedef struct h5dump_table_list_t {
h5dump_table_list_t table_list = {0, 0, NULL};
table_t *group_table = NULL, *dset_table = NULL, *type_table = NULL;
-unsigned dump_indent = 0; /*how far in to indent the line */
+unsigned dump_indent = 0; /* how far in to indent the line */
int unamedtype = 0; /* shared datatype with no name */
hbool_t hit_elink = FALSE; /* whether we have traversed an external link */
size_t prefix_len = 1024;
@@ -61,23 +61,26 @@ char *prefix = NULL;
const char *fp_format = NULL;
/* things to display or which are set via command line parameters */
-int display_all = TRUE;
-int display_oid = FALSE;
-int display_data = TRUE;
-int display_attr_data = TRUE;
-int display_char = FALSE; /*print 1-byte numbers as ASCII */
-int usingdasho = FALSE;
-int display_bb = FALSE; /*superblock */
-int display_dcpl = FALSE; /*dcpl */
-int display_fi = FALSE; /*file index */
-int display_ai = TRUE; /*array index */
-int display_escape = FALSE; /*escape non printable characters */
-int display_region = FALSE; /*print region reference data */
-int disable_compact_subset= FALSE; /* disable compact form of subset notation */
-int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/
-int include_attrs = TRUE; /* Display attributes */
-int display_vds_first = FALSE; /* vds display to all by default*/
-int vds_gap_size = 0; /* vds skip missing files default is none */
+typedef struct {
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
+} dump_opt_t;
+dump_opt_t dump_opts = {TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, 0};
#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
#define PACKED_BITS_SIZE_MAX (8*sizeof(long long)) /* Maximum bits size of integer types of packed-bits */
diff --git a/tools/src/h5dump/h5dump_ddl.c b/tools/src/h5dump/h5dump_ddl.c
index 1df205c..b50ce52 100644
--- a/tools/src/h5dump/h5dump_ddl.c
+++ b/tools/src/h5dump/h5dump_ddl.c
@@ -103,13 +103,13 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
- ctx.display_index = display_ai;
- ctx.display_char = display_char;
+ ctx.display_index = dump_opts.display_ai;
+ ctx.display_char = dump_opts.display_char;
attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = display_oid;
- data_output = display_data;
- attr_data_output = display_attr_data;
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
+ attr_data_output = dump_opts.display_attr_data;
string_dataformat = *outputformat;
@@ -125,7 +125,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
h5dump_type_table = type_table;
@@ -185,7 +185,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
/* Build the object's path name */
@@ -242,16 +242,16 @@ dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5_ATT
break;
case H5O_TYPE_DATASET:
- if(display_data) {
+ if(dump_opts.display_data) {
if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
error_msg("error in creating default access property list ID\n");
}
- if (display_vds_first) {
+ if (dump_opts.display_vds_first) {
if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
error_msg("error in setting access property list ID, virtual_view\n");
}
- if (vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0)
+ if (dump_opts.vds_gap_size > 0) {
+ if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
error_msg("error in setting access property list ID, virtual_printf_gap\n");
}
}
@@ -565,7 +565,7 @@ attr_iteration(hid_t gid, unsigned attr_crt_order_flags)
{
/* attribute iteration: if there is a request to do H5_INDEX_CRT_ORDER and tracking order is set
in the group for attributes, then, sort by creation order, otherwise by name */
- if(include_attrs) {
+ if(dump_opts.include_attrs) {
if((sort_by == H5_INDEX_CRT_ORDER) && (attr_crt_order_flags & H5P_CRT_ORDER_TRACKED)) {
if(H5Aiterate2(gid, sort_by, sort_order, NULL, dump_attr_cb, NULL) < 0) {
error_msg("error getting attribute information\n");
@@ -642,7 +642,7 @@ dump_named_datatype(hid_t tid, const char *name)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
if ((tcpl_id = H5Tget_create_plist(tid)) < 0) {
@@ -795,7 +795,7 @@ dump_group(hid_t gid, const char *name)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
@@ -831,7 +831,7 @@ dump_group(hid_t gid, const char *name)
}
} /* end if */
- if(display_oid)
+ if(dump_opts.display_oid)
h5tools_dump_oid(rawoutstream, outputformat, &ctx, gid);
h5tools_dump_comment(rawoutstream, outputformat, &ctx, gid);
@@ -926,7 +926,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
if ((dcpl_id = H5Dget_create_plist(did)) < 0) {
@@ -967,11 +967,11 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space);
H5Sclose(space);
- if(display_oid) {
+ if(dump_opts.display_oid) {
h5tools_dump_oid(rawoutstream, outputformat, &ctx, did);
}
- if(display_dcpl) {
+ if(dump_opts.display_dcpl) {
h5dump_type_table = type_table;
h5tools_dump_dcpl(rawoutstream, outputformat, &ctx, dcpl_id, type, did);
h5dump_type_table = NULL;
@@ -979,16 +979,16 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset)
H5Pclose(dcpl_id);
ctx.sset = sset;
- ctx.display_index = display_ai;
- ctx.display_char = display_char;
- if(display_data) {
+ ctx.display_index = dump_opts.display_ai;
+ ctx.display_char = dump_opts.display_char;
+ if(dump_opts.display_data) {
unsigned data_loop = 1;
unsigned u;
- if(display_packed_bits)
+ if(dump_opts.display_packed_bits)
data_loop = packed_bits_num;
for(u = 0; u < data_loop; u++) {
- if(display_packed_bits) {
+ if(dump_opts.display_packed_bits) {
ctx.need_prefix = TRUE;
h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0);
/* Render the element */
@@ -1091,7 +1091,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
HDmemset(&ctx, 0, sizeof(ctx));
@@ -1099,7 +1099,7 @@ dump_data(hid_t obj_id, int obj_data, struct subset_t *sset, int display_index)
ctx.cur_column = dump_indent;
ctx.sset = sset;
ctx.display_index = display_index;
- ctx.display_char = display_char;
+ ctx.display_char = dump_opts.display_char;
if(obj_data == DATASET_DATA)
print_dataset = TRUE;
@@ -1527,8 +1527,8 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
HDmemset(&ctx, 0, sizeof(ctx));
ctx.indent_level = dump_indent / COL;
ctx.cur_column = dump_indent;
- ctx.display_index = display_ai;
- ctx.display_char = display_char;
+ ctx.display_index = dump_opts.display_ai;
+ ctx.display_char = dump_opts.display_char;
string_dataformat = *outputformat;
@@ -1544,7 +1544,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/");
@@ -1583,9 +1583,9 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED *data, int H5
} /* end if */
attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT);
- oid_output = display_oid;
- data_output = display_data;
- attr_data_output = display_attr_data;
+ oid_output = dump_opts.display_oid;
+ data_output = dump_opts.display_data;
+ attr_data_output = dump_opts.display_attr_data;
h5dump_type_table = type_table;
h5tools_dump_attribute(rawoutstream, outputformat, &ctx, attr_name, attr_id);
@@ -1637,16 +1637,16 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis
struct subset_t *sset = (struct subset_t *)data;
const char *real_name = display_name ? display_name : dset;
- if(display_data) {
+ if(dump_opts.display_data) {
if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) {
error_msg("error in creating default access property list ID\n");
}
- if (display_vds_first) {
+ if (dump_opts.display_vds_first) {
if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0)
error_msg("error in setting access property list ID, virtual_view\n");
}
- if (vds_gap_size > 0) {
- if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0)
+ if (dump_opts.vds_gap_size > 0) {
+ if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)dump_opts.vds_gap_size) < 0)
error_msg("error in setting access property list ID, virtual_printf_gap\n");
}
}
diff --git a/tools/src/h5dump/h5dump_extern.h b/tools/src/h5dump/h5dump_extern.h
index 00d3bd2..c615621 100644
--- a/tools/src/h5dump/h5dump_extern.h
+++ b/tools/src/h5dump/h5dump_extern.h
@@ -50,32 +50,35 @@ typedef struct h5dump_table_list_t {
extern h5dump_table_list_t table_list;
extern table_t *group_table, *dset_table, *type_table;
-extern unsigned dump_indent; /*how far in to indent the line */
-extern int unamedtype; /* shared datatype with no name */
-extern hbool_t hit_elink; /* whether we have traversed an external link */
+extern unsigned dump_indent; /* how far in to indent the line */
+extern int unamedtype; /* shared datatype with no name */
+extern hbool_t hit_elink; /* whether we have traversed an external link */
extern size_t prefix_len;
extern char *prefix;
extern const char *fp_format;
/* things to display or which are set via command line parameters */
-extern int display_all;
-extern int display_oid;
-extern int display_data;
-extern int display_attr_data;
-extern int display_char; /*print 1-byte numbers as ASCII */
-extern int usingdasho;
-extern int display_bb; /*superblock */
-extern int display_dcpl; /*dcpl */
-extern int display_fi; /*file index */
-extern int display_ai; /*array index */
-extern int display_escape; /*escape non printable characters */
-extern int display_region; /*print region reference data */
-extern int disable_compact_subset; /* disable compact form of subset notation */
-extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/
-extern int include_attrs; /* Display attributes */
-extern int display_vds_first; /* vds display to first missing */
-extern int vds_gap_size; /* vds skip missing files */
+typedef struct {
+ int display_all;
+ int display_oid;
+ int display_data;
+ int display_attr_data;
+ int display_char; /* print 1-byte numbers as ASCII */
+ int usingdasho;
+ int display_bb; /* superblock */
+ int display_dcpl; /* dcpl */
+ int display_fi; /* file index */
+ int display_ai; /* array index */
+ int display_escape; /* escape non printable characters */
+ int display_region; /* print region reference data */
+ int disable_compact_subset; /* disable compact form of subset notation */
+ int display_packed_bits; /* print 1-8 byte numbers as packed bits */
+ int include_attrs; /* Display attributes */
+ int display_vds_first; /* vds display to all by default */
+ int vds_gap_size; /* vds skip missing files default is none */
+} dump_opt_t;
+extern dump_opt_t dump_opts;
#define PACKED_BITS_MAX 8 /* Maximum number of packed-bits to display */
#define PACKED_BITS_SIZE_MAX 8*sizeof(long long) /* Maximum bits size of integer types of packed-bits */
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 95aff48..bb47f77 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -162,7 +162,7 @@ xml_dump_all_cb(hid_t group, const char *name, const H5L_info2_t *linfo, void H5
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
/* Build the object's path name */
@@ -888,7 +888,7 @@ xml_print_datatype(hid_t type, unsigned in_group)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
if(!in_group && H5Tcommitted(type) > 0) {
@@ -1538,7 +1538,7 @@ xml_dump_datatype(hid_t type)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
ctx.indent_level++;
@@ -1669,7 +1669,7 @@ xml_dump_dataspace(hid_t space)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
ctx.indent_level++;
@@ -1992,7 +1992,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
ctx.need_prefix = TRUE;
@@ -2014,7 +2014,7 @@ xml_dump_attr(hid_t attr, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED
ctx.indent_level++;
dump_indent += COL;
- if (display_attr_data && space_type != H5S_NULL) {
+ if (dump_opts.display_attr_data && space_type != H5S_NULL) {
switch (H5Tget_class(type)) {
case H5T_INTEGER:
case H5T_FLOAT:
@@ -2293,7 +2293,7 @@ xml_dump_named_datatype(hid_t type, const char *name)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
dtxid = (char *)HDmalloc((size_t)100);
@@ -2506,7 +2506,7 @@ xml_dump_group(hid_t gid, const char *name)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
if(HDstrcmp(name, "/") == 0) {
@@ -2889,7 +2889,7 @@ xml_print_refs(hid_t did, int source)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
@@ -3039,7 +3039,7 @@ xml_print_strs(hid_t did, int source)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
for (i = 0; i < (hsize_t)ssiz; i++) {
@@ -3151,7 +3151,7 @@ check_filters(hid_t dcpl)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
nfilt = H5Pget_nfilters(dcpl);
@@ -3287,7 +3287,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
ctx.indent_level++;
@@ -3627,7 +3627,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
xml_name_to_XID(did, tmp, rstr, 100, 1);
@@ -3916,7 +3916,7 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
dump_indent -= COL;
tempi = H5Dget_storage_size(did);
- if (display_data && (tempi > 0)) {
+ if (dump_opts.display_data && (tempi > 0)) {
switch (H5Tget_class(type)) {
case H5T_INTEGER:
case H5T_FLOAT:
@@ -4172,7 +4172,7 @@ xml_print_enum(hid_t type)
else
string_dataformat.line_ncols = h5tools_nCols;
- string_dataformat.do_escape = display_escape;
+ string_dataformat.do_escape = dump_opts.display_escape;
outputformat = &string_dataformat;
nmembs = (unsigned)H5Tget_nmembers(type);
diff --git a/tools/src/h5format_convert/h5format_convert.c b/tools/src/h5format_convert/h5format_convert.c
index 2c4cf41..e60097b 100644
--- a/tools/src/h5format_convert/h5format_convert.c
+++ b/tools/src/h5format_convert/h5format_convert.c
@@ -109,7 +109,7 @@ static void usage(const char *prog)
* Purpose: parse command line input
*
* Return: Success: 0
- * Failure: 1
+ * Failure: 1
*
*-------------------------------------------------------------------------
*/
@@ -127,47 +127,47 @@ parse_command_line(int argc, const char **argv)
/* parse command line options */
while ((opt = get_option(argc, argv, s_opts, l_opts)) != EOF) {
- switch((char) opt) {
- case 'h':
- usage(h5tools_getprogname());
- h5tools_setstatus(EXIT_SUCCESS);
- goto error;
-
- case 'V':
- print_version(h5tools_getprogname());
- h5tools_setstatus(EXIT_SUCCESS);
- goto error;
-
- case 'v':
- verbose_g = TRUE;
- break;
-
- case 'd': /* -d dname */
- if(opt_arg != NULL && *opt_arg)
- dname_g = HDstrdup(opt_arg);
- if(dname_g == NULL) {
- h5tools_setstatus(EXIT_FAILURE);
- error_msg("No dataset name\n", opt_arg);
- usage(h5tools_getprogname());
- goto error;
- }
- dset_g = TRUE;
- break;
-
- case 'n': /* -n */
- noop_g = TRUE;
- break;
-
- case 'E':
- enable_error_stack = 1;
- break;
-
- default:
- h5tools_setstatus(EXIT_FAILURE);
- usage(h5tools_getprogname());
- goto error;
- break;
- } /* switch */
+ switch((char) opt) {
+ case 'h':
+ usage(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'V':
+ print_version(h5tools_getprogname());
+ h5tools_setstatus(EXIT_SUCCESS);
+ goto error;
+
+ case 'v':
+ verbose_g = TRUE;
+ break;
+
+ case 'd': /* -d dname */
+ if(opt_arg != NULL && *opt_arg)
+ dname_g = HDstrdup(opt_arg);
+ if(dname_g == NULL) {
+ h5tools_setstatus(EXIT_FAILURE);
+ error_msg("No dataset name\n", opt_arg);
+ usage(h5tools_getprogname());
+ goto error;
+ }
+ dset_g = TRUE;
+ break;
+
+ case 'n': /* -n */
+ noop_g = TRUE;
+ break;
+
+ case 'E':
+ enable_error_stack = 1;
+ break;
+
+ default:
+ h5tools_setstatus(EXIT_FAILURE);
+ usage(h5tools_getprogname());
+ goto error;
+ break;
+ } /* switch */
} /* while */
if (argc <= opt_ind) {
@@ -207,17 +207,17 @@ leave(int ret)
* Function: convert()
*
* Purpose: To downgrade a dataset's indexing type or layout version:
- * For chunked:
- * Downgrade the chunk indexing type to version 1 B-tree
- * If type is already version 1 B-tree, no further action
- * For compact/contiguous:
- * Downgrade the layout version from 4 to 3
- * If version is already <= 3, no further action
- * For virtual:
- * No further action
+ * For chunked:
+ * Downgrade the chunk indexing type to version 1 B-tree
+ * If type is already version 1 B-tree, no further action
+ * For compact/contiguous:
+ * Downgrade the layout version from 4 to 3
+ * If version is already <= 3, no further action
+ * For virtual:
+ * No further action
*
* Return: Success: 0
- * Failure: 1
+ * Failure: 1
*
*-------------------------------------------------------------------------
*/
@@ -312,7 +312,7 @@ convert(hid_t fid, const char *dname)
}
if(verbose_g)
- HDfprintf(stdout, "Converting the dataset...\n");
+ HDfprintf(stdout, "Converting the dataset...\n");
/* Downgrade the dataset */
if(H5Dformat_convert(did) < 0) {
@@ -377,7 +377,7 @@ convert_dsets_cb(const char *path, const H5O_info2_t *oi, const char *already_vi
if(verbose_g)
HDfprintf(stdout, "Going to process dataset:%s...\n", path);
if(convert(fid, path) < 0)
- goto error;
+ goto error;
} /* end if */
} /* end if */
@@ -392,57 +392,56 @@ error:
* Function: main
*
* Purpose: To convert the chunk indexing type of a dataset in a file to
- * version 1 B-tree.
+ * version 1 B-tree.
*
* Return: Success: 0
- * Failure: 1
+ * Failure: 1
*
*-------------------------------------------------------------------------
*/
int
main(int argc, const char *argv[])
{
- H5E_auto2_t func;
- void *edata;
hid_t fid = H5I_INVALID_HID;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
/* Parse command line options */
if(parse_command_line(argc, argv) < 0)
- goto done;
+ goto done;
else if(verbose_g)
- HDfprintf(stdout, "Process command line options\n");
+ HDfprintf(stdout, "Process command line options\n");
if(noop_g && verbose_g)
- HDfprintf(stdout, "It is noop...\n");
+ HDfprintf(stdout, "It is noop...\n");
+
+ /* enable error reporting if command line option */
+ h5tools_error_report();
/* Open the HDF5 file */
if((fid = h5tools_fopen(fname_g, H5F_ACC_RDWR, H5P_DEFAULT, FALSE, NULL, 0)) < 0) {
- error_msg("unable to open file \"%s\"\n", fname_g);
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
- } else if(verbose_g)
- HDfprintf(stdout, "Open the file %s\n", fname_g);
+ error_msg("unable to open file \"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+ else if(verbose_g)
+ HDfprintf(stdout, "Open the file %s\n", fname_g);
if(dset_g) { /* Convert a specified dataset in the file */
- if(verbose_g)
- HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g);
- if(convert(fid, dname_g) < 0)
- goto done;
- } else { /* Convert all datasets in the file */
- if(verbose_g)
- HDfprintf(stdout, "Processing all datasets in the file...\n");
- if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0)
- goto done;
+ if(verbose_g)
+ HDfprintf(stdout, "Going to process dataset: %s...\n", dname_g);
+ if(convert(fid, dname_g) < 0)
+ goto done;
+ }
+ else { /* Convert all datasets in the file */
+ if(verbose_g)
+ HDfprintf(stdout, "Processing all datasets in the file...\n");
+ if(h5trav_visit(fid, "/", TRUE, TRUE, convert_dsets_cb, NULL, &fid, H5O_INFO_BASIC) < 0)
+ goto done;
} /* end else */
if(verbose_g) {
@@ -464,19 +463,20 @@ main(int argc, const char *argv[])
done:
/* Close the file */
if(fid >= 0) {
- if(H5Fclose(fid) < 0) {
- error_msg("unable to close file \"%s\"\n", fname_g);
- h5tools_setstatus(EXIT_FAILURE);
- } else if(verbose_g)
- HDfprintf(stdout, "Close the file\n");
+ if(H5Fclose(fid) < 0) {
+ error_msg("unable to close file \"%s\"\n", fname_g);
+ h5tools_setstatus(EXIT_FAILURE);
+ }
+ else if(verbose_g) {
+ HDfprintf(stdout, "Close the file\n");
+ }
} /* end if */
if(fname_g)
- HDfree(fname_g);
+ HDfree(fname_g);
if(dname_g)
- HDfree(dname_g);
+ HDfree(dname_g);
- H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(h5tools_getstatus());
} /* end main() */
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index b11fe7f..4221eec 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -941,7 +941,7 @@ static int readFloatData(FILE *strm, struct Input *in)
*
* Return: 0, ok, -1 no
*
- * Programmer: Pedro Vicente, pvn@hdfgroup.org
+ * Programmer: Pedro Vicente
*
* Date: July, 26, 2007
*
@@ -3735,8 +3735,8 @@ static int getExternalFilename(struct Input *in, FILE *strm)
return (-1);
}
- in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp)) * sizeof(char));
- (void) HDstrcpy(in->externFilename, temp);
+ in->externFilename = (char *) HDmalloc ((size_t) (HDstrlen(temp) + 1) * sizeof(char));
+ (void) HDstrncpy(in->externFilename, temp, HDstrlen(temp) + 1);
return (0);
}
diff --git a/tools/src/h5jam/h5jam.c b/tools/src/h5jam/h5jam.c
index 009e527..8b61112 100644
--- a/tools/src/h5jam/h5jam.c
+++ b/tools/src/h5jam/h5jam.c
@@ -120,13 +120,6 @@ usage (const char *prog)
static void
leave(int ret)
{
- if (ub_file)
- HDfree (ub_file);
- if (input_file)
- HDfree (input_file);
- if (output_file)
- HDfree (output_file);
-
h5tools_close();
HDexit(ret);
@@ -195,8 +188,6 @@ main (int argc, const char *argv[])
int ufid = -1;
int h5fid = -1;
int ofid = -1;
- void *edata;
- H5E_auto2_t func;
hid_t ifile = H5I_INVALID_HID;
hid_t plist = H5I_INVALID_HID;
herr_t status;
@@ -214,20 +205,20 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
parse_command_line(argc, argv);
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
if (ub_file == NULL) {
/* no user block */
error_msg("missing argument for -u <user_file>.\n");
help_ref_msg(stderr);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
testval = H5Fis_accessible(ub_file, H5P_DEFAULT);
@@ -235,13 +226,15 @@ main (int argc, const char *argv[])
if (testval > 0) {
error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n");
help_ref_msg(stderr);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
if (input_file == NULL) {
error_msg("missing argument for -i <HDF5 file>.\n");
help_ref_msg(stderr);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
testval = H5Fis_accessible(input_file, H5P_DEFAULT);
@@ -249,45 +242,49 @@ main (int argc, const char *argv[])
if (testval <= 0) {
error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file);
help_ref_msg(stderr);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT);
if (ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", input_file);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
plist = H5Fget_create_plist(ifile);
if (plist < 0) {
error_msg("Can't get file creation plist for file \"%s\"\n", input_file);
- H5Fclose(ifile);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
status = H5Pget_userblock(plist, &usize);
if (status < 0) {
error_msg("Can't get user block for file \"%s\"\n", input_file);
- H5Pclose(plist);
- H5Fclose(ifile);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
H5Pclose(plist);
+ plist = H5I_INVALID_HID;
H5Fclose(ifile);
+ ifile = H5I_INVALID_HID;
ufid = HDopen(ub_file, O_RDONLY);
if(ufid < 0) {
error_msg("unable to open user block file \"%s\"\n", ub_file);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
res = HDfstat(ufid, &sbuf);
if(res < 0) {
error_msg("Can't stat file \"%s\"\n", ub_file);
- HDclose (ufid);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
fsize = (off_t)sbuf.st_size;
@@ -295,16 +292,15 @@ main (int argc, const char *argv[])
h5fid = HDopen(input_file, O_RDONLY);
if(h5fid < 0) {
error_msg("unable to open HDF5 file for read \"%s\"\n", input_file);
- HDclose (ufid);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
res = HDfstat(h5fid, &sbuf2);
if(res < 0) {
error_msg("Can't stat file \"%s\"\n", input_file);
- HDclose (h5fid);
- HDclose (ufid);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
h5fsize = (hsize_t)sbuf2.st_size;
@@ -314,9 +310,8 @@ main (int argc, const char *argv[])
if (ofid < 0) {
error_msg("unable to open output file \"%s\"\n", output_file);
- HDclose (h5fid);
- HDclose (ufid);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
}
else {
@@ -324,9 +319,8 @@ main (int argc, const char *argv[])
if (ofid < 0) {
error_msg("unable to create output file \"%s\"\n", output_file);
- HDclose (h5fid);
- HDclose (ufid);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
}
@@ -365,12 +359,11 @@ main (int argc, const char *argv[])
/* pad the ub */
if(write_pad(ofid, where, &where) < 0) {
error_msg("Can't pad file \"%s\"\n", output_file);
- HDclose (h5fid);
- HDclose (ufid);
- HDclose (ofid);
- leave (EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
} /* end if */
+done:
if(ub_file)
HDfree(ub_file);
if(input_file)
@@ -378,6 +371,11 @@ main (int argc, const char *argv[])
if(output_file)
HDfree(output_file);
+ if(plist >= 0)
+ H5Pclose(plist);
+ if(ifile >= 0)
+ H5Fclose(ifile);
+
if(ufid >= 0)
HDclose(ufid);
if(h5fid >= 0)
@@ -385,7 +383,7 @@ main (int argc, const char *argv[])
if(ofid >= 0)
HDclose(ofid);
- return h5tools_getstatus();
+ leave(h5tools_getstatus());
}
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5jam/h5unjam.c b/tools/src/h5jam/h5unjam.c
index 203522b..b48e2c1 100644
--- a/tools/src/h5jam/h5unjam.c
+++ b/tools/src/h5jam/h5unjam.c
@@ -185,6 +185,13 @@ done:
return EXIT_FAILURE;
}
+static void
+leave(int ret)
+{
+ h5tools_close();
+ HDexit(ret);
+}
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -197,8 +204,6 @@ done:
int
main(int argc, const char *argv[])
{
- void *edata;
- H5E_auto2_t func;
hid_t ifile = H5I_INVALID_HID;
hid_t plist = H5I_INVALID_HID;
off_t fsize;
@@ -211,16 +216,15 @@ main(int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
if(EXIT_FAILURE == parse_command_line(argc, argv))
goto done;
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
if (input_file == NULL) {
/* no user block */
error_msg("missing argument for HDF5 file input.\n");
@@ -319,9 +323,7 @@ done:
HDfree(ub_file);
}
- h5tools_close();
-
- return h5tools_getstatus();
+ leave(h5tools_getstatus());
}
/*-------------------------------------------------------------------------
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 765ab63..8cf9b3c 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, March 23, 1998
*/
@@ -1298,230 +1298,6 @@ print_type(h5tools_str_t *buffer, hid_t type, int ind)
h5tools_str_append(buffer,"%lu-byte class-%u unknown", (unsigned long)H5Tget_size(type), (unsigned)data_class);
}
-/*
- *
- */
-static void
-dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t container, H5R_ref_t *ref_buf, int ndims)
-{
- hid_t new_obj_id = H5I_INVALID_HID;
- hid_t new_obj_sid = H5I_INVALID_HID;
- hsize_t elmt_counter = 0; /*counts the # elements printed. */
- size_t ncols = 80; /* available output width */
- int i;
- hsize_t curr_pos = 0; /* total data element position */
- h5tools_str_t buffer; /* string into which to render */
- h5tools_context_t datactx; /* print context */
-
- H5TOOLS_START_DEBUG("");
-
- datactx = *ctx; /* print context */
- /* Assume entire data space to be printed */
- if (datactx.ndims > 0)
- for (i = 0; (unsigned)i < datactx.ndims; i++)
- datactx.p_min_idx[i] = 0;
- datactx.need_prefix = TRUE;
-
- HDmemset(&buffer, 0, sizeof(h5tools_str_t));
- for(i = 0; i < ndims; i++, datactx.cur_elmt++, elmt_counter++) {
- H5O_type_t obj_type = -1; /* Object type */
- H5R_type_t ref_type; /* Reference type */
-
- H5TOOLS_DEBUG("reference loop:%d with curr_pos=%ld", i, curr_pos);
-
- datactx.need_prefix = TRUE;
- h5tools_str_reset(&buffer);
- H5TOOLS_DEBUG("reference loop - h5tools_str_sprint with H5T_STD_REF:%d", i);
- h5tools_str_sprint(&buffer, info, container, H5T_STD_REF, &ref_buf[i], &datactx);
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)i, (hsize_t)ndims);
-
- ref_type = H5Rget_type((const H5R_ref_t *)&ref_buf[i]);
- switch (ref_type) {
- case H5R_OBJECT1:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT1");
- if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) {
- switch (obj_type) {
- case H5O_TYPE_DATASET:
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- datactx.indent_level++;
- h5tools_dump_dset(stream, info, &datactx, new_obj_id);
- datactx.indent_level--;
- if(H5Dclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Dclose H5R_OBJECT1:H5O_TYPE_DATASET failed");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_INFO("H5Rdestroy H5R_OBJECT1:H5O_TYPE_DATASET failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_object H5R_OBJECT1:H5O_TYPE_DATASET failed");
- break;
-
- case H5O_TYPE_GROUP:
- case H5O_TYPE_NAMED_DATATYPE:
- case H5O_TYPE_MAP:
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- break;
- } /* end switch */
- }
- else
- H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT1 failed");
- break;
- case H5R_DATASET_REGION1:
- H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION1");
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- datactx.indent_level++;
- h5tools_dump_dset(stream, info, &datactx, new_obj_id);
- datactx.indent_level--;
- if(H5Dclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION1 failed");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_INFO("H5Rdestroy H5R_DATASET_REGION1 failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION1 failed");
- break;
- case H5R_OBJECT2:
- H5TOOLS_DEBUG("ref_type is H5R_OBJECT2");
- if (H5Rget_obj_type3(&ref_buf[i], H5P_DEFAULT, &obj_type) >= 0) {
- switch (obj_type) {
- case H5O_TYPE_GROUP:
- break;
-
- case H5O_TYPE_DATASET:
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- datactx.indent_level++;
- h5tools_dump_dset(stream, info, &datactx, new_obj_id);
- datactx.indent_level--;
- if(H5Oclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Oclose H5R_OBJECT2 failed");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_INFO("H5Rdestroy H5R_OBJECT2 failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_object H5R_OBJECT2 failed");
- break;
-
- case H5O_TYPE_NAMED_DATATYPE:
- break;
-
- case H5O_TYPE_MAP:
- case H5O_TYPE_UNKNOWN:
- case H5O_TYPE_NTYPES:
- default:
- break;
- } /* end switch */
- }
- else
- H5TOOLS_INFO("H5Rget_obj_type3 H5R_OBJECT2 failed");
- break;
- case H5R_DATASET_REGION2:
- H5TOOLS_DEBUG("ref_type is H5R_DATASET_REGION2");
-
- if (info->line_ncols > 0)
- ncols = info->line_ncols;
-
- /* if (new_obj_id < 0) - could mean that no reference was written do not throw failure */
- if((new_obj_id = H5Ropen_object(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) < 0)
- H5TOOLS_INFO("H5Ropen_object H5R_DATASET_REGION2 failed");
- else {
- if((new_obj_sid = H5Ropen_region(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- if (h5tools_is_zero(&ref_buf[i], H5Tget_size(H5T_STD_REF))) {
- H5TOOLS_DEBUG("NULL H5R_DATASET_REGION2");
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " {");
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- datactx.need_prefix = TRUE;
- datactx.indent_level++;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- datactx.indent_level--;
- datactx.need_prefix = TRUE;
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "}");
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- }
- else {
- H5S_sel_type region_type;
-
- region_type = H5Sget_select_type(new_obj_sid);
- if(region_type == H5S_SEL_POINTS) {
- /* Print point information */
- H5TOOLS_DEBUG("H5S_SEL_POINTS H5R_DATASET_REGION2");
- h5tools_dump_region_data_points(new_obj_sid, new_obj_id, stream, info, &datactx,
- &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
- }
- else if(region_type == H5S_SEL_HYPERSLABS) {
- /* Print block information */
- H5TOOLS_DEBUG("H5S_SEL_HYPERSLABS H5R_DATASET_REGION2");
- h5tools_dump_region_data_blocks(new_obj_sid, new_obj_id, stream, info, &datactx,
- &buffer, &curr_pos, ncols, (hsize_t)i, elmt_counter);
- }
- else
- H5TOOLS_INFO("invalid region type");
- } /* end else to if (h5tools_is_zero(... */
- if(H5Sclose(new_obj_sid) < 0)
- H5TOOLS_INFO("H5Sclose H5R_DATASET_REGION2 failed");
- }
- else
- H5TOOLS_INFO("H5Ropen_region H5R_DATASET_REGION2 failed");
- if(H5Dclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Dclose H5R_DATASET_REGION2 failed");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_INFO("H5Rdestroy H5R_DATASET_REGION2 failed");
- }
- break;
- case H5R_ATTR:
- H5TOOLS_DEBUG("ref_type is H5R_ATTR");
- if((new_obj_id = H5Ropen_attr(&ref_buf[i], H5P_DEFAULT, H5P_DEFAULT)) >= 0) {
- h5tools_dump_region_attribute(new_obj_id, stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- if(H5Aclose(new_obj_id) < 0)
- H5TOOLS_INFO("H5Aclose H5R_ATTR failed");
- if(H5Rdestroy(&ref_buf[i]) < 0)
- H5TOOLS_INFO("H5Rdestroy H5R_ATTR failed");
- }
- else {
- H5TOOLS_DEBUG("NULL H5R_ATTR");
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, " {");
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- datactx.need_prefix = TRUE;
- datactx.indent_level++;
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "NULL");
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
- datactx.indent_level--;
- datactx.need_prefix = TRUE;
-
- h5tools_str_reset(&buffer);
- h5tools_str_append(&buffer, "}");
- h5tools_render_element(stream, info, &datactx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
-
- H5TOOLS_INFO("H5Ropen_attr H5R_ATTR failed");
- }
- break;
- case H5R_BADTYPE:
- case H5R_MAXTYPE:
- default:
- break;
- } /* end switch */
-
- H5TOOLS_DEBUG("finished reference loop:%d",i);
- } /* end for(i = 0; i < ndims; i++, ctx->cur_elmt++, elmt_counter++) */
-
- h5tools_str_close(&buffer);
-
- PRINTVALSTREAM(stream, "\n");
-
- H5TOOLS_ENDDEBUG("");
-}
-
/*-------------------------------------------------------------------------
* Function: dump_dataset_values
*
@@ -1537,7 +1313,6 @@ dump_dataset_values(hid_t dset)
hid_t space = H5I_INVALID_HID;
hsize_t total_size[H5S_MAX_RANK];
int ndims;
- size_t i;
char string_prefix[64];
static char fmt_double[16];
static char fmt_float[16];
@@ -1653,13 +1428,9 @@ dump_dataset_values(hid_t dset)
H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims);
/* Assume entire data space to be printed */
- if (ctx.ndims > 0)
- for (i = 0; i < (size_t)ctx.ndims; i++)
- ctx.p_min_idx[i] = 0;
-
H5Sget_simple_extent_dims(space, total_size, NULL);
- if (ctx.ndims > 0)
- init_acc_pos(&ctx, total_size);
+ init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx);
+
ctx.need_prefix = TRUE;
if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
@@ -1669,7 +1440,9 @@ dump_dataset_values(hid_t dset)
H5TOOLS_INFO("H5Dread reference failed");
H5TOOLS_GOTO_DONE_NO_RET();
}
- dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims);
+ h5tools_dump_reference(rawoutstream, info, &ctx, dset, ref_buf, ndims);
+
+ PRINTVALSTREAM(rawoutstream, "\n");
HDfree(ref_buf);
}
}
@@ -1707,7 +1480,6 @@ dump_attribute_values(hid_t attr)
hid_t space = H5I_INVALID_HID;
hsize_t total_size[H5S_MAX_RANK];
int ndims;
- size_t i;
char string_prefix[64];
static char fmt_double[16];
static char fmt_float[16];
@@ -1824,13 +1596,9 @@ dump_attribute_values(hid_t attr)
H5TOOLS_DEBUG("ndims=%d - ctx.ndims=%d", ndims, ctx.ndims);
/* Assume entire data space to be printed */
- if (ctx.ndims > 0)
- for (i = 0; i < (size_t)ctx.ndims; i++)
- ctx.p_min_idx[i] = 0;
-
H5Sget_simple_extent_dims(space, total_size, NULL);
- if (ctx.ndims > 0)
- init_acc_pos(&ctx, total_size);
+ init_acc_pos(ctx.ndims, total_size, ctx.acc, ctx.pos, ctx.p_min_idx);
+
ctx.need_prefix = TRUE;
if (NULL != (ref_buf = (H5R_ref_t *)HDcalloc(MAX(sizeof(unsigned), sizeof(H5R_ref_t)), (size_t)ndims))) {
@@ -1841,7 +1609,9 @@ dump_attribute_values(hid_t attr)
H5TOOLS_GOTO_DONE_NO_RET();
}
ctx.indent_level++;
- dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims);
+ h5tools_dump_reference(rawoutstream, info, &ctx, attr, ref_buf, ndims);
+
+ PRINTVALSTREAM(rawoutstream, "\n");
ctx.indent_level--;
HDfree(ref_buf);
}
@@ -2856,10 +2626,6 @@ main(int argc, const char *argv[])
const char *preferred_driver = NULL;
int err_exit = 0;
hid_t fapl_id = H5P_DEFAULT;
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
hbool_t custom_vol_fapl = FALSE;
h5tools_vol_info_t vol_info;
@@ -2889,17 +2655,9 @@ main(int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
/* Initialize fapl info struct */
HDmemset(&vol_info, 0, sizeof(h5tools_vol_info_t));
@@ -3158,6 +2916,9 @@ main(int argc, const char *argv[])
}
} /* end for */
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
/* If no arguments remain then print a usage message (instead of doing
* absolutely nothing ;-) */
if (argno >= argc) {
@@ -3208,11 +2969,6 @@ main(int argc, const char *argv[])
}
}
- if (enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
-
/* Each remaining argument is an hdf5 file followed by an optional slash
* and object name.
*
@@ -3271,7 +3027,6 @@ main(int argc, const char *argv[])
x = oname;
if (NULL == (oname = HDstrdup(oname))) {
HDfprintf(rawerrorstream, "memory allocation failed\n");
- H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(EXIT_FAILURE);
}
*x = '\0';
@@ -3316,7 +3071,6 @@ main(int argc, const char *argv[])
h5tools_str_reset(&buffer);
print_obj_name(&buffer, &iter, oname, "**NOT FOUND**");
h5tools_render_element(rawoutstream, info, &ctx, &buffer, &curr_pos, (size_t)info->line_ncols, (hsize_t)0, (hsize_t)0);
- H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(EXIT_FAILURE);
} /* end if */
} /* end if */
@@ -3326,7 +3080,6 @@ main(int argc, const char *argv[])
/* Open the object and display it's information */
if (li.type == H5L_TYPE_HARD) {
if (visit_obj(file_id, oname, &iter) < 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(EXIT_FAILURE);
}
} /* end if(li.type == H5L_TYPE_HARD) */
@@ -3357,12 +3110,10 @@ main(int argc, const char *argv[])
if (fapl_id != H5P_DEFAULT) {
if (0 < H5Pclose(fapl_id)) {
HDfprintf(rawerrorstream, "Error: Unable to set close fapl entry\n\n");
- H5Eset_auto2(H5E_DEFAULT, func, edata);
leave(EXIT_FAILURE);
}
}
- H5Eset_auto2(H5E_DEFAULT, func, edata);
if (err_exit)
leave(EXIT_FAILURE);
else
diff --git a/tools/src/h5repack/h5repack.h b/tools/src/h5repack/h5repack.h
index caa1166..b124fdb 100644
--- a/tools/src/h5repack/h5repack.h
+++ b/tools/src/h5repack/h5repack.h
@@ -101,25 +101,27 @@ typedef struct {
/* all the above, ready to go to the hrepack call */
typedef struct {
- pack_opttbl_t *op_tbl; /*table with all -c and -f options */
- int all_layout; /*apply the layout to all objects */
- int all_filter; /*apply the filter to all objects */
+ pack_opttbl_t *op_tbl; /* table with all -c and -f options */
+ int all_layout; /* apply the layout to all objects */
+ int all_filter; /* apply the filter to all objects */
filter_info_t filter_g[H5_REPACK_MAX_NFILTERS]; /*global filter array for the ALL case */
- int n_filter_g; /*number of global filters */
- chunk_info_t chunk_g; /*global chunk INFO for the ALL case */
- H5D_layout_t layout_g; /*global layout information for the ALL case */
- int verbose; /*verbose mode */
- hsize_t min_comp; /*minimum size to compress, in bytes */
- int use_native; /*use a native type in write */
- hbool_t latest; /*pack file with the latest file format */
- H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
- H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
- hid_t fin_fapl; /* FAPL to use for opening the input file */
- hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
- int grp_compact; /* Set the maximum number of links to store as header messages in the group */
- int grp_indexed; /* Set the minimum number of links to store in the indexed format */
- int msg_size[8]; /* Minimum size of shared messages: dataspace,
- datatype, fill value, filter pipleline, attribute */
+ int n_filter_g; /* number of global filters */
+ chunk_info_t chunk_g; /* global chunk INFO for the ALL case */
+ H5D_layout_t layout_g; /* global layout information for the ALL case */
+ int verbose; /* verbose mode */
+ hbool_t merge; /* Merge external file. */
+ hbool_t prune; /* Don't follow external file. */
+ hsize_t min_comp; /* minimum size to compress, in bytes */
+ int use_native; /* use a native type in write */
+ hbool_t latest; /* pack file with the latest file format */
+ H5F_libver_t low_bound; /* The file's low bound as in H5Fset_libver_bounds() */
+ H5F_libver_t high_bound; /* The file's high bound as in H5Fset_libver_bounds() */
+ hid_t fin_fapl; /* FAPL to use for opening the input file */
+ hid_t fout_fapl; /* FAPL to use for opening/creating the output file */
+ int grp_compact; /* Set the maximum number of links to store as header messages in the group */
+ int grp_indexed; /* Set the minimum number of links to store in the indexed format */
+ int msg_size[8]; /* Minimum size of shared messages: dataspace,
+ datatype, fill value, filter pipleline, attribute */
const char *ublock_filename; /* user block file name */
hsize_t ublock_size; /* user block size */
hsize_t meta_block_size; /* metadata aggregation block size (for H5Pset_meta_block_size) */
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index b1d6ab4..8f3496f 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -594,6 +594,8 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
hid_t f_space_id = H5I_INVALID_HID; /* file space ID */
hid_t ftype_id = H5I_INVALID_HID; /* file type ID */
hid_t wtype_id = H5I_INVALID_HID; /* read/write type ID */
+ hid_t ocpl_id = H5I_INVALID_HID; /* property to pass copy options */
+ hid_t lcpl_id = H5I_INVALID_HID; /* link creation property list */
named_dt_t *named_dt_head = NULL; /* Pointer to the stack of named datatypes copied */
size_t msize; /* size of type */
hsize_t nelmts; /* number of elements in dataset */
@@ -610,6 +612,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
int req_filter; /* there was a request for a filter */
int req_obj_layout = 0; /* request layout to current object */
unsigned crt_order_flags; /* group creation order flag */
+ h5tool_link_info_t linkinfo;
unsigned i;
unsigned u;
int ifil;
@@ -619,6 +622,9 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
hsize_t size_dset;
int ret_value = 0;
+ /* init linkinfo struct */
+ HDmemset(&linkinfo, 0, sizeof(h5tool_link_info_t));
+
/*-------------------------------------------------------------------------
* copy the supplied object list
*-------------------------------------------------------------------------
@@ -1137,26 +1143,25 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
*-------------------------------------------------------------------------
*/
else {
- hid_t pid = H5I_INVALID_HID;
-
/* create property to pass copy options */
- if ((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pcreate failed");
/* set options for object copy */
- if (H5Pset_copy_object(pid, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
+ if (H5Pset_copy_object(ocpl_id, H5O_COPY_WITHOUT_ATTR_FLAG) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
if (H5Ocopy(fidin, /* Source file or group identifier */
travt->objs[i].name, /* Name of the source object to be copied */
fidout, /* Destination file or group identifier */
travt->objs[i].name, /* Name of the destination object */
- pid, /* Properties which apply to the copy */
+ ocpl_id, /* Properties which apply to the copy */
H5P_DEFAULT) < 0) /* Properties which apply to the new hard link */
H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
- if (H5Pclose(pid) < 0)
+ if (H5Pclose(ocpl_id) < 0)
H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ ocpl_id = H5I_INVALID_HID;
/*-------------------------------------------------------------------------
* Copy attrs manually
@@ -1228,11 +1233,61 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt,
if (options->verbose)
HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
- if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
- H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
+ /* Check -X option. */
+ if (options->merge) {
+ if (H5tools_get_symlink_info(fidin, travt->objs[i].name, &linkinfo, 1) == 0) {
+ /* dangling link */
+ if (options->prune) {
+ HDprintf("Pruned %s.\n", travt->objs[i].name);
+ }
+ else {
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
+ }
+ }
+ else {
+ /* valid link */
+ /* create property to pass copy options */
+ if ((ocpl_id = H5Pcreate(H5P_OBJECT_COPY)) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate create property failed");
- if (options->verbose)
- HDprintf(FORMAT_OBJ, "link", travt->objs[i].name);
+ /* set options for object copy */
+ if (H5Pset_copy_object(ocpl_id, H5O_COPY_EXPAND_EXT_LINK_FLAG) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_copy_object failed");
+
+ /* Create link creation property list */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) {
+ H5TOOLS_GOTO_ERROR((-1), "H5Pcreate link creation property failed");
+ }
+
+ /* Set flag for intermediate group creation */
+ if (H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pset_create_intermediate_group failed");
+
+ if (H5Ocopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, ocpl_id, lcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Ocopy failed");
+
+ if (H5Pclose(lcpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+
+ if (H5Pclose(ocpl_id) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Pclose failed");
+ }
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
+ linkinfo.trg_path = NULL;
+ } /* options->merge */
+ else {
+ if (options->prune) {
+ HDprintf("Pruned %s.\n", travt->objs[i].name);
+ }
+ else {
+ if (H5Lcopy(fidin, travt->objs[i].name, fidout, travt->objs[i].name, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ H5TOOLS_GOTO_ERROR((-1), "H5Lcopy failed");
+ }
+ }
break;
default:
@@ -1249,15 +1304,22 @@ done:
if (named_datatype_free(&named_dt_head, 0) < 0)
H5TOOLS_ERROR((-1), "named_datatype_free failed");
}
- else
+ else {
H5E_BEGIN_TRY {
named_datatype_free(&named_dt_head, 1);
} H5E_END_TRY;
+ }
+
+ /* free link info path */
+ if (linkinfo.trg_path)
+ HDfree(linkinfo.trg_path);
H5E_BEGIN_TRY
{
H5Gclose(grp_in);
H5Gclose(grp_out);
+ H5Pclose(lcpl_id);
+ H5Pclose(ocpl_id);
H5Pclose(dcpl_in);
H5Pclose(gcpl_in);
H5Pclose(gcpl_out);
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index f7822ca..cf0c611 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -32,36 +32,38 @@ const char *outfile = NULL;
* Command-line options: The user can specify short or long-named
* parameters.
*/
-static const char *s_opts = "hVvf:l:m:e:nLj:k:c:d:s:u:b:M:t:a:i:o:S:P:T:G:q:z:E";
+static const char *s_opts = "a:b:c:d:e:f:hi:j:k:l:m:no:q:s:t:u:vz:EG:LM:P:S:T:VXW1:2:3:4:5:6:";
static struct long_options l_opts[] = {
- { "help", no_arg, 'h' },
- { "version", no_arg, 'V' },
- { "verbose", no_arg, 'v' },
+ { "alignment", require_arg, 'a' },
+ { "block", require_arg, 'b' },
+ { "compact", require_arg, 'c' },
+ { "indexed", require_arg, 'd' },
+ { "file", require_arg, 'e' },
{ "filter", require_arg, 'f' },
+ { "help", no_arg, 'h' },
+ { "infile", require_arg, 'i' }, /* for backward compability */
+ { "low", require_arg, 'j' },
+ { "high", require_arg, 'k' },
{ "layout", require_arg, 'l' },
{ "minimum", require_arg, 'm' },
- { "file", require_arg, 'e' },
{ "native", no_arg, 'n' },
- { "latest", no_arg, 'L' },
- { "low", require_arg, 'j' },
- { "high", require_arg, 'k' },
- { "compact", require_arg, 'c' },
- { "indexed", require_arg, 'd' },
+ { "outfile", require_arg, 'o' }, /* for backward compability */
+ { "sort_by", require_arg, 'q' },
{ "ssize", require_arg, 's' },
+ { "threshold", require_arg, 't' },
{ "ublock", require_arg, 'u' },
- { "block", require_arg, 'b' },
+ { "verbose", no_arg, 'v' },
+ { "sort_order", require_arg, 'z' },
+ { "enable-error-stack", no_arg, 'E' },
+ { "fs_pagesize", require_arg, 'G' },
+ { "latest", no_arg, 'L' },
{ "metadata_block_size", require_arg, 'M' },
- { "threshold", require_arg, 't' },
- { "alignment", require_arg, 'a' },
- { "infile", require_arg, 'i' }, /* for backward compability */
- { "outfile", require_arg, 'o' }, /* for backward compability */
- { "fs_strategy", require_arg, 'S' },
{ "fs_persist", require_arg, 'P' },
+ { "fs_strategy", require_arg, 'S' },
{ "fs_threshold", require_arg, 'T' },
- { "fs_pagesize", require_arg, 'G' },
- { "sort_by", require_arg, 'q' },
- { "sort_order", require_arg, 'z' },
- { "enable-error-stack", no_arg, 'E' },
+ { "version", no_arg, 'V' },
+ { "merge", no_arg, 'X' },
+ { "prune", no_arg, 'W' },
{ "src-vol-value", require_arg, '1' },
{ "src-vol-name", require_arg, '2' },
{ "src-vol-info", require_arg, '3' },
@@ -113,6 +115,9 @@ static void usage(const char *prog) {
PRINTVALSTREAM(rawoutstream, " --high=BOUND The high bound for library release versions to use\n");
PRINTVALSTREAM(rawoutstream, " when creating objects in the file\n");
PRINTVALSTREAM(rawoutstream, " (default is H5F_LIBVER_LATEST)\n");
+ PRINTVALSTREAM(rawoutstream, " --merge Follow external soft link recursively and merge data\n");
+ PRINTVALSTREAM(rawoutstream, " --prune Do not follow external soft links and remove link\n");
+ PRINTVALSTREAM(rawoutstream, " --merge --prune Follow external link, merge data and remove dangling link\n");
PRINTVALSTREAM(rawoutstream, " -c L1, --compact=L1 Maximum number of links in header messages\n");
PRINTVALSTREAM(rawoutstream, " -d L2, --indexed=L2 Minimum number of links in the indexed format\n");
PRINTVALSTREAM(rawoutstream, " -s S[:F], --ssize=S[:F] Shared object header message minimum size\n");
@@ -545,6 +550,14 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
options->high_bound = bound;
break;
+ case 'X':
+ options->merge = TRUE;
+ break;
+
+ case 'W':
+ options->prune = TRUE;
+ break;
+
case 'c':
options->grp_compact = HDatoi( opt_arg );
if (options->grp_compact > 0)
@@ -804,10 +817,6 @@ done:
int main(int argc, const char **argv)
{
pack_opt_t options; /*the global options */
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
int parse_ret;
HDmemset(&options, 0, sizeof(pack_opt_t));
@@ -818,14 +827,6 @@ int main(int argc, const char **argv)
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
/* update hyperslab buffer size from H5TOOLS_BUFSIZE env if exist */
if (h5tools_getenv_update_hyperslab_bufsize() < 0) {
HDprintf("Error occurred while retrieving H5TOOLS_BUFSIZE value\n");
@@ -855,10 +856,8 @@ int main(int argc, const char **argv)
goto done;
}
- if (enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
+ /* enable error reporting if command line option */
+ h5tools_error_report();
/* pack it */
if (h5repack(infile, outfile, &options) < 0) {
diff --git a/tools/src/h5repack/h5repack_parse.c b/tools/src/h5repack/h5repack_parse.c
index 95cacc1..50ccd7a 100644
--- a/tools/src/h5repack/h5repack_parse.c
+++ b/tools/src/h5repack/h5repack_parse.c
@@ -478,7 +478,7 @@ obj_list_t* parse_filter(const char *str, unsigned *n_objs, filter_info_t *filt,
* Example:
* "AA,B,CDE:CHUNK=10X10"
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: December 30, 2003
*
diff --git a/tools/src/h5repack/h5repack_refs.c b/tools/src/h5repack/h5repack_refs.c
index 2685823..5baabb6 100644
--- a/tools/src/h5repack/h5repack_refs.c
+++ b/tools/src/h5repack/h5repack_refs.c
@@ -537,7 +537,6 @@ static int copy_refs_attr(hid_t loc_in,
KY 2020-02-07
*/
is_ref_comp = (ref_comp_field_n > 0);
-
}
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index fb3d50d7..ec4b5ab 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -1786,32 +1786,23 @@ main(int argc, const char *argv[])
iter_t iter;
const char *fname = NULL;
hid_t fid = H5I_INVALID_HID;
- H5E_auto2_t func;
- H5E_auto2_t tools_func;
- void *edata;
- void *tools_edata;
struct handler_t *hand = NULL;
hid_t fapl_id = H5P_DEFAULT;
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
- /* Disable tools error reporting */
- H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
HDmemset(&iter, 0, sizeof(iter));
if(parse_command_line(argc, argv, &hand) < 0)
goto done;
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
if (drivername) {
h5tools_vfd_info_t vfd_info;
@@ -1843,11 +1834,6 @@ main(int argc, const char *argv[])
fname = argv[opt_ind];
- if(enable_error_stack > 0) {
- H5Eset_auto2(H5E_DEFAULT, func, edata);
- H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
- }
-
/* Check for filename given */
if(fname) {
hid_t fcpl;
@@ -1952,8 +1938,6 @@ done:
h5tools_setstatus(EXIT_FAILURE);
} /* end if */
- H5Eset_auto2(H5E_DEFAULT, func, edata);
-
leave(h5tools_getstatus());
} /* end main() */
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index f95d1bc..96cbf9c 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -266,14 +266,9 @@ main (int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable the HDF5 library's error reporting */
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* initialize h5tools lib */
h5tools_init();
- H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
-
/* Parse command line options */
if(parse_command_line(argc, argv) < 0)
goto done;
@@ -281,6 +276,9 @@ main (int argc, const char *argv[])
if(fname_g == NULL)
goto done;
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
/* Print usage/exit if not using at least one of the options */
if(!clear_status_flags && !remove_cache_image &&
!increment_eoa_eof && !print_filesize) {
@@ -387,7 +385,6 @@ main (int argc, const char *argv[])
warn_msg("No cache image in the file\n");
}
-
h5tools_setstatus(EXIT_SUCCESS);
done:
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c
index e9a783b..7242ed3 100644
--- a/tools/src/misc/h5debug.c
+++ b/tools/src/misc/h5debug.c
@@ -15,7 +15,7 @@
*
* Created: debug.c
* Jul 18 1997
- * Robb Matzke <matzke@llnl.gov>
+ * Robb Matzke
*
* Purpose: Debugs an existing HDF5 file at a low level.
*
@@ -237,7 +237,6 @@ get_H5FA_class(const uint8_t *sig)
* Failure: exit (non-zero)
*
* Programmer: Robb Matzke
- * matzke@llnl.gov
* Jul 18 1997
*
*-------------------------------------------------------------------------
diff --git a/tools/src/misc/h5mkgrp.c b/tools/src/misc/h5mkgrp.c
index cbd6e6d..ad3b7b8 100644
--- a/tools/src/misc/h5mkgrp.c
+++ b/tools/src/misc/h5mkgrp.c
@@ -268,9 +268,6 @@ main(int argc, const char *argv[])
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
- /* Disable the HDF5 library's error reporting */
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
/* Initialize h5tools lib */
h5tools_init();
@@ -289,6 +286,9 @@ main(int argc, const char *argv[])
leave(EXIT_FAILURE);
}
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
/* Check for creating groups with new format version */
if(params_g.latest) {
/* Set the "use the latest version of the format" bounds */
diff --git a/tools/src/misc/h5repart.c b/tools/src/misc/h5repart.c
index d516fa0..371cf2c 100644
--- a/tools/src/misc/h5repart.c
+++ b/tools/src/misc/h5repart.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Wednesday, May 13, 1998
*
* Purpose: Repartitions a file family. This program can be used to
diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in
index 2440ca4..ebbcb6c 100644
--- a/tools/test/h5copy/testh5copy.sh.in
+++ b/tools/test/h5copy/testh5copy.sh.in
@@ -13,7 +13,7 @@
#
# Tests for the h5copy tool
#
-# Pedro Vicente Nunes (pvn@hdfgroup.org), Albert Cheng (acheng@hdfgroup.org)
+# Pedro Vicente Nunes, Albert Cheng
# Thursday, July 20, 2006
#
@@ -200,6 +200,7 @@ TOOLTEST()
fi
runh5diff=no
fi
+
if [ "$3" = -o ]; then
outputfile=$4
else
@@ -219,6 +220,7 @@ TOOLTEST()
$RUNSERIAL $H5COPY_BIN $@
) > $actualout 2> $actualerr
RET=$?
+
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
@@ -268,6 +270,7 @@ TOOLTEST_PREFILL()
$RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name2
) > $actualout 2> $actualerr
RET=$?
+
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
@@ -282,6 +285,7 @@ TOOLTEST_PREFILL()
$RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $obj_name -d $obj_name2
) > $actualout 2> $actualerr
RET=$?
+
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
@@ -313,6 +317,7 @@ TOOLTEST_SAME()
else
runh5diff=no
fi
+
if [ "$3" = -o ]; then
outputfile=$4
else
@@ -330,6 +335,7 @@ TOOLTEST_SAME()
$RUNSERIAL $H5COPY_BIN -i $inputfile -o $outputfile -v -s $grp_name -d $grp_name
) > $actualout 2> $actualerr
RET=$?
+
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
@@ -344,6 +350,7 @@ TOOLTEST_SAME()
$RUNSERIAL $H5COPY_BIN -i $outputfile -o $outputfile -v -s $grp_name -d $grp_name2
) > $actualout 2> $actualerr
RET=$?
+
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
@@ -406,6 +413,7 @@ TOOLTEST_FAIL()
if [ "$1" = -i ]; then
inputfile=$2
fi
+
if [ "$3" = -o ]; then
outputfile=$4
fi
@@ -417,8 +425,8 @@ TOOLTEST_FAIL()
#echo "#############################"
$RUNSERIAL $H5COPY_BIN $@
) > $actualout 2> $actualerr
-
RET=$?
+
# save actualout and actualerr in case they are needed later.
cp $actualout $actualout_sav
STDOUT_FILTER $actualout
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index 3d9c6f5..4e8e8d1 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -66,8 +66,10 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/non_comparables2.h5
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter.h5
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/tudfilter2.h5
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings1.h5
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/diff_strings2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_strings2.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps1.h5
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps2.h5
# tools/testfiles/vds
${HDF5_TOOLS_DIR}/testfiles/vds/1_a.h5
${HDF5_TOOLS_DIR}/testfiles/vds/1_b.h5
@@ -291,6 +293,7 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_80.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_800.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_801.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_830.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_90.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt
@@ -302,6 +305,7 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v3.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_vlstr.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_eps.txt
)
set (LIST_WIN_TEST_FILES
@@ -338,9 +342,10 @@
# Overwrite system dependent files (Windows) and not VS2015
#
set (COPY_WINDOWS_FILES false)
- if (MINGW)
- set (COPY_WINDOWS_FILES true)
- endif ()
+ # MinGW tests may depend on host system
+ #if (MINGW)
+ # set (COPY_WINDOWS_FILES true)
+ #endif ()
if (WIN32 AND MSVC_VERSION LESS 1900)
set (COPY_WINDOWS_FILES true)
endif ()
@@ -539,8 +544,11 @@
set (ATTR_VERBOSE_LEVEL_FILE1 h5diff_attr_v_level1.h5)
set (ATTR_VERBOSE_LEVEL_FILE2 h5diff_attr_v_level2.h5)
# strings
- set (STRINGS1 diff_strings1.h5)
- set (STRINGS2 diff_strings2.h5)
+ set (STRINGS1 h5diff_strings1.h5)
+ set (STRINGS2 h5diff_strings2.h5)
+ # epsilon
+ set (EPS1 h5diff_eps1.h5)
+ set (EPS2 h5diff_eps2.h5)
# VDS tests
set (FILEV1 1_vds.h5)
@@ -912,6 +920,8 @@
h5diff_800.out.err
h5diff_801.out
h5diff_801.out.err
+ h5diff_830.out
+ h5diff_830.out.err
h5diff_8625.out
h5diff_8625.out.err
h5diff_8639.out
@@ -926,6 +936,8 @@
h5diff_v3.out.err
h5diff_vlstr.out
h5diff_vlstr.out.err
+ h5diff_eps.out
+ h5diff_eps.out.err
)
set_tests_properties (H5DIFF-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
if (last_test)
@@ -1107,6 +1119,9 @@ ADD_H5_TEST (h5diff_609 0 -d 200 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
# 6.10: number smaller than smallest difference
ADD_H5_TEST (h5diff_610 1 -d 1 ${FILE1} ${FILE2} g1/dset3 g1/dset4)
+# eps: number smaller than epsilon
+ADD_H5_TEST (h5diff_eps 0 -v3 -d 1e-16 ${EPS1} ${EPS2})
+
# ##############################################################################
# # -p
# ##############################################################################
@@ -1492,9 +1507,9 @@ ADD_H5_TEST (h5diff_484 0 -v --exclude-path "/dset3" ${EXCLUDE_FILE1_1} ${EXCLUD
# 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)
+ADD_H5_TEST (h5diff_485 0 -v --exclude-path "/group1" ${EXCLUDE_FILE3_1} ${EXCLUDE_FILE3_2})
+ADD_H5_TEST (h5diff_486 0 -v --exclude-path "/group1" ${EXCLUDE_FILE3_2} ${EXCLUDE_FILE3_1})
+ADD_H5_TEST (h5diff_487 1 -v --exclude-path "/group1/dset" ${EXCLUDE_FILE3_1} ${EXCLUDE_FILE3_2})
# ##############################################################################
# # diff various multiple vlen and fixed strings in a compound type dataset
@@ -1528,12 +1543,15 @@ ADD_H5_TEST (h5diff_646 1 -v --use-system-epsilon -p 0.05 ${FILE1} ${FILE2} /g1/
# ##############################################################################
# # Test array variances
# ##############################################################################
-#
-# Test with -d , -p and --use-system-epsilon.
ADD_H5_TEST (h5diff_800 1 -v ${FILE7} ${FILE8} /g1/array /g1/array)
ADD_H5_TEST (h5diff_801 1 -v ${FILE7} ${FILE8A} /g1/array /g1/array)
# ##############################################################################
+# # dataset subsets
+# ##############################################################################
+#TRILABS-227 ADD_H5_TEST (h5diff_830 1 --enable-error-stack -v ${FILE7} ${FILE8} /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;])
+
+# ##############################################################################
# # VDS tests
# ##############################################################################
ADD_H5_TEST (h5diff_v1 0 -v ${FILEV1} ${FILEV2})
diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in
index 341cba5..ffc43da 100644
--- a/tools/test/h5diff/h5diff_plugin.sh.in
+++ b/tools/test/h5diff/h5diff_plugin.sh.in
@@ -135,24 +135,24 @@ CLEAN_TESTFILES_AND_TESTDIR()
# -h print help page
while [ $# -gt 0 ]; do
case "$1" in
- -p) # reset the tool name and bin to run ph5diff tests
- TESTNAME=ph5diff
- H5DIFF=../../src/h5diff/ph5diff # The tool name
- H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary
- pmode=yes
- shift
- ;;
+ -p) # reset the tool name and bin to run ph5diff tests
+ TESTNAME=ph5diff
+ H5DIFF=../../src/h5diff/ph5diff # The tool name
+ H5DIFF_BIN=`pwd`/$H5DIFF # The path of the tool binary
+ pmode=yes
+ shift
+ ;;
-h) # print help page
- echo "$0 [-p] [-h]"
- echo " -p run ph5diff tests"
- echo " -h print help page"
- shift
- exit 0
- ;;
+ echo "$0 [-p] [-h]"
+ echo " -p run ph5diff tests"
+ echo " -h print help page"
+ shift
+ exit 0
+ ;;
*) # unknown option
echo "$0: Unknown option ($1)"
- exit 1
- ;;
+ exit 1
+ ;;
esac
done
@@ -218,19 +218,21 @@ TOOLTEST() {
# Run test.
TESTING $H5DIFF $@
(
- #echo "#############################"
- #echo "Expected output for '$H5DIFF $@'"
- #echo "#############################"
- cd $TESTDIR
- eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@"
+ #echo "#############################"
+ #echo "Expected output for '$H5DIFF $@'"
+ #echo "#############################"
+ cd $TESTDIR
+ eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
EXIT_CODE=$?
+
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
cat $actual_err >> $actual
+
# don't add exit code check in pmode, as it causes failure. (exit code
# is from mpirun not tool)
# if any problem occurs relate to an exit code, it will be caught in
@@ -260,27 +262,29 @@ TOOLTEST() {
actual_sorted=actual_sorted
sort $expect -o $expect_sorted
sort $actual -o $actual_sorted
+
# remove "EXIT CODE:" line from expect file. test for exit code
# is done by serial mode.
grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit
mv $expect_sorted.noexit $expect_sorted
- if $CMP $expect_sorted $actual_sorted; then
- echo " PASSED"
- else
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
- if test yes = "$verbose"; then
- echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
- $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
- echo "====The actual output ($actual_sav)"
- sed 's/^/ /' < $actual_sav
- echo "====The actual stderr ($actual_err_sav)"
- sed 's/^/ /' < $actual_err_sav
- echo "====End of actual stderr ($actual_err_sav)"
- echo ""
+
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ echo "====The actual output ($actual_sav)"
+ sed 's/^/ /' < $actual_sav
+ echo "====The actual stderr ($actual_err_sav)"
+ sed 's/^/ /' < $actual_err_sav
+ echo "====End of actual stderr ($actual_err_sav)"
+ echo ""
+ fi
fi
fi
- fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
@@ -306,18 +310,20 @@ TOOLTEST_ERR() {
# Run test.
TESTING $H5DIFF $@
(
- #echo "#############################"
- #echo "Expected output for '$H5DIFF $@'"
- #echo "#############################"
- cd $TESTDIR
- eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@"
+ #echo "#############################"
+ #echo "Expected output for '$H5DIFF $@'"
+ #echo "#############################"
+ cd $TESTDIR
+ eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
EXIT_CODE=$?
+
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
+
# don't add exit code check in pmode, as it causes failure. (exit code
# is from mpirun not tool)
# if any problem occurs relate to an exit code, it will be caught in
@@ -348,23 +354,24 @@ TOOLTEST_ERR() {
sort $expect_err -o $expect_sorted
sort $actual_err -o $actual_sorted
mv $expect_sorted.noexit $expect_sorted
- if $CMP $expect_sorted $actual_sorted; then
- echo " PASSED"
- else
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
- if test yes = "$verbose"; then
- echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
- $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
- echo "====The actual output ($actual_sav)"
- sed 's/^/ /' < $actual_sav
- echo "====The actual stderr ($actual_err_sav)"
- sed 's/^/ /' < $actual_err_sav
- echo "====End of actual stderr ($actual_err_sav)"
- echo ""
+
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ echo "====The actual output ($actual_sav)"
+ sed 's/^/ /' < $actual_sav
+ echo "====The actual stderr ($actual_err_sav)"
+ sed 's/^/ /' < $actual_err_sav
+ echo "====End of actual stderr ($actual_err_sav)"
+ echo ""
+ fi
fi
fi
- fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index 1d5354f..173a5ce 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -31,7 +31,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
*
* Purpose: generate files for h5diff testing
*
- * Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: November 12, 2003
*
@@ -94,8 +94,11 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
#define NON_COMPARBLES1 "non_comparables1.h5"
#define NON_COMPARBLES2 "non_comparables2.h5"
/* string dataset and attribute */
-#define DIFF_STRINGS1 "diff_strings1.h5"
-#define DIFF_STRINGS2 "diff_strings2.h5"
+#define DIFF_STRINGS1 "h5diff_strings1.h5"
+#define DIFF_STRINGS2 "h5diff_strings2.h5"
+/* double dataset and epsilon */
+#define DIFF_EPS1 "h5diff_eps1.h5"
+#define DIFF_EPS2 "h5diff_eps2.h5"
#define UIMAX 4294967295u /*Maximum value for a variable of type unsigned int */
#define STR_SIZE 3
@@ -110,7 +113,7 @@ size_t H5TOOLS_MALLOCSIZE = (128 * 1024 * 1024);
/* Error macros */
#define AT() HDprintf("ERROR at %s:%d in %s()...\n", __FILE__, __LINE__, FUNC);
-#define PROGRAM_ERROR {AT(); goto error;}
+#define PROGRAM_ERROR do {AT(); goto error;} while(0)
/* A UD link traversal function. Shouldn't actually be called. */
static hid_t
@@ -172,6 +175,7 @@ static void test_comps_vlen_arry(const char *fname, const char *dset,
static void test_data_nocomparables(const char *fname, int diff);
static void test_objs_nocomparables(const char *fname1, const char *fname2);
static void test_objs_strings(const char *fname, const char *fname2);
+static void test_double_epsilon(const char *fname1, const char *fname2);
/* called by test_attributes() and test_datasets() */
static void write_attr_strings(hid_t loc_id, const char* dset_name, hid_t fid, int make_diffs);
@@ -288,6 +292,9 @@ int main(void)
/* string dataset and attribute. HDFFV-10028 */
test_objs_strings(DIFF_STRINGS1, DIFF_STRINGS2);
+ /* double dataset and epsilion. HDFFV-10897 */
+ test_double_epsilon(DIFF_EPS1, DIFF_EPS2);
+
return EXIT_SUCCESS;
}
@@ -4928,73 +4935,73 @@ test_objs_nocomparables(const char *fname1, const char *fname2)
*------------------------------------------------------------------------*/
/* file1 */
if((fid1 = H5Fopen(fname1, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* file2 */
if((fid2 = H5Fopen(fname2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/*-----------------------------------------------------------------------
* in file1 : add member objects
*------------------------------------------------------------------------*/
/* parent group */
if((topgid1 = H5Gcreate2(fid1, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* dataset */
if(write_dset(topgid1, 1, dims, "obj1", H5T_NATIVE_INT, data1) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* group */
if((gid1 = H5Gcreate2(topgid1, "obj2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* committed type */
if((tid1 = H5Tcopy(H5T_NATIVE_INT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Tcommit2(topgid1, "obj3", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/*-----------------------------------------------------------------------
* in file2 : add member objects
*------------------------------------------------------------------------*/
/* parent group */
if((topgid2 = H5Gcreate2(fid2, "diffobjtypes", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* group */
if((gid2 = H5Gcreate2(topgid2, "obj1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* committed type */
if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Tcommit2(topgid2, "obj2", tid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* dataset */
if(write_dset(topgid2, 1, dims, "obj3", H5T_NATIVE_INT, data2) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/*-----------------------------------------------------------------------
* Close IDs
*-----------------------------------------------------------------------*/
if(H5Fclose(fid1) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Fclose(fid2) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Gclose(topgid1) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Gclose(topgid2) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Gclose(gid1) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Gclose(gid2) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Tclose(tid1) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Tclose(tid2) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
return;
@@ -8018,6 +8025,59 @@ out:
return -1;
}
+/*
+ * Function: test_double_epsilion
+ *
+ * Purpose: Create test files to compare data with epsilion
+ */
+static
+void test_double_epsilon(const char *fname1, const char *fname2)
+{
+ hid_t fid1 = H5I_INVALID_HID, fid2 = H5I_INVALID_HID;
+ hsize_t dims1[2] = { 4, 7 };
+ double wdata[4][7];
+ int i, j;
+
+ /*-------------------------------------------------------------------------
+ * create two files
+ *-------------------------------------------------------------------------
+ */
+ if ((fid1 = H5Fcreate(fname1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR;
+ if ((fid2 = H5Fcreate(fname2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ PROGRAM_ERROR;
+
+ /*
+ * Initialize data.
+ */
+ for (i=0; i<4; i++)
+ for (j=0; j<7; j++)
+ wdata[i][j] = 0.0;
+
+ /* dataset */
+ if(write_dset(fid1, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0)
+ PROGRAM_ERROR;
+
+ /*
+ * Initialize data.
+ */
+ for (i=0; i<4; i++)
+ for (j=0; j<7; j++)
+ wdata[i][j] = (double)1.e-19;
+
+ /* dataset */
+ if(write_dset(fid2, 2, dims1, "dataset", H5T_IEEE_F64LE, wdata) < 0)
+ PROGRAM_ERROR;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+ } H5E_END_TRY;
+
+ return;
+}
+
/*-------------------------------------------------------------------------
* Function: write_attr
*
@@ -8073,22 +8133,22 @@ write_dset(hid_t loc_id, int rank, hsize_t *dims, const char *name, hid_t tid, v
/* create a space */
if((sid = H5Screate_simple(rank, dims, NULL)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* create the dataset */
if((did = H5Dcreate2(loc_id, name, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* write */
if(buf)
if(H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
/* close */
if(H5Dclose(did) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
if(H5Sclose(sid) < 0)
- PROGRAM_ERROR
+ PROGRAM_ERROR;
return SUCCEED;
diff --git a/tools/test/h5diff/testfiles/h5diff_10.txt b/tools/test/h5diff/testfiles/h5diff_10.txt
index 0a2fd12..b5ff01a 100644
--- a/tools/test/h5diff/testfiles/h5diff_10.txt
+++ b/tools/test/h5diff/testfiles/h5diff_10.txt
@@ -17,10 +17,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -109,6 +108,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_58_ref.txt b/tools/test/h5diff/testfiles/h5diff_58_ref.txt
index 6fa2299..48a4b33 100644
--- a/tools/test/h5diff/testfiles/h5diff_58_ref.txt
+++ b/tools/test/h5diff/testfiles/h5diff_58_ref.txt
@@ -1,32 +1,32 @@
dataset: </g1/reference2D> and </g1/reference2D>
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt
index 55b8da7..f52d8cc 100644
--- a/tools/test/h5diff/testfiles/h5diff_600.txt
+++ b/tools/test/h5diff/testfiles/h5diff_600.txt
@@ -17,10 +17,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -109,6 +108,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_603.txt b/tools/test/h5diff/testfiles/h5diff_603.txt
index 36cd0ef..84111b3 100644
--- a/tools/test/h5diff/testfiles/h5diff_603.txt
+++ b/tools/test/h5diff/testfiles/h5diff_603.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_606.txt b/tools/test/h5diff/testfiles/h5diff_606.txt
index c2e9ac1..d915d36 100644
--- a/tools/test/h5diff/testfiles/h5diff_606.txt
+++ b/tools/test/h5diff/testfiles/h5diff_606.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_612.txt b/tools/test/h5diff/testfiles/h5diff_612.txt
index 2e09432..1ef8cdf 100644
--- a/tools/test/h5diff/testfiles/h5diff_612.txt
+++ b/tools/test/h5diff/testfiles/h5diff_612.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_615.txt b/tools/test/h5diff/testfiles/h5diff_615.txt
index a07de54..881362e 100644
--- a/tools/test/h5diff/testfiles/h5diff_615.txt
+++ b/tools/test/h5diff/testfiles/h5diff_615.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_621.txt b/tools/test/h5diff/testfiles/h5diff_621.txt
index 5f44dd7..ba39a99 100644
--- a/tools/test/h5diff/testfiles/h5diff_621.txt
+++ b/tools/test/h5diff/testfiles/h5diff_621.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_622.txt b/tools/test/h5diff/testfiles/h5diff_622.txt
index 2e28a42..70421fc 100644
--- a/tools/test/h5diff/testfiles/h5diff_622.txt
+++ b/tools/test/h5diff/testfiles/h5diff_622.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_623.txt b/tools/test/h5diff/testfiles/h5diff_623.txt
index 21cb90a..0d74268 100644
--- a/tools/test/h5diff/testfiles/h5diff_623.txt
+++ b/tools/test/h5diff/testfiles/h5diff_623.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_624.txt b/tools/test/h5diff/testfiles/h5diff_624.txt
index 92c98d9..cb8b8b4 100644
--- a/tools/test/h5diff/testfiles/h5diff_624.txt
+++ b/tools/test/h5diff/testfiles/h5diff_624.txt
@@ -18,10 +18,9 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Verbose mode with level. Print differences and list of objects.
Level of detail depends on value of N:
0 : Identical to '-v' or '--verbose'.
- 1 : All level 0 information plus one-line attribute
- status summary.
- 2 : All level 1 information plus extended attribute
- status report.
+ 1 : All level 0 information plus one-line attribute status summary.
+ 2 : All level 1 information plus extended attribute status report.
+ 3 : All level 2 information plus file names.
-q, --quiet
Quiet mode. Do not produce output.
--enable-error-stack
@@ -110,6 +109,14 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
excluded.
This option can be used repeatedly to exclude multiple paths.
+ --exclude-attribute "path/to/object/with/attribute"
+ Exclude attributes on the specified path to an object when comparing files or groups.
+
+ If there are multiple paths to an object, only the specified path(s)
+ will be excluded; the comparison will include any path not explicitly
+ excluded.
+ This option can be used repeatedly to exclude multiple paths.
+
Modes of output:
Default mode: print the number of differences found and where they occured
-r Report mode: print the above plus the differences
diff --git a/tools/test/h5diff/testfiles/h5diff_70.txt b/tools/test/h5diff/testfiles/h5diff_70.txt
index efa34ea..b0b8bf6 100644
--- a/tools/test/h5diff/testfiles/h5diff_70.txt
+++ b/tools/test/h5diff/testfiles/h5diff_70.txt
@@ -1183,10 +1183,42 @@ position opaque3D of </dset> opaque3D of </dset> difference
[ 3 2 1 ] 24 0 24
24 differences found
attribute: <reference of </dset>> and <reference of </dset>>
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
0 differences found
attribute: <reference2D of </dset>> and <reference2D of </dset>>
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
0 differences found
attribute: <reference3D of </dset>> and <reference3D of </dset>>
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
0 differences found
attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_700.txt b/tools/test/h5diff/testfiles/h5diff_700.txt
index 851a407..6cf9893 100644
--- a/tools/test/h5diff/testfiles/h5diff_700.txt
+++ b/tools/test/h5diff/testfiles/h5diff_700.txt
@@ -1187,10 +1187,42 @@ position opaque3D of </dset> opaque3D of </dset> difference
[ 3 2 1 ] 24 0 24
24 differences found
attribute: <reference of </dset>> and <reference of </dset>>
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
0 differences found
attribute: <reference2D of </dset>> and <reference2D of </dset>>
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
0 differences found
attribute: <reference3D of </dset>> and <reference3D of </dset>>
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
0 differences found
attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_701.txt b/tools/test/h5diff/testfiles/h5diff_701.txt
index 33f1a0f..4187754 100644
--- a/tools/test/h5diff/testfiles/h5diff_701.txt
+++ b/tools/test/h5diff/testfiles/h5diff_701.txt
@@ -1254,10 +1254,42 @@ position opaque3D of </dset> opaque3D of </dset> difference
[ 3 2 1 ] 24 0 24
24 differences found
attribute: <reference of </dset>> and <reference of </dset>>
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
0 differences found
attribute: <reference2D of </dset>> and <reference2D of </dset>>
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
0 differences found
attribute: <reference3D of </dset>> and <reference3D of </dset>>
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
0 differences found
attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_702.txt b/tools/test/h5diff/testfiles/h5diff_702.txt
index 851a407..6cf9893 100644
--- a/tools/test/h5diff/testfiles/h5diff_702.txt
+++ b/tools/test/h5diff/testfiles/h5diff_702.txt
@@ -1187,10 +1187,42 @@ position opaque3D of </dset> opaque3D of </dset> difference
[ 3 2 1 ] 24 0 24
24 differences found
attribute: <reference of </dset>> and <reference of </dset>>
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
0 differences found
attribute: <reference2D of </dset>> and <reference2D of </dset>>
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
0 differences found
attribute: <reference3D of </dset>> and <reference3D of </dset>>
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
0 differences found
attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_703.txt b/tools/test/h5diff/testfiles/h5diff_703.txt
index 33f1a0f..4187754 100644
--- a/tools/test/h5diff/testfiles/h5diff_703.txt
+++ b/tools/test/h5diff/testfiles/h5diff_703.txt
@@ -1254,10 +1254,42 @@ position opaque3D of </dset> opaque3D of </dset> difference
[ 3 2 1 ] 24 0 24
24 differences found
attribute: <reference of </dset>> and <reference of </dset>>
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
+Not comparable: <reference of </dset>> or <reference of </dset>> is an empty dataset
0 differences found
attribute: <reference2D of </dset>> and <reference2D of </dset>>
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
+Not comparable: <reference2D of </dset>> or <reference2D of </dset>> is an empty dataset
0 differences found
attribute: <reference3D of </dset>> and <reference3D of </dset>>
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
+Not comparable: <reference3D of </dset>> or <reference3D of </dset>> is an empty dataset
0 differences found
attribute: <string of </dset>> and <string of </dset>>
size: [2] [2]
diff --git a/tools/test/h5diff/testfiles/h5diff_80.txt b/tools/test/h5diff/testfiles/h5diff_80.txt
index b223eed..11dccd8 100644
--- a/tools/test/h5diff/testfiles/h5diff_80.txt
+++ b/tools/test/h5diff/testfiles/h5diff_80.txt
@@ -528,166 +528,166 @@ position opaque3D opaque3D difference
24 differences found
dataset: </g1/reference> and </g1/reference>
size: [2] [2]
-position difference
+position reference reference difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference reference difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
4 differences found
dataset: </g1/reference2D> and </g1/reference2D>
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference2D reference2D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
12 differences found
dataset: </g1/reference3D> and </g1/reference3D>
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
size: [2] [2]
-position difference
+position reference3D reference3D difference
------------------------------------------------------------
[ 0 ] 1 0 1
[ 1 ] 2 0 2
diff --git a/tools/test/h5diff/testfiles/h5diff_830.txt b/tools/test/h5diff/testfiles/h5diff_830.txt
new file mode 100644
index 0000000..8f00d8b
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_830.txt
@@ -0,0 +1,30 @@
+dataset: </g1/array3D> and </g1/array3D>
+size: [4x3x2] [4x3x2]
+position array3D array3D difference
+------------------------------------------------------------
+[ 0 0 0 ] 1 0 1
+[ 0 0 0 ] 2 0 2
+[ 0 0 0 ] 3 0 3
+[ 0 0 1 ] 4 0 4
+[ 0 0 1 ] 5 0 5
+[ 0 0 1 ] 6 0 6
+[ 0 2 0 ] 13 0 13
+[ 0 2 0 ] 14 0 14
+[ 0 2 0 ] 15 0 15
+[ 0 2 1 ] 16 0 16
+[ 0 2 1 ] 17 0 17
+[ 0 2 1 ] 18 0 18
+[ 2 0 0 ] 37 0 37
+[ 2 0 0 ] 38 0 38
+[ 2 0 0 ] 39 0 39
+[ 2 0 1 ] 40 0 40
+[ 2 0 1 ] 41 0 41
+[ 2 0 1 ] 42 0 42
+[ 2 2 0 ] 49 0 49
+[ 2 2 0 ] 50 0 50
+[ 2 2 0 ] 51 0 51
+[ 2 2 1 ] 52 0 52
+[ 2 2 1 ] 53 0 53
+[ 2 2 1 ] 54 0 54
+24 differences found
+EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_eps.txt b/tools/test/h5diff/testfiles/h5diff_eps.txt
new file mode 100644
index 0000000..3a71366
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_eps.txt
@@ -0,0 +1,17 @@
+file1: h5diff_eps1.h5
+file2: h5diff_eps2.h5
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /DS1
+
+
+group : </> and </>
+0 differences found
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+
+dataset: </DS1> and </DS1>
+0 differences found
+Attributes status: 0 common, 0 only in obj1, 0 only in obj2
+EXIT CODE: 0
diff --git a/tools/test/h5diff/testfiles/h5diff_eps1.h5 b/tools/test/h5diff/testfiles/h5diff_eps1.h5
new file mode 100644
index 0000000..2803a1d
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_eps1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_eps2.h5 b/tools/test/h5diff/testfiles/h5diff_eps2.h5
new file mode 100644
index 0000000..4acf27a
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_eps2.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/h5diff_reg.txt b/tools/test/h5diff/testfiles/h5diff_reg.txt
index d4f5415..ecb6275 100644
--- a/tools/test/h5diff/testfiles/h5diff_reg.txt
+++ b/tools/test/h5diff/testfiles/h5diff_reg.txt
@@ -1,12 +1,11 @@
dataset: </Dataset3> and </Dataset3>
-attribute: <Attr1 of <(null)>> and <Attr1 of <(null)>>
+attribute: <Attr1 of <Dataset3>> and <Attr1 of <Dataset3>>
0 differences found
-Warning: Cannot open referenced attribute: attribute 1
-Warning: Cannot open referenced attribute: attribute 2
-attribute: <Attr2 of <(null)>> and <Attr2 of <(null)>>
+Warning: Cannot open referenced attribute1
+attribute: <Attr2 of <Dataset3>> and <Attr2 of <Dataset3>>
0 differences found
-attribute: <Attr3 of <(null)>> and <Attr3 of <(null)>>
+attribute: <Attr3 of <Dataset3>> and <Attr3 of <Dataset3>>
0 differences found
0 differences found
obj1 obj2
diff --git a/tools/test/h5diff/testfiles/diff_strings1.h5 b/tools/test/h5diff/testfiles/h5diff_strings1.h5
index 0f8b380..0f8b380 100644
--- a/tools/test/h5diff/testfiles/diff_strings1.h5
+++ b/tools/test/h5diff/testfiles/h5diff_strings1.h5
Binary files differ
diff --git a/tools/test/h5diff/testfiles/diff_strings2.h5 b/tools/test/h5diff/testfiles/h5diff_strings2.h5
index e8520ae..e8520ae 100644
--- a/tools/test/h5diff/testfiles/diff_strings2.h5
+++ b/tools/test/h5diff/testfiles/h5diff_strings2.h5
Binary files differ
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
index 2d490a8..587c340 100644
--- a/tools/test/h5diff/testh5diff.sh.in
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -85,6 +85,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr2.h5
$SRC_H5DIFF_TESTFILES/h5diff_attr3.h5
$SRC_H5DIFF_TESTFILES/h5diff_dset1.h5
$SRC_H5DIFF_TESTFILES/h5diff_dset2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_dset3.h5
$SRC_H5DIFF_TESTFILES/h5diff_hyper1.h5
$SRC_H5DIFF_TESTFILES/h5diff_hyper2.h5
$SRC_H5DIFF_TESTFILES/h5diff_empty.h5
@@ -119,8 +120,10 @@ $SRC_H5DIFF_TESTFILES/h5diff_attr_v_level2.h5
$SRC_H5DIFF_TESTFILES/h5diff_enum_invalid_values.h5
$SRC_H5DIFF_TESTFILES/non_comparables1.h5
$SRC_H5DIFF_TESTFILES/non_comparables2.h5
-$SRC_H5DIFF_TESTFILES/diff_strings1.h5
-$SRC_H5DIFF_TESTFILES/diff_strings2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_strings1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_strings2.h5
+$SRC_H5DIFF_TESTFILES/h5diff_eps1.h5
+$SRC_H5DIFF_TESTFILES/h5diff_eps2.h5
$SRC_TOOLS_TESTFILES/tvlstr.h5
"
@@ -349,6 +352,9 @@ $SRC_H5DIFF_TESTFILES/h5diff_708.txt
$SRC_H5DIFF_TESTFILES/h5diff_709.txt
$SRC_H5DIFF_TESTFILES/h5diff_710.txt
$SRC_H5DIFF_TESTFILES/h5diff_80.txt
+$SRC_H5DIFF_TESTFILES/h5diff_800.txt
+$SRC_H5DIFF_TESTFILES/h5diff_801.txt
+$SRC_H5DIFF_TESTFILES/h5diff_830.txt
$SRC_H5DIFF_TESTFILES/h5diff_90.txt
$SRC_H5DIFF_TESTFILES/h5diff_8625.txt
$SRC_H5DIFF_TESTFILES/h5diff_8639.txt
@@ -357,6 +363,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_v1.txt
$SRC_H5DIFF_TESTFILES/h5diff_v2.txt
$SRC_H5DIFF_TESTFILES/h5diff_v3.txt
$SRC_H5DIFF_TESTFILES/h5diff_vlstr.txt
+$SRC_H5DIFF_TESTFILES/h5diff_eps.txt
"
#
@@ -494,18 +501,20 @@ TOOLTEST() {
# Run test.
TESTING $H5DIFF $@
(
- #echo "#############################"
- #echo "Expected output for '$H5DIFF $@'"
- #echo "#############################"
- cd $TESTDIR
- eval $RUNCMD $H5DIFF_BIN "$@"
+ #echo "#############################"
+ #echo "Expected output for '$H5DIFF $@'"
+ #echo "#############################"
+ cd $TESTDIR
+ eval $RUNCMD $H5DIFF_BIN "$@"
) >$actual 2>$actual_err
EXIT_CODE=$?
+
# save actual and actual_err in case they are needed later.
cp $actual $actual_sav
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
+
# don't add exit code check in pmode, as it causes failure. (exit code
# is from mpirun not tool)
# if any problem occurs relate to an exit code, it will be caught in
@@ -539,23 +548,24 @@ TOOLTEST() {
# is done by serial mode.
grep -v "EXIT CODE:" $expect_sorted > $expect_sorted.noexit
mv $expect_sorted.noexit $expect_sorted
- if $CMP $expect_sorted $actual_sorted; then
- echo " PASSED"
- else
- echo "*FAILED*"
- nerrors="`expr $nerrors + 1`"
- if test yes = "$verbose"; then
- echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
- $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
- echo "====The actual output ($actual_sav)"
- sed 's/^/ /' < $actual_sav
- echo "====The actual stderr ($actual_err_sav)"
- sed 's/^/ /' < $actual_err_sav
- echo "====End of actual stderr ($actual_err_sav)"
- echo ""
+
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ echo "====The actual output ($actual_sav)"
+ sed 's/^/ /' < $actual_sav
+ echo "====The actual stderr ($actual_err_sav)"
+ sed 's/^/ /' < $actual_err_sav
+ echo "====End of actual stderr ($actual_err_sav)"
+ echo ""
+ fi
fi
fi
- fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
@@ -717,10 +727,10 @@ TOOLTEST h5diff_59.txt -v h5diff_dtypes.h5 h5diff_dtypes.h5 dset11a dset11b
# Strings
# ( HDFFV-10128 )
-TOOLTEST h5diff_60.txt -v diff_strings1.h5 diff_strings2.h5 string1 string1
-TOOLTEST h5diff_61.txt -v diff_strings1.h5 diff_strings2.h5 string2 string2
-TOOLTEST h5diff_62.txt -v diff_strings1.h5 diff_strings2.h5 string3 string3
-TOOLTEST h5diff_63.txt -v diff_strings1.h5 diff_strings2.h5 string4 string4
+TOOLTEST h5diff_60.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string1 string1
+TOOLTEST h5diff_61.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string2 string2
+TOOLTEST h5diff_62.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string3 string3
+TOOLTEST h5diff_63.txt -v h5diff_strings1.h5 h5diff_strings2.h5 string4 string4
# ##############################################################################
# # Error messages
@@ -763,6 +773,9 @@ TOOLTEST h5diff_609.txt -d 200 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dse
# 6.10: number smaller than smallest difference
TOOLTEST h5diff_610.txt -d 1 h5diff_basic1.h5 h5diff_basic2.h5 g1/dset3 g1/dset4
+# eps: number smaller than epsilon
+TOOLTEST h5diff_eps.txt -v3 -d 1e-16 h5diff_eps1.h5 h5diff_eps2.h5
+
# ##############################################################################
# # -p
@@ -1184,6 +1197,17 @@ TOOLTEST h5diff_645.txt -v -p 0.05 --use-system-epsilon h5diff_basic1.h5 h5diff_
TOOLTEST h5diff_646.txt -v --use-system-epsilon -p 0.05 h5diff_basic1.h5 h5diff_basic2.h5 /g1/dset3 /g1/dset4
# ##############################################################################
+# # Test array variances
+# ##############################################################################
+TOOLTEST h5diff_800.txt -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array /g1/array
+TOOLTEST h5diff_801.txt -v h5diff_dset1.h5 h5diff_dset3.h5 /g1/array /g1/array
+
+# ##############################################################################
+# # dataset subsets
+# ##############################################################################
+#TRILABS-227 TOOLTEST h5diff_830.txt --enable-error-stack -v h5diff_dset1.h5 h5diff_dset2.h5 /g1/array3D[0,0,0;2,2,1;2,2,2;] /g1/array3D[0,0,0;2,2,1;2,2,2;]
+
+# ##############################################################################
# VDS tests
# ##############################################################################
TOOLTEST h5diff_v1.txt -v 1_vds.h5 2_vds.h5
diff --git a/tools/test/h5dump/h5dump_plugin.sh.in b/tools/test/h5dump/h5dump_plugin.sh.in
index 6a00a16..d940ab3 100644
--- a/tools/test/h5dump/h5dump_plugin.sh.in
+++ b/tools/test/h5dump/h5dump_plugin.sh.in
@@ -181,8 +181,8 @@ TOOLTEST() {
# Run test.
TESTING $H5DUMP $@
(
- cd $TESTDIR
- $ENVCMD $RUNSERIAL $H5DUMP_BIN "$@"
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $H5DUMP_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -192,24 +192,24 @@ TOOLTEST() {
STDERR_FILTER $actual_err
cat $actual_err >> $actual
- if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual > /dev/null 2>&1 ; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
+ rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
fi
}
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index 731e233..3bb6604 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -3964,7 +3964,7 @@ static void gent_char(void)
*
* Return: void
*
- * Programmer: pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 28, 2003
*
@@ -4404,7 +4404,7 @@ static void write_attr_in(hid_t loc_id,
*
* Return: void
*
- * Programmer: pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 28, 2003
*
@@ -4854,7 +4854,7 @@ static void write_dset_in(hid_t loc_id,
*
* Return: void
*
- * Programmer: pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 19, 2003
*
@@ -4923,7 +4923,7 @@ static void gent_attr_all(void)
*
* Purpose: utility function to write an attribute
*
- * Programmer: pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 19, 2003
*
@@ -4962,7 +4962,7 @@ int write_attr(hid_t loc_id, int rank, hsize_t *dims, const char *attr_name,
*
* Return:
*
- * Programmer: pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
*
* Date: May 27, 2003
*
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index 53c8927..b69346e 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -465,14 +465,14 @@ TESTING() {
TOOLTEST() {
# check if caseless compare and diff requested
if [ "$1" = ignorecase ]; then
- caseless="-i"
- # replace cmp with diff which runs much longer.
- xCMP="$DIFF -i"
- shift
+ caseless="-i"
+ # replace cmp with diff which runs much longer.
+ xCMP="$DIFF -i"
+ shift
else
- caseless=""
- # stick with faster cmp if ignorecase is not requested.
- xCMP="$CMP"
+ caseless=""
+ # stick with faster cmp if ignorecase is not requested.
+ xCMP="$CMP"
fi
expect="$TESTDIR/$1"
@@ -485,8 +485,8 @@ TOOLTEST() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -495,24 +495,24 @@ TOOLTEST() {
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $xCMP $expect $actual > /dev/null 2>&1 ; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
+ rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
fi
}
@@ -534,41 +534,41 @@ TOOLTEST2() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expect $actual; then
- if [ ! -f $expectdata ]; then
- # Create the expect data file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
- cp $actualdata $expectdata
- echo " Expected data (*.exp) missing"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
- elif $CMP $expectdata $actualdata; then
- echo " PASSED"
- else
+ elif $CMP $expect $actual; then
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ echo " Expected data (*.exp) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expectdata $actualdata; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
+ fi
+ else
echo "*FAILED*"
- echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
- fi
- else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actualdata $actual_err
+ rm -f $actual $actualdata $actual_err
fi
}
@@ -592,56 +592,55 @@ TOOLTEST2A() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expect $actual; then
- if [ ! -f $expectdata ]; then
- # Create the expect data file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
- cp $actualdata $expectdata
- echo " Expected data (*.exp) missing"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
- elif $DIFF $expectdata $actualdata; then
- if [ ! -f $expectmeta ]; then
- # Create the expect meta file if it doesn't yet exist.
- echo " CREATED"
- cp $actualmeta $expectmeta
- echo " Expected metafile (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expectmeta $actualmeta; then
- echo " PASSED"
+ elif $CMP $expect $actual; then
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ echo " Expected data (*.exp) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $DIFF $expectdata $actualdata; then
+ if [ ! -f $expectmeta ]; then
+ # Create the expect meta file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualmeta $expectmeta
+ echo " Expected metafile (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expectmeta $actualmeta; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected metafile (*.ddl) differs from actual metafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectmeta $actualmeta |sed 's/^/ /'
+ fi
else
- echo "*FAILED*"
- echo " Expected metafile (*.ddl) differs from actual metafile (*.txt)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectmeta $actualmeta |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
fi
- else
+ else
echo "*FAILED*"
- echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
- fi
- else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actualdata $actual_err $actualmeta
+ rm -f $actual $actualdata $actual_err $actualmeta
fi
-
}
# same as TOOLTEST2 but only compares the generated data file to the expected data file
@@ -658,28 +657,28 @@ TOOLTEST2B() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
if [ ! -f $expectdata ]; then
- # Create the expect data file if it doesn't yet exist.
- echo " CREATED"
- cp $actualdata $expectdata
- echo " Expected data (*.exp) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ echo " Expected data (*.exp) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expectdata $actualdata; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actualdata $actual_err
+ rm -f $actual $actualdata $actual_err
fi
}
@@ -699,8 +698,8 @@ TOOLTEST3() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -719,23 +718,23 @@ TOOLTEST3() {
$actual_err > $actual_ext
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
@@ -757,8 +756,8 @@ TOOLTEST4() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -777,30 +776,30 @@ TOOLTEST4() {
$actual_err > $actual_ext
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- if $CMP $expect_err $actual_ext; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected result (*.err) differs from actual result (*.oerr)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
- fi
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
+ fi
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
@@ -822,8 +821,8 @@ TOOLTEST5() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -842,33 +841,33 @@ TOOLTEST5() {
$actual_err > $actual_ext
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- if $CMP $expect_err $actual_ext; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected result (*.err) differs from actual result (*.oerr)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
- fi
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
+ fi
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
-
}
+
# ADD_HELP_TEST
TOOLTEST_HELP() {
@@ -880,27 +879,27 @@ TOOLTEST_HELP() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
if [ ! -f $expectdata ]; then
- # Create the expect data file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect-CREATED
- echo " Expected output (*.txt) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect-CREATED
+ echo " Expected output (*.txt) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected output (*.txt) differs from actual output (*.out)"
- nerrors="`expr $nerrors + 1`"
+ echo "*FAILED*"
+ echo " Expected output (*.txt) differs from actual output (*.out)"
+ nerrors="`expr $nerrors + 1`"
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err
fi
}
@@ -920,14 +919,16 @@ GREPTEST()
# Run test.
TESTING $DUMPER -p $@
(
- cd $TESTDIR
- $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@"
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@"
) >$actual 2>$actual_err
+
if [ "$txttype" = "ERRTXT" ]; then
$GREP "$expectdata" $actual_err > /dev/null
else
$GREP "$expectdata" $actual > /dev/null
fi
+
if [ $? -eq 0 ]; then
echo " PASSED"
else
@@ -937,7 +938,7 @@ GREPTEST()
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err
fi
}
@@ -956,14 +957,16 @@ GREPTEST2()
# Run test.
TESTING $DUMPER -p $@
(
- cd $TESTDIR
- $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@"
+ cd $TESTDIR
+ $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@"
) >$actual 2>$actual_err
+
if [ "$txttype" = "ERRTXT" ]; then
$GREP "$expectdata" $actual_err > /dev/null
else
$GREP "$expectdata" $actual > /dev/null
fi
+
if [ $? -eq 0 ]; then
echo " PASSED"
else
@@ -973,21 +976,21 @@ GREPTEST2()
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err
fi
}
# Print a "SKIP" message
SKIP() {
- TESTING $DUMPER $@
+ TESTING $DUMPER $@
echo " -SKIP-"
}
# Print a line-line message left justified in a field of 70 characters
#
PRINT_H5DIFF() {
- SPACES=" "
- echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
}
@@ -997,10 +1000,11 @@ DIFFTEST()
{
PRINT_H5DIFF $@
(
- cd $TESTDIR
- $RUNSERIAL $H5DIFF_BIN "$@" -q
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN "$@" -q
)
RET=$?
+
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
@@ -1014,8 +1018,8 @@ DIFFTEST()
# beginning with the word "Verifying".
#
PRINT_H5IMPORT() {
- SPACES=" "
- echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Call the h5import tool
@@ -1025,15 +1029,16 @@ IMPORTTEST()
# remove the output hdf5 file if it exists
hdf5_file="$TESTDIR/$5"
if [ -f $hdf5_file ]; then
- rm -f $hdf5_file
+ rm -f $hdf5_file
fi
PRINT_H5IMPORT $@
(
- cd $TESTDIR
- $RUNSERIAL $H5IMPORT_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $H5IMPORT_BIN "$@"
)
RET=$?
+
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
@@ -1138,9 +1143,9 @@ TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5
TOOLTEST tcompound_complex2.ddl --enable-error-stack tcompound_complex2.h5
# tests for bitfields and opaque data types
if test $WORDS_BIGENDIAN != "yes"; then
-TOOLTEST tbitnopaque_le.ddl --enable-error-stack tbitnopaque.h5
+ TOOLTEST tbitnopaque_le.ddl --enable-error-stack tbitnopaque.h5
else
-TOOLTEST tbitnopaque_be.ddl --enable-error-stack tbitnopaque.h5
+ TOOLTEST tbitnopaque_be.ddl --enable-error-stack tbitnopaque.h5
fi
#test for the nested compound type
@@ -1318,12 +1323,12 @@ TOOLTEST tallfilters.ddl --enable-error-stack -H -p -d all tfilters.h5
TOOLTEST tuserfilter.ddl --enable-error-stack -H -p -d myfilter tfilters.h5
if test $USE_FILTER_DEFLATE = "yes" ; then
- # data read internal filters
- TOOLTEST treadintfilter.ddl --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5
- if test $USE_FILTER_SZIP = "yes"; then
- # data read
- TOOLTEST treadfilter.ddl --enable-error-stack -d all -d szip tfilters.h5
- fi
+ # data read internal filters
+ TOOLTEST treadintfilter.ddl --enable-error-stack -d deflate -d shuffle -d fletcher32 -d nbit -d scaleoffset tfilters.h5
+ if test $USE_FILTER_SZIP = "yes"; then
+ # data read
+ TOOLTEST treadfilter.ddl --enable-error-stack -d all -d szip tfilters.h5
+ fi
fi
# test for displaying objects with very long names
@@ -1380,9 +1385,9 @@ TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbin
# Clean up binary output files
if test -z "$HDF5_NOCLEANUP"; then
- rm -f out[1-4].bin
- rm -f out1.h5
- rm -f out3.h5
+ rm -f out[1-4].bin
+ rm -f out1.h5
+ rm -f out3.h5
fi
# test for dataset region references
@@ -1394,7 +1399,7 @@ TOOLTEST2 tbinregR.exp --enable-error-stack -d /Dataset1 -s 0 -R -y -o tbinregR.
# Clean up text output files
if test -z "$HDF5_NOCLEANUP"; then
- rm -f tbinregR.txt
+ rm -f tbinregR.txt
fi
# tests for group creation order
diff --git a/tools/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in
index febce2c..ff0659a 100644
--- a/tools/test/h5dump/testh5dumppbits.sh.in
+++ b/tools/test/h5dump/testh5dumppbits.sh.in
@@ -236,26 +236,25 @@ TOOLTEST() {
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
+ rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
fi
-
}
@@ -274,36 +273,36 @@ TOOLTEST2() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expect $actual; then
- if [ ! -f $expectdata ]; then
- # Create the expect data file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
- cp $actualdata $expectdata
- echo " Expected data (*.exp) missing"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
- elif $CMP $expectdata $actualdata; then
- echo " PASSED"
- else
+ elif $CMP $expect $actual; then
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ echo " Expected data (*.exp) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expectdata $actualdata; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
+ fi
+ else
echo "*FAILED*"
- echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
- fi
- else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
@@ -328,8 +327,8 @@ TOOLTEST3() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -348,23 +347,23 @@ TOOLTEST3() {
$actual_err > $actual_ext
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
@@ -385,8 +384,8 @@ TOOLTEST4() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -405,30 +404,30 @@ TOOLTEST4() {
$actual_err > $actual_ext
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- if $CMP $expect_err $actual_ext; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected result (*.err) differs from actual result (*.oerr)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
- fi
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
+ fi
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
@@ -442,8 +441,8 @@ SKIP() {
# Print a line-line message left justified in a field of 70 characters
#
PRINT_H5DIFF() {
- SPACES=" "
- echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
}
@@ -453,10 +452,11 @@ DIFFTEST()
{
PRINT_H5DIFF $@
(
- cd $TESTDIR
- $RUNSERIAL $H5DIFF_BIN "$@" -q
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN "$@" -q
)
RET=$?
+
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
@@ -470,8 +470,8 @@ DIFFTEST()
# beginning with the word "Verifying".
#
PRINT_H5IMPORT() {
- SPACES=" "
- echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Call the h5import tool
@@ -481,22 +481,22 @@ IMPORTTEST()
# remove the output hdf5 file if it exists
hdf5_file="$TESTDIR/$5"
if [ -f $hdf5_file ]; then
- rm -f $hdf5_file
+ rm -f $hdf5_file
fi
PRINT_H5IMPORT $@
(
- cd $TESTDIR
- $RUNSERIAL $H5IMPORT_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $H5IMPORT_BIN "$@"
)
RET=$?
+
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
-
}
diff --git a/tools/test/h5dump/testh5dumpvds.sh.in b/tools/test/h5dump/testh5dumpvds.sh.in
index f89234e..29ff238 100644
--- a/tools/test/h5dump/testh5dumpvds.sh.in
+++ b/tools/test/h5dump/testh5dumpvds.sh.in
@@ -205,8 +205,8 @@ TOOLTEST() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -216,26 +216,25 @@ TOOLTEST() {
STDERR_FILTER $actual_err
cat $actual_err >> $actual
- if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
+ rm -f $actual $actual_err $actual_sav $actual_err_sav $actual_ext
fi
-
}
@@ -254,42 +253,42 @@ TOOLTEST2() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
cat $actual_err >> $actual
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expect $actual; then
- if [ ! -f $expectdata ]; then
- # Create the expect data file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
- cp $actualdata $expectdata
- echo " Expected data (*.exp) missing"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
nerrors="`expr $nerrors + 1`"
- elif $CMP $expectdata $actualdata; then
- echo " PASSED"
- else
+ elif $CMP $expect $actual; then
+ if [ ! -f $expectdata ]; then
+ # Create the expect data file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actualdata $expectdata
+ echo " Expected data (*.exp) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expectdata $actualdata; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
+ fi
+ else
echo "*FAILED*"
- echo " Expected datafile (*.exp) differs from actual datafile (*.txt)"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /'
- fi
- else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actualdata $actual_err
+ rm -f $actual $actualdata $actual_err
fi
}
@@ -309,8 +308,8 @@ TOOLTEST3() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -326,27 +325,27 @@ TOOLTEST3() {
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
- $actual_err > $actual_ext
+ $actual_err > $actual_ext
cat $actual_ext >> $actual
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
}
@@ -367,8 +366,8 @@ TOOLTEST4() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
# save actual and actual_err in case they are needed later.
@@ -384,47 +383,46 @@ TOOLTEST4() {
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
- $actual_err > $actual_ext
+ $actual_err > $actual_ext
#cat $actual_ext >> $actual
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
elif $CMP $expect $actual; then
- if $CMP $expect_err $actual_ext; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected result (*.err) differs from actual result (*.oerr)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
- fi
+ if $CMP $expect_err $actual_ext; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.oerr)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_ext |sed 's/^/ /'
+ fi
else
- echo "*FAILED*"
- echo " Expected result (*.ddl) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.ddl) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
fi
-
}
# Print a "SKIP" message
SKIP() {
- TESTING $DUMPER $@
+ TESTING $DUMPER $@
echo " -SKIP-"
}
# Print a line-line message left justified in a field of 70 characters
#
PRINT_H5DIFF() {
- SPACES=" "
- echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo " Running h5diff $* $SPACES" | cut -c1-70 | tr -d '\012'
}
@@ -434,25 +432,25 @@ DIFFTEST()
{
PRINT_H5DIFF $@
(
- cd $TESTDIR
- $RUNSERIAL $H5DIFF_BIN "$@" -q
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN "$@" -q
)
RET=$?
+
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
-
}
# Print a line-line message left justified in a field of 70 characters
# beginning with the word "Verifying".
#
PRINT_H5IMPORT() {
- SPACES=" "
- echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo " Running h5import $* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Call the h5import tool
@@ -462,22 +460,22 @@ IMPORTTEST()
# remove the output hdf5 file if it exists
hdf5_file="$TESTDIR/$5"
if [ -f $hdf5_file ]; then
- rm -f $hdf5_file
+ rm -f $hdf5_file
fi
PRINT_H5IMPORT $@
(
- cd $TESTDIR
- $RUNSERIAL $H5IMPORT_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $H5IMPORT_BIN "$@"
)
RET=$?
+
if [ $RET != 0 ] ; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
else
echo " PASSED"
fi
-
}
@@ -491,7 +489,7 @@ COPY_TESTFILES_TO_TESTDIR
####### test for dataset vds ######
- # Data read
+# Data read
if test $USE_FILTER_DEFLATE = "yes" ; then
TOOLTEST tvds-1.ddl --enable-error-stack 1_vds.h5
TOOLTEST tvds-2.ddl --enable-error-stack 2_vds.h5
@@ -504,7 +502,7 @@ if test $USE_FILTER_DEFLATE = "yes" ; then
TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5
fi
- # Layout read
+# Layout read
if test $USE_FILTER_DEFLATE = "yes" ; then
TOOLTEST tvds_layout-1.ddl -p --enable-error-stack 1_vds.h5
TOOLTEST tvds_layout-2.ddl -p --enable-error-stack 2_vds.h5
diff --git a/tools/test/h5dump/testh5dumpxml.sh.in b/tools/test/h5dump/testh5dumpxml.sh.in
index f7af300..52a13c2 100644
--- a/tools/test/h5dump/testh5dumpxml.sh.in
+++ b/tools/test/h5dump/testh5dumpxml.sh.in
@@ -262,36 +262,35 @@ TOOLTEST() {
# Run test.
TESTING $DUMPER $@
(
- cd $TESTDIR
- $RUNSERIAL $DUMPER_BIN "$@"
+ cd $TESTDIR
+ $RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
-
if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.xml) missing"
- nerrors="`expr $nerrors + 1`"
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.xml) missing"
+ nerrors="`expr $nerrors + 1`"
elif $CMP $expect $actual; then
- echo " PASSED"
+ echo " PASSED"
else
- echo "*FAILED*"
- echo " Expected result (*.xml) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ echo "*FAILED*"
+ echo " Expected result (*.xml) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
fi
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err
fi
}
# Print a "SKIP" message
SKIP() {
- TESTING $DUMPER $@
- echo " -SKIP-"
+ TESTING $DUMPER $@
+ echo " -SKIP-"
}
diff --git a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
index d85a999..e72892d 100644
--- a/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
+++ b/tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
@@ -1,8 +1 @@
h5format_convert error: unable to downgrade dataset "/DSET_ERR"
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5trav_visit(): traverse failed
- major: Failure in tools library
- minor: error in function
- #001: (file name) line (number) in traverse(): H5Lvisit_by_name failed
- major: Failure in tools library
- minor: error in function
diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in
index d780a3d..2cdd445 100644
--- a/tools/test/h5format_convert/testh5fc.sh.in
+++ b/tools/test/h5format_convert/testh5fc.sh.in
@@ -483,7 +483,7 @@ TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n
#
#
# h5format_convert -v h5fc_err_level.h5 (error encountered in converting the dataset)
-TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v --enable-error-stack
+TOOLTEST_MASK_OUT h5fc_v_err.ddl h5fc_err_level.h5 -v
#
#
#
diff --git a/tools/test/h5jam/tellub.c b/tools/test/h5jam/tellub.c
index 559c677..453444d 100644
--- a/tools/test/h5jam/tellub.c
+++ b/tools/test/h5jam/tellub.c
@@ -70,11 +70,12 @@ parse_command_line (int argc, const char *argv[])
switch ((char) opt) {
case 'h':
usage (h5tools_getprogname());
- HDexit(EXIT_SUCCESS);
+ h5tools_setstatus(EXIT_SUCCESS);
+ break;
case '?':
default:
usage (h5tools_getprogname());
- HDexit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
}
}
@@ -82,10 +83,17 @@ parse_command_line (int argc, const char *argv[])
if (argc <= opt_ind) {
error_msg("missing file name\n");
usage (h5tools_getprogname());
- HDexit(EXIT_FAILURE);
+ h5tools_setstatus(EXIT_FAILURE);
}
} /* end parse_command_line() */
+static void
+leave(int ret)
+{
+ h5tools_close();
+ HDexit(ret);
+}
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -98,9 +106,7 @@ int
main (int argc, const char *argv[])
{
char *ifname;
- void *edata;
- H5E_auto2_t func;
- hid_t ifile;
+ hid_t ifile = H5I_INVALID_HID;
hsize_t usize;
htri_t testval;
herr_t status;
@@ -112,16 +118,16 @@ main (int argc, const char *argv[])
/* Initialize h5tools lib */
h5tools_init();
- /* Disable error reporting */
- H5Eget_auto2(H5E_DEFAULT, &func, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
parse_command_line(argc, argv);
+ /* enable error reporting if command line option */
+ h5tools_error_report();
+
if(argc <= (opt_ind)) {
error_msg("missing file name\n");
usage (h5tools_getprogname());
- return EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
ifname = HDstrdup(argv[opt_ind]);
@@ -130,33 +136,39 @@ main (int argc, const char *argv[])
if(testval <= 0) {
error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
- return EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT);
if(ifile < 0) {
error_msg("Can't open input HDF5 file \"%s\"\n", ifname);
- return EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
plist = H5Fget_create_plist(ifile);
if(plist < 0) {
error_msg("Can't get file creation plist for file \"%s\"\n", ifname);
- return EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
status = H5Pget_userblock(plist, &usize);
if(status < 0) {
error_msg("Can't get user block for file \"%s\"\n", ifname);
- return EXIT_FAILURE;
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
}
HDprintf("%ld\n", (long) usize);
+done:
H5Pclose (plist);
- H5Fclose (ifile);
+ if(ifile >= 0)
+ H5Fclose (ifile);
- return EXIT_SUCCESS;
+ leave(h5tools_getstatus());
} /* end main() */
diff --git a/tools/test/h5ls/h5ls_plugin.sh.in b/tools/test/h5ls/h5ls_plugin.sh.in
index c89269d..28370e6 100644
--- a/tools/test/h5ls/h5ls_plugin.sh.in
+++ b/tools/test/h5ls/h5ls_plugin.sh.in
@@ -139,8 +139,8 @@ CLEAN_TESTFILES_AND_TESTDIR()
# Print a $* message left justified in a field of 70 characters
#
MESSAGE() {
- SPACES=" "
- echo "$* $SPACES" | cut -c1-70 | tr -d '\012'
+ SPACES=" "
+ echo "$* $SPACES" | cut -c1-70 | tr -d '\012'
}
# Print a line-line message left justified in a field of 70 characters
@@ -206,7 +206,7 @@ TOOLTEST() {
echo ""
fi
elif [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
+ # Create the expect file if it doesn't yet exist.
echo " CREATED"
cp $actual $expect
echo " Expected result (*.ls) missing"
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index 4823d07..af73b75 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -72,6 +72,14 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5repack_paged_persist.h5
# h5diff/testfile
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_attr1.h5
+ # tools/testfiles for external links
+ ${HDF5_TOOLS_DIR}/testfiles/tsoftlinks.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinkfar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinksrc.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlinktar.h5
+ ${HDF5_TOOLS_DIR}/testfiles/textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_trg.h5
# tools/testfiles
${HDF5_TOOLS_DIR}/testfiles/tfamily00000.h5
${HDF5_TOOLS_DIR}/testfiles/tfamily00001.h5
@@ -128,6 +136,13 @@
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_version_test.h5repack_layout.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_zero.h5repack_layout.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5
+ # tools/testfiles for external links
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-merge.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-merge.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-merge.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-merge.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-merge.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5
)
set (LIST_DDL_TEST_FILES
@@ -154,6 +169,25 @@
# refs
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/attrregion.tattrreg.h5
${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/dataregion.tdatareg.h5
+ # tools/testfiles for external links
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-base.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-base.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-base.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-base.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-base.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-prune.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-prune.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-prune.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-prune.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-prune.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinkfar-mergeprune.textlinkfar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinksrc-mergeprune.textlinksrc.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlinktar-mergeprune.textlinktar.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/textlink-mergeprune.textlink.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5
+ ${HDF5_TOOLS_TEST_H5REPACK_SOURCE_DIR}/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5
)
foreach (h5_file ${LIST_HDF5_TEST_FILES})
@@ -276,7 +310,7 @@
endif ()
endmacro ()
- macro (ADD_H5_CMP_TEST testname testfilter testtype resultcode resultfile)
+ macro (ADD_H5_FILTER_TEST testname testfilter testtype resultcode resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -410,6 +444,48 @@
endif ()
endmacro ()
+ macro (ADD_H5_DIFF_TEST testname testtype resultcode testfile)
+ if ("${testtype}" STREQUAL "SKIP")
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5REPACK_DIFF-${testname}
+ COMMAND ${CMAKE_COMMAND} -E echo "SKIP ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}"
+ )
+ set_property(TEST H5REPACK_DIFF-${testname} PROPERTY DISABLED)
+ endif ()
+ else ()
+ add_test (
+ NAME H5REPACK_DIFF-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND} -E remove testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_DIFF-${testname}-clear-objects PROPERTIES
+ FIXTURES_REQUIRED clear_h5repack
+ )
+ add_test (
+ NAME H5REPACK_DIFF-${testname}
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:h5repack${tgt_file_ext}> --enable-error-stack ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile}
+ )
+ set_tests_properties (H5REPACK_DIFF-${testname} PROPERTIES
+ DEPENDS H5REPACK_DIFF-${testname}-clear-objects
+ )
+ add_test (
+ NAME H5REPACK_DIFF-${testname}_DFF
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_EMULATOR=${CMAKE_CROSSCOMPILING_EMULATOR}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5diff${tgt_file_ext}>"
+ -D "TEST_ARGS:STRING=-v;--enable-error-stack;${testfile};out-${testname}.${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=out-${testname}.${testfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${testname}.${testfile}.tst"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5REPACK_DIFF-${testname}_DFF PROPERTIES
+ DEPENDS H5REPACK_DIFF-${testname}
+ )
+ endif ()
+ endmacro ()
+
macro (ADD_H5_STAT_TEST testname testtype resultcode statarg resultfile)
if ("${testtype}" STREQUAL "SKIP")
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -1148,7 +1224,7 @@
if (NOT USE_FILTER_DEFLATE)
set (TESTTYPE "SKIP")
endif ()
- ADD_H5_CMP_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
+ ADD_H5_FILTER_TEST (gzip_verbose_filters "O?...ing file[^\n]+\n" ${TESTTYPE} 0 ${arg})
###########################################################
# the following tests assume the input files have filters
@@ -1540,6 +1616,44 @@ ADD_H5_EXTERNAL_TEST (ext_int32le_3d "TEST" int32le_3d -l CONTI)
ADD_H5_EXTERNAL_TEST (ext_uint8be "TEST" uint8be -l CONTI)
##############################################################################
+### E X T E R N A L L I N K T E S T S
+##############################################################################
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (h5copy_extlinks_src-base "TEST" 0 h5copy_extlinks_src.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (tsoftlinks-base "TEST" 0 tsoftlinks.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlink-base "TEST" 0 textlink.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlinkfar-base "TEST" 0 textlinkfar.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlinksrc-base "TEST" 0 textlinksrc.h5 --enable-error-stack)
+ADD_H5_DMP_TEST (textlinktar-base "TEST" 0 textlinktar.h5 --enable-error-stack)
+
+ADD_H5_DIFF_TEST (h5copy_extlinks_src-merge "TEST" 0 h5copy_extlinks_src.h5 --merge)
+ADD_H5_DIFF_TEST (tsoftlinks-merge "TEST" 1 tsoftlinks.h5 --merge)
+ADD_H5_DIFF_TEST (textlink-merge "TEST" 0 textlink.h5 --merge)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DIFF_TEST (textlinkfar-merge "TEST" 1 textlinkfar.h5 --merge)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DIFF_TEST (textlinksrc-merge "TEST" 1 textlinksrc.h5 --merge)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DIFF_TEST (textlinktar-merge "TEST" 1 textlinktar.h5 --merge)
+
+ADD_H5_DMP_TEST (h5copy_extlinks_src-prune "TEST" 0 h5copy_extlinks_src.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (tsoftlinks-prune "TEST" 0 tsoftlinks.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlink-prune "TEST" 0 textlink.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlinkfar-prune "TEST" 0 textlinkfar.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlinksrc-prune "TEST" 0 textlinksrc.h5 --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlinktar-prune "TEST" 0 textlinktar.h5 --prune --enable-error-stack)
+
+ADD_H5_DMP_TEST (h5copy_extlinks_src-mergeprune "TEST" 0 h5copy_extlinks_src.h5 --merge --prune --enable-error-stack)
+ADD_H5_DMP_TEST (tsoftlinks-mergeprune "TEST" 0 tsoftlinks.h5 --merge --prune --enable-error-stack)
+ADD_H5_DMP_TEST (textlink-mergeprune "TEST" 0 textlink.h5 --merge --prune --enable-error-stack)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (textlinkfar-mergeprune "TEST" 0 textlinkfar.h5 --merge --prune --enable-error-stack)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (textlinksrc-mergeprune "TEST" 0 textlinksrc.h5 --merge --prune --enable-error-stack)
+### HDFFV-11128 needs fixed to enable the following test
+#ADD_H5_DMP_TEST (textlinktar-mergeprune "TEST" 0 textlinktar.h5 --merge --prune --enable-error-stack)
+
+##############################################################################
### P L U G I N T E S T S
##############################################################################
if (BUILD_SHARED_LIBS)
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index ad6fef8..18e6d86 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -92,10 +92,18 @@ $SRC_H5REPACK_TESTFILES/h5repack_attr_refs.h5
$SRC_H5REPACK_TESTFILES/h5repack_deflate.h5
$SRC_H5REPACK_TESTFILES/h5repack_early.h5
$SRC_H5REPACK_TESTFILES/h5repack_ext.h5
+$SRC_H5REPACK_TESTFILES/h5repack_f32le.h5
+$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex.h5
$SRC_H5REPACK_TESTFILES/h5repack_fill.h5
$SRC_H5REPACK_TESTFILES/h5repack_filters.h5
$SRC_H5REPACK_TESTFILES/h5repack_fletcher.h5
$SRC_H5REPACK_TESTFILES/h5repack_hlink.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d.h5
+$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex.h5
$SRC_H5REPACK_TESTFILES/h5repack_layout.h5
$SRC_H5REPACK_TESTFILES/h5repack_layouto.h5
$SRC_H5REPACK_TESTFILES/h5repack_layout2.h5
@@ -109,23 +117,26 @@ $SRC_H5REPACK_TESTFILES/h5repack_refs.h5
$SRC_H5REPACK_TESTFILES/h5repack_shuffle.h5
$SRC_H5REPACK_TESTFILES/h5repack_soffset.h5
$SRC_H5REPACK_TESTFILES/h5repack_szip.h5
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5
+$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5
+########fsm#files########
$SRC_H5REPACK_TESTFILES/h5repack_aggr.h5
$SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_nopersist.h5
$SRC_H5REPACK_TESTFILES/h5repack_fsm_aggr_persist.h5
$SRC_H5REPACK_TESTFILES/h5repack_none.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_nopersist.h5
$SRC_H5REPACK_TESTFILES/h5repack_paged_persist.h5
-$SRC_H5REPACK_TESTFILES/h5repack_f32le.h5
-$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex.h5
-$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d.h5
-$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex.h5
-$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d.h5
-$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex.h5
-$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d.h5
-$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex.h5
-$SRC_H5REPACK_TESTFILES/h5repack_uint8be.h5
-$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex.h5
+########h5diff/testfile########
$SRC_H5DIFF_TESTFILES/h5diff_attr1.h5
+########tools/testfiles#for#external#links########
+$SRC_TOOLS_TESTFILES/tsoftlinks.h5
+$SRC_TOOLS_TESTFILES/textlinkfar.h5
+$SRC_TOOLS_TESTFILES/textlinksrc.h5
+$SRC_TOOLS_TESTFILES/textlinktar.h5
+$SRC_TOOLS_TESTFILES/textlink.h5
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src.h5
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_trg.h5
+########tools/testfiles########
$SRC_TOOLS_TESTFILES/tfamily00000.h5
$SRC_TOOLS_TESTFILES/tfamily00001.h5
$SRC_TOOLS_TESTFILES/tfamily00002.h5
@@ -138,6 +149,8 @@ $SRC_TOOLS_TESTFILES/tfamily00008.h5
$SRC_TOOLS_TESTFILES/tfamily00009.h5
$SRC_TOOLS_TESTFILES/tfamily00010.h5
$SRC_TOOLS_TESTFILES/tordergr.h5
+########reference#conversion#files########
+########tools/testfiles/vds########
$SRC_TOOLS_TESTFILES/vds/1_a.h5
$SRC_TOOLS_TESTFILES/vds/1_b.h5
$SRC_TOOLS_TESTFILES/vds/1_c.h5
@@ -168,33 +181,73 @@ $SRC_H5REPACK_TESTFILES/h5repack-help.txt
$SRC_H5REPACK_TESTFILES/h5repack_ext.bin
$SRC_H5REPACK_TESTFILES/ublock.bin
$SRC_H5REPACK_TESTFILES/h5repack.info
-$SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl
-$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl
+########dat#files########
$SRC_H5REPACK_TESTFILES/h5repack_f32le_ex-0.dat
$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-0.dat
$SRC_H5REPACK_TESTFILES/h5repack_int32le_1d_ex-1.dat
$SRC_H5REPACK_TESTFILES/h5repack_int32le_2d_ex-0.dat
$SRC_H5REPACK_TESTFILES/h5repack_int32le_3d_ex-0.dat
-$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl
-$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst
-$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
-$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl
$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-0.dat
$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-1.dat
$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-2.dat
$SRC_H5REPACK_TESTFILES/h5repack_uint8be_ex-3.dat
-$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst
-$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
-$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl
-$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl
-$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl
-$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl
+###############
+$SRC_H5REPACK_TESTFILES/crtorder.tordergr.h5.ddl
+$SRC_H5REPACK_TESTFILES/deflate_limit.h5repack_layout.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl
+########fsm#files########
$SRC_H5REPACK_TESTFILES/SP.h5repack_fsm_aggr_nopersist.h5.ddl
$SRC_H5REPACK_TESTFILES/S.h5repack_fsm_aggr_persist.h5.ddl
$SRC_H5REPACK_TESTFILES/STG.h5repack_none.h5.ddl
$SRC_H5REPACK_TESTFILES/GS.h5repack_paged_nopersist.h5.ddl
$SRC_H5REPACK_TESTFILES/SP.h5repack_paged_persist.h5.ddl
$SRC_H5REPACK_TESTFILES/SPT.h5repack_aggr.h5.ddl
+########vds#files########
+$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_chunk20x10x5-v.ddl
+$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_chunk3x6x9-v.ddl
+$SRC_H5REPACK_TESTFILES/3_1_vds.h5-vds_chunk2x5x8-v.ddl
+$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl
+$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl
+########refs#files########
+$SRC_H5REPACK_TESTFILES/attrregion.tattrreg.h5.ddl
+$SRC_H5REPACK_TESTFILES/dataregion.tdatareg.h5.ddl
+########external#links#files########
+$SRC_H5REPACK_TESTFILES/textlinkfar-base.textlinkfar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinksrc-base.textlinksrc.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinktar-base.textlinktar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlink-base.textlink.h5.ddl
+$SRC_H5REPACK_TESTFILES/tsoftlinks-base.tsoftlinks.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinkfar-merge.textlinkfar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst
+$SRC_H5REPACK_TESTFILES/tsoftlinks-merge.tsoftlinks.h5.tst
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinkfar-prune.textlinkfar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinksrc-prune.textlinksrc.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinktar-prune.textlinktar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlink-prune.textlink.h5.ddl
+$SRC_H5REPACK_TESTFILES/tsoftlinks-prune.tsoftlinks.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinkfar-mergeprune.textlinkfar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinksrc-mergeprune.textlinksrc.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlinktar-mergeprune.textlinktar.h5.ddl
+$SRC_H5REPACK_TESTFILES/textlink-mergeprune.textlink.h5.ddl
+$SRC_H5REPACK_TESTFILES/tsoftlinks-mergeprune.tsoftlinks.h5.ddl
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl
+########tst#files########
+$SRC_H5REPACK_TESTFILES/h5repack_filters.h5-gzip_verbose_filters.tst
+$SRC_H5REPACK_TESTFILES/h5repack_layout.h5-dset2_chunk_20x10-errstk.tst
+$SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst
+########external#links#tst#files########
+$SRC_H5REPACK_TESTFILES/tsoftlinks-merge.tsoftlinks.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinkfar-merge.textlinkfar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinksrc-merge.textlinksrc.h5.tst
+$SRC_H5REPACK_TESTFILES/textlinktar-merge.textlinktar.h5.tst
+$SRC_H5REPACK_TESTFILES/textlink-merge.textlink.h5.tst
+$SRC_H5REPACK_TESTFILES/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
"
#
@@ -271,6 +324,12 @@ SKIP() {
echo " -SKIP-"
}
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
# Call the h5diff tool
#
DIFFTEST()
@@ -620,6 +679,7 @@ VERIFY_INVALIDBOUNDS()
# -----------------------------------------------------------------------------
# Expect h5diff to fail
+# Use only by VERIFY_EXTERNAL_CONSOLIDATION
# -----------------------------------------------------------------------------
DIFFFAIL()
{
@@ -805,6 +865,121 @@ TOOLTESTV()
rm -f $outfile
}
+# This is same as TOOLTESTV() with comparing display output
+# with actual filename swapped
+#
+TOOLTESTSV()
+{
+ expect="$TESTDIR/$1.$2.tst"
+ actual="$TESTDIR/`basename $2 .ddl`.out"
+ actual_err="$TESTDIR/`basename $2 .ddl`.err"
+
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5diff equal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -v $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+
+ # display output compare
+ STDOUT_FILTER $actual
+ cat $actual_err >> $actual
+
+ VERIFY output from $H5REPACK $@
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.tst) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
+
+# This is same as TOOLTESTSV() but expects a diff fail
+#
+TOOLFAILSV()
+{
+ expect="$TESTDIR/$1.$2.tst"
+ actual="$TESTDIR/`basename $2 .ddl`.out"
+ actual_err="$TESTDIR/`basename $2 .ddl`.err"
+
+ infile=$2
+ outfile=out-$1.$2
+ shift
+ shift
+
+ # Run test.
+ TESTING $H5REPACK $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET != 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ VERIFY h5diff unequal $@
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5DIFF_BIN -v $infile $outfile
+ ) >$actual 2>$actual_err
+ RET=$?
+ if [ $RET == 0 ] ; then
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ else
+ echo " PASSED"
+ fi
+ fi
+
+ # display output compare
+ STDOUT_FILTER $actual
+ cat $actual_err >> $actual
+
+ VERIFY output from $H5REPACK $@
+ if cmp -s $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.tst) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && diff -c $expect $actual |sed 's/^/ /'
+ fi
+
+ rm -f $actual $actual_err
+ rm -f $outfile
+}
+
# same as TOOLTESTV but filters error stack output and compares to an error file
# Extract file name, line number, version and thread IDs because they may be different
# ADD_H5ERR_MASK_TEST
@@ -1356,44 +1531,28 @@ TOOLTEST_STAT SPT $arg
# layout options (these files have no filters)
#########################################################
VERIFY_LAYOUT_DSET dset2_chunk_20x10 h5repack_layout.h5 dset2 CHUNKED --layout dset2:CHUNK=20x10
-
VERIFY_LAYOUT_ALL chunk_20x10 h5repack_layout.h5 CHUNKED -l CHUNK=20x10
-
VERIFY_LAYOUT_DSET dset2_conti h5repack_layout.h5 dset2 CONTIGUOUS -l dset2:CONTI
-
VERIFY_LAYOUT_ALL conti h5repack_layout.h5 CONTIGUOUS -l CONTI
-
VERIFY_LAYOUT_DSET dset2_compa h5repack_layout.h5 dset2 COMPACT -l dset2:COMPA
-
VERIFY_LAYOUT_ALL compa h5repack_layout.h5 COMPACT -l COMPA
-
TOOLTESTM dset2_chunk_20x10-errstk h5repack_layout.h5 --layout=dset2:CHUNK=20x10x5 --enable-error-stack
################################################################
# layout conversions (file has no filters)
###############################################################
-
VERIFY_LAYOUT_DSET dset_compa_conti h5repack_layout.h5 dset_compact CONTIGUOUS -l dset_compact:CONTI
-
VERIFY_LAYOUT_DSET dset_compa_chunk h5repack_layout.h5 dset_compact CHUNKED -l dset_compact:CHUNK=2x5
-
VERIFY_LAYOUT_DSET dset_compa_compa h5repack_layout.h5 dset_compact COMPACT -l dset_compact:COMPA
-
VERIFY_LAYOUT_DSET dset_conti_compa h5repack_layout.h5 dset_contiguous COMPACT -l dset_contiguous:COMPA
-
VERIFY_LAYOUT_DSET dset_conti_chunk h5repack_layout.h5 dset_contiguous CHUNKED -l dset_contiguous:CHUNK=3x6
-
VERIFY_LAYOUT_DSET dset_conti_conti h5repack_layout.h5 dset_contiguous CONTIGUOUS -l dset_contiguous:CONTI
-
VERIFY_LAYOUT_DSET chunk_compa h5repack_layout.h5 dset_chunk COMPACT -l dset_chunk:COMPA
-
VERIFY_LAYOUT_DSET chunk_conti h5repack_layout.h5 dset_chunk CONTIGUOUS -l dset_chunk:CONTI
-
VERIFY_LAYOUT_DSET chunk_18x13 h5repack_layout.h5 dset_chunk CHUNKED -l dset_chunk:CHUNK=18x13
# test convert small size dataset ( < 1k) to compact layout without -m
VERIFY_LAYOUT_DSET contig_small_compa h5repack_layout2.h5 contig_small COMPACT -l contig_small:COMPA
-
VERIFY_LAYOUT_DSET contig_small_fixed_compa h5repack_layout2.h5 chunked_small_fixed COMPACT -l chunked_small_fixed:COMPA
#---------------------------------------------------------------------------
@@ -1421,6 +1580,7 @@ VERIFY_LAYOUT_DSET chunk2compa h5repack_layout3.h5 chunk_unlimit1 CHUNK -l chunk
# chunk dim is bigger than dataset dim. ( dset size < 64k )
VERIFY_LAYOUT_DSET error1 h5repack_layout3.h5 chunk_unlimit1 H5S_UNLIMITED -f chunk_unlimit1:NONE
# chunk dim is bigger than dataset dim. ( dset size > 64k )
+
VERIFY_LAYOUT_DSET error2 h5repack_layout3.h5 chunk_unlimit2 H5S_UNLIMITED -f chunk_unlimit2:NONE
# chunk dims are smaller than dataset dims. ( dset size < 64k )
@@ -1435,7 +1595,6 @@ TOOLTEST error4 h5repack_layout3.h5 -f NONE
# (dset size < 64K) and with unlimited max dims on a condition as follow.
# (HDFFV-8214)
#--------------------------------------------------------------------------
-
# chunk dim is bigger than dataset dim. should succeed.
VERIFY_LAYOUT_DSET ckdim_biger h5repack_layout3.h5 chunk_unlimit2 CONTI -l chunk_unlimit2:CONTI
# chunk dim is smaller than dataset dim. should succeed.
@@ -1466,7 +1625,6 @@ else
fi
# several global filters
-
arg="h5repack_layout.h5 --filter GZIP=1 --filter SHUF"
if test $USE_FILTER_DEFLATE != "yes" ; then
SKIP $arg
@@ -1562,9 +1720,15 @@ else
VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI
fi
-#########################################################
-# Testing version bounds
-#########################################################
+################################################################
+# reference new api conversions
+###############################################################
+#TOOLTEST_DUMP attrregion tattrreg.h5
+#TOOLTEST_DUMP dataregion tdatareg.h5
+
+##############################################################################
+### V E R S I O N B O U N D S T E S T S
+##############################################################################
# -j 0 -k 2, superblock will be 0
VERIFY_SUPERBLOCK 0 2 0 h5repack_layout.h5 -j 0 -k 2 h5repack_layout.h5
# -j 1 -k 2, superblock will be 2
@@ -1574,11 +1738,49 @@ VERIFY_SUPERBLOCK 2 2 3 h5repack_layout.h5 -j 2 -k 2 h5repack_layout.h5
# -j 0 -k 1, file cannot be opened
VERIFY_INVALIDBOUNDS 0 1 bounds_latest_latest.h5
-########################################
-# Testing external storage
-########################################
+##############################################################################
+### E X T E R N A L S T O R A G E T E S T S
+##############################################################################
VERIFY_EXTERNAL_CONSOLIDATION -l CONTI
+##############################################################################
+### E X T E R N A L L I N K T E S T S
+##############################################################################
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP h5copy_extlinks_src-base h5copy_extlinks_src.h5 --enable-error-stack
+TOOLTEST_DUMP tsoftlinks-base tsoftlinks.h5 --enable-error-stack
+TOOLTEST_DUMP textlink-base textlink.h5 --enable-error-stack
+TOOLTEST_DUMP textlinkfar-base textlinkfar.h5 --enable-error-stack
+TOOLTEST_DUMP textlinksrc-base textlinksrc.h5 --enable-error-stack
+TOOLTEST_DUMP textlinktar-base textlinktar.h5 --enable-error-stack
+
+TOOLTESTSV h5copy_extlinks_src-merge h5copy_extlinks_src.h5 --merge
+TOOLFAILSV tsoftlinks-merge tsoftlinks.h5 --merge
+TOOLTESTSV textlink-merge textlink.h5 --merge
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLFAILSV textlinkfar-merge textlinkfar.h5 --merge
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLFAILSV textlinksrc-merge textlinksrc.h5 --merge
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLFAILSV textlinktar-merge textlinktar.h5 --merge
+
+TOOLTEST_DUMP h5copy_extlinks_src-prune h5copy_extlinks_src.h5 --prune --enable-error-stack
+TOOLTEST_DUMP tsoftlinks-prune tsoftlinks.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlink-prune textlink.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlinkfar-prune textlinkfar.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlinksrc-prune textlinksrc.h5 --prune --enable-error-stack
+TOOLTEST_DUMP textlinktar-prune textlinktar.h5 --prune --enable-error-stack
+
+TOOLTEST_DUMP h5copy_extlinks_src-mergeprune h5copy_extlinks_src.h5 --merge --prune --enable-error-stack
+TOOLTEST_DUMP tsoftlinks-mergeprune tsoftlinks.h5 --merge --prune --enable-error-stack
+TOOLTEST_DUMP textlink-mergeprune textlink.h5 --merge --prune --enable-error-stack
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP textlinkfar-mergeprune textlinkfar.h5 --merge --prune --enable-error-stack
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP textlinksrc-mergeprune textlinksrc.h5 --merge --prune --enable-error-stack
+### HDFFV-11128 needs fixed to enable the following test
+#TOOLTEST_DUMP textlinktar-mergeprune textlinktar.h5 --merge --prune --enable-error-stack
+
# Clean up temporary files/directories
CLEAN_TESTFILES_AND_TESTDIR
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index ab0dbb7..2666e95 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -3872,7 +3872,7 @@ out:
*
* Purpose: write datasets in LOC_ID
*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+* Programmer: Pedro Vicente
*
* Date: November 12, 2003
*
@@ -4736,7 +4736,7 @@ out:
*
* Purpose: write attributes in LOC_ID (dataset, group, named datatype)
*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+* Programmer: Pedro Vicente
*
* Date: November 12, 2003
*
@@ -5927,7 +5927,7 @@ out:
*
* Purpose: utility function to create and write a dataset in LOC_ID
*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+* Programmer: Pedro Vicente
*
* Date: November 12, 2003
*
@@ -5963,7 +5963,7 @@ out:
*
* Purpose: utility function to create and write a dataset in LOC_ID
*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+* Programmer: Pedro Vicente
*
* Date: November 12, 2003
*
@@ -6011,7 +6011,7 @@ out:
*
* Purpose: utility function to write an attribute in LOC_ID
*
-* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
+* Programmer: Pedro Vicente
*
* Date: November 12, 2003
*
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl
new file mode 100644
index 0000000..ad8a320
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-base.h5copy_extlinks_src.h5.ddl
@@ -0,0 +1,28 @@
+HDF5 "out-h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5" {
+GROUP "/" {
+ GROUP "group_ext" {
+ DATATYPE "extlink_datatype" H5T_STD_I32LE;
+ DATASET "extlink_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "extlink_grp" {
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst b/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
new file mode 100644
index 0000000..52f215d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-merge.h5copy_extlinks_src.h5.tst
@@ -0,0 +1,26 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /group_ext
+ x x /group_ext/extlink_datatype
+ x x /group_ext/extlink_dset
+ x x /group_ext/extlink_grp
+ x x /group_ext/extlink_notyet1
+ x x /group_ext/extlink_notyet2
+
+group : </> and </>
+0 differences found
+group : </group_ext> and </group_ext>
+0 differences found
+Not comparable: </group_ext/extlink_datatype> is of type H5G_UDLINK and </group_ext/extlink_datatype> is of type H5G_TYPE
+Not comparable: </group_ext/extlink_dset> is of type H5G_UDLINK and </group_ext/extlink_dset> is of type H5G_DATASET
+Not comparable: </group_ext/extlink_grp> is of type H5G_UDLINK and </group_ext/extlink_grp> is of type H5G_GROUP
+external link: </group_ext/extlink_notyet1> and </group_ext/extlink_notyet1>
+0 differences found
+external link: </group_ext/extlink_notyet2> and </group_ext/extlink_notyet2>
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl
new file mode 100644
index 0000000..ad8a320
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5.ddl
@@ -0,0 +1,28 @@
+HDF5 "out-h5copy_extlinks_src-mergeprune.h5copy_extlinks_src.h5" {
+GROUP "/" {
+ GROUP "group_ext" {
+ DATATYPE "extlink_datatype" H5T_STD_I32LE;
+ DATASET "extlink_dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2200
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "extlink_grp" {
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl b/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl
new file mode 100644
index 0000000..b7d7bca
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src-prune.h5copy_extlinks_src.h5.ddl
@@ -0,0 +1,6 @@
+HDF5 "out-h5copy_extlinks_src-prune.h5copy_extlinks_src.h5" {
+GROUP "/" {
+ GROUP "group_ext" {
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5 b/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5
new file mode 100644
index 0000000..7b8621e
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_src.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5 b/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5
new file mode 100644
index 0000000..3a0242d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/h5copy_extlinks_trg.h5
Binary files differ
diff --git a/tools/test/h5repack/testfiles/h5repack-help.txt b/tools/test/h5repack/testfiles/h5repack-help.txt
index 00fae24..e12838d 100644
--- a/tools/test/h5repack/testfiles/h5repack-help.txt
+++ b/tools/test/h5repack/testfiles/h5repack-help.txt
@@ -29,6 +29,9 @@ usage: h5repack [OPTIONS] file1 file2
--high=BOUND The high bound for library release versions to use
when creating objects in the file
(default is H5F_LIBVER_LATEST)
+ --merge Follow external soft link recursively and merge data
+ --prune Do not follow external soft links and remove link
+ --merge --prune Follow external link, merge data and remove dangling link
-c L1, --compact=L1 Maximum number of links in header messages
-d L2, --indexed=L2 Minimum number of links in the indexed format
-s S[:F], --ssize=S[:F] Shared object header message minimum size
diff --git a/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl
new file mode 100644
index 0000000..b87a17d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-base.textlink.h5.ddl
@@ -0,0 +1,12 @@
+HDF5 "out-textlink-base.textlink.h5" {
+GROUP "/" {
+ EXTERNAL_LINK "extlink1" {
+ TARGETFILE "filename"
+ TARGETPATH "objname"
+ }
+ EXTERNAL_LINK "extlink2" {
+ TARGETFILE "anotherfile"
+ TARGETPATH "anotherobj"
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst b/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst
new file mode 100644
index 0000000..a7ff71d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-merge.textlink.h5.tst
@@ -0,0 +1,13 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /extlink1
+ x x /extlink2
+
+group : </> and </>
+0 differences found
+external link: </extlink1> and </extlink1>
+0 differences found
+external link: </extlink2> and </extlink2>
+0 differences found
diff --git a/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl
new file mode 100644
index 0000000..7206ae9
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-mergeprune.textlink.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlink-mergeprune.textlink.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl b/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl
new file mode 100644
index 0000000..83db344
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlink-prune.textlink.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlink-prune.textlink.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl
new file mode 100644
index 0000000..a5eb497
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-base.textlinkfar.h5.ddl
@@ -0,0 +1,116 @@
+HDF5 "out-textlinkfar-base.textlinkfar.h5" {
+GROUP "/" {
+ EXTERNAL_LINK "src_file" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ HARDLINK "/"
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst b/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst
new file mode 100644
index 0000000..6673d39
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-merge.textlinkfar.h5.tst
@@ -0,0 +1,20 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /src_file
+ x /src_file/ext2soft_link1
+ x /src_file/ext2softdangle_link1
+ x /src_file/ext_link1
+ x /src_file/ext_link2
+ x /src_file/ext_link3
+ x /src_file/ext_link4
+ x /src_file/ext_link5
+
+group : </> and </>
+0 differences found
+Not comparable: </src_file> is of type H5G_UDLINK and </src_file> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl
new file mode 100644
index 0000000..7ba3308
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-mergeprune.textlinkfar.h5.ddl
@@ -0,0 +1,152 @@
+HDF5 "out-textlinkfar-mergeprune.textlinkfar.h5" {
+GROUP "/" {
+ GROUP "src_file" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ HARDLINK "/dset1"
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ HARDLINK "/group"
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ HARDLINK "/dset"
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" HARDLINK "/type"
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ HARDLINK "/empty_group"
+ }
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl b/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl
new file mode 100644
index 0000000..30f8f1b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinkfar-prune.textlinkfar.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlinkfar-prune.textlinkfar.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl
new file mode 100644
index 0000000..9a9a9aa
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-base.textlinksrc.h5.ddl
@@ -0,0 +1,150 @@
+HDF5 "out-textlinksrc-base.textlinksrc.h5" {
+GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ HARDLINK "/dset1"
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ HARDLINK "/group"
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ HARDLINK "/dset"
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" HARDLINK "/type"
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ HARDLINK "/empty_group"
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst b/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst
new file mode 100644
index 0000000..d5a5902
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-merge.textlinksrc.h5.tst
@@ -0,0 +1,32 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /ext2soft_link1
+ x x /ext2softdangle_link1
+ x x /ext_link1
+ x /ext_link1/dset
+ x /ext_link1/elink_t1
+ x /ext_link1/elink_t2
+ x /ext_link1/subgroup
+ x /ext_link1/subgroup/link_to_group
+ x x /ext_link2
+ x x /ext_link3
+ x x /ext_link4
+ x x /ext_link5
+
+group : </> and </>
+0 differences found
+Not comparable: </ext2soft_link1> is of type H5G_UDLINK and </ext2soft_link1> is of type H5G_DATASET
+external link: </ext2softdangle_link1> and </ext2softdangle_link1>
+0 differences found
+Not comparable: </ext_link1> is of type H5G_UDLINK and </ext_link1> is of type H5G_GROUP
+Not comparable: </ext_link2> is of type H5G_UDLINK and </ext_link2> is of type H5G_DATASET
+Not comparable: </ext_link3> is of type H5G_UDLINK and </ext_link3> is of type H5G_TYPE
+external link: </ext_link4> and </ext_link4>
+0 differences found
+Not comparable: </ext_link5> is of type H5G_UDLINK and </ext_link5> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl
new file mode 100644
index 0000000..5b3c740
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-mergeprune.textlinksrc.h5.ddl
@@ -0,0 +1,187 @@
+HDF5 "out-textlinksrc-mergeprune.textlinksrc.h5" {
+GROUP "/" {
+ DATASET "ext2soft_link1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "ext_link1" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ HARDLINK "/"
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/ext_link1"
+ }
+ }
+ }
+ DATASET "ext_link2" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2104
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "ext_link3" H5T_STD_I32LE;
+ GROUP "ext_link5" {
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl b/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl
new file mode 100644
index 0000000..65d35ef
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinksrc-prune.textlinksrc.h5.ddl
@@ -0,0 +1,4 @@
+HDF5 "out-textlinksrc-prune.textlinksrc.h5" {
+GROUP "/" {
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl
new file mode 100644
index 0000000..3f02ff2
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-base.textlinktar.h5.ddl
@@ -0,0 +1,168 @@
+HDF5 "out-textlinktar-base.textlinktar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "empty_group" {
+ }
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2072
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ HARDLINK "/"
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ DATATYPE "type" H5T_STD_I32LE;
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst b/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst
new file mode 100644
index 0000000..ccf4f7b
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-merge.textlinktar.h5.tst
@@ -0,0 +1,44 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset
+ x x /empty_group
+ x x /group
+ x x /group/dset
+ x x /group/elink_t1
+ x /group/elink_t1/ext2soft_link1
+ x /group/elink_t1/ext2softdangle_link1
+ x /group/elink_t1/ext_link1
+ x /group/elink_t1/ext_link2
+ x /group/elink_t1/ext_link3
+ x /group/elink_t1/ext_link4
+ x /group/elink_t1/ext_link5
+ x x /group/elink_t2
+ x x /group/subgroup
+ x x /group/subgroup/link_to_group
+ x x /type
+
+group : </> and </>
+0 differences found
+dataset: </dset> and </dset>
+0 differences found
+group : </empty_group> and </empty_group>
+0 differences found
+group : </group> and </group>
+0 differences found
+dataset: </group/dset> and </group/dset>
+0 differences found
+Not comparable: </group/elink_t1> is of type H5G_UDLINK and </group/elink_t1> is of type H5G_GROUP
+external link: </group/elink_t2> and </group/elink_t2>
+0 differences found
+group : </group/subgroup> and </group/subgroup>
+0 differences found
+group : </group/subgroup/link_to_group> and </group/subgroup/link_to_group>
+0 differences found
+datatype: </type> and </type>
+0 differences found
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl
new file mode 100644
index 0000000..c52e34d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-mergeprune.textlinktar.h5.ddl
@@ -0,0 +1,200 @@
+HDF5 "out-textlinktar-mergeprune.textlinktar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "empty_group" {
+ }
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2072
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "elink_t1" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2848
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3136
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ EXTERNAL_LINK "elink_t1" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/"
+ GROUP "/" {
+ EXTERNAL_LINK "ext2soft_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dset1"
+ DATASET "/soft_dset1" {
+ HARDLINK "/dset1"
+ }
+ }
+ EXTERNAL_LINK "ext2softdangle_link1" {
+ TARGETFILE "tsoftlinks.h5"
+ TARGETPATH "/soft_dangle"
+ }
+ EXTERNAL_LINK "ext_link1" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group"
+ GROUP "group" {
+ HARDLINK "/group"
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 3160
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" H5T_STD_I32LE;
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "elink_t2" {
+ TARGETFILE "textlinksrc.h5"
+ TARGETPATH "/ext_link4"
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ }
+ EXTERNAL_LINK "ext_link2" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "dset"
+ DATASET "dset" {
+ HARDLINK "/dset"
+ }
+ }
+ EXTERNAL_LINK "ext_link3" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "type"
+ DATATYPE "type" HARDLINK "/type"
+ }
+ EXTERNAL_LINK "ext_link4" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "group/elink_t2"
+ }
+ EXTERNAL_LINK "ext_link5" {
+ TARGETFILE "textlinktar.h5"
+ TARGETPATH "empty_group"
+ GROUP "empty_group" {
+ HARDLINK "/empty_group"
+ }
+ }
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ DATATYPE "type" H5T_STD_I32LE;
+}
+}
diff --git a/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl b/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl
new file mode 100644
index 0000000..6787784
--- /dev/null
+++ b/tools/test/h5repack/testfiles/textlinktar-prune.textlinktar.h5.ddl
@@ -0,0 +1,52 @@
+HDF5 "out-textlinktar-prune.textlinktar.h5" {
+GROUP "/" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "empty_group" {
+ }
+ GROUP "group" {
+ DATASET "dset" {
+ DATATYPE H5T_STD_I32LE
+ DATASPACE SIMPLE { ( 6 ) / ( 6 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 24
+ OFFSET 2072
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ GROUP "subgroup" {
+ GROUP "link_to_group" {
+ HARDLINK "/group"
+ }
+ }
+ }
+ DATATYPE "type" H5T_STD_I32LE;
+}
+}
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl
new file mode 100644
index 0000000..b0cd32d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-base.tsoftlinks.h5.ddl
@@ -0,0 +1,77 @@
+HDF5 "out-tsoftlinks-base.tsoftlinks.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "dtype" H5T_STD_I32BE;
+ GROUP "group1" {
+ SOFTLINK "soft_dangle" {
+ LINKTARGET "not_yet"
+ }
+ SOFTLINK "soft_dset1" {
+ LINKTARGET "/dset1"
+ }
+ SOFTLINK "soft_dset2" {
+ LINKTARGET "/dset2"
+ }
+ SOFTLINK "soft_dtype" {
+ LINKTARGET "/dtype"
+ }
+ SOFTLINK "soft_empty_grp" {
+ LINKTARGET "/group_empty"
+ }
+ }
+ GROUP "group_empty" {
+ }
+ SOFTLINK "soft_dangle" {
+ LINKTARGET "not_yet"
+ }
+ SOFTLINK "soft_dset1" {
+ LINKTARGET "/dset1"
+ }
+ SOFTLINK "soft_dtype" {
+ LINKTARGET "/dtype"
+ }
+ SOFTLINK "soft_empty_grp" {
+ LINKTARGET "/group_empty"
+ }
+ SOFTLINK "soft_group1" {
+ LINKTARGET "/group1"
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst b/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst
new file mode 100644
index 0000000..27c33d7
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-merge.tsoftlinks.h5.tst
@@ -0,0 +1,53 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dset1
+ x x /dset2
+ x x /dtype
+ x x /group1
+ x x /group1/soft_dangle
+ x x /group1/soft_dset1
+ x x /group1/soft_dset2
+ x x /group1/soft_dtype
+ x x /group1/soft_empty_grp
+ x x /group_empty
+ x x /soft_dangle
+ x x /soft_dset1
+ x x /soft_dtype
+ x x /soft_empty_grp
+ x x /soft_group1
+ x /soft_group1/soft_dangle
+ x /soft_group1/soft_dset1
+ x /soft_group1/soft_dset2
+ x /soft_group1/soft_dtype
+ x /soft_group1/soft_empty_grp
+
+group : </> and </>
+0 differences found
+dataset: </dset1> and </dset1>
+0 differences found
+dataset: </dset2> and </dset2>
+0 differences found
+datatype: </dtype> and </dtype>
+0 differences found
+group : </group1> and </group1>
+0 differences found
+link : </group1/soft_dangle> and </group1/soft_dangle>
+0 differences found
+Not comparable: </group1/soft_dset1> is of type H5G_LINK and </group1/soft_dset1> is of type H5G_DATASET
+Not comparable: </group1/soft_dset2> is of type H5G_LINK and </group1/soft_dset2> is of type H5G_DATASET
+Not comparable: </group1/soft_dtype> is of type H5G_LINK and </group1/soft_dtype> is of type H5G_TYPE
+Not comparable: </group1/soft_empty_grp> is of type H5G_LINK and </group1/soft_empty_grp> is of type H5G_GROUP
+group : </group_empty> and </group_empty>
+0 differences found
+link : </soft_dangle> and </soft_dangle>
+0 differences found
+Not comparable: </soft_dset1> is of type H5G_LINK and </soft_dset1> is of type H5G_DATASET
+Not comparable: </soft_dtype> is of type H5G_LINK and </soft_dtype> is of type H5G_TYPE
+Not comparable: </soft_empty_grp> is of type H5G_LINK and </soft_empty_grp> is of type H5G_GROUP
+Not comparable: </soft_group1> is of type H5G_LINK and </soft_group1> is of type H5G_GROUP
+--------------------------------
+Some objects are not comparable
+--------------------------------
+Use -c for a list of objects without details of differences.
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl
new file mode 100644
index 0000000..fa4e12d
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-mergeprune.tsoftlinks.h5.ddl
@@ -0,0 +1,127 @@
+HDF5 "out-tsoftlinks-mergeprune.tsoftlinks.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "dtype" H5T_STD_I32BE;
+ GROUP "group1" {
+ DATASET "soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2112
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "soft_dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2144
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "soft_dtype" H5T_STD_I32BE;
+ GROUP "soft_empty_grp" {
+ }
+ }
+ GROUP "group_empty" {
+ }
+ DATASET "soft_dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2176
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "soft_dtype" H5T_STD_I32BE;
+ GROUP "soft_empty_grp" {
+ }
+ GROUP "soft_group1" {
+ SOFTLINK "soft_dangle" {
+ LINKTARGET "not_yet"
+ }
+ SOFTLINK "soft_dset1" {
+ LINKTARGET "/dset1"
+ }
+ SOFTLINK "soft_dset2" {
+ LINKTARGET "/dset2"
+ }
+ SOFTLINK "soft_dtype" {
+ LINKTARGET "/dtype"
+ }
+ SOFTLINK "soft_empty_grp" {
+ LINKTARGET "/group_empty"
+ }
+ }
+}
+}
diff --git a/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl b/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl
new file mode 100644
index 0000000..de58ef2
--- /dev/null
+++ b/tools/test/h5repack/testfiles/tsoftlinks-prune.tsoftlinks.h5.ddl
@@ -0,0 +1,47 @@
+HDF5 "out-tsoftlinks-prune.tsoftlinks.h5" {
+GROUP "/" {
+ DATASET "dset1" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2048
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATASET "dset2" {
+ DATATYPE H5T_STD_I32BE
+ DATASPACE SIMPLE { ( 4, 2 ) / ( 4, 2 ) }
+ STORAGE_LAYOUT {
+ CONTIGUOUS
+ SIZE 32
+ OFFSET 2080
+ }
+ FILTERS {
+ NONE
+ }
+ FILLVALUE {
+ FILL_TIME H5D_FILL_TIME_IFSET
+ VALUE H5D_FILL_VALUE_DEFAULT
+ }
+ ALLOCATION_TIME {
+ H5D_ALLOC_TIME_LATE
+ }
+ }
+ DATATYPE "dtype" H5T_STD_I32BE;
+ GROUP "group1" {
+ }
+ GROUP "group_empty" {
+ }
+}
+}
diff --git a/tools/test/misc/h5perf_gentest.c b/tools/test/misc/h5perf_gentest.c
index f50e5fb..511a9e2 100644
--- a/tools/test/misc/h5perf_gentest.c
+++ b/tools/test/misc/h5perf_gentest.c
@@ -14,7 +14,7 @@
creates a large number of attributes, groups, and datasets by specifying
-a, -g, -d options respectively. Using "-h" option to see details.
- Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013
+ Programmer: Peter Cao, Jan. 2013
****************************************************************************/
#include "hdf5.h"
@@ -128,7 +128,7 @@ int main (int argc, char *argv[])
Return: Non-negative on success/Negative on failure
- Programmer: Peter Cao <xcao@hdfgroup.org>, Jan. 2013
+ Programmer: Peter Cao, Jan. 2013
****************************************************************************/
herr_t create_perf_test_file(const char *fname, int ngrps, int ndsets,
int nattrs, hsize_t nrows, hsize_t dim0, hsize_t chunk, int vlen,
diff --git a/tools/test/misc/h5repart_gentest.c b/tools/test/misc/h5repart_gentest.c
index bd94104..520069f 100644
--- a/tools/test/misc/h5repart_gentest.c
+++ b/tools/test/misc/h5repart_gentest.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu<slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* June 1, 2005
*
* Purpose: Generate a family file of 1024 bytes for each member
diff --git a/tools/test/misc/testfiles/h5mkgrp_version.txt.in b/tools/test/misc/testfiles/h5mkgrp_version.txt.in
index 75c13a5..37dbabd 100644
--- a/tools/test/misc/testfiles/h5mkgrp_version.txt.in
+++ b/tools/test/misc/testfiles/h5mkgrp_version.txt.in
@@ -1 +1 @@
-h5mkgrp: Version @HDF5_PACKAGE_VERSION_STRING@
+h5mkgrp: Version @HDF5_RELEASE_VERSION_STRING@
diff --git a/tools/test/misc/testh5mkgrp.sh.in b/tools/test/misc/testh5mkgrp.sh.in
index 3ad1f71..7dc8155 100644
--- a/tools/test/misc/testh5mkgrp.sh.in
+++ b/tools/test/misc/testh5mkgrp.sh.in
@@ -13,7 +13,7 @@
#
# Tests for the h5mkgrp tool
#
-# Quincey Koziol (koziol@hdfgroup.org)
+# Quincey Koziol
# Tuesday, February 13, 2007
#
@@ -150,10 +150,11 @@ TOOLTEST()
{
TESTING $H5MKGRP $@
(
- cd $TESTDIR
- $RUNSERIAL $H5MKGRP_BIN $@
+ cd $TESTDIR
+ $RUNSERIAL $H5MKGRP_BIN $@
) > output.out
RET=$?
+
if [ $RET != 0 ]; then
echo "*FAILED*"
echo "failed result is:"
@@ -164,7 +165,7 @@ TOOLTEST()
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f output.out
+ rm -f output.out
fi
fi
}
@@ -181,8 +182,8 @@ H5LSTEST()
# any unexpected output from that stream too.
VERIFY_H5LS $@
(
- cd $TESTDIR
- $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@
+ cd $TESTDIR
+ $RUNSERIAL $H5LS_BIN $H5LS_ARGS $@
) 2>&1 |sed 's/Modified:.*/Modified: XXXX-XX-XX XX:XX:XX XXX/' >$actual
# save actual in case it is needed later.
@@ -190,25 +191,25 @@ H5LSTEST()
STDOUT_FILTER $actual
STDERR_FILTER $actual
- if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.ls) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expect $actual; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected result (*.ls) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
- fi
-
- # Clean up output file
- if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_sav
- fi
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ls) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.ls) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_sav
+ fi
}
# Single run of tool
@@ -258,30 +259,30 @@ CMPTEST()
# any unexpected output from that stream too.
TESTING $H5MKGRP $@
(
- cd $TESTDIR
- $RUNSERIAL $H5MKGRP_BIN $@
+ cd $TESTDIR
+ $RUNSERIAL $H5MKGRP_BIN $@
) >$actual 2>$actual_err
cat $actual_err >> $actual
- if [ ! -f $expect ]; then
- # Create the expect file if it doesn't yet exist.
- echo " CREATED"
- cp $actual $expect
- echo " Expected result (*.txt) missing"
- nerrors="`expr $nerrors + 1`"
- elif $CMP $expect $actual; then
- echo " PASSED"
- else
- echo "*FAILED*"
- echo " Expected result (*.txt) differs from actual result (*.out)"
- nerrors="`expr $nerrors + 1`"
- test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
- fi
-
- # Clean up output file
- if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
- fi
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.txt) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expect $actual; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.txt) differs from actual result (*.out)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
+ fi
}
##############################################################################
diff --git a/tools/test/perform/CMakeLists.txt b/tools/test/perform/CMakeLists.txt
index 6780c06..3c45e85 100644
--- a/tools/test/perform/CMakeLists.txt
+++ b/tools/test/perform/CMakeLists.txt
@@ -78,7 +78,7 @@ set (chunk_cache_SOURCES
${HDF5_TOOLS_TEST_PERFORM_SOURCE_DIR}/chunk_cache.c
)
add_executable (chunk_cache ${chunk_cache_SOURCES})
-target_include_directories (chunk_cache PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+target_include_directories (chunk_cache PRIVATE "${HDF5_TEST_SRC_DIR};${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
if (NOT BUILD_SHARED_LIBS)
TARGET_C_PROPERTIES (chunk_cache STATIC)
target_link_libraries (chunk_cache PRIVATE ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
index 3603c9b..bd16e1d 100644
--- a/tools/test/perform/chunk.c
+++ b/tools/test/perform/chunk.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <robb@arborea.spizella.com>
+ * Programmer: Robb Matzke
* Thursday, May 14, 1998
*
* Purpose: Checks the effect of various I/O request sizes and raw data
diff --git a/tools/test/perform/chunk_cache.c b/tools/test/perform/chunk_cache.c
index e594e34..d7c56af 100644
--- a/tools/test/perform/chunk_cache.c
+++ b/tools/test/perform/chunk_cache.c
@@ -19,6 +19,7 @@
*/
#include "hdf5.h"
#include "H5private.h"
+#include "h5test.h"
#define FILENAME "chunk_cache_perf.h5"
@@ -79,18 +80,6 @@ counter (unsigned H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
}
/*---------------------------------------------------------------------------*/
-static double retrieve_time(void)
-{
-#ifdef H5_HAVE_GETTIMEOFDAY
- struct timeval t;
- HDgettimeofday(&t, NULL);
- return ((double)t.tv_sec + (double)t.tv_usec / 1000000);
-#else
- return 0.0;
-#endif
-}
-
-/*---------------------------------------------------------------------------*/
static void
cleanup (void)
{
@@ -110,8 +99,7 @@ static int create_dset1(hid_t file)
hid_t dcpl = H5I_INVALID_HID;
hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2};
hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2};
- int data[DSET1_DIM1][DSET1_DIM2]; /* data for writing */
- int i, j;
+ int **data; /* data for writing */
/* Create the data space. */
if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0)
@@ -135,9 +123,10 @@ static int create_dset1(hid_t file)
H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- for (i = 0; i < DSET1_DIM1; i++)
- for (j = 0; j < DSET1_DIM2; j++)
- data[i][j] = i+j;
+ /* Create & fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
+ H5TEST_FILL_2D_ARRAY(data, int, DSET1_DIM1, DSET1_DIM2);
+
/* Write data to dataset */
if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
@@ -171,17 +160,16 @@ static int create_dset2(hid_t file)
hid_t dcpl = H5I_INVALID_HID;
hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2};
hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2};
- int data[DSET2_DIM1][DSET2_DIM2]; /* data for writing */
- int i, j;
+ int **data; /* data for writing */
/* Create the data space. */
- if((dataspace = H5Screate_simple (RANK, dims, NULL)) < 0)
+ if((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
goto error;
/* Modify dataset creation properties, i.e. enable chunking */
- if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0)
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto error;
- if(H5Pset_chunk (dcpl, RANK, chunk_dims) < 0)
+ if(H5Pset_chunk(dcpl, RANK, chunk_dims) < 0)
goto error;
/* Set the dummy filter simply for counting the number of bytes being read into the memory */
@@ -191,35 +179,35 @@ static int create_dset2(hid_t file)
goto error;
/* Create a new dataset within the file using chunk creation properties. */
- if((dataset = H5Dcreate2 (file, DSET2_NAME, H5T_NATIVE_INT, dataspace,
+ if((dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, dataspace,
H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- for (i = 0; i < DSET2_DIM1; i++)
- for (j = 0; j < DSET2_DIM2; j++)
- data[i][j] = i+j;
+ /* Create & fill array */
+ H5TEST_ALLOCATE_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
+ H5TEST_FILL_2D_ARRAY(data, int, DSET2_DIM1, DSET2_DIM2);
/* Write data to dataset */
- if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
goto error;
/* Close resources */
- H5Dclose (dataset);
- H5Pclose (dcpl);
- H5Sclose (dataspace);
+ H5Dclose(dataset);
+ H5Pclose(dcpl);
+ H5Sclose(dataspace);
return 0;
error:
H5E_BEGIN_TRY {
- H5Dclose (dataset);
- H5Pclose (dcpl);
- H5Sclose (dataspace);
+ H5Dclose(dataset);
+ H5Pclose(dcpl);
+ H5Sclose(dataspace);
} H5E_END_TRY;
return 1;
}
+
/*---------------------------------------------------------------------------
* Check the performance of the chunk cache when partial chunks exist
* along the dataset dimensions.
@@ -253,7 +241,7 @@ static int check_partial_chunks_perf(hid_t file)
nbytes_global = 0;
- start_t = retrieve_time();
+ start_t = H5_get_time();
/* Read the data row by row */
for(i = 0; i < DSET1_DIM1; i++) {
@@ -267,13 +255,12 @@ static int check_partial_chunks_perf(hid_t file)
goto error;
}
- end_t = retrieve_time();
+ end_t = H5_get_time();
-#ifdef H5_HAVE_GETTIMEOFDAY
- printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
-#else
- printf("1. Partial chunks: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global);
-#endif
+ if((end_t - start_t) > (double)0.0f)
+ printf("1. Partial chunks: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
+ else
+ printf("1. Partial chunks: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global);
H5Dclose (dataset);
H5Sclose (filespace);
@@ -328,7 +315,7 @@ static int check_hash_value_perf(hid_t file)
nbytes_global = 0;
- start_t = retrieve_time();
+ start_t = H5_get_time();
/* Read the data column by column */
for(i = 0; i < DSET2_DIM2; i++) {
@@ -342,13 +329,12 @@ static int check_hash_value_perf(hid_t file)
goto error;
}
- end_t = retrieve_time();
+ end_t = H5_get_time();
-#ifdef H5_HAVE_GETTIMEOFDAY
- printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
-#else
- printf("2. Hash value: no total read time because gettimeofday() is not available; number of bytes being read from file is %lu\n", nbytes_global);
-#endif
+ if((end_t - start_t) > (double)0.0f)
+ printf("2. Hash value: total read time is %lf; number of bytes being read from file is %lu\n", (end_t -start_t), nbytes_global);
+ else
+ printf("2. Hash value: no total read time because timer is not available; number of bytes being read from file is %lu\n", nbytes_global);
H5Dclose (dataset);
H5Sclose (filespace);
diff --git a/tools/test/perform/iopipe.c b/tools/test/perform/iopipe.c
index bf4728d..bb74a1b 100644
--- a/tools/test/perform/iopipe.c
+++ b/tools/test/perform/iopipe.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, March 12, 1998
*/
@@ -21,10 +21,6 @@
#include "H5private.h"
-#ifdef H5_HAVE_SYS_TIMEB
-#include <sys/timeb.h>
-#endif
-
#define RAW_FILE_NAME "iopipe.raw"
#define HDF5_FILE_NAME "iopipe.h5"
@@ -56,25 +52,18 @@
* Programmer: Robb Matzke
* Thursday, March 12, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-#ifdef H5_HAVE_GETRUSAGE
static void
-print_stats (const char *prefix,
+print_stats(const char *prefix,
+#ifdef H5_HAVE_GETRUSAGE
struct rusage *r_start, struct rusage *r_stop,
- struct timeval *t_start, struct timeval *t_stop,
- size_t nbytes)
-#else /* H5_HAVE_GETRUSAGE */
-static void
-print_stats (const char *prefix,
- struct timeval *r_start, struct timeval *r_stop,
- struct timeval *t_start, struct timeval *t_stop,
- size_t nbytes)
#endif /* H5_HAVE_GETRUSAGE */
+ double t_start, double t_stop,
+ size_t nbytes)
{
- double e_time, bw;
+ double e_time;
+ char bw[16];
#ifdef H5_HAVE_GETRUSAGE
double u_time, s_time;
@@ -88,27 +77,16 @@ print_stats (const char *prefix,
((double)(r_start->ru_stime.tv_sec)+
(double)(r_start->ru_stime.tv_usec)/(double)1000000.0F);
#endif
-#ifndef H5_HAVE_SYS_TIMEB
- e_time = ((double)(t_stop->tv_sec)+
- (double)(t_stop->tv_usec)/(double)1000000.0F) -
- ((double)(t_start->tv_sec)+
- (double)(t_start->tv_usec)/(double)1000000.0F);
-#else
- e_time = ((double)(t_stop->tv_sec)+
- (double)(t_stop->tv_usec)/(double)1000.0F) -
- ((double)(t_start->tv_sec)+
- (double)(t_start->tv_usec)/(double)1000.0F);
-#endif
- bw = (double)nbytes / e_time;
+ e_time = t_stop - t_start;
+ H5_bandwidth(bw, (double)nbytes, e_time);
#ifdef H5_HAVE_GETRUSAGE
- printf (HEADING "%1.2fuser %1.2fsystem %1.2felapsed %1.2fMB/s\n",
- prefix, u_time, s_time, e_time, bw/(1024*1024));
+ HDprintf(HEADING "%1.2fuser %1.2fsystem %1.2felapsed %s\n",
+ prefix, u_time, s_time, e_time, bw);
#else
- printf (HEADING "%1.2felapsed %1.2fMB/s\n",
- prefix, e_time, bw/(1024*1024));
+ HDprintf(HEADING "%1.2felapsed %s\n",
+ prefix, e_time, bw);
#endif
-
}
@@ -122,12 +100,10 @@ print_stats (const char *prefix,
* Programmer: Robb Matzke
* Thursday, March 12, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
-synchronize (void)
+synchronize(void)
{
#ifdef H5_HAVE_SYSTEM
#if defined(H5_HAVE_WIN32_API) && ! defined(__CYGWIN__)
@@ -157,24 +133,20 @@ synchronize (void)
* Programmer: Robb Matzke
* Thursday, March 12, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
-main (void)
+main(void)
{
- static hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
- static unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
+ hsize_t size[2] = {REQUEST_SIZE_X, REQUEST_SIZE_Y};
+ unsigned nread = NREAD_REQUESTS, nwrite = NWRITE_REQUESTS;
unsigned char *the_data = NULL;
hid_t file, dset, file_space = H5I_INVALID_HID;
#ifdef H5_HAVE_GETRUSAGE
struct rusage r_start, r_stop;
-#else
- struct timeval r_start, r_stop;
#endif
- struct timeval t_start, t_stop;
+ double t_start, t_stop;
int fd;
unsigned u;
herr_t H5_ATTR_NDEBUG_UNUSED status;
@@ -184,322 +156,221 @@ main (void)
hsize_t count[2];
-#ifdef H5_HAVE_SYS_TIMEB
- struct _timeb *tbstart = malloc(sizeof(struct _timeb));
- struct _timeb *tbstop = malloc(sizeof(struct _timeb));
-#endif
/*
* The extra cast in the following statement is a bug workaround for the
* Win32 version 5.0 compiler.
* 1998-11-06 ptl
*/
- printf ("I/O request size is %1.1fMB\n",
- (double)(hssize_t)(size[0]*size[1])/(double)1024.0F*(double)1024);
+ HDprintf("I/O request size is %1.1fMB\n",
+ (double)(hssize_t)(size[0] * size[1]) / (double)1024.0F * (double)1024);
/* Open the files */
- file = H5Fcreate (HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- HDassert (file>=0);
- fd = HDopen (RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
- HDassert (fd>=0);
+ file = H5Fcreate(HDF5_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ HDassert(file >= 0);
+ fd = HDopen(RAW_FILE_NAME, O_RDWR|O_CREAT|O_TRUNC, 0666);
+ HDassert(fd >= 0);
/* Create the dataset */
- file_space = H5Screate_simple (2, size, size);
+ file_space = H5Screate_simple(2, size, size);
HDassert(file_space >= 0);
dset = H5Dcreate2(file, "dset", H5T_NATIVE_UCHAR, file_space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
HDassert(dset >= 0);
- the_data = (unsigned char *)malloc((size_t)(size[0] * size[1]));
+ the_data = (unsigned char *)HDmalloc((size_t)(size[0] * size[1]));
/* initial fill for lazy malloc */
HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
+
/* Fill raw */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "fill raw");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "fill raw");
for(u = 0; u < nwrite; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- HDmemset(the_data, 0xAA, (size_t)(size[0]*size[1]));
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ HDmemset(the_data, 0xAA, (size_t)(size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("fill raw",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("fill raw",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Fill hdf5 */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "fill hdf5");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "fill hdf5");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- HDassert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("fill hdf5",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("fill hdf5",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Write the raw dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "out raw");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "out raw");
for(u = 0; u < nwrite; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- offset = HDlseek (fd, (off_t)0, SEEK_SET);
- HDassert (0==offset);
- n = HDwrite (fd, the_data, (size_t)(size[0]*size[1]));
- HDassert (n>=0 && (size_t)n==size[0]*size[1]);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek(fd, (off_t)0, SEEK_SET);
+ HDassert(0 == offset);
+ n = HDwrite(fd, the_data, (size_t)(size[0] * size[1]));
+ HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("out raw",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("out raw",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Write the hdf5 dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "out hdf5");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "out hdf5");
for(u = 0; u < nwrite; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dwrite (dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, the_data);
- HDassert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dwrite(dset, H5T_NATIVE_UCHAR, H5S_ALL, H5S_ALL,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("out hdf5",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("out hdf5",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read the raw dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "in raw");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "in raw");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- offset = HDlseek (fd, (off_t)0, SEEK_SET);
- HDassert (0==offset);
- n = HDread (fd, the_data, (size_t)(size[0]*size[1]));
- HDassert (n>=0 && (size_t)n==size[0]*size[1]);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ offset = HDlseek(fd, (off_t)0, SEEK_SET);
+ HDassert(0 == offset);
+ n = HDread(fd, the_data, (size_t)(size[0] * size[1]));
+ HDassert(n >= 0 && (size_t)n == (size[0] * size[1]));
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("in raw",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("in raw",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read the hdf5 dataset */
- synchronize ();
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "in hdf5");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "in hdf5");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- HDassert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc ('\n', stderr);
- print_stats ("in hdf5",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*size[0]*size[1]));
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
+ print_stats("in hdf5",
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Read hyperslab */
- HDassert (size[0]>20 && size[1]>20);
+ HDassert(size[0] > 20 && size[1] > 20);
start[0] = start[1] = 10;
- count[0] = count[1] = size[0]-20;
- status = H5Sselect_hyperslab (file_space, H5S_SELECT_SET, start, NULL, count, NULL);
- HDassert (status>=0);
- synchronize ();
+ count[0] = count[1] = size[0] - 20;
+ status = H5Sselect_hyperslab(file_space, H5S_SELECT_SET, start, NULL, count, NULL);
+ HDassert(status >= 0);
+ synchronize();
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_start);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_start, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstart);
-#endif
-#endif
- HDfprintf (stderr, HEADING, "in hdf5 partial");
+ t_start = H5_get_time();
+ HDfprintf(stderr, HEADING, "in hdf5 partial");
for(u = 0; u < nread; u++) {
- putc (PROGRESS, stderr);
- HDfflush(stderr);
- status = H5Dread (dset, H5T_NATIVE_UCHAR, file_space, file_space,
- H5P_DEFAULT, the_data);
- HDassert (status>=0);
+ HDputc(PROGRESS, stderr);
+ HDfflush(stderr);
+ status = H5Dread(dset, H5T_NATIVE_UCHAR, file_space, file_space,
+ H5P_DEFAULT, the_data);
+ HDassert(status >= 0);
}
#ifdef H5_HAVE_GETRUSAGE
HDgetrusage(RUSAGE_SELF, &r_stop);
#endif
-#ifdef H5_HAVE_GETTIMEOFDAY
- HDgettimeofday(&t_stop, NULL);
-#else
-#ifdef H5_HAVE_SYS_TIMEB
- _ftime(tbstop);
- t_start.tv_sec = tbstart->time;
- t_start.tv_usec = tbstart->millitm;
- t_stop.tv_sec = tbstop->time;
- t_stop.tv_usec = tbstop->millitm;
-#endif
-#endif
- putc('\n', stderr);
+ t_stop = H5_get_time();
+ HDputc('\n', stderr);
print_stats("in hdf5 partial",
- &r_start, &r_stop, &t_start, &t_stop,
- (size_t)(nread*count[0]*count[1]));
-
-
+#ifdef H5_HAVE_GETRUSAGE
+ &r_start, &r_stop,
+#endif /* H5_HAVE_GETRUSAGE */
+ t_start, t_stop, (size_t)(nread * size[0] * size[1]));
/* Close everything */
HDclose(fd);
+
H5Dclose(dset);
H5Sclose(file_space);
H5Fclose(file);
- free(the_data);
+
+ HDfree(the_data);
return 0;
}
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
index 58558a5..bb3aff5 100644
--- a/tools/test/perform/overhead.c
+++ b/tools/test/perform/overhead.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, September 28, 1998
*
* Purpose: Creates a chunked dataset and measures the storage overhead.
diff --git a/tools/test/perform/perf_meta.c b/tools/test/perform/perf_meta.c
index b56f074..77248cc 100644
--- a/tools/test/perform/perf_meta.c
+++ b/tools/test/perform/perf_meta.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Friday, Oct 3, 2004
*
* Purpose: Tests performance of metadata
diff --git a/tools/testfiles/trefer_attrR.ddl b/tools/testfiles/trefer_attrR.ddl
index e64c8e6..118e7bf 100644
--- a/tools/testfiles/trefer_attrR.ddl
+++ b/tools/testfiles/trefer_attrR.ddl
@@ -12,16 +12,16 @@ GROUP "/" {
}
}
ATTRIBUTE "trefer_attr.h5/Group1/Dataset2/Attr1" {
- NULL
+ NULL
}
- ATTRIBUTE "trefer_attr.h5/Group1/Attr2" {
+ ATTRIBUTE "trefer_attr.h5/Group1/Attr2" {
DATATYPE H5T_STD_U32LE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
DATA {
(0): 1, 4, 7, 10
}
}
- ATTRIBUTE "trefer_attr.h5/Group1/Datatype1/Attr3" {
+ ATTRIBUTE "trefer_attr.h5/Group1/Datatype1/Attr3" {
DATATYPE H5T_STD_U32LE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
DATA {
diff --git a/tools/testfiles/trefer_extR.ddl b/tools/testfiles/trefer_extR.ddl
index 3d4647d..a96e5fd 100644
--- a/tools/testfiles/trefer_extR.ddl
+++ b/tools/testfiles/trefer_extR.ddl
@@ -12,16 +12,16 @@ GROUP "/" {
}
}
ATTRIBUTE "trefer_ext1.h5/Group1/Dataset2/Attr1" {
- NULL
+ NULL
}
- ATTRIBUTE "trefer_ext1.h5/Group1/Attr2" {
+ ATTRIBUTE "trefer_ext1.h5/Group1/Attr2" {
DATATYPE H5T_STD_U32LE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
DATA {
(0): 1, 4, 7, 10
}
}
- ATTRIBUTE "trefer_ext1.h5/Group1/Datatype1/Attr3" {
+ ATTRIBUTE "trefer_ext1.h5/Group1/Datatype1/Attr3" {
DATATYPE H5T_STD_U32LE
DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
DATA {