summaryrefslogtreecommitdiffstats
path: root/test/lheap.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/lheap.c')
-rw-r--r--test/lheap.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/lheap.c b/test/lheap.c
index f5b7f77..dd8110e 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -20,6 +20,7 @@
#include "h5test.h"
#include "H5srcdir.h"
#include "H5ACprivate.h"
+#include "H5CXprivate.h" /* API Contexts */
#include "H5HLprivate.h"
#include "H5Iprivate.h"
@@ -62,6 +63,7 @@ main(void)
int i, j; /* miscellaneous counters */
char buf[1024]; /* the value to store */
const char *s; /* value to read */
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Reset library */
h5_reset();
@@ -75,6 +77,8 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if(FAIL == (file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)))
goto error;
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
@@ -85,12 +89,12 @@ main(void)
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if(FAIL == H5HL_create(f, H5AC_ind_read_dxpl_id, (size_t)0, &heap_addr/*out*/)) {
+ if(FAIL == H5HL_create(f, (size_t)0, &heap_addr/*out*/)) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
}
- if (NULL == (heap = H5HL_protect(f, H5AC_ind_read_dxpl_id, heap_addr, H5AC__NO_FLAGS_SET))) {
+ if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__NO_FLAGS_SET))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -102,7 +106,7 @@ main(void)
if(j > 4)
buf[j] = '\0';
- if(UFAIL == (obj[i] = H5HL_insert(f, H5AC_ind_read_dxpl_id, heap, strlen(buf) + 1, buf))) {
+ if(UFAIL == (obj[i] = H5HL_insert(f, heap, strlen(buf) + 1, buf))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -115,6 +119,8 @@ main(void)
}
if (FAIL == H5Fclose(file))
goto error;
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED();
/*
@@ -125,6 +131,8 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if(FAIL == (file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)))
goto error;
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
if(NULL == (f = (H5F_t *)H5I_object(file))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
@@ -142,7 +150,7 @@ main(void)
if(j > 4)
buf[j] = '\0';
- if (NULL == (heap = H5HL_protect(f, H5AC_ind_read_dxpl_id, heap_addr, H5AC__READ_ONLY_FLAG))) {
+ if (NULL == (heap = H5HL_protect(f, heap_addr, H5AC__READ_ONLY_FLAG))) {
H5_FAILED();
H5Eprint2(H5E_DEFAULT, stdout);
goto error;
@@ -171,6 +179,8 @@ main(void)
if (FAIL == H5Fclose(file))
goto error;
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED();
/* Check opening existing file non-default sizes of lengths and addresses */
@@ -179,6 +189,8 @@ main(void)
const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */
hid_t dset = -1;
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
if(file >= 0){
if((dset = H5Dopen2(file, "/Dataset1", H5P_DEFAULT)) < 0)
TEST_ERROR
@@ -194,6 +206,8 @@ main(void)
goto error;
} /* end else */
}
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED();
/* Verify symbol table messages are cached */
@@ -208,6 +222,7 @@ main(void)
HDputs("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5Fclose(file);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
}