summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-04-12 01:59:45 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-04-12 01:59:45 (GMT)
commitd6bb18abbc2d6e145afff18446a0814403f1a3b7 (patch)
tree8a340ebde9f0fea052c3d40b6e98f2d0ca7f7aaa /test
parentde71a7fe74ca0954efec963066e2606d798691f4 (diff)
downloadhdf5-d6bb18abbc2d6e145afff18446a0814403f1a3b7.zip
hdf5-d6bb18abbc2d6e145afff18446a0814403f1a3b7.tar.gz
hdf5-d6bb18abbc2d6e145afff18446a0814403f1a3b7.tar.bz2
[svn-r13648] Description:
Rename new error handling API routines from H5E<foo>_stack() to H5E<foo>2(). Tested on: Mac OS X/32 10.4.9 (amazon) FreeBSD/32 6.2 (duty) FreeBSD/64 6.2 (liberty)
Diffstat (limited to 'test')
-rw-r--r--test/dtransform.c8
-rw-r--r--test/enum.c2
-rw-r--r--test/error_test.c249
-rw-r--r--test/fheap.c6
-rw-r--r--test/flush2.c14
-rw-r--r--test/gheap.c14
-rw-r--r--test/h5test.h6
-rw-r--r--test/lheap.c14
-rw-r--r--test/ohdr.c34
-rw-r--r--test/testhdf5.h14
10 files changed, 171 insertions, 190 deletions
diff --git a/test/dtransform.c b/test/dtransform.c
index 094f993..3b53aed 100644
--- a/test/dtransform.c
+++ b/test/dtransform.c
@@ -569,16 +569,16 @@ error:
int test_set(void)
{
hid_t dxpl_id;
- H5E_auto_stack_t func;
+ H5E_auto2_t func;
const char* str = "(9/5.0)*x + 32";
char* ptrgetTest = malloc(strlen(str)+1);
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER))<0) TEST_ERROR;
/* Test get before set */
- H5Eget_auto_stack(H5E_DEFAULT,&func,NULL);
+ H5Eget_auto2(H5E_DEFAULT,&func,NULL);
- H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
TESTING("H5Pget_data_transform (get before set)")
if(H5Pget_data_transform(dxpl_id, ptrgetTest, strlen(str)+1) < 0)
{
@@ -620,7 +620,7 @@ int test_set(void)
TESTING("H5Pset_data_transform (set with invalid transform 8)")
INVALID_SET_TEST("(9/5)*x + x^2");
- H5Eset_auto_stack(H5E_DEFAULT, func, NULL);
+ H5Eset_auto2(H5E_DEFAULT, func, NULL);
return 0;
diff --git a/test/enum.c b/test/enum.c
index ae746c4..7574e40 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -401,7 +401,7 @@ test_value_dsnt_exist(void)
TESTING("for non-existing name and value");
/* Turn off error reporting since we expect failure in this test */
- if (H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL) < 0) goto error;
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0) goto error;
if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error;
diff --git a/test/error_test.c b/test/error_test.c
index e8ccacf..7850ff1 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -77,7 +77,8 @@ hid_t ERR_MIN_GETNUM;
#define LONG_DESC_SIZE 8192
-herr_t custom_print_cb(unsigned n, const H5E_error_stack_t *err_desc, void* client_data);
+herr_t custom_print_cb(unsigned n, const H5E_error2_t *err_desc,
+ void *client_data);
/*-------------------------------------------------------------------------
@@ -92,9 +93,6 @@ herr_t custom_print_cb(unsigned n, const H5E_error_stack_t *err_desc, void* clie
* Programmer: Raymond Lu
* July 10, 2003
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -103,8 +101,8 @@ test_error(hid_t file)
hid_t dataset, space;
hid_t estack_id;
hsize_t dims[2];
- const char *FUNC_test_error="test_error";
- H5E_auto_stack_t old_func;
+ const char *FUNC_test_error = "test_error";
+ H5E_auto2_t old_func;
void *old_data;
TESTING("error API based on data I/O");
@@ -120,53 +118,52 @@ test_error(hid_t file)
} H5E_END_TRY;
/* Create the dataset */
- if ((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space,
- H5P_DEFAULT))<0) {
- H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE,
+ if((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT)) < 0) {
+ H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE,
"H5Dcreate failed");
goto error;
- }
+ } /* end if */
/* Test enabling and disabling default printing */
- if (H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_data)<0)
+ if(H5Eget_auto2(H5E_DEFAULT, &old_func, &old_data) < 0)
TEST_ERROR;
- if (old_data != NULL)
+ if(old_data != NULL)
TEST_ERROR;
- if (old_func != (H5E_auto_stack_t)H5Eprint_stack)
+ if(old_func != (H5E_auto2_t)H5Eprint2)
TEST_ERROR;
- if(H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL)<0)
+ if(H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
TEST_ERROR;
/* Make H5Dwrite fail, verify default print is disabled */
- if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)>=0) {
- H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
+ if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) >= 0) {
+ H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
"H5Dwrite shouldn't succeed");
goto error;
- }
+ } /* end if */
- if(H5Eset_auto_stack(H5E_DEFAULT, old_func, old_data)<0)
+ if(H5Eset_auto2(H5E_DEFAULT, old_func, old_data) < 0)
TEST_ERROR;
/* Test saving and restoring the current error stack */
- if (H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2)<0) {
- H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
+ if(H5Dwrite(FAKE_ID, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ipoints2) < 0) {
+ H5Epush2(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE,
"H5Dwrite failed as supposed to");
estack_id = H5Eget_current_stack();
H5Dclose(dataset);
H5Sclose(space);
H5Eset_current_stack(estack_id);
goto error;
- }
+ } /* end if */
/* In case program comes to this point, close dataset */
- if(H5Dclose(dataset)<0) TEST_ERROR;
+ if(H5Dclose(dataset) < 0) TEST_ERROR;
TEST_ERROR;
error:
return -1;
-}
+} /* end test_error() */
/*-------------------------------------------------------------------------
@@ -181,62 +178,59 @@ test_error(hid_t file)
* Programmer: Raymond Lu
* July 10, 2003
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
init_error(void)
{
ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME)+1;
- char *cls_name = HDmalloc(strlen(ERR_CLS_NAME)+1);
+ char *cls_name = HDmalloc(HDstrlen(ERR_CLS_NAME)+1);
ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1;
char *msg = HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1);
H5E_type_t *msg_type= HDmalloc(sizeof(H5E_type_t));
- if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS))<0)
+ if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0)
TEST_ERROR;
if(cls_size != H5Eget_class_name(ERR_CLS, cls_name, (size_t)cls_size) + 1)
TEST_ERROR;
- if(strcmp(ERR_CLS_NAME, cls_name))
+ if(HDstrcmp(ERR_CLS_NAME, cls_name))
TEST_ERROR;
- if((ERR_MAJ_TEST = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_TEST_MSG))<0)
+ if((ERR_MAJ_TEST = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_TEST_MSG)) < 0)
TEST_ERROR;
- if((ERR_MAJ_IO = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_IO_MSG))<0)
+ if((ERR_MAJ_IO = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_IO_MSG)) < 0)
TEST_ERROR;
- if((ERR_MAJ_API = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_API_MSG))<0)
+ if((ERR_MAJ_API = H5Ecreate_msg(ERR_CLS, H5E_MAJOR, ERR_MAJ_API_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_SUBROUTINE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_SUBROUTINE_MSG))<0)
+ if((ERR_MIN_SUBROUTINE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_SUBROUTINE_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_ERRSTACK = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_ERRSTACK_MSG))<0)
+ if((ERR_MIN_ERRSTACK = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_ERRSTACK_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_CREATE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_CREATE_MSG))<0)
+ if((ERR_MIN_CREATE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_CREATE_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_WRITE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_WRITE_MSG))<0)
+ if((ERR_MIN_WRITE = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_WRITE_MSG)) < 0)
TEST_ERROR;
- if((ERR_MIN_GETNUM = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_GETNUM_MSG))<0)
+ if((ERR_MIN_GETNUM = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_GETNUM_MSG)) < 0)
TEST_ERROR;
if(msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, msg_type, msg, (size_t)msg_size) + 1)
TEST_ERROR;
if(*msg_type != H5E_MINOR)
TEST_ERROR;
- if(strcmp(msg, ERR_MIN_SUBROUTINE_MSG))
+ if(HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG))
TEST_ERROR;
- free(cls_name);
- free(msg);
- free(msg_type);
+ HDfree(cls_name);
+ HDfree(msg);
+ HDfree(msg_type);
return 0;
- error:
+error:
return -1;
-}
+} /* end init_error() */
/*-------------------------------------------------------------------------
@@ -251,42 +245,40 @@ init_error(void)
* Programmer: Raymond Lu
* July 14, 2003
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
error_stack(void)
{
int err_num;
- const char *FUNC_error_stack="error_stack";
+ const char *FUNC_error_stack = "error_stack";
- if((err_num = H5Eget_num(H5E_DEFAULT))<0)
+ if((err_num = H5Eget_num(H5E_DEFAULT)) < 0)
TEST_ERROR;
if(err_num)
TEST_ERROR;
- if((ERR_STACK = H5Eget_current_stack())<0)
+ if((ERR_STACK = H5Eget_current_stack()) < 0)
TEST_ERROR;
/* Make it push error, force this function to fail */
- if((err_num = H5Eget_num(ERR_STACK))==0) {
- H5Epush_stack(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
+ if((err_num = H5Eget_num(ERR_STACK)) == 0) {
+ H5Epush2(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM,
"Get number test failed, returned %d", err_num);
goto error;
- }
+ } /* end if */
/* In case program falls through here, close the stack and let it fail. */
- if(H5Eclose_stack(ERR_STACK)<0)
+ if(H5Eclose_stack(ERR_STACK) < 0)
TEST_ERROR;
return -1;
- error:
+error:
return -1;
-}
+} /* end error_stack() */
+
/*-------------------------------------------------------------------------
* Function: long_desc_cb
*
@@ -299,21 +291,18 @@ error_stack(void)
* Programmer: Quincey Koziol
* January 19, 2005
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
-long_desc_cb(unsigned UNUSED n, const H5E_error_stack_t *err_desc, void* client_data)
+long_desc_cb(unsigned UNUSED n, const H5E_error2_t *err_desc, void *client_data)
{
- char *real_desc = (char *)client_data;
+ char *real_desc = (char *)client_data;
- if(err_desc->desc!=NULL && HDstrcmp(err_desc->desc,real_desc)==0)
+ if(err_desc->desc != NULL && HDstrcmp(err_desc->desc, real_desc) == 0)
return(0);
else
return(-1);
-}
+} /* end long_desc_cb() */
/*-------------------------------------------------------------------------
@@ -328,53 +317,54 @@ long_desc_cb(unsigned UNUSED n, const H5E_error_stack_t *err_desc, void* client_
* Programmer: Quincey Koziol
* January 19, 2005
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
test_long_desc(void)
{
- const char *format="Testing very long description string, %s";
+ const char *format = "Testing very long description string, %s";
char *long_desc = NULL;
char *full_desc = NULL;
size_t u;
- const char *test_FUNC="test_long_desc";
+ const char *test_FUNC = "test_long_desc";
/* Allocate space for the error description info */
- if((long_desc=HDmalloc(LONG_DESC_SIZE))==NULL) TEST_ERROR;
- if((full_desc=HDmalloc(LONG_DESC_SIZE+128))==NULL) TEST_ERROR;
+ if(NULL == (long_desc = HDmalloc(LONG_DESC_SIZE))) TEST_ERROR;
+ if(NULL == (full_desc = HDmalloc(LONG_DESC_SIZE + 128))) TEST_ERROR;
/* Create the long part of the error description */
- for(u=0; u<LONG_DESC_SIZE; u++)
- long_desc[u]='A'+(u%26);
- long_desc[LONG_DESC_SIZE-1]='\0';
+ for(u = 0; u < LONG_DESC_SIZE; u++)
+ long_desc[u] = 'A' + (u % 26);
+ long_desc[LONG_DESC_SIZE - 1] = '\0';
/* Clear the default error stack */
- if(H5Eclear_stack(H5E_DEFAULT)<0) TEST_ERROR;
+ if(H5Eclear2(H5E_DEFAULT) < 0) TEST_ERROR;
/* Push an error with a long description */
- if(H5Epush_stack(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc)<0) TEST_ERROR;
+ if(H5Epush2(H5E_DEFAULT, __FILE__, test_FUNC, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, format, long_desc) < 0) TEST_ERROR;
/* Create the string that should be in the description */
- HDsnprintf(full_desc,LONG_DESC_SIZE+128,format,long_desc);
+ HDsnprintf(full_desc, LONG_DESC_SIZE + 128, format, long_desc);
/* Make certain that the description is correct */
- if(H5Ewalk_stack(H5E_DEFAULT, H5E_WALK_UPWARD, long_desc_cb, full_desc)<0) TEST_ERROR;
+ if(H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, long_desc_cb, full_desc) < 0) TEST_ERROR;
/* Clear the default error stack again */
- if(H5Eclear_stack(H5E_DEFAULT)<0) TEST_ERROR;
+ if(H5Eclear2(H5E_DEFAULT) < 0) TEST_ERROR;
HDfree(long_desc);
HDfree(full_desc);
+
return(0);
error:
- if(long_desc) HDfree(long_desc);
- if(full_desc) HDfree(full_desc);
+ if(long_desc)
+ HDfree(long_desc);
+ if(full_desc)
+ HDfree(full_desc);
+
return(-1);
-}
+} /* end test_long_desc() */
/*-------------------------------------------------------------------------
@@ -389,9 +379,6 @@ error:
* Programmer: Raymond Lu
* July 17, 2003
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -399,20 +386,21 @@ dump_error(hid_t estack)
{
/* Print errors in library default way */
fprintf(stderr, "********* Print error stack in HDF5 default way *********\n");
- if(H5Eprint_stack(estack, stderr)<0)
+ if(H5Eprint2(estack, stderr) < 0)
TEST_ERROR;
/* Customized way to print errors */
fprintf(stderr, "\n********* Print error stack in customized way *********\n");
- if(H5Ewalk_stack(estack, H5E_WALK_UPWARD, custom_print_cb, stderr)<0)
+ if(H5Ewalk2(estack, H5E_WALK_UPWARD, custom_print_cb, stderr) < 0)
TEST_ERROR;
return 0;
- error:
+error:
return -1;
-}
+} /* end dump_error() */
+
/*-------------------------------------------------------------------------
* Function: custom_print_cb
*
@@ -425,13 +413,10 @@ dump_error(hid_t estack)
* Programmer: Raymond Lu
* July 17, 2003
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
herr_t
-custom_print_cb(unsigned n, const H5E_error_stack_t *err_desc, void* client_data)
+custom_print_cb(unsigned n, const H5E_error2_t *err_desc, void* client_data)
{
FILE *stream = (FILE *)client_data;
char maj[MSG_SIZE];
@@ -440,27 +425,27 @@ custom_print_cb(unsigned n, const H5E_error_stack_t *err_desc, void* client_data
const int indent = 4;
/* Get descriptions for the major and minor error numbers */
- if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE)<0)
+ if(H5Eget_class_name(err_desc->cls_id, cls, MSG_SIZE) < 0)
TEST_ERROR;
- if(H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE)<0)
+ if(H5Eget_msg(err_desc->maj_num, NULL, maj, MSG_SIZE) < 0)
TEST_ERROR;
- if(H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE)<0)
+ if(H5Eget_msg(err_desc->min_num, NULL, min, MSG_SIZE) < 0)
TEST_ERROR;
- fprintf (stream, "%*serror #%03d: %s in %s(): line %u\n",
+ fprintf(stream, "%*serror #%03d: %s in %s(): line %u\n",
indent, "", n, err_desc->file_name,
err_desc->func_name, err_desc->line);
- fprintf (stream, "%*sclass: %s\n", indent*2, "", cls);
- fprintf (stream, "%*smajor: %s\n", indent*2, "", maj);
- fprintf (stream, "%*sminor: %s\n", indent*2, "", min);
+ fprintf(stream, "%*sclass: %s\n", indent * 2, "", cls);
+ fprintf(stream, "%*smajor: %s\n", indent * 2, "", maj);
+ fprintf(stream, "%*sminor: %s\n", indent * 2, "", min);
return 0;
- error:
+error:
return -1;
-}
+} /* end custom_print_cb() */
/*-------------------------------------------------------------------------
@@ -475,32 +460,29 @@ custom_print_cb(unsigned n, const H5E_error_stack_t *err_desc, void* client_data
* Programmer: Raymond Lu
* July 10, 2003
*
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
close_error(void)
{
/* Close major errors, let H5Eunregister_class close minor errors */
- if(H5Eclose_msg(ERR_MAJ_TEST)<0)
- TEST_ERROR ;
+ if(H5Eclose_msg(ERR_MAJ_TEST) < 0)
+ TEST_ERROR;
- if(H5Eclose_msg(ERR_MAJ_IO)<0)
- TEST_ERROR ;
+ if(H5Eclose_msg(ERR_MAJ_IO) < 0)
+ TEST_ERROR;
- if(H5Eclose_msg(ERR_MAJ_API)<0)
- TEST_ERROR ;
+ if(H5Eclose_msg(ERR_MAJ_API) < 0)
+ TEST_ERROR;
- if(H5Eunregister_class(ERR_CLS)<0)
- TEST_ERROR ;
+ if(H5Eunregister_class(ERR_CLS) < 0)
+ TEST_ERROR;
return 0;
- error:
+error:
return -1;
-}
+} /* end close_error() */
/*-------------------------------------------------------------------------
@@ -511,8 +493,6 @@ close_error(void)
* Programmer: Raymond Lu
* July 10, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -521,25 +501,25 @@ main(void)
hid_t file, fapl;
hid_t estack_id;
char filename[1024];
- const char *FUNC_main="main";
+ const char *FUNC_main = "main";
fprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n");
/* Initialize errors */
- if(init_error()<0)
- TEST_ERROR ;
+ if(init_error() < 0)
+ TEST_ERROR;
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
- TEST_ERROR ;
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR;
/* Test error stack */
- if(error_stack()<0) {
+ if(error_stack() < 0) {
/* Push an error onto error stack */
- if(H5Epush_stack(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
- "Error stack test failed")<0) TEST_ERROR;
+ if(H5Epush2(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
+ "Error stack test failed") < 0) TEST_ERROR;
/* Delete an error from the top of error stack */
H5Epop(ERR_STACK, 1);
@@ -548,36 +528,37 @@ main(void)
dump_error(ERR_STACK);
/* Empty error stack */
- H5Eclear_stack(ERR_STACK);
+ H5Eclear2(ERR_STACK);
/* Close error stack */
H5Eclose_stack(ERR_STACK);
- }
+ } /* end if */
/* Test error API */
- if(test_error(file)<0) {
- H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE,
+ if(test_error(file) < 0) {
+ H5Epush2(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE,
"Error test failed, %s", "it's wrong");
estack_id = H5Eget_current_stack();
- H5Eprint_stack(estack_id, stderr);
+ H5Eprint2(estack_id, stderr);
H5Eclose_stack(estack_id);
- }
+ } /* end if */
/* Test pushing a very long error description */
- if(test_long_desc()<0) TEST_ERROR;
+ if(test_long_desc() < 0) TEST_ERROR;
- if (H5Fclose(file)<0) TEST_ERROR ;
+ if(H5Fclose(file) < 0) TEST_ERROR;
h5_cleanup(FILENAME, fapl);
/* Close error information */
- if(close_error()<0)
- TEST_ERROR ;
+ if(close_error() < 0)
+ TEST_ERROR;
printf("All error API tests passed.\n");
return 0;
- error:
+error:
printf("***** ERROR TEST FAILED! *****\n");
return 1;
}
#endif /*H5_WANT_H5_V1_6_COMPAT*/
+
diff --git a/test/fheap.c b/test/fheap.c
index b3f6986..68ef1a5 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -2814,7 +2814,7 @@ test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
/* Insert a 1-sized object into heap (should be a 'tiny' object) */
if(add_obj(fh, dxpl, (size_t)10, (size_t)1, &state, NULL))
@@ -5952,7 +5952,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
/* Try reading bogus heap ID from heap w/objects */
H5E_BEGIN_TRY {
@@ -5960,7 +5960,7 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
/* Close the fractal heap */
if(H5HF_close(fh, dxpl) < 0)
diff --git a/test/flush2.c b/test/flush2.c
index 2b8cf7a..f8d8aa8 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -161,7 +161,7 @@ int
main(void)
{
hid_t fapl;
- H5E_auto_stack_t func;
+ H5E_auto2_t func;
char name[1024];
const char *envval = NULL;
@@ -189,8 +189,8 @@ main(void)
/* Check the case where the file was not flushed. This should give an error
* so we turn off the error stack temporarily */
TESTING("H5Fflush (part2 without flush)");
- H5Eget_auto_stack(H5E_DEFAULT,&func,NULL);
- H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL);
+ H5Eget_auto2(H5E_DEFAULT,&func,NULL);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
h5_fixname(FILENAME[1], fapl, name, sizeof name);
if(check_file(name, fapl, FALSE))
@@ -206,13 +206,13 @@ main(void)
goto error;
#endif
}
- H5Eset_auto_stack(H5E_DEFAULT, func, NULL);
+ H5Eset_auto2(H5E_DEFAULT, func, NULL);
/* Check the case where the file was flushed, but more data was added afterward. This should give an error
* so we turn off the error stack temporarily */
TESTING("H5Fflush (part2 with flush and later addition)");
- H5Eget_auto_stack(H5E_DEFAULT,&func,NULL);
- H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL);
+ H5Eget_auto2(H5E_DEFAULT,&func,NULL);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
h5_fixname(FILENAME[2], fapl, name, sizeof name);
if(check_file(name, fapl, TRUE))
@@ -229,7 +229,7 @@ main(void)
#endif
}
- H5Eset_auto_stack(H5E_DEFAULT, func, NULL);
+ H5Eset_auto2(H5E_DEFAULT, func, NULL);
h5_cleanup(FILENAME, fapl);
diff --git a/test/gheap.c b/test/gheap.c
index d10e553..6dbd8a3 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -90,7 +90,7 @@ test_1 (hid_t fapl)
for (i=0; i<1024; i++) {
size = i+1;
memset (out, 'A'+i%26, size);
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
if (status<0) {
H5_FAILED();
@@ -109,7 +109,7 @@ test_1 (hid_t fapl)
for (i=0; i<1024; i++) {
size = i+1;
memset (out, 'A'+i%26, size);
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
@@ -182,7 +182,7 @@ test_2 (hid_t fapl)
for (i=0; i<1024; i++) {
size = 1024-i;
memset (out, 'A'+i%26, size);
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
if (H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i)<0) {
H5_FAILED();
puts(" Unable to insert object into global heap");
@@ -196,7 +196,7 @@ test_2 (hid_t fapl)
for (i=0; i<1024; i++) {
size = 1024-i;
memset (out, 'A'+i%26, size);
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) {
H5_FAILED();
puts(" Unable to read object");
@@ -267,7 +267,7 @@ test_3 (hid_t fapl)
for (i=0; i<1024; i++) {
size = i%30+100;
memset (out, 'A'+i%26, size);
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
if (status<0) {
H5_FAILED();
@@ -346,7 +346,7 @@ test_4 (hid_t fapl)
/* Insert */
size = i%30+100;
memset (out, 'A'+i%26, size);
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i);
if (status<0) {
H5_FAILED();
@@ -360,7 +360,7 @@ test_4 (hid_t fapl)
* remove B, insert D, E, F; remove E; etc.
*/
if (1==i%3) {
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i-1);
if (status<0) {
H5_FAILED();
diff --git a/test/h5test.h b/test/h5test.h
index 8c10faf..4add74c 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -104,9 +104,9 @@ extern MPI_Info h5_io_info_g; /* MPI INFO object for IO */
#define H5_WARNING() {puts("*WARNING*");fflush(stdout);}
#define SKIPPED() {puts(" -SKIP-");fflush(stdout);}
#define TEST_ERROR {H5_FAILED(); AT(); goto error;}
-#define STACK_ERROR {H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
-#define FAIL_STACK_ERROR {H5_FAILED(); AT(); \
- H5Eprint_stack(H5E_DEFAULT, stdout); goto error;}
+#define STACK_ERROR {H5Eprint2(H5E_DEFAULT, stdout); goto error;}
+#define FAIL_STACK_ERROR {H5_FAILED(); AT(); H5Eprint2(H5E_DEFAULT, stdout); \
+ goto error;}
#define FAIL_PUTS_ERROR(s) {H5_FAILED(); AT(); puts(s); goto error;}
/*
diff --git a/test/lheap.c b/test/lheap.c
index 437f635..8f496f4 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -78,12 +78,12 @@ main(void)
goto error;
if(NULL == (f = H5I_object(file))) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if(H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/) < 0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
for(i = 0; i < NOBJS; i++) {
@@ -94,7 +94,7 @@ main(void)
if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap_addr, strlen(buf)+1,
buf))) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
@@ -115,7 +115,7 @@ main(void)
if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error;
if (NULL==(f=H5I_object(file))) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
for (i=0; i<NOBJS; i++) {
@@ -127,13 +127,13 @@ main(void)
if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr))) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (NULL == (s = H5HL_offset_into(f, heap, obj[i]))) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
@@ -147,7 +147,7 @@ main(void)
if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr, H5AC__NO_FLAGS_SET) < 0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
diff --git a/test/ohdr.c b/test/ohdr.c
index 24fcd6e..43cc78e 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -76,7 +76,7 @@ main(void)
if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0)
goto error;
if (NULL==(f=H5I_object(file))) {
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
@@ -88,7 +88,7 @@ main(void)
HDmemset(&oh_loc, 0, sizeof(oh_loc));
if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
PASSED();
@@ -98,17 +98,17 @@ main(void)
time_new = 11111111;
if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (ro!=time_new) {
@@ -126,17 +126,17 @@ main(void)
time_new = 33333333;
if (H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (ro!=time_new) {
@@ -161,13 +161,13 @@ main(void)
time_new = (i+1)*1000+1;
if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
PASSED();
@@ -181,12 +181,12 @@ main(void)
time_new = (i + 1) * 1000 + 10;
if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, TRUE)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
}
@@ -198,24 +198,24 @@ main(void)
TESTING("message deletion");
if (H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) {
H5_FAILED();
puts(" H5O_msg_read() should have failed but didn't");
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
goto error;
}
if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro, H5P_DATASET_XFER_DEFAULT)) {
H5_FAILED();
puts(" H5O_msg_read() should have failed but didn't");
- H5Eclear_stack(H5E_DEFAULT);
+ H5Eclear2(H5E_DEFAULT);
goto error;
}
PASSED();
@@ -225,7 +225,7 @@ main(void)
TESTING("object header closing");
if (H5O_close(&oh_loc)<0) {
H5_FAILED();
- H5Eprint_stack(H5E_DEFAULT, stdout);
+ H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
if (H5Fclose(file)<0) goto error;
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 97e6263..8817725 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -40,7 +40,7 @@
if ((ret) == (val)) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
"in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
} \
} while(0)
@@ -52,7 +52,7 @@
if ((ret)<0) { \
TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \
(where), (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
} \
}
@@ -64,7 +64,7 @@
if (!(ret)) { \
TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \
(where), (int)__LINE__, __FILE__); \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
} \
}
@@ -77,7 +77,7 @@
if ((x) != (val)) { \
TestErrPrintf("*** UNEXPECTED VALUE from %s should be %ld, but is %ld at line %4d " \
"in %s\n", (where), (long)(val), (long)(x), (int)__LINE__, __FILE__); \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
} \
} while(0)
@@ -90,7 +90,7 @@
if (HDstrcmp(x, val)) { \
TestErrPrintf("*** UNEXPECTED VALUE from %s should be %s, but is %s at line %4d " \
"in %s\n", where, val, x, (int)__LINE__, __FILE__); \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
} \
} while(0)
@@ -101,11 +101,11 @@
"%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \
} \
if (GetTestVerbosity()>=VERBO_HI) \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
if ((ret) == FAIL) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \
"in %s\n", func, (long)(ret), (int)__LINE__, __FILE__); \
- H5Eprint_stack(H5E_DEFAULT, stdout); \
+ H5Eprint2(H5E_DEFAULT, stdout); \
} \
} while(0)