diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-09-01 17:43:30 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-09-01 17:43:30 (GMT) |
commit | cb7f03a26ff906175e5bf37af57547681683770f (patch) | |
tree | d8d167353c83fe6caebc6df15c33ca1c7f6dc521 /test | |
parent | 226f162ce75ff63e3d1468d17528ba629c51db58 (diff) | |
download | hdf5-cb7f03a26ff906175e5bf37af57547681683770f.zip hdf5-cb7f03a26ff906175e5bf37af57547681683770f.tar.gz hdf5-cb7f03a26ff906175e5bf37af57547681683770f.tar.bz2 |
[svn-r9183] Purpose: New feature
Description: Restore 6 old error API functions back to the library to be backward
compatible with v1.6. They are H5Epush, H5Eprint, H5Ewalk, H5Eclear, H5Eset_auto,
H5Eget_auto. These functions do not have error stack as parameter.
Solution: Internally, these functions use default error stack.
Platforms tested: h5committest and fuss.
Misc. update: RELEASE.txt
Diffstat (limited to 'test')
-rw-r--r-- | test/enum.c | 6 | ||||
-rw-r--r-- | test/err_compat.c | 3 | ||||
-rw-r--r-- | test/error_test.c | 31 | ||||
-rw-r--r-- | test/filename.c | 17 | ||||
-rw-r--r-- | test/gheap.c | 42 | ||||
-rw-r--r-- | test/h5test.c | 22 | ||||
-rw-r--r-- | test/lheap.c | 42 | ||||
-rw-r--r-- | test/ohdr.c | 134 | ||||
-rw-r--r-- | test/testframe.c | 6 | ||||
-rw-r--r-- | test/testhdf5.h | 88 |
10 files changed, 69 insertions, 322 deletions
diff --git a/test/enum.c b/test/enum.c index bd8397b..b80d488 100644 --- a/test/enum.c +++ b/test/enum.c @@ -376,11 +376,7 @@ test_value_dsnt_exist(void) TESTING("for non-existing name and value"); /* Turn off error reporting since we expect failure in this test */ -#ifdef H5_WANT_H5_V1_6_COMPAT - if (H5Eset_auto(NULL, NULL) < 0) goto error; -#else - if (H5Eset_auto(H5E_DEFAULT, NULL, NULL) < 0) goto error; -#endif /* H5_WANT_H5_V1_6_COMPAT */ + if (H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL) < 0) goto error; if ((datatype_id = H5Tenum_create(H5T_NATIVE_INT))< 0) goto error; diff --git a/test/err_compat.c b/test/err_compat.c index f06ca10..740fe42 100644 --- a/test/err_compat.c +++ b/test/err_compat.c @@ -226,7 +226,6 @@ main(void) const char *FUNC_main="main"; fprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There're supposed to be some error messages\n"); - /*h5_reset();*/ fapl = h5_fileaccess(); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); @@ -262,4 +261,4 @@ main(void) printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /* H5_WANT_H5_V1_6_COMPAT */ +#endif /*H5_WANT_H5_V1_6_COMPAT*/ diff --git a/test/error_test.c b/test/error_test.c index ebe0b7e..bd5ee2c 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -119,35 +119,35 @@ test_error(hid_t file) /* Create the dataset */ if ((dataset = H5Dcreate(file, DSET_NAME, H5T_STD_I32BE, space, H5P_DEFAULT))<0) { - H5Epush(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, + H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_CREATE, "H5Dcreate failed"); goto error; } /* Test enabling and disabling default printing */ - if (H5Eget_auto(H5E_DEFAULT, &old_func, &old_data)<0) + if (H5Eget_auto_stack(H5E_DEFAULT, &old_func, &old_data)<0) TEST_ERROR; if (old_data != NULL) TEST_ERROR; - if (old_func != (H5E_auto_t)H5Eprint) + if (old_func != (H5E_auto_t)H5Eprint_stack) TEST_ERROR; - if(H5Eset_auto(H5E_DEFAULT, NULL, NULL)<0) + if(H5Eset_auto_stack(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(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, + H5Epush_stack(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, "H5Dwrite shouldn't succeed"); goto error; } - if(H5Eset_auto(H5E_DEFAULT, old_func, old_data)<0) + if(H5Eset_auto_stack(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(H5E_DEFAULT, __FILE__, FUNC_test_error, __LINE__, ERR_CLS, ERR_MAJ_IO, ERR_MIN_WRITE, + H5Epush_stack(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); @@ -269,7 +269,7 @@ error_stack(void) /* Make it push error, force this function to fail */ if((err_num = H5Eget_num(ERR_STACK))==0) { - H5Epush(ERR_STACK, __FILE__, FUNC_error_stack, __LINE__, ERR_CLS, ERR_MAJ_API, ERR_MIN_GETNUM, + H5Epush_stack(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; } @@ -307,12 +307,12 @@ dump_error(hid_t estack) { /* Print errors in library default way */ fprintf(stderr, "********* Print error stack in HDF5 default way *********\n"); - if(H5Eprint(estack, stderr)<0) + if(H5Eprint_stack(estack, stderr)<0) TEST_ERROR; /* Customized way to print errors */ fprintf(stderr, "\n********* Print error stack in customized way *********\n"); - if(H5Ewalk(estack, H5E_WALK_UPWARD, custom_print_cb, stderr)<0) + if(H5Ewalk_stack(estack, H5E_WALK_UPWARD, custom_print_cb, stderr)<0) TEST_ERROR; return 0; @@ -432,7 +432,6 @@ main(void) const char *FUNC_main="main"; fprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n"); - /*h5_reset();*/ /* Initialize errors */ if(init_error()<0) @@ -447,7 +446,7 @@ main(void) /* Test error stack */ if(error_stack()<0) { /* Push an error onto error stack */ - H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, + H5Epush_stack(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_ERRSTACK, "Error stack test failed"); /* Delete an error from the top of error stack */ @@ -457,7 +456,7 @@ main(void) dump_error(ERR_STACK); /* Empty error stack */ - H5Eclear(ERR_STACK); + H5Eclear_stack(ERR_STACK); /* Close error stack */ H5Eclose_stack(ERR_STACK); @@ -465,10 +464,10 @@ main(void) /* Test error API */ if(test_error(file)<0) { - H5Epush(H5E_DEFAULT, __FILE__, FUNC_main, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, + H5Epush_stack(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(estack_id, stderr); + H5Eprint_stack(estack_id, stderr); H5Eclose_stack(estack_id); } @@ -486,4 +485,4 @@ main(void) printf("***** ERROR TEST FAILED! *****\n"); return 1; } -#endif /* H5_WANT_H5_V1_6_COMPAT */ +#endif /*H5_WANT_H5_V1_6_COMPAT*/ diff --git a/test/filename.c b/test/filename.c index 9a4af54..5439d14 100644 --- a/test/filename.c +++ b/test/filename.c @@ -41,7 +41,6 @@ typedef struct s1_t { } s1_t; /* Used to make certain a return name _is_ the file name */ -#ifdef H5_WANT_H5_V1_6_COMPAT #define VERIFY_NAME(x, val, where) do { \ if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ @@ -50,24 +49,10 @@ typedef struct s1_t { if (strcmp(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 (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ HDstrcmp(x, ""); \ } while(0) -#else /* H5_WANT_H5_V1_6_COMPAT */ -#define VERIFY_NAME(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ - } \ - if (strcmp(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 (H5E_DEFAULT, stdout); \ - } \ - HDstrcmp(x, ""); \ -} while(0) -#endif /* H5_WANT_H5_V1_6_COMPAT */ int main( void ) { diff --git a/test/gheap.c b/test/gheap.c index d7098ea..9417e73 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -89,11 +89,7 @@ test_1 (hid_t fapl) for (i=0; i<1024; i++) { size = i+1; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); @@ -112,11 +108,7 @@ test_1 (hid_t fapl) for (i=0; i<1024; i++) { size = i+1; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) { H5_FAILED(); puts(" Unable to read object"); @@ -189,11 +181,7 @@ test_2 (hid_t fapl) for (i=0; i<1024; i++) { size = 1024-i; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(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"); @@ -207,11 +195,7 @@ test_2 (hid_t fapl) for (i=0; i<1024; i++) { size = 1024-i; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in)) { H5_FAILED(); puts(" Unable to read object"); @@ -282,11 +266,7 @@ test_3 (hid_t fapl) for (i=0; i<1024; i++) { size = i%30+100; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); @@ -365,11 +345,7 @@ test_4 (hid_t fapl) /* Insert */ size = i%30+100; memset (out, 'A'+i%26, size); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); if (status<0) { H5_FAILED(); @@ -383,11 +359,7 @@ test_4 (hid_t fapl) * remove B, insert D, E, F; remove E; etc. */ if (1==i%3) { -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i-1); if (status<0) { H5_FAILED(); diff --git a/test/h5test.c b/test/h5test.c index 1338b5b..042c763 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -89,11 +89,7 @@ MPI_Info h5_io_info_g=MPI_INFO_NULL;/* MPI INFO object for IO */ */ static const char *multi_letters = "msbrglo"; -#ifdef H5_WANT_H5_V1_6_COMPAT -static herr_t h5_errors(void *client_data); -#else /* H5_WANT_H5_V1_6_COMPAT */ static herr_t h5_errors(hid_t err_stack, void *client_data); -#endif /* H5_WANT_H5_V1_6_COMPAT */ /*------------------------------------------------------------------------- @@ -112,20 +108,11 @@ static herr_t h5_errors(hid_t err_stack, void *client_data); * *------------------------------------------------------------------------- */ -#ifdef H5_WANT_H5_V1_6_COMPAT -static herr_t -h5_errors(void UNUSED *client_data) -#else static herr_t h5_errors(hid_t err_stack, void UNUSED *client_data) -#endif /* H5_WANT_H5_V1_6_COMPAT */ { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint (stdout); -#else - H5Eprint (err_stack, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(err_stack, stdout); return 0; } @@ -228,11 +215,8 @@ h5_reset(void) HDfflush(stdout); HDfflush(stderr); H5close(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eset_auto (h5_errors, NULL); -#else - H5Eset_auto (H5E_DEFAULT, h5_errors, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + + H5Eset_auto_stack(H5E_DEFAULT, h5_errors, NULL); /* * Cause the library to emit some diagnostics early so they don't diff --git a/test/lheap.c b/test/lheap.c index e1694ba..76c11a0 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -74,20 +74,12 @@ main(void) goto error; if (NULL==(f=H5I_object(file))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5HL_create(f, H5P_DATASET_XFER_DEFAULT, 0, &heap_addr/*out*/)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } for (i = 0; i < NOBJS; i++) { @@ -98,11 +90,7 @@ main(void) if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap_addr, strlen(buf)+1, buf))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } } @@ -118,11 +106,7 @@ main(void) if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error; if (NULL==(f=H5I_object(file))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } for (i=0; i<NOBJS; i++) { @@ -134,21 +118,13 @@ main(void) if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (NULL == (s = H5HL_offset_into(f, heap, obj[i]))) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } @@ -162,11 +138,7 @@ main(void) if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } } diff --git a/test/ohdr.c b/test/ohdr.c index a893d08..e74f35b 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -74,11 +74,7 @@ main(void) if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error; if (NULL==(f=H5I_object(file))) { -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } @@ -89,11 +85,7 @@ main(void) HDmemset(&oh_ent,0,sizeof(H5G_entry_t)); if (H5O_create(f, H5P_DATASET_XFER_DEFAULT, 64, &oh_ent/*out*/)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } PASSED(); @@ -103,29 +95,17 @@ main(void) time_new = 11111111; if (H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (NULL==H5O_read(&oh_ent, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (ro!=time_new) { @@ -143,29 +123,17 @@ main(void) time_new = 33333333; if (H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, 0, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (NULL==H5O_read(&oh_ent, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (ro!=time_new) { @@ -184,29 +152,17 @@ main(void) time_new = 55555555; if (H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (NULL==H5O_read(&oh_ent, H5O_MTIME_NEW_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (ro!=time_new) { @@ -224,29 +180,17 @@ main(void) time_new = 77777777; if (H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, 1, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (NULL==H5O_read(&oh_ent, H5O_MTIME_NEW_ID, 1, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (ro!=time_new) { @@ -270,21 +214,13 @@ main(void) time_new = (i+1)*1000+1; if (H5O_modify(&oh_ent, H5O_MTIME_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } PASSED(); @@ -298,11 +234,7 @@ main(void) time_new = (i + 1) * 1000 + 10; if (H5O_modify(&oh_ent, H5O_MTIME_NEW_ID, H5O_NEW_MESG, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5AC_flush(f, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, TRUE)<0) { @@ -310,7 +242,7 @@ main(void) #ifdef H5_WANT_H5_V1_6_COMPAT H5Eprint(stdout); #else - H5Eprint(H5E_DEFAULT, stdout); + H5Eprint_stack(H5E_DEFAULT, stdout); #endif /* H5_WANT_H5_V1_6_COMPAT */ goto error; } @@ -323,40 +255,24 @@ main(void) TESTING("message deletion"); if (H5O_remove(&oh_ent, H5O_MTIME_NEW_ID, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5O_remove(&oh_ent, H5O_MTIME_ID, H5O_ALL, H5P_DATASET_XFER_DEFAULT)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5O_read(&oh_ent, H5O_MTIME_NEW_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_read() should have failed but didn't"); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); goto error; } if (H5O_read(&oh_ent, H5O_MTIME_ID, 0, &ro, H5P_DATASET_XFER_DEFAULT)) { H5_FAILED(); puts(" H5O_read() should have failed but didn't"); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eclear(); -#else - H5Eclear(H5E_DEFAULT); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eclear_stack(H5E_DEFAULT); goto error; } PASSED(); @@ -366,11 +282,7 @@ main(void) TESTING("object header closing"); if (H5O_close(&oh_ent)<0) { H5_FAILED(); -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eprint(stdout); -#else - H5Eprint(H5E_DEFAULT, stdout); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eprint_stack(H5E_DEFAULT, stdout); goto error; } if (H5Fclose(file)<0) goto error; diff --git a/test/testframe.c b/test/testframe.c index b0bfacf..bebc612 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -133,11 +133,7 @@ void TestInit(const char *ProgName, void (*private_usage)(void), int (*private_p * 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. */ -#ifdef H5_WANT_H5_V1_6_COMPAT - H5Eset_auto (NULL, NULL); -#else - H5Eset_auto (H5E_DEFAULT, NULL, NULL); -#endif /* H5_WANT_H5_V1_6_COMPAT */ + H5Eset_auto_stack(H5E_DEFAULT, NULL, NULL); /* * Record the program name and private routines if provided. diff --git a/test/testhdf5.h b/test/testhdf5.h index f01a32e..e00f56d 100644 --- a/test/testhdf5.h +++ b/test/testhdf5.h @@ -31,7 +31,6 @@ /* Use %ld to print the value because long should cover most cases. */ /* Used to make certain a return value _is_not_ a value */ -#ifdef H5_WANT_H5_V1_6_COMPAT #define CHECK(ret, val, where) do { \ if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ "in %s returned %ld \n", \ @@ -40,7 +39,7 @@ if ((ret) == (val)) { \ TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } while(0) @@ -52,117 +51,50 @@ if ((ret)<0) { \ TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } #define CHECK_PTR(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ (where), (int)__LINE__, __FILE__, (ret)); \ } \ if (!(ret)) { \ TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ (where), (int)__LINE__, __FILE__); \ - H5Eprint (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } /* Used to make certain a return value _is_ a value */ #define VERIFY(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ + if (GetTestVerbosity()>=VERBO_HI) { \ print_func(" Call to routine: %15s at line %4d in %s had value " \ "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ } \ 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 (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } while(0) /* Used to document process through a test and to check for errors */ #define RESULT(ret,func) do { \ - if (GetTestVerbosity()>VERBO_MED) { \ + if (GetTestVerbosity()>VERBO_MED) { \ print_func(" Call to routine: %15s at line %4d in %s returned " \ "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ } \ - if (GetTestVerbosity()>=VERBO_HI) \ - H5Eprint(stdout); \ + if (GetTestVerbosity()>=VERBO_HI) \ + H5Eprint_stack(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 (stdout); \ + H5Eprint_stack(H5E_DEFAULT, stdout); \ } \ } while(0) -#else -#define CHECK(ret, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) print_func(" Call to routine: %15s at line %4d " \ - "in %s returned %ld \n", \ - where, (int)__LINE__, __FILE__, \ - (long)(ret)); \ - if ((ret) == (val)) { \ - TestErrPrintf("*** UNEXPECTED RETURN from %s is %ld at line %4d " \ - "in %s\n", where, (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} while(0) - -#define CHECK_I(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %ld\n", \ - (where), (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if ((ret)<0) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is %ld line %4d in %s\n", \ - (where), (long)(ret), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} - -#define CHECK_PTR(ret,where) { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s returned %p\n", \ - (where), (int)__LINE__, __FILE__, (ret)); \ - } \ - if (!(ret)) { \ - TestErrPrintf ("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", \ - (where), (int)__LINE__, __FILE__); \ - H5Eprint (H5E_DEFAULT, stdout); \ - } \ -} - -/* Used to make certain a return value _is_ a value */ -#define VERIFY(x, val, where) do { \ - if (GetTestVerbosity()>=VERBO_HI) { \ - print_func(" Call to routine: %15s at line %4d in %s had value " \ - "%ld \n", (where), (int)__LINE__, __FILE__, (long)(x)); \ - } \ - 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 (H5E_DEFAULT, stdout); \ - } \ -} while(0) - -/* Used to document process through a test and to check for errors */ -#define RESULT(ret,func) do { \ - if (GetTestVerbosity()>VERBO_MED) { \ - print_func(" Call to routine: %15s at line %4d in %s returned " \ - "%ld\n", func, (int)__LINE__, __FILE__, (long)(ret)); \ - } \ - if (GetTestVerbosity()>=VERBO_HI) \ - H5Eprint(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 (H5E_DEFAULT, stdout); \ - } \ -} while(0) - -#endif /* H5_WANT_H5_V1_6_COMPAT */ - /* Used to document process through a test */ #define MESSAGE(V,A) {if (GetTestVerbosity()>(V)) print_func A;} |