diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2017-10-17 21:13:12 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2017-10-17 21:13:12 (GMT) |
commit | 78a5870680770a8827c0e1e805688be30d1a33a7 (patch) | |
tree | 2f5afb93f2d3580cb78a422718c401dfc305c297 /tools | |
parent | d9bfebc1db91f7313df179661ccadbcca277fc91 (diff) | |
download | hdf5-78a5870680770a8827c0e1e805688be30d1a33a7.zip hdf5-78a5870680770a8827c0e1e805688be30d1a33a7.tar.gz hdf5-78a5870680770a8827c0e1e805688be30d1a33a7.tar.bz2 |
Fix error handling issues
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lib/h5diff.c | 157 | ||||
-rw-r--r-- | tools/lib/h5diff_array.c | 111 | ||||
-rw-r--r-- | tools/lib/h5diff_attr.c | 103 | ||||
-rw-r--r-- | tools/lib/h5diff_dset.c | 85 | ||||
-rw-r--r-- | tools/test/h5diff/CMakeTests.cmake | 18 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_417.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_418.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_419.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_420.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_421.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_422.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_467.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_469.txt | 2 | ||||
-rw-r--r-- | tools/test/h5diff/testfiles/h5diff_udfail.txt | 12 |
14 files changed, 261 insertions, 241 deletions
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index ab5d125..94cca58 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -393,8 +393,7 @@ trav_grp_objs(const char *path, const H5O_info_t *oinfo, * Track and extra checkings while visiting all symbolic-links. *------------------------------------------------------------------------*/ static herr_t -trav_grp_symlinks(const char *path, const H5L_info_t *linfo, - void *udata) +trav_grp_symlinks(const char *path, const H5L_info_t *linfo, void *udata) { herr_t ret_value = 0; trav_info_t *tinfo = (trav_info_t *)udata; @@ -414,7 +413,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, switch(linfo->type) { case H5L_TYPE_SOFT: if((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) { - HGOTO_DONE(ret_value); + HGOTO_DONE(FAIL); } else if (ret_value == 0) { /* no dangling link option given and detect dangling link */ @@ -437,13 +436,13 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents"); } break; case H5L_TYPE_EXTERNAL: if ((ret_value = H5tools_get_symlink_info(tinfo->fid, path, &lnk_info, opts->follow_links)) < 0) { - HGOTO_DONE(ret_value); + HGOTO_DONE(FAIL); } else if (ret_value == 0) { /* no dangling link option given and detect dangling link */ @@ -469,7 +468,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, trav_grp_objs,trav_grp_symlinks, tinfo) < 0) { parallel_print("Error: Could not get file contents\n"); opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents\n"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Could not get file contents\n"); } break; @@ -479,7 +478,7 @@ trav_grp_symlinks(const char *path, const H5L_info_t *linfo, default: parallel_print("Error: Invalid link type\n"); opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Invalid link type"); + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Error: Invalid link type"); break; } /* end of switch */ @@ -552,7 +551,7 @@ h5diff(const char *fname1, HGOTO_DONE(0); opts->cmn_objs = 1; /* eliminate warning */ - opts->err_stat = 1; /* initialize error status to FAIL */ + opts->err_stat = 0; /* initialize error status */ /*------------------------------------------------------------------------- * open the files first; if they are not valid, no point in continuing @@ -561,14 +560,14 @@ h5diff(const char *fname1, /* open file 1 */ if((file1_id = h5tools_fopen(fname1, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname1); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1); + HGOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname1); } /* end if */ /* open file 2 */ if((file2_id = h5tools_fopen(fname2, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) { parallel_print("h5diff: <%s>: unable to open file\n", fname2); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2); + HGOTO_ERROR(1, H5E_tools_min_id_g, "<%s>: unable to open file\n", fname2); } /* end if */ /*------------------------------------------------------------------------- @@ -586,11 +585,11 @@ h5diff(const char *fname1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj1fullname, "/%s", objname1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ if ((obj1fullname = (char*)HDmalloc(HDstrlen(objname1) + 2)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); HDstrcpy(obj1fullname, "/"); HDstrcat(obj1fullname, objname1); @@ -604,11 +603,11 @@ h5diff(const char *fname1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj2fullname, "/%s", objname2) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); #else /* H5_HAVE_ASPRINTF */ /* (malloc 2 more for "/" and end-of-line) */ if ((obj2fullname = (char*)HDmalloc(HDstrlen(objname2) + 2)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); HDstrcpy(obj2fullname, "/"); HDstrcat(obj2fullname, objname2); #endif /* H5_HAVE_ASPRINTF */ @@ -627,14 +626,12 @@ h5diff(const char *fname1, /* check if link itself exist */ if(H5Lexists(file1_id, obj1fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found"); } /* get info from link */ if(H5Lget_info(file1_id, obj1fullname, &src_linfo1, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj1fullname); - H5TOOLS_INFO(H5E_tools_min_id_g, "Unable to get link info\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lget_info failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed"); } info1_lp = info1_obj; @@ -650,8 +647,7 @@ h5diff(const char *fname1, if(H5Oget_info_by_name(file1_id, obj1fullname, &oinfo1, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } obj1type = (h5trav_type_t)oinfo1.type; trav_info_add(info1_obj, obj1fullname, obj1type); @@ -680,13 +676,12 @@ h5diff(const char *fname1, /* check if link itself exist */ if(H5Lexists(file2_id, obj2fullname, H5P_DEFAULT) <= 0) { parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Object could not be found"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Object could not be found"); } /* get info from link */ if(H5Lget_info(file2_id, obj2fullname, &src_linfo2, H5P_DEFAULT) < 0) { parallel_print("Unable to get link info from <%s>\n", obj2fullname); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Lget_info failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Lget_info failed"); } info2_lp = info2_obj; @@ -702,8 +697,7 @@ h5diff(const char *fname1, if(H5Oget_info_by_name(file2_id, obj2fullname, &oinfo2, H5P_DEFAULT) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Error: Could not get file contents"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Error: Could not get file contents"); } obj2type = (h5trav_type_t)oinfo2.type; trav_info_add(info2_obj, obj2fullname, obj2type); @@ -731,7 +725,7 @@ h5diff(const char *fname1, obj2type = H5TRAV_TYPE_GROUP; } - + h5diffdebug2("get any symbolic links info - errstat:%d\n", opts->err_stat); /* get any symbolic links info */ l_ret1 = H5tools_get_symlink_info(file1_id, obj1fullname, &trg_linfo1, opts->follow_links); l_ret2 = H5tools_get_symlink_info(file2_id, obj2fullname, &trg_linfo2, opts->follow_links); @@ -755,8 +749,7 @@ h5diff(const char *fname1, /* treat dangling link as error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj1fullname); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "treat dangling link as error"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error"); } else { if(opts->m_verbose) @@ -770,8 +763,7 @@ h5diff(const char *fname1, } else if(l_ret1 < 0) { /* fail */ parallel_print ("Object <%s> could not be found in <%s>\n", obj1fullname, fname1); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Object could not be found"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found"); } else if(l_ret1 != 2) { /* symbolic link */ obj1type = (h5trav_type_t)trg_linfo1.trg_type; @@ -798,8 +790,7 @@ h5diff(const char *fname1, /* treat dangling link as error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", obj2fullname); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "treat dangling link as error"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "treat dangling link as error"); } else { if(opts->m_verbose) @@ -813,8 +804,7 @@ h5diff(const char *fname1, } else if(l_ret2 < 0) { /* fail */ parallel_print ("Object <%s> could not be found in <%s>\n", obj2fullname, fname2); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Object could not be found"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Object could not be found"); } else if(l_ret2 != 2) { /* symbolic link */ obj2type = (h5trav_type_t)trg_linfo2.trg_type; @@ -841,7 +831,7 @@ h5diff(const char *fname1, h5difftrace("h5diff NOT (opts->m_verbose || opts->m_report)\n"); /* if no danglink links */ if (l_ret1 > 0 && l_ret2 > 0) - if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname)!=0) + if (h5tools_is_obj_same(file1_id, obj1fullname, file2_id, obj2fullname) != 0) HGOTO_DONE(0); } @@ -858,8 +848,7 @@ h5diff(const char *fname1, if(h5trav_visit(file1_id, obj1fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info1_grp) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Could not get file contents"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } info1_lp = info1_grp; @@ -873,11 +862,11 @@ h5diff(const char *fname1, if(h5trav_visit(file2_id, obj2fullname, TRUE, TRUE, trav_grp_objs, trav_grp_symlinks, info2_grp) < 0) { parallel_print("Error: Could not get file contents\n"); - opts->err_stat = 1; - HGOTO_ERROR(opts->err_stat, H5E_tools_min_id_g, "Could not get file contents"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Could not get file contents"); } /* end if */ info2_lp = info2_grp; } + h5diffdebug2("groups traversed - errstat:%d\n", opts->err_stat); #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -926,9 +915,9 @@ h5diff(const char *fname1, file2_id, obj2fullname, info2_lp, match_list, opts); - opts->err_stat = 0; /* success status */ - done: + opts->err_stat = opts->err_stat | ret_value; + #ifdef H5_HAVE_PARALLEL if(g_Parallel) /* All done at this point, let tasks know that they won't be needed */ @@ -994,7 +983,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, { hsize_t nfound = 0; unsigned i; - int ret_value = 0; + int ret_value = opts->err_stat; const char *grp1_path = ""; const char *grp2_path = ""; char *obj1_fullpath = NULL; @@ -1056,16 +1045,17 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #endif for(i = 0; i < table->nobjs; i++) { + h5diffdebug3("diff for common objects[%d] - errstat:%d\n", i, opts->err_stat); if(table->objs[i].flags[0] && table->objs[i].flags[1]) { /* make full path for obj1 */ #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj1_fullpath, "%s%s", grp1_path, table->objs[i].name) < 0) { - HERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ if((obj1_fullpath = (char*)HDmalloc(HDstrlen(grp1_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) { - HERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); } else { HDstrcpy(obj1_fullpath, grp1_path); @@ -1078,11 +1068,11 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #ifdef H5_HAVE_ASPRINTF /* Use the asprintf() routine, since it does what we're trying to do below */ if(HDasprintf(&obj2_fullpath, "%s%s", grp2_path, table->objs[i].name) < 0) { - HERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); } #else /* H5_HAVE_ASPRINTF */ if((obj2_fullpath = (char*)HDmalloc(HDstrlen(grp2_path) + HDstrlen(table->objs[i].name) + 1)) == NULL) { - HERROR(FAIL, H5E_tools_min_id_g, "name buffer allocation failed"); + HERROR(1, H5E_tools_min_id_g, "name buffer allocation failed"); } else { HDstrcpy(obj2_fullpath, grp2_path); @@ -1267,7 +1257,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, HDfree(obj2_fullpath); } /* end if */ } /* end for */ - h5difftrace("done with for loop\n"); + h5diffdebug2("done with for loop - errstat:%d\n", opts->err_stat); #ifdef H5_HAVE_PARALLEL if(g_Parallel) { @@ -1351,7 +1341,9 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, #endif /* H5_HAVE_PARALLEL */ out: - /* free table */ + opts->err_stat = opts->err_stat | ret_value; + +/* free table */ if (table) trav_table_free(table); h5diffdebug2("diff_match finish:%d\n", nfound); @@ -1381,7 +1373,8 @@ diff(hid_t file1_id, diff_opt_t * opts, diff_args_t *argdata) { - int ret_value = 0; + int ret_value = opts->err_stat; + int status = -1; hid_t dset1_id = -1; hid_t dset2_id = -1; hid_t type1_id = -1; @@ -1400,9 +1393,6 @@ diff(hid_t file1_id, h5difftrace("diff start\n"); - /*init error status */ - opts->err_stat = 1; - /*init link info struct */ HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t)); HDmemset(&linkinfo2, 0, sizeof(h5tool_link_info_t)); @@ -1422,26 +1412,26 @@ diff(hid_t file1_id, */ /* target object1 - get type and name */ - if ((ret_value = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); + if ((status = H5tools_get_symlink_info(file1_id, path1, &linkinfo1, opts->follow_links)) < 0) + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); /* dangling link */ - if (ret_value == 0) { + if (status == 0) { if (opts->no_dangle_links) { /* dangling link is error */ if(opts->m_verbose) parallel_print("Warning: <%s> is a dangling link.\n", path1); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "dangling link is error"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "dangling link is error"); } else is_dangle_link1 = TRUE; } /* target object2 - get type and name */ - if ((ret_value = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, opts->follow_links)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); + if ((status = H5tools_get_symlink_info(file2_id, path2, &linkinfo2, opts->follow_links)) < 0) + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5tools_get_symlink_info failed"); /* dangling link */ - if (ret_value == 0) { + if (status == 0) { if (opts->no_dangle_links) { /* dangling link is error */ if(opts->m_verbose) @@ -1454,7 +1444,6 @@ diff(hid_t file1_id, /* found dangling link */ if (is_dangle_link1 || is_dangle_link2) { - opts->err_stat = 0; HGOTO_DONE(0); } @@ -1479,7 +1468,6 @@ diff(hid_t file1_id, /* TODO: will need to update non-comparable is different * opts->contents = 0; */ - opts->err_stat = 0; HGOTO_DONE(0); } else /* now both object types are same */ @@ -1532,7 +1520,6 @@ diff(hid_t file1_id, } /* if(opts->m_verbose || opts->m_report) */ /* exact same, so comparison is done */ - opts->err_stat = 0; HGOTO_DONE(0); } } @@ -1544,9 +1531,9 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_DATASET: if((dset1_id = H5Dopen2(file1_id, path1, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed"); if((dset2_id = H5Dopen2(file2_id, path2, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 failed"); /* verbose (-v) and report (-r) mode */ if(opts->m_verbose || opts->m_report) { do_print_objname("dataset", path1, path2, opts); @@ -1579,9 +1566,9 @@ diff(hid_t file1_id, if(H5Dclose(dset1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed"); if(H5Dclose(dset2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dclose failed"); break; /*---------------------------------------------------------------------- @@ -1590,15 +1577,15 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_NAMED_DATATYPE: if((type1_id = H5Topen2(file1_id, path1, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed"); if((type2_id = H5Topen2(file2_id, path2, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Topen2 failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Topen2 failed"); - if((ret_value = H5Tequal(type1_id, type2_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tequal failed"); + if((status = H5Tequal(type1_id, type2_id)) < 0) + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tequal failed"); /* if H5Tequal is > 0 then the datatypes refer to the same datatype */ - nfound = (ret_value > 0) ? 0 : 1; + nfound = (status > 0) ? 0 : 1; if(print_objname(opts, nfound)) do_print_objname("datatype", path1, path2, opts); @@ -1617,9 +1604,9 @@ diff(hid_t file1_id, nfound += diff_attr(type1_id, type2_id, path1, path2, opts); if(H5Tclose(type1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed"); if(H5Tclose(type2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose failed"); break; /*---------------------------------------------------------------------- @@ -1635,9 +1622,9 @@ diff(hid_t file1_id, print_found(nfound); if((grp1_id = H5Gopen2(file1_id, path1, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); if((grp2_id = H5Gopen2(file2_id, path2, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); /*----------------------------------------------------------------- * compare attributes @@ -1649,9 +1636,9 @@ diff(hid_t file1_id, nfound += diff_attr(grp1_id, grp2_id, path1, path2, opts); if(H5Gclose(grp1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); if(H5Gclose(grp2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Gclose failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Gclose failed"); break; @@ -1661,10 +1648,10 @@ diff(hid_t file1_id, */ case H5TRAV_TYPE_LINK: { - ret_value = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path); + status = HDstrcmp(linkinfo1.trg_path, linkinfo2.trg_path); /* if the target link name is not same then the links are "different" */ - nfound = (ret_value != 0) ? 1 : 0; + nfound = (status != 0) ? 1 : 0; if(print_objname(opts, nfound)) do_print_objname("link", path1, path2, opts); @@ -1686,16 +1673,16 @@ diff(hid_t file1_id, if(linkinfo1.linfo.type == H5L_TYPE_EXTERNAL && linkinfo2.linfo.type == H5L_TYPE_EXTERNAL) { /* If the buffers are the same size, compare them */ if(linkinfo1.linfo.u.val_size == linkinfo2.linfo.u.val_size) { - ret_value = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size); + status = HDmemcmp(linkinfo1.trg_path, linkinfo2.trg_path, linkinfo1.linfo.u.val_size); } else - ret_value = 1; + status = 1; /* if "linkinfo1.trg_path" != "linkinfo2.trg_path" then the links * are "different" extlinkinfo#.path is combination string of * file_name and obj_name */ - nfound = (ret_value != 0) ? 1 : 0; + nfound = (status != 0) ? 1 : 0; if(print_objname(opts, nfound)) do_print_objname("external link", path1, path2, opts); @@ -1734,9 +1721,9 @@ diff(hid_t file1_id, break; } - opts->err_stat = 0; - done: + opts->err_stat = opts->err_stat | ret_value; + /*----------------------------------- * handle dangling link(s) */ @@ -1782,7 +1769,7 @@ done: /* enable error reporting */ } H5E_END_TRY; - h5diffdebug2("diff finish:%d\n", nfound); + h5diffdebug3("diff finish:%d - errstat:%d\n", nfound, opts->err_stat); return nfound; } diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 5d77de3..54b9109 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -285,7 +285,7 @@ hsize_t diff_array( mcomp_t members; H5T_class_t type_class; - h5difftrace("diff_array start\n"); + h5diffdebug2("diff_array start - errstat:%d\n", opts->err_stat); /* get the size. */ size = H5Tget_size(m_type); type_class = H5Tget_class(m_type); @@ -378,7 +378,7 @@ hsize_t diff_array( } /* i */ close_member_types(&members); } /* switch */ - h5diffdebug2("diff_array finish:%d\n", nfound); + h5diffdebug3("diff_array finish:%d - errstat:%d\n", nfound, opts->err_stat); return nfound; } @@ -447,13 +447,11 @@ static hsize_t diff_datum( hbool_t iszero1; hbool_t iszero2; hsize_t nfound = 0; /* differences found */ - hsize_t ret_value = 0; + hsize_t ret_value = opts->err_stat; double per; hbool_t both_zero; h5difftrace("diff_datum start\n"); - /* default error sttaus */ - opts->err_stat = 1; type_size = H5Tget_size(m_type); type_class = H5Tget_class(m_type); @@ -467,14 +465,14 @@ static hsize_t diff_datum( type_class != H5T_STRING && type_class != H5T_VLEN && HDmemcmp(mem1, mem2, type_size) == 0) - HGOTO_DONE(0); + HGOTO_DONE(opts->err_stat); switch (H5Tget_class(m_type)) { case H5T_NO_CLASS: case H5T_TIME: case H5T_NCLASSES: default: - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Invalid type class"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Invalid type class"); break; /*------------------------------------------------------------------------- @@ -725,7 +723,8 @@ static hsize_t diff_datum( iszero1 = all_zero(_mem1, H5Tget_size(m_type)); iszero2 = all_zero(_mem2, H5Tget_size(m_type)); if (iszero1 != iszero2) { - HGOTO_DONE (1); + nfound++; + HGOTO_DONE (opts->err_stat); } else if (!iszero1 && !iszero2) { /*------------------------------------------------------------------------- @@ -740,14 +739,22 @@ static hsize_t diff_datum( hid_t region1_id = -1; hid_t region2_id = -1; - if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); - if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); - if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region object 1 failed"); - if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_region object 2 failed"); + if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem1)) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); + } + if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_DATASET_REGION, _mem2)) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + } + if ((region1_id = H5Rget_region(container1_id, H5R_DATASET_REGION, _mem1)) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 1 failed"); + } + if ((region2_id = H5Rget_region(container2_id, H5R_DATASET_REGION, _mem2)) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_region object 2 failed"); + } nfound = diff_region(obj1_id, obj2_id, region1_id, region2_id, opts); @@ -766,23 +773,31 @@ static hsize_t diff_datum( H5O_type_t obj1_type; H5O_type_t obj2_type; - if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type2 object 1 failed"); - if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rget_obj_type2 object 2 failed"); + if (H5Rget_obj_type2(container1_id, H5R_OBJECT, _mem1, &obj1_type) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 1 failed"); + } + if (H5Rget_obj_type2(container2_id, H5R_OBJECT, _mem2, &obj2_type) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rget_obj_type2 object 2 failed"); + } /* check object type */ if (ret_value >= 0) if (obj1_type != obj2_type) { parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); opts->not_cmp = 1; - HGOTO_DONE (0); + HGOTO_DONE (opts->err_stat); } - if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); - if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) - HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 1 failed"); + } + if ((obj2_id = H5Rdereference2(container2_id, H5P_DEFAULT, H5R_OBJECT, _mem2)) < 0) { + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "H5Rdereference2 object 2 failed"); + } /* compare */ if (obj1_type == H5O_TYPE_DATASET) @@ -839,7 +854,7 @@ static hsize_t diff_datum( char temp2_char; if(type_size != sizeof(char)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not char size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not char size"); HDmemcpy(&temp1_char, mem1, sizeof(char)); HDmemcpy(&temp2_char, mem2, sizeof(char)); /* -d and !-p */ @@ -914,7 +929,7 @@ static hsize_t diff_datum( unsigned char temp2_uchar; if(type_size != sizeof(unsigned char)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not unsigned char size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned char size"); HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char)); HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char)); @@ -990,7 +1005,7 @@ static hsize_t diff_datum( short temp2_short; if(type_size != sizeof(short)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not short size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not short size"); HDmemcpy(&temp1_short, mem1, sizeof(short)); HDmemcpy(&temp2_short, mem2, sizeof(short)); @@ -1066,7 +1081,7 @@ static hsize_t diff_datum( unsigned short temp2_ushort; if(type_size != sizeof(unsigned short)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not unsigned short size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned short size"); HDmemcpy(&temp1_ushort, mem1, sizeof(unsigned short)); HDmemcpy(&temp2_ushort, mem2, sizeof(unsigned short)); @@ -1142,7 +1157,7 @@ static hsize_t diff_datum( int temp2_int; if(type_size != sizeof(int)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not int size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not int size"); HDmemcpy(&temp1_int, mem1, sizeof(int)); HDmemcpy(&temp2_int, mem2, sizeof(int)); @@ -1218,7 +1233,7 @@ static hsize_t diff_datum( unsigned int temp2_uint; if(type_size != sizeof(unsigned int)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not unsigned int size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned int size"); HDmemcpy(&temp1_uint, mem1, sizeof(unsigned int)); HDmemcpy(&temp2_uint, mem2, sizeof(unsigned int)); @@ -1294,7 +1309,7 @@ static hsize_t diff_datum( long temp2_long; if(type_size != sizeof(long)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not long size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long size"); HDmemcpy(&temp1_long, mem1, sizeof(long)); HDmemcpy(&temp2_long, mem2, sizeof(long)); @@ -1370,7 +1385,7 @@ static hsize_t diff_datum( unsigned long temp2_ulong; if(type_size != sizeof(unsigned long)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not unsigned long size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not unsigned long size"); HDmemcpy(&temp1_ulong, mem1, sizeof(unsigned long)); HDmemcpy(&temp2_ulong, mem2, sizeof(unsigned long)); @@ -1454,7 +1469,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(float)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not float size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not float size"); HDmemcpy(&temp1_float, mem1, sizeof(float)); HDmemcpy(&temp2_float, mem2, sizeof(float)); @@ -1613,7 +1628,7 @@ static hsize_t diff_datum( hbool_t isnan2 = FALSE; if(type_size != sizeof(double)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not double size"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not double size"); HDmemcpy(&temp1_double, mem1, sizeof(double)); HDmemcpy(&temp2_double, mem2, sizeof(double)); @@ -1771,8 +1786,9 @@ static hsize_t diff_datum( hbool_t isnan1 = FALSE; hbool_t isnan2 = FALSE; - if(type_size != sizeof(long double)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Type size is not long double size"); + if(type_size != sizeof(long double)) { + HGOTO_ERROR(1, H5E_tools_min_id_g, "Type size is not long double size"); + } HDmemcpy(&temp1_double, mem1, sizeof(long double)); HDmemcpy(&temp2_double, mem2, sizeof(long double)); @@ -1922,10 +1938,11 @@ static hsize_t diff_datum( break; /* H5T_FLOAT class */ } /* switch */ - opts->err_stat = 0; done: - h5diffdebug2("diff_datum finish:%d\n", nfound); + opts->err_stat = opts->err_stat | ret_value; + + h5diffdebug3("diff_datum finish:%d - errstat:%d\n", nfound, opts->err_stat); return nfound; } @@ -2003,7 +2020,7 @@ void print_points(int i, hsize_t *ptdata, int ndims) { 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) { - hsize_t ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + hsize_t ret_value = 0; hssize_t nblocks1, npoints1; hssize_t nblocks2, npoints2; hsize_t alloc_size; @@ -2046,14 +2063,16 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - HERROR(H5E_tools_g, H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(nblocks1, hssize_t, hsize_t); H5Sget_select_hyper_blocklist(region1_id, (hsize_t) 0, (hsize_t) nblocks1, ptdata1); if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - HERROR(H5E_tools_g, H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(nblocks2, hssize_t, hsize_t); @@ -2107,14 +2126,16 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t HDassert(alloc_size == (hsize_t)((size_t )alloc_size)); /*check for overflow*/ if((ptdata1 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - HERROR(H5E_tools_g, H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t); H5Sget_select_elem_pointlist(region1_id, (hsize_t) 0, (hsize_t) npoints1, ptdata1); if((ptdata2 = (hsize_t *) HDmalloc((size_t )alloc_size)) == NULL) { - HERROR(H5E_tools_g, H5E_tools_min_id_g, "Buffer allocation failed"); + opts->err_stat = 1; + H5TOOLS_INFO(H5E_tools_min_id_g, "Buffer allocation failed"); } else { H5_CHECK_OVERFLOW(npoints1, hssize_t, hsize_t); @@ -4380,7 +4401,7 @@ static hbool_t equal_float(float value, float expected, diff_opt_t *opts) { return TRUE; if (opts->use_system_epsilon) - if ( ABS( (value-expected) ) < FLT_EPSILON) + if (ABS( (value-expected) ) < FLT_EPSILON) return TRUE; h5difftrace("equal_float finish\n"); diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c index d671449..6019738 100644 --- a/tools/lib/h5diff_attr.c +++ b/tools/lib/h5diff_attr.c @@ -139,7 +139,7 @@ static void table_attr_mark_exist(unsigned *exist, char *name, table_attrs_t *ta *------------------------------------------------------------------------*/ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t ** table_out, diff_opt_t *opts) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int ret_value = 0; H5O_info_t oinfo1, oinfo2; /* Object info */ hid_t attr1_id = -1; /* attr ID */ hid_t attr2_id = -1; /* attr ID */ @@ -163,12 +163,13 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t if (table_lp == NULL) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "Table allocation failed"); - h5diffdebug3("build_match_list_attrs: %ld - %ld\n", curr1 < oinfo1.num_attrs, curr2 < oinfo2.num_attrs); - /*-------------------------------------------------- * build the list */ while(curr1 < oinfo1.num_attrs && curr2 < oinfo2.num_attrs) { + h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs); + h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", curr2, oinfo2.num_attrs); + /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -221,6 +222,8 @@ 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) { + h5diffdebug3("build_match_list_attrs 1: %ld - %ld\n", curr1, oinfo1.num_attrs); + /*------------------ * open attribute1 */ if((attr1_id = H5Aopen_by_idx(loc1_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)curr1, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -243,6 +246,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) { + h5diffdebug3("build_match_list_attrs 2: %ld - %ld\n", 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) @@ -290,7 +294,7 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - h5difftrace("build_match_list_attrs end\n"); + h5diffdebug2("build_match_list_attrs end - errstat:%d\n", opts->err_stat); return ret_value; } @@ -314,7 +318,7 @@ hsize_t diff_attr(hid_t loc1_id, const char *path2, diff_opt_t *opts) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int ret_value = opts->err_stat; hid_t attr1_id = -1; /* attr ID */ hid_t attr2_id = -1; /* attr ID */ hid_t space1_id = -1; /* space ID */ @@ -348,11 +352,10 @@ hsize_t diff_attr(hid_t loc1_id, table_attrs_t *match_list_attrs = NULL; h5difftrace("diff_attr start\n"); - /* Initialize error status */ - opts->err_stat = 1; - - if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "build_match_list_attrs failed"); + if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) { + HGOTO_ERROR(1, H5E_tools_min_id_g, "build_match_list_attrs failed"); + } + h5diffdebug2("build_match_list_attrs - errstat:%d\n", opts->err_stat); /* if detect any unique extra attr */ if(match_list_attrs->nattrs_only1 || match_list_attrs->nattrs_only2) { @@ -360,8 +363,10 @@ hsize_t diff_attr(hid_t loc1_id, /* exit will be 1 */ opts->contents = 0; } + h5diffdebug2("match_list_attrs info - errstat:%d\n", opts->err_stat); for(u = 0; u < (unsigned)match_list_attrs->nattrs; u++) { + h5diffdebug3("match_list_attrs loop[%d] - errstat:%d\n", u, 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; h5diffdebug2("diff_attr name - %s\n", name1); @@ -369,20 +374,20 @@ hsize_t diff_attr(hid_t loc1_id, /*-------------- * attribute 1 */ if((attr1_id = H5Aopen(loc1_id, name1, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen first attribute failed"); /*-------------- * attribute 2 */ if((attr2_id = H5Aopen(loc2_id, name2, H5P_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aopen second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aopen second attribute failed"); h5difftrace("diff_attr got attributes\n"); /* get the datatypes */ if((ftype1_id = H5Aget_type(attr1_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); vstrtype1 = H5Tis_variable_str(ftype1_id); if((ftype2_id = H5Aget_type(attr2_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); vstrtype2 = H5Tis_variable_str(ftype2_id); /* no compare if either one but not both are variable string type */ @@ -392,37 +397,37 @@ hsize_t diff_attr(hid_t loc1_id, path1, name1, path2, name2); opts->not_cmp = 1; if (H5Tclose(ftype1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); if (H5Tclose(ftype2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); if (H5Aclose(attr1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed"); if (H5Aclose(attr2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed"); continue; } if((mtype1_id = H5Tget_native_type(ftype1_id, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type first attribute ftype failed"); if((mtype2_id = H5Tget_native_type(ftype2_id, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type second attribute ftype failed"); if((msize1 = H5Tget_size(mtype1_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size first attribute mtype failed"); if((msize2 = H5Tget_size(mtype2_id)) == 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_size second attribute mtype failed"); /* get the dataspace */ if((space1_id = H5Aget_space(attr1_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space first attribute failed"); if((space2_id = H5Aget_space(attr2_id)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_space second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_space second attribute failed"); /* get dimensions */ if((rank1 = H5Sget_simple_extent_dims(space1_id, dims1, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims first attribute failed"); if((rank2 = H5Sget_simple_extent_dims(space2_id, dims2, NULL)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims second attribute failed"); /*---------------------------------------------------------------------- * check for comparable TYPE and SPACE @@ -434,21 +439,21 @@ hsize_t diff_attr(hid_t loc1_id, if(diff_can_type(ftype1_id, ftype2_id, rank1, rank2, dims1, dims2, dims1, dims2, name1, name2, opts, 0) != 1) { if(H5Tclose(ftype1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute ftype failed"); if(H5Tclose(ftype2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute ftype failed"); if(H5Sclose(space1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose first attribute failed"); if(H5Sclose(space2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sclose second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sclose second attribute failed"); if(H5Aclose(attr1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose first attribute failed"); if(H5Aclose(attr2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aclose second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aclose second attribute failed"); if(H5Tclose(mtype1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); if(H5Tclose(mtype2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); continue; } @@ -459,7 +464,7 @@ hsize_t diff_attr(hid_t loc1_id, */ if(FAIL == match_up_memsize(ftype1_id, ftype2_id, &mtype1_id, &mtype2_id, &msize1, &msize2)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "match_up_memsize failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); /*--------------------------------------------------------------------- * read @@ -473,18 +478,18 @@ hsize_t diff_attr(hid_t loc1_id, buf2 = (void *)HDcalloc((size_t)(nelmts1), msize2); if(buf1 == NULL || buf2 == NULL) { parallel_print("cannot read into memory\n"); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "buffer allocation failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "buffer allocation failed"); } if(H5Aread(attr1_id, mtype1_id, buf1) < 0) { parallel_print("Failed reading attribute1 %s/%s\n", path1, name1); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); } else buf1hasdata = TRUE; if(H5Aread(attr2_id, mtype2_id, buf2) < 0) { parallel_print("Failed reading attribute2 %s/%s\n", path2, name2); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); } else buf2hasdata = TRUE; @@ -542,29 +547,29 @@ hsize_t diff_attr(hid_t loc1_id, buf2 = NULL; if(H5Tclose(ftype1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); if(H5Tclose(ftype2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); if(H5Sclose(space1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); if(H5Sclose(space2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); if(H5Aclose(attr1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type first attribute failed"); if(H5Aclose(attr2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Aget_type second attribute failed"); if(H5Tclose(mtype1_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose first attribute mtype failed"); if(H5Tclose(mtype2_id) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tclose second attribute mtype failed"); nfound_total += nfound; } } /* u */ - opts->err_stat = 0; - done: + opts->err_stat = opts->err_stat | ret_value; + H5E_BEGIN_TRY { if(buf1) { if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id)) @@ -589,7 +594,7 @@ done: H5Aclose(attr2_id); } H5E_END_TRY; - h5difftrace("diff_attr end\n"); + h5diffdebug2("diff_attr end - errstat:%d\n", opts->err_stat); return nfound_total; } diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 768caff..bea008c 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -33,7 +33,8 @@ hsize_t diff_dataset(hid_t file1_id, const char *obj2_name, diff_opt_t *opts) { - int ret_value = 0; /*no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int ret_value = opts->err_stat; + int status = -1; hid_t did1 = -1; hid_t did2 = -1; hid_t dcpl1 = -1; @@ -41,7 +42,6 @@ hsize_t diff_dataset(hid_t file1_id, hsize_t nfound = 0; h5difftrace("diff_dataset start\n"); - opts->err_stat = 1; /*------------------------------------------------------------------------- * open the handles *------------------------------------------------------------------------- @@ -49,17 +49,17 @@ hsize_t diff_dataset(hid_t file1_id, /* Open the datasets */ if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj1_name); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 first dataset failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 first dataset failed"); } if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0) { parallel_print("Cannot open dataset <%s>\n", obj2_name); - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dopen2 second dataset failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dopen2 second dataset failed"); } if((dcpl1 = H5Dget_create_plist(did1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist first dataset failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist first dataset failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist second dataset failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist second dataset failed"); /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -68,18 +68,18 @@ hsize_t diff_dataset(hid_t file1_id, * 2) the internal filters might be turned off *------------------------------------------------------------------------- */ - if ((ret_value = h5tools_canreadf((opts->m_verbose ? obj1_name : NULL), dcpl1) == 1) && - (ret_value = h5tools_canreadf((opts->m_verbose ? obj2_name : NULL), dcpl2) == 1)) + 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); - else if (ret_value < 0) { - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "h5tools_canreadf failed"); + else if (status < 0) { + HGOTO_ERROR(1, H5E_tools_min_id_g, "h5tools_canreadf failed"); } else opts->not_cmp = 1; - opts->err_stat = 0; - done: + opts->err_stat = opts->err_stat | ret_value; + /* disable error reporting */ H5E_BEGIN_TRY { H5Pclose(dcpl1); @@ -89,7 +89,7 @@ done: /* enable error reporting */ } H5E_END_TRY; - h5diffdebug2("diff_dataset finish:%d\n", nfound); + h5diffdebug3("diff_dataset finish:%d - errstat:%d\n", nfound, opts->err_stat); return nfound; } @@ -150,7 +150,7 @@ hsize_t diff_datasetid(hid_t did1, const char *obj2_name, diff_opt_t *opts) { - int ret_value = 0; /* no need to LEAVE() on ERROR: HERR_INIT(int, SUCCEED) */ + int ret_value = opts->err_stat; hid_t sid1 = -1; hid_t sid2 = -1; hid_t f_tid1 = -1; @@ -192,27 +192,26 @@ hsize_t diff_datasetid(hid_t did1, int i; unsigned int vl_data = 0; /*contains VL datatypes */ - opts->err_stat = 1; h5difftrace("diff_datasetid start\n"); /* Get the dataspace handle */ if((sid1 = H5Dget_space(did1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed"); /* Get rank */ if((rank1 = H5Sget_simple_extent_ndims(sid1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); /* Get the dataspace handle */ if((sid2 = H5Dget_space(did2)) < 0 ) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_space failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_space failed"); /* Get rank */ if((rank2 = H5Sget_simple_extent_ndims(sid2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid1, dims1, maxdim1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed"); /* Get dimensions */ if(H5Sget_simple_extent_dims(sid2, dims2, maxdim2) < 0) @@ -226,25 +225,25 @@ hsize_t diff_datasetid(hid_t did1, /* Get the data type */ if((f_tid1 = H5Dget_type(did1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed"); /* Get the data type */ if((f_tid2 = H5Dget_type(did2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_type failed"); /*------------------------------------------------------------------------- * get the storage layout type *------------------------------------------------------------------------- */ if((dcpl1 = H5Dget_create_plist(did1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((dcpl2 = H5Dget_create_plist(did2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dget_create_plist failed"); if((stl1 = H5Pget_layout(dcpl1)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed"); if((stl2 = H5Pget_layout(dcpl2)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_layout failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Pget_layout failed"); /*------------------------------------------------------------------------- * check for empty datasets @@ -278,6 +277,7 @@ hsize_t diff_datasetid(hid_t did1, obj1_name, obj2_name, opts, 0) != 1) can_compare = 0; + h5diffdebug2("diff_can_type - errstat:%d\n", opts->err_stat); /*------------------------------------------------------------------------- * memory type and sizes @@ -285,10 +285,10 @@ hsize_t diff_datasetid(hid_t did1, */ h5difftrace("check for memory type and sizes\n"); if((m_tid1 = H5Tget_native_type(f_tid1, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed"); if((m_tid2 = H5Tget_native_type(f_tid2, H5T_DIR_DEFAULT)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Tget_native_type failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Tget_native_type failed"); m_size1 = H5Tget_size(m_tid1); m_size2 = H5Tget_size(m_tid2); @@ -319,6 +319,7 @@ hsize_t diff_datasetid(hid_t did1, */ if(TRUE == h5tools_detect_vlen(m_tid1)) vl_data = TRUE; + h5diffdebug2("h5tools_detect_vlen - errstat:%d\n", opts->err_stat); /*------------------------------------------------------------------------ * only attempt to compare if possible @@ -351,7 +352,7 @@ hsize_t diff_datasetid(hid_t did1, if (FAIL == match_up_memsize (f_tid1, f_tid2, &m_tid1, &m_tid2, &m_size1, &m_size2)) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "match_up_memsize failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "match_up_memsize failed"); h5diffdebug3("m_size: %ld - %ld\n", m_size1, m_size2); dadims = dims1; dam_size = m_size1; @@ -397,10 +398,10 @@ hsize_t diff_datasetid(hid_t did1, if(buf1 != NULL && buf2 != NULL) { h5difftrace("buf1 != NULL && buf2 != NULL\n"); if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); h5difftrace("H5Dread did2\n"); if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); /* array diff */ nfound = diff_array(buf1, buf2, danelmts, (hsize_t)0, rank1, dadims, @@ -463,9 +464,9 @@ hsize_t diff_datasetid(hid_t did1, * E.g., sm_space. */ if((sm_buf1 = HDmalloc((size_t)sm_nbytes)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed"); if((sm_buf2 = HDmalloc((size_t)sm_nbytes)) == NULL) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "HDmalloc failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "HDmalloc failed"); sm_nelmts = sm_nbytes / p_type_nbytes; sm_space = H5Screate_simple(1, &sm_nelmts, NULL); @@ -482,19 +483,19 @@ hsize_t diff_datasetid(hid_t did1, hs_nelmts *= hs_size[i]; } /* end for */ if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Sselect_hyperslab failed"); } /* end if */ else hs_nelmts = 1; if(H5Dread(did1, m_tid1, sm_space, sid1, H5P_DEFAULT, sm_buf1) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); if(H5Dread(did2, m_tid2, sm_space, sid2, H5P_DEFAULT, sm_buf2) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dread failed"); + HGOTO_ERROR(1, H5E_tools_min_id_g, "H5Dread failed"); /* 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 */ @@ -534,11 +535,10 @@ hsize_t diff_datasetid(hid_t did1, * close *------------------------------------------------------------------------- */ - h5difftrace("reclaim any VL memory\n"); + h5diffdebug2("reclaim any VL memory - errstat:%d\n", opts->err_stat); done: - - opts->err_stat = ret_value; + opts->err_stat = opts->err_stat | ret_value; /* free */ if(buf1 != NULL) { @@ -802,6 +802,9 @@ int diff_can_type(hid_t f_tid1, /* file data type */ } } done: + if (ret_value < 0) + opts->err_stat = 1; + h5diffdebug2("diff_can_type end - %d\n", ret_value); return ret_value; } diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake index 165c29a..b5dd820 100644 --- a/tools/test/h5diff/CMakeTests.cmake +++ b/tools/test/h5diff/CMakeTests.cmake @@ -1441,22 +1441,22 @@ ADD_H5_TEST (h5diff_415 1 --follow-symlinks -v ${FILE14} ${FILE14} /softlink3_to ADD_H5_TEST (h5diff_416 0 --follow-symlinks -v ${FILE14} ${FILE14} /softlink3_to_slink2 /softlink4_to_slink2) # non-exist-softlink vs softlink" -ADD_H5_TEST (h5diff_417 2 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_noexist /softlink_dset2) +ADD_H5_TEST (h5diff_417 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_noexist /softlink_dset2) # softlink vs non-exist-softlink" -ADD_H5_TEST (h5diff_418 2 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist) +ADD_H5_TEST (h5diff_418 1 --follow-symlinks -v ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist) # non-exist-extlink_file vs extlink" -ADD_H5_TEST (h5diff_419 2 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist2 /ext_link_dset2) +ADD_H5_TEST (h5diff_419 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist2 /ext_link_dset2) # exlink vs non-exist-extlink_file" -ADD_H5_TEST (h5diff_420 2 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist2) +ADD_H5_TEST (h5diff_420 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist2) # extlink vs non-exist-extlink_obj" -ADD_H5_TEST (h5diff_421 2 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist1) +ADD_H5_TEST (h5diff_421 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_dset2 /ext_link_noexist1) # non-exist-extlink_obj vs extlink" -ADD_H5_TEST (h5diff_422 2 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_dset2) +ADD_H5_TEST (h5diff_422 1 --follow-symlinks -v ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_dset2) # extlink_to_softlink_to_dset1 vs dset2" ADD_H5_TEST (h5diff_423 1 --follow-symlinks -v ${FILE17} ${FILE18} /ext_link_to_slink1 /dset2) @@ -1512,11 +1512,11 @@ ADD_H5_TEST (h5diff_465 0 --follow-symlinks h5diff_danglelinks1.h5 h5diff_dangle # soft dangling vs. soft dangling ADD_H5_TEST (h5diff_466 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link1) # soft link vs. soft dangling -ADD_H5_TEST (h5diff_467 2 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2) +ADD_H5_TEST (h5diff_467 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /soft_link2) # ext dangling vs. ext dangling ADD_H5_TEST (h5diff_468 0 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link4) # ext link vs. ext dangling -ADD_H5_TEST (h5diff_469 2 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2) +ADD_H5_TEST (h5diff_469 1 -v --follow-symlinks h5diff_danglelinks1.h5 h5diff_danglelinks2.h5 /ext_link2) #--------------------------------------------------- # dangling links without follow symlink @@ -1655,7 +1655,7 @@ ADD_H5_TEST (h5diff_v3 0 -c ${FILEV1} ${FILEV2}) ############################################################################## if (BUILD_SHARED_LIBS) ADD_H5_UD_TEST (h5diff_plugin_test 0 h5diff_ud -v tudfilter.h5 tudfilter2.h5) - ADD_H5_UD_TEST (h5diff_plugin_fail 2 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) + ADD_H5_UD_TEST (h5diff_plugin_fail 0 h5diff_udfail -v tudfilter.h5 tudfilter2.h5) endif () # ############################################################################## diff --git a/tools/test/h5diff/testfiles/h5diff_417.txt b/tools/test/h5diff/testfiles/h5diff_417.txt index 29d467a..0ea2542 100644 --- a/tools/test/h5diff/testfiles/h5diff_417.txt +++ b/tools/test/h5diff/testfiles/h5diff_417.txt @@ -1,3 +1,3 @@ obj1 </softlink_noexist> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_418.txt b/tools/test/h5diff/testfiles/h5diff_418.txt index b6173d9..46222bb 100644 --- a/tools/test/h5diff/testfiles/h5diff_418.txt +++ b/tools/test/h5diff/testfiles/h5diff_418.txt @@ -1,3 +1,3 @@ obj2 </softlink_noexist> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_419.txt b/tools/test/h5diff/testfiles/h5diff_419.txt index ee6e831..387c600 100644 --- a/tools/test/h5diff/testfiles/h5diff_419.txt +++ b/tools/test/h5diff/testfiles/h5diff_419.txt @@ -1,3 +1,3 @@ obj1 </ext_link_noexist2> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_420.txt b/tools/test/h5diff/testfiles/h5diff_420.txt index 67c22ba..f3e65d9 100644 --- a/tools/test/h5diff/testfiles/h5diff_420.txt +++ b/tools/test/h5diff/testfiles/h5diff_420.txt @@ -1,3 +1,3 @@ obj2 </ext_link_noexist2> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_421.txt b/tools/test/h5diff/testfiles/h5diff_421.txt index 7fd70ee..833c60c 100644 --- a/tools/test/h5diff/testfiles/h5diff_421.txt +++ b/tools/test/h5diff/testfiles/h5diff_421.txt @@ -1,3 +1,3 @@ obj2 </ext_link_noexist1> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_422.txt b/tools/test/h5diff/testfiles/h5diff_422.txt index d1114af..3e675d5 100644 --- a/tools/test/h5diff/testfiles/h5diff_422.txt +++ b/tools/test/h5diff/testfiles/h5diff_422.txt @@ -1,3 +1,3 @@ obj1 </ext_link_noexist1> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_467.txt b/tools/test/h5diff/testfiles/h5diff_467.txt index 35d3b74..f5195c0 100644 --- a/tools/test/h5diff/testfiles/h5diff_467.txt +++ b/tools/test/h5diff/testfiles/h5diff_467.txt @@ -1,3 +1,3 @@ obj2 </soft_link2> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_469.txt b/tools/test/h5diff/testfiles/h5diff_469.txt index 23cb62f..594fd80 100644 --- a/tools/test/h5diff/testfiles/h5diff_469.txt +++ b/tools/test/h5diff/testfiles/h5diff_469.txt @@ -1,3 +1,3 @@ obj2 </ext_link2> is a dangling link. 1 differences found -EXIT CODE: 2 +EXIT CODE: 1 diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.txt b/tools/test/h5diff/testfiles/h5diff_udfail.txt index c154c6b..aac5528 100644 --- a/tools/test/h5diff/testfiles/h5diff_udfail.txt +++ b/tools/test/h5diff/testfiles/h5diff_udfail.txt @@ -1,12 +1,16 @@ file1 file2 --------------------------------------- - x x / - x x /dynlibud + x x / + x x /dynlibud group : </> and </> 0 differences found dataset: </dynlibud> and </dynlibud> 0 differences found -warning: dataset </dynlibud> cannot be read, user defined filter is not available -EXIT CODE: 2 +-------------------------------- +Some objects are not comparable +-------------------------------- +Use -c for a list of objects without details of differences. +Warning: dataset </dynlibud> cannot be read, user defined filter is not available +EXIT CODE: 0 |