summaryrefslogtreecommitdiffstats
path: root/test/ohdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/ohdr.c')
-rw-r--r--test/ohdr.c134
1 files changed, 69 insertions, 65 deletions
diff --git a/test/ohdr.c b/test/ohdr.c
index ab50a5f5..d0f6966 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -31,6 +31,8 @@
#define H5G_FRIEND /*suppress error about including H5Gpkg */
#include "H5Gpkg.h"
+#include "H5CXprivate.h" /* API Contexts */
+
const char *FILENAME[] = {
"ohdr",
NULL
@@ -84,51 +86,51 @@ test_cont(char *filename, hid_t fapl)
goto error;
} /* end if */
- if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0)
+ if(H5O_create(f, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0)
FAIL_STACK_ERROR
- if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0)
+ if(H5O_create(f, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0)
FAIL_STACK_ERROR
time_new = 11111111;
- if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name) < 0)
FAIL_STACK_ERROR
- if(1 != H5O_link(&oh_locA, 1, H5AC_ind_read_dxpl_id))
+ if(1 != H5O_link(&oh_locA, 1))
FAIL_STACK_ERROR
- if(1 != H5O_link(&oh_locB, 1, H5AC_ind_read_dxpl_id))
+ if(1 != H5O_link(&oh_locB, 1))
FAIL_STACK_ERROR
- if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5O_expunge_chunks_test(&oh_locA, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_expunge_chunks_test(&oh_locA) < 0)
FAIL_STACK_ERROR
- if(H5O_get_hdr_info(&oh_locA, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
+ if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0)
FAIL_STACK_ERROR
nchunks = hdr_info.nchunks;
/* remove the 1st H5O_NAME_ID message */
- if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE) < 0)
FAIL_STACK_ERROR
- if(H5O_get_hdr_info(&oh_locA, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
+ if(H5O_get_hdr_info(&oh_locA, &hdr_info) < 0)
FAIL_STACK_ERROR
if(hdr_info.nchunks >= nchunks)
@@ -143,7 +145,6 @@ test_cont(char *filename, hid_t fapl)
PASSED();
-
return SUCCEED;
error:
@@ -169,7 +170,6 @@ test_ohdr_cache(char *filename, hid_t fapl)
{
hid_t file = -1; /* File ID */
hid_t my_fapl; /* FAPL ID */
- hid_t my_dxpl; /* DXPL ID */
H5AC_cache_config_t mdc_config; /* Metadata cache configuration info */
H5F_t *f = NULL; /* File handle */
H5HL_t *lheap, *lheap2, *lheap3; /* Pointer to local heaps */
@@ -195,10 +195,6 @@ test_ohdr_cache(char *filename, hid_t fapl)
if(H5Pset_mdc_config(my_fapl, &mdc_config) < 0)
FAIL_STACK_ERROR
- /* Make a copy of the default DXPL */
- if((my_dxpl = H5Pcopy(H5AC_ind_read_dxpl_id)) < 0)
- FAIL_STACK_ERROR
-
/* Create the file to operate on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
FAIL_STACK_ERROR
@@ -210,31 +206,31 @@ test_ohdr_cache(char *filename, hid_t fapl)
FAIL_STACK_ERROR
/* Create object (local heap) that occupies most of cache */
- if(H5HL_create(f, my_dxpl, (31 * 1024), &lheap_addr) < 0)
+ if(H5HL_create(f, (31 * 1024), &lheap_addr) < 0)
FAIL_STACK_ERROR
/* Protect local heap (which actually pins it in the cache) */
- if(NULL == (lheap = H5HL_protect(f, my_dxpl, lheap_addr, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (lheap = H5HL_protect(f, lheap_addr, H5AC__READ_ONLY_FLAG)))
FAIL_STACK_ERROR
/* Create an object header */
HDmemset(&oh_loc, 0, sizeof(oh_loc));
- if(H5O_create(f, my_dxpl, (size_t)2048, (size_t)1, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
+ if(H5O_create(f, (size_t)2048, (size_t)1, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
FAIL_STACK_ERROR
/* Query object header information */
rc = 0;
- if(H5O_get_rc(&oh_loc, my_dxpl, &rc) < 0)
+ if(H5O_get_rc(&oh_loc, &rc) < 0)
FAIL_STACK_ERROR
if(0 != rc)
TEST_ERROR
/* Create object (local heap) that occupies most of cache */
- if(H5HL_create(f, my_dxpl, (31 * 1024), &lheap_addr2) < 0)
+ if(H5HL_create(f, (31 * 1024), &lheap_addr2) < 0)
FAIL_STACK_ERROR
/* Protect local heap (which actually pins it in the cache) */
- if(NULL == (lheap2 = H5HL_protect(f, my_dxpl, lheap_addr2, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (lheap2 = H5HL_protect(f, lheap_addr2, H5AC__READ_ONLY_FLAG)))
FAIL_STACK_ERROR
/* Unprotect local heap (which actually unpins it from the cache) */
@@ -243,15 +239,15 @@ test_ohdr_cache(char *filename, hid_t fapl)
/* Create object header message in new object header */
time_new = 11111111;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, my_dxpl) < 0)
+ if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
/* Create object (local heap) that occupies most of cache */
- if(H5HL_create(f, my_dxpl, (31 * 1024), &lheap_addr3) < 0)
+ if(H5HL_create(f, (31 * 1024), &lheap_addr3) < 0)
FAIL_STACK_ERROR
/* Protect local heap (which actually pins it in the cache) */
- if(NULL == (lheap3 = H5HL_protect(f, my_dxpl, lheap_addr3, H5AC__READ_ONLY_FLAG)))
+ if(NULL == (lheap3 = H5HL_protect(f, lheap_addr3, H5AC__READ_ONLY_FLAG)))
FAIL_STACK_ERROR
/* Unprotect local heap (which actually unpins it from the cache) */
@@ -265,13 +261,13 @@ test_ohdr_cache(char *filename, hid_t fapl)
* a non-invasive way -QAK)
*/
rc = 0;
- if(H5O_get_rc(&oh_loc, my_dxpl, &rc) < 0)
+ if(H5O_get_rc(&oh_loc, &rc) < 0)
FAIL_STACK_ERROR
if(0 != rc)
TEST_ERROR
/* Decrement reference count o object header */
- if(H5O_dec_rc_by_loc(&oh_loc, my_dxpl) < 0)
+ if(H5O_dec_rc_by_loc(&oh_loc) < 0)
FAIL_STACK_ERROR
/* Close object header created */
@@ -282,8 +278,6 @@ test_ohdr_cache(char *filename, hid_t fapl)
if(H5HL_unprotect(lheap) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(my_dxpl) < 0)
- FAIL_STACK_ERROR
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
@@ -741,7 +735,7 @@ error:
#define STR_EARLIEST "earliest"
#define STR_V18 "v18"
#define STR_LATEST "latest"
-char *version_string(H5F_libver_t libver)
+static char *version_string(H5F_libver_t libver)
{
char *str = NULL;
@@ -806,9 +800,9 @@ main(void)
H5O_loc_t oh_loc; /* Object header locations */
H5F_libver_t low, high; /* File format bounds */
time_t time_new, ro;
- unsigned b; /* Index for "new format" loop */
char msg[80]; /* Message for file format version */
int i; /* Local index variable */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret; /* Generic return value */
/* Reset library */
@@ -816,6 +810,10 @@ main(void)
fapl = h5_fileaccess();
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ /* Push API context */
+ if(H5CX_push() < 0) FAIL_STACK_ERROR
+ api_ctx_pushed = TRUE;
+
/* Loop through all the combinations of low/high library format bounds */
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
@@ -860,22 +858,22 @@ main(void)
*/
TESTING("object header creation");
HDmemset(&oh_loc, 0, sizeof(oh_loc));
- if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
+ if(H5O_create(f, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0)
FAIL_STACK_ERROR
PASSED();
/* create a new message */
TESTING("message creation");
time_new = 11111111;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(1 != H5O_link(&oh_loc, 1, H5AC_ind_read_dxpl_id))
+ if(1 != H5O_link(&oh_loc, 1))
FAIL_STACK_ERROR
- if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_ind_read_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
- if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_ind_read_dxpl_id))
+ if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
FAIL_STACK_ERROR
if(ro != time_new)
TEST_ERROR
@@ -886,19 +884,19 @@ main(void)
*/
TESTING("message modification");
time_new = 33333333;
- if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_ind_read_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
- if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_ind_read_dxpl_id))
+ if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
FAIL_STACK_ERROR
if(ro != time_new)
TEST_ERROR
/* Make certain that chunk #0 in the object header can be encoded with a 1-byte size */
- if(H5O_get_hdr_info(&oh_loc, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
+ if(H5O_get_hdr_info(&oh_loc, &hdr_info) < 0)
FAIL_STACK_ERROR
if(hdr_info.space.total >=256)
TEST_ERROR
@@ -916,16 +914,16 @@ main(void)
TESTING("object header overflow in memory");
for(i = 0; i < 40; i++) {
time_new = (i + 1) * 1000 + 1000000;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
} /* end for */
- if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_ind_read_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
/* Make certain that chunk #0 in the object header will be encoded with a 2-byte size */
- if(H5O_get_hdr_info(&oh_loc, H5AC_ind_read_dxpl_id, &hdr_info) < 0)
+ if(H5O_get_hdr_info(&oh_loc, &hdr_info) < 0)
FAIL_STACK_ERROR
if(hdr_info.space.total < 256)
TEST_ERROR
@@ -960,11 +958,11 @@ main(void)
TESTING("object header overflow on disk");
for(i = 0; i < 10; i++) {
time_new = (i + 1) * 1000 + 10;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_ind_read_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
} /* end for */
PASSED();
@@ -973,13 +971,13 @@ main(void)
* Delete all time messages.
*/
TESTING("message deletion");
- if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE) < 0)
FAIL_STACK_ERROR
- if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_ind_read_dxpl_id))
+ if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
FAIL_STACK_ERROR
- if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro, H5AC_ind_read_dxpl_id))
+ if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro))
FAIL_STACK_ERROR
PASSED();
@@ -990,23 +988,23 @@ main(void)
*/
TESTING("constant message handling");
time_new = 22222222;
- if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new) < 0)
FAIL_STACK_ERROR
- if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0)
+ if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
- if(H5AC_expunge_entry(f, H5AC_ind_read_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
+ if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
- if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_ind_read_dxpl_id))
+ if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
FAIL_STACK_ERROR
if(ro != time_new)
TEST_ERROR
time_new = 33333333;
H5E_BEGIN_TRY {
- ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id);
+ ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
- if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5AC_ind_read_dxpl_id) < 0)
+ if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -1045,6 +1043,10 @@ main(void)
if(test_ohdr_swmr(TRUE) < 0) TEST_ERROR
if(test_ohdr_swmr(FALSE) < 0) TEST_ERROR
+ /* Pop API context */
+ if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ api_ctx_pushed = FALSE;
+
HDputs("All object header tests passed.");
h5_cleanup(FILENAME, fapl);
return 0;
@@ -1055,6 +1057,8 @@ error:
H5Fclose(file);
} H5E_END_TRY;
+ if(api_ctx_pushed) H5CX_pop();
+
return 1;
} /* end main() */