HDFFV-9774 Add enable-error-stack to h5diff

This commit is contained in:
Allen Byrne
2017-09-06 11:00:27 -05:00
parent dcc11dbdbd
commit a57f039a6a
28 changed files with 477 additions and 297 deletions

View File

@@ -11,9 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include <stdlib.h>
#include <assert.h>
#include <memory.h>
#include "H5private.h"
#include "h5diff.h"
#include "h5diff_common.h"
@@ -72,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;
@@ -82,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);
@@ -106,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,8 +149,11 @@ int main(int argc, const char *argv[])
*
*-------------------------------------------------------------------------
*/
void h5diff_exit(int status)
H5_ATTR_NORETURN void
h5diff_exit(int status)
{
h5tools_close();
HDexit(status);
}