summaryrefslogtreecommitdiffstats
path: root/test/accum_swmr_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/accum_swmr_reader.c')
-rw-r--r--test/accum_swmr_reader.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/accum_swmr_reader.c b/test/accum_swmr_reader.c
index c1a238d..9005b99 100644
--- a/test/accum_swmr_reader.c
+++ b/test/accum_swmr_reader.c
@@ -17,6 +17,8 @@
#include "H5Fpkg.h"
#include "H5FDpkg.h"
+
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
/* Filename: this is the same as the define in accum.c used by test_swmr_write_big() */
@@ -48,6 +50,7 @@ main(void)
uint8_t rbuf[1024]; /* Buffer for reading */
uint8_t buf[1024]; /* Buffer for holding the expected data */
char *driver = NULL; /* VFD string (from env variable) */
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
@@ -69,13 +72,15 @@ main(void)
/* Open the file with SWMR_READ */
if((fid = H5Fopen(SWMR_FILENAME, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get H5F_t * to internal file structure */
if(NULL == (f = (H5F_t *)H5I_object(fid)))
FAIL_STACK_ERROR
/* Should read in [1024, 2024] with buf data */
- if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, H5AC_ind_read_dxpl_id, rbuf) < 0)
+ if(H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)1024, (size_t)1024, rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data read is correct */
@@ -87,11 +92,14 @@ main(void)
FAIL_STACK_ERROR;
if(H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
return EXIT_SUCCESS;
error:
H5Fclose(fid);
+if(api_ctx_pushed) H5CX_pop();
return EXIT_FAILURE;
} /* end main() */