diff options
Diffstat (limited to 'test/farray.c')
-rw-r--r-- | test/farray.c | 132 |
1 files changed, 69 insertions, 63 deletions
diff --git a/test/farray.c b/test/farray.c index f9f97bf..5ff950e 100644 --- a/test/farray.c +++ b/test/farray.c @@ -25,8 +25,9 @@ #include "H5FApkg.h" /* Fixed Arrays */ /* Other private headers that this test requires */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Iprivate.h" /* IDs */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5VMprivate.h" /* Vectors and arrays */ /* Local macros */ @@ -265,7 +266,7 @@ set_fa_state(const H5FA_create_t *cparam, farray_state_t *state) *------------------------------------------------------------------------- */ static int -reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, +reopen_file(hid_t *file, H5F_t **f, hid_t fapl, H5FA_t **fa, haddr_t fa_addr, const farray_test_param_t *tparam) { /* Check for closing & re-opening the array */ @@ -273,7 +274,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, if(tparam->reopen_array) { /* Close array, if given */ if(fa && *fa) { - if(H5FA_close(*fa, dxpl) < 0) + if(H5FA_close(*fa) < 0) FAIL_STACK_ERROR *fa = NULL; } /* end if */ @@ -300,7 +301,7 @@ reopen_file(hid_t *file, H5F_t **f, hid_t fapl, hid_t dxpl, /* Re-open array, if given */ if(fa) - if(NULL == (*fa = H5FA_open(*f, dxpl, fa_addr, NULL))) + if(NULL == (*fa = H5FA_open(*f, fa_addr, NULL))) FAIL_STACK_ERROR } /* end if */ @@ -323,13 +324,13 @@ error: *------------------------------------------------------------------------- */ static int -create_array(H5F_t *f, hid_t dxpl, const H5FA_create_t *cparam, +create_array(H5F_t *f, const H5FA_create_t *cparam, H5FA_t **fa, haddr_t *fa_addr) { farray_state_t state; /* State of extensible array */ /* Create array */ - if(NULL == (*fa = H5FA_create(f, dxpl, cparam, NULL))) + if(NULL == (*fa = H5FA_create(f, cparam, NULL))) FAIL_STACK_ERROR /* Check status of array */ @@ -400,11 +401,11 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the fixed array */ - if(H5FA_close(fa, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa) < 0) FAIL_STACK_ERROR /* Delete array */ - if(H5FA_delete(f, H5AC_ind_read_dxpl_id, fa_addr, NULL) < 0) + if(H5FA_delete(f, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -462,11 +463,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.raw_elmt_size = 0; H5E_BEGIN_TRY { - fa = H5FA_create(f, H5AC_ind_read_dxpl_id, &test_cparam, NULL); + fa = H5FA_create(f, &test_cparam, NULL); } H5E_END_TRY; if(fa) { /* Close opened fixed array */ - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); fa = NULL; /* Indicate error */ @@ -477,11 +478,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = 0; H5E_BEGIN_TRY { - fa = H5FA_create(f, H5AC_ind_read_dxpl_id, &test_cparam, NULL); + fa = H5FA_create(f, &test_cparam, NULL); } H5E_END_TRY; if(fa) { /* Close opened fixed array */ - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); fa = NULL; /* Indicate error */ @@ -492,11 +493,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.nelmts = 0; H5E_BEGIN_TRY { - fa = H5FA_create(f, H5AC_ind_read_dxpl_id, &test_cparam, NULL); + fa = H5FA_create(f, &test_cparam, NULL); } H5E_END_TRY; if(fa) { /* Close opened fixed array */ - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); fa = NULL; /* Indicate error */ @@ -516,7 +517,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE TESTING("fixed array creation"); /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR PASSED() @@ -540,7 +541,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); H5Fclose(file); } H5E_END_TRY; @@ -576,19 +577,19 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TESTING("create, close & reopen fixed array"); /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Close the fixed array */ - if(H5FA_close(fa, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5AC_ind_read_dxpl_id, NULL, HADDR_UNDEF, tparam) < 0) + if(reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0) TEST_ERROR /* Re-open the array */ - if(NULL == (fa = H5FA_open(f, H5AC_ind_read_dxpl_id, fa_addr, NULL))) + if(NULL == (fa = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -607,7 +608,7 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); H5Fclose(file); } H5E_END_TRY; @@ -646,11 +647,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TESTING("open fixed array twice"); /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, H5AC_ind_read_dxpl_id, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -660,12 +661,12 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5AC_ind_read_dxpl_id, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ @@ -677,7 +678,7 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, H5AC_ind_read_dxpl_id, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -685,7 +686,7 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5FA_close(fa, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -708,9 +709,9 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); if(fa2) - H5FA_close(fa2, H5AC_ind_read_dxpl_id); + H5FA_close(fa2); H5Fclose(file); H5Fclose(file2); } H5E_END_TRY; @@ -758,11 +759,11 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa TEST_ERROR /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, H5AC_ind_read_dxpl_id, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -772,7 +773,7 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; @@ -784,11 +785,11 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5AC_ind_read_dxpl_id, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ - if(H5FA_close(fa, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; @@ -819,7 +820,7 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, H5AC_ind_read_dxpl_id, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f2, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -844,9 +845,9 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); if(fa2) - H5FA_close(fa2, H5AC_ind_read_dxpl_id); + H5FA_close(fa2); H5Fclose(file); H5Fclose(file2); H5Fclose(file0); @@ -887,15 +888,15 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TESTING("deleting open fixed array"); /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again */ - if(NULL == (fa2 = H5FA_open(f, H5AC_ind_read_dxpl_id, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f, fa_addr, NULL))) FAIL_STACK_ERROR /* Request that the array be deleted */ - if(H5FA_delete(f, H5AC_ind_read_dxpl_id, fa_addr, NULL) < 0) + if(H5FA_delete(f, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -905,38 +906,38 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa2) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Try re-opening the array again (should fail, as array will be deleted) */ H5E_BEGIN_TRY { - fa2 = H5FA_open(f, H5AC_ind_read_dxpl_id, fa_addr, NULL); + fa2 = H5FA_open(f, fa_addr, NULL); } H5E_END_TRY; if(fa2) { /* Close opened array */ - H5FA_close(fa2, H5AC_ind_read_dxpl_id); + H5FA_close(fa2); /* Indicate error */ TEST_ERROR } /* end if */ /* Close the first fixed array wrapper */ - if(H5FA_close(fa, H5AC_ind_read_dxpl_id) < 0) + if(H5FA_close(fa) < 0) FAIL_STACK_ERROR fa = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5AC_ind_read_dxpl_id, NULL, HADDR_UNDEF, tparam) < 0) + if(reopen_file(&file, &f, fapl, NULL, HADDR_UNDEF, tparam) < 0) TEST_ERROR /* Try re-opening the array again (should fail, as array is now deleted) */ H5E_BEGIN_TRY { - fa = H5FA_open(f, H5AC_ind_read_dxpl_id, fa_addr, NULL); + fa = H5FA_open(f, fa_addr, NULL); } H5E_END_TRY; if(fa) { /* Close opened array */ - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); /* Indicate error */ TEST_ERROR @@ -962,9 +963,9 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); if(fa2) - H5FA_close(fa2, H5AC_ind_read_dxpl_id); + H5FA_close(fa2); H5Fclose(file); } H5E_END_TRY; @@ -1391,7 +1392,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -1399,7 +1400,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5AC_ind_read_dxpl_id, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) TEST_ERROR if(H5FA_get_nelmts(fa, &fa_nelmts) < 0) @@ -1431,7 +1432,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5AC_ind_read_dxpl_id, idx, &relmt) < 0) + if(H5FA_get(fa, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1458,7 +1459,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, idx = (hsize_t)sidx; relmt = (uint64_t)0; - if(H5FA_get(fa, H5AC_ind_read_dxpl_id, idx, &relmt) < 0) + if(H5FA_get(fa, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved element is correct */ @@ -1467,12 +1468,12 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Set element of array */ welmt = (uint64_t)7 + idx; - if(H5FA_set(fa, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) + if(H5FA_set(fa, idx, &welmt) < 0) FAIL_STACK_ERROR /* Retrieve element of array (set now) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5AC_ind_read_dxpl_id, idx, &relmt) < 0) + if(H5FA_get(fa, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved element is correct */ @@ -1502,7 +1503,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); H5Fclose(file); } H5E_END_TRY; @@ -1546,7 +1547,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Create array */ - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &fa, &fa_addr) < 0) + if(create_array(f, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -1554,7 +1555,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5AC_ind_read_dxpl_id, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, &fa, fa_addr, tparam) < 0) TEST_ERROR if(H5FA_get_nelmts(fa, &fa_nelmts) < 0) @@ -1576,7 +1577,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5AC_ind_read_dxpl_id, idx, &relmt) < 0) + if(H5FA_get(fa, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1585,7 +1586,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Set element of array */ welmt = (uint64_t)7 + idx; - if(H5FA_set(fa, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) + if(H5FA_set(fa, idx, &welmt) < 0) FAIL_STACK_ERROR /* Verify array state */ @@ -1596,7 +1597,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Retrieve element of array (set now) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5AC_ind_read_dxpl_id, idx, &relmt) < 0) + if(H5FA_get(fa, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1608,7 +1609,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, for(cnt = 0; cnt < skip_elmts; cnt++) { /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5AC_ind_read_dxpl_id, cnt, &relmt) < 0) + if(H5FA_get(fa, cnt, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1629,7 +1630,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5AC_ind_read_dxpl_id); + H5FA_close(fa); H5Fclose(file); } H5E_END_TRY; @@ -1658,6 +1659,7 @@ main(void) unsigned nerrors = 0; /* Cumulative error count */ time_t curr_time; /* Current time, for seeding random number generator */ int ExpressMode; /* Test express value */ +hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ /* Reset library */ h5_reset(); @@ -1668,6 +1670,8 @@ main(void) /* Set the filename to use for this test (dependent on fapl) */ h5_fixname(FILENAME[0], fapl, filename_g, sizeof(filename_g)); +if(H5CX_push() < 0) FAIL_STACK_ERROR +api_ctx_pushed = TRUE; /* Seed random #'s */ curr_time = HDtime(NULL); @@ -1787,6 +1791,8 @@ main(void) /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); +if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR +api_ctx_pushed = FALSE; if(nerrors) goto error; |