summaryrefslogtreecommitdiffstats
path: root/test/cache_tagging.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2018-03-15 21:54:30 (GMT)
commit4a17aff4085ad6ee265b95730aca3f493056dec8 (patch)
tree8bfb665c6d95a2e3520fa1bb0ff54d95aff3923f /test/cache_tagging.c
parent853ae26333592faf69cd8c454ef92ffea8549df5 (diff)
downloadhdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.zip
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.gz
hdf5-4a17aff4085ad6ee265b95730aca3f493056dec8.tar.bz2
Add API context interface and use it throughout the library.
Diffstat (limited to 'test/cache_tagging.c')
-rw-r--r--test/cache_tagging.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index 9c79968..15ce6c2 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -22,6 +22,7 @@
#include "testhdf5.h"
#include "cache_common.h"
+#include "H5CXprivate.h" /* API Contexts */
#include "H5HLprivate.h"
/* ============ */
@@ -349,7 +350,7 @@ evict_entries(hid_t fid)
/* Evict all we can from the cache to examine full tag creation tree */
/* This function will likely return failure since the root group
* is still protected. Thus, don't check its return value. */
- H5C_flush_cache(f, H5P_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG);
return 0;
@@ -3635,9 +3636,9 @@ check_invalid_tag_application(void)
/* Variables */
H5F_t * f = NULL;
hid_t fid = -1;
- hid_t dxpl_id = -1;
haddr_t addr;
H5HL_t * lheap = NULL;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
/* Testing Macro */
@@ -3646,38 +3647,39 @@ check_invalid_tag_application(void)
#if H5C_DO_TAGGING_SANITY_CHECKS
/* Create a test file */
if ( (fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0 ) TEST_ERROR;
+if(H5CX_push() < 0) TEST_ERROR
+api_ctx_pushed = TRUE;
/* Get internal file pointer*/
if ( NULL == (f = (H5F_t *)H5I_object(fid)) ) TEST_ERROR;
- /* Create dxpl */
- if ( (dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR;
-
/* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */
/* Ensure this returns FAILURE, as a tag has not been set up. */
- if ( H5HL_create(f, H5AC_ind_read_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR;
+ if ( H5HL_create(f, (size_t)1024, &addr) >= 0) TEST_ERROR;
- /* Now set up a tag in the dxpl */
- if ( H5AC_tag(H5AC_ind_read_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR;
+ /* Now set up a tag in the API context */
+ H5AC_tag((haddr_t)25, NULL);
/* Verify the same call to H5HL_create now works as intended, with a tag set up. */
- if ( H5HL_create(f, H5AC_ind_read_dxpl_id, (size_t)1024, &addr) < 0) TEST_ERROR;
+ if ( H5HL_create(f, (size_t)1024, &addr) < 0) TEST_ERROR;
- /* Reset dxpl to use invalid tag. */
- if ( H5AC_tag(H5AC_ind_read_dxpl_id, H5AC__INVALID_TAG, NULL) < 0) TEST_ERROR;
+ /* Reset API context to use invalid tag. */
+ H5AC_tag(H5AC__INVALID_TAG, NULL);
/* Call H5HL_protect to protect the local heap created above. */
/* This should fail as no tag is set up during the protect call */
- if (( lheap = H5HL_protect(f, H5AC_ind_read_dxpl_id, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR;
+ if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR;
/* Again, set up a valid tag in the DXPL */
- if ( H5AC_tag(H5AC_ind_read_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR;
+ H5AC_tag((haddr_t)25, NULL);
/* Call H5HL_protect again to protect the local heap. This should succeed. */
- if (( lheap = H5HL_protect(f, H5AC_ind_read_dxpl_id, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR;
+ if (( lheap = H5HL_protect(f, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR;
/* Now unprotect the heap, as we're done with the test. */
if ( H5HL_unprotect(lheap) < 0 ) TEST_ERROR;
+if(api_ctx_pushed && H5CX_pop() < 0) TEST_ERROR
+api_ctx_pushed = FALSE;
/* Close open objects and file */
if ( H5Fclose(fid) < 0 ) TEST_ERROR;
@@ -3692,6 +3694,10 @@ check_invalid_tag_application(void)
return 0;
error:
+#if H5C_DO_TAGGING_SANITY_CHECKS
+if(api_ctx_pushed) H5CX_pop();
+#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
+
return 1;
} /* check_invalid_tag_application */