diff options
author | Albert Cheng <acheng@hdfgroup.org> | 2010-10-28 16:19:52 (GMT) |
---|---|---|
committer | Albert Cheng <acheng@hdfgroup.org> | 2010-10-28 16:19:52 (GMT) |
commit | 71bf205c79d20738bf8f5a19907a80e428369d50 (patch) | |
tree | c7789153b8ade89277d3f65b7e96443fc7adfda4 /test | |
parent | 9b956eb466c99e5996b46abca4cafd66f2cb93a2 (diff) | |
download | hdf5-71bf205c79d20738bf8f5a19907a80e428369d50.zip hdf5-71bf205c79d20738bf8f5a19907a80e428369d50.tar.gz hdf5-71bf205c79d20738bf8f5a19907a80e428369d50.tar.bz2 |
[svn-r19692] added PrintErrorStackOn and PrintErrorStackOff to turn auto error stack
printing on and off.
Diffstat (limited to 'test')
-rw-r--r-- | test/h5test.h | 2 | ||||
-rw-r--r-- | test/testframe.c | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/test/h5test.h b/test/h5test.h index 3d3f72e..b4670d4 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -192,6 +192,8 @@ H5TEST_DLL int TestErrPrintf(const char *format, ...); H5TEST_DLL void SetTest(const char *testname, int action); H5TEST_DLL void TestAlarmOn(void); H5TEST_DLL void TestAlarmOff(void); +H5TEST_DLL void PrintErrorStackOn(void); +H5TEST_DLL void PrintErrorStackOff(void); #ifdef H5_HAVE_FILTER_SZIP H5TEST_DLL int h5_szip_can_encode(void); diff --git a/test/testframe.c b/test/testframe.c index 1d7c958..a12594c 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -49,6 +49,8 @@ int TestVerbosity = VERBO_DEF; /* Default Verbosity is Low */ static int Summary = 0; /* Show test summary. Default is no. */ static int CleanUp = 1; /* Do cleanup or not. Default is yes. */ static int TestExpress = -1; /* Do TestExpress or not. -1 means not set yet. */ +static H5E_auto_t *PrintErrorStackFunc; +static void **PrintErrorStackData; static TestStruct Test[MAXNUMOFTESTS]; static int Index = 0; static const void *Test_parameters = NULL; @@ -130,12 +132,14 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p setbuf(stdout, NULL); #endif + /* Save error printing settings */ + H5Eget_auto2(H5E_DEFAULT, PrintErrorStackFunc, PrintErrorStackData); /* * Turn off automatic error reporting since we do it ourselves. Besides, * half the functions this test calls are private, so automatic error * reporting wouldn't do much good since it's triggered at the API layer. */ - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + PrintErrorStackOff(); /* * Record the program name and private routines if provided. @@ -606,3 +610,19 @@ void TestAlarmOn(void) HDalarm((unsigned)alarm_sec); } + +/* + * Enable error stack printing when errors occur. + */ +void PrintErrorStackOn(void) +{ + H5Eset_auto2(H5E_DEFAULT, PrintErrorStackFunc, PrintErrorStackData); +} + +/* + * Disable error stack printing when errors occur. + */ +void PrintErrorStackOff(void) +{ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); +} |