summaryrefslogtreecommitdiffstats
path: root/tools/src/h5diff/h5diff_main.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-31 20:58:37 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-31 20:58:37 (GMT)
commit89f65fc97ee28270ee06978fcab2865dd345140e (patch)
tree81a56ed30e4d1106ef5b2ac7621f410d59a41edc /tools/src/h5diff/h5diff_main.c
parentabcf30f232914c1ec9b8c5f2a3bb3a621af7bfe4 (diff)
downloadhdf5-89f65fc97ee28270ee06978fcab2865dd345140e.zip
hdf5-89f65fc97ee28270ee06978fcab2865dd345140e.tar.gz
hdf5-89f65fc97ee28270ee06978fcab2865dd345140e.tar.bz2
HDFFV-9774 Add enable-error-stack argument to h5diff
Diffstat (limited to 'tools/src/h5diff/h5diff_main.c')
-rw-r--r--tools/src/h5diff/h5diff_main.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/tools/src/h5diff/h5diff_main.c b/tools/src/h5diff/h5diff_main.c
index 66ff71e..8dab3b4 100644
--- a/tools/src/h5diff/h5diff_main.c
+++ b/tools/src/h5diff/h5diff_main.c
@@ -69,6 +69,10 @@
int main(int argc, const char *argv[])
{
int ret;
+ H5E_auto2_t func;
+ H5E_auto2_t tools_func;
+ void *edata;
+ void *tools_edata;
const char *fname1 = NULL;
const char *fname2 = NULL;
const char *objname1 = NULL;
@@ -79,21 +83,34 @@ 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, &options);
+ if (enable_error_stack) {
+ H5Eset_auto2(H5E_DEFAULT, func, edata);
+ H5Eset_auto2(H5tools_ERR_STACK_g, tools_func, tools_edata);
+ }
+
/*-------------------------------------------------------------------------
* do the diff
*-------------------------------------------------------------------------
*/
- nfound = h5diff(fname1,fname2,objname1,objname2,&options);
+ nfound = h5diff(fname1, fname2, objname1, objname2, &options);
print_info(&options);
@@ -103,17 +120,17 @@ int main(int argc, const char *argv[])
*-------------------------------------------------------------------------
*/
- ret = (nfound == 0 ? 0 : 1 );
+ ret = (nfound == 0 ? 0 : 1);
/* if graph difference return 1 for differences */
- if ( options.contents == 0 )
+ if (options.contents == 0)
ret = 1;
/* and return 2 for error */
if (options.err_stat)
ret = 2;
- return ret;
+ h5diff_exit(ret);
}
/*-------------------------------------------------------------------------
@@ -135,6 +152,8 @@ int main(int argc, const char *argv[])
H5_ATTR_NORETURN void
h5diff_exit(int status)
{
+ h5tools_close();
+
HDexit(status);
}