summaryrefslogtreecommitdiffstats
path: root/test/freespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/freespace.c')
-rw-r--r--test/freespace.c440
1 files changed, 216 insertions, 224 deletions
diff --git a/test/freespace.c b/test/freespace.c
index 39c5688..ebc7840 100644
--- a/test/freespace.c
+++ b/test/freespace.c
@@ -23,6 +23,8 @@
/* Other private headers that this test requires */
#define H5F_FRIEND /*suppress error about including H5Fpkg */
#include "H5Fpkg.h"
+
+#include "H5CXprivate.h" /* API Contexts */
#include "H5Iprivate.h"
#include "H5VMprivate.h"
@@ -446,7 +448,6 @@ static unsigned
test_fs_create(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -456,6 +457,7 @@ test_fs_create(hid_t fapl)
H5FS_create_t cparam, test_cparam; /* creation parameters */
uint16_t nclasses;
unsigned init_flags=0;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("the creation/close/reopen/deletion of the free-space manager");
@@ -477,6 +479,8 @@ test_fs_create(hid_t fapl)
/* Re-open the file */
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -486,13 +490,10 @@ test_fs_create(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -512,12 +513,12 @@ test_fs_create(hid_t fapl)
FAIL_STACK_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr,
+ if(NULL == (frsp = H5FS_open(f, fs_addr,
nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -527,12 +528,12 @@ test_fs_create(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -547,10 +548,8 @@ test_fs_create(hid_t fapl)
/* Verify the file is the correct size */
if(file_size != empty_size)
TEST_ERROR
-
- /* Close the dxpl */
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR;
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -559,9 +558,9 @@ test_fs_create(hid_t fapl)
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_fs_create() */
@@ -595,7 +594,6 @@ static unsigned
test_fs_sect_add(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl_id (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -608,6 +606,7 @@ test_fs_sect_add(hid_t fapl)
unsigned init_flags=0;
h5_stat_size_t file_size=0, tmp_file_size=0, fr_meta_size=0;
unsigned can_shrink=FALSE;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("adding a section via H5FS_sect_add() to free-space: test 1");
@@ -628,6 +627,8 @@ test_fs_sect_add(hid_t fapl)
/* Re-open the file */
if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -636,13 +637,10 @@ test_fs_sect_add(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -654,7 +652,7 @@ test_fs_sect_add(hid_t fapl)
init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -669,7 +667,7 @@ test_fs_sect_add(hid_t fapl)
fr_meta_size = H5FS_HEADER_SIZE(f) + H5FS_SINFO_PREFIX_SIZE(f);
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -704,7 +702,7 @@ test_fs_sect_add(hid_t fapl)
nclasses = NELMTS(test_classes);
init_flags = H5FS_CLS_GHOST_OBJ;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -717,7 +715,7 @@ test_fs_sect_add(hid_t fapl)
init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
0, NULL) < 0)
FAIL_STACK_ERROR
@@ -732,7 +730,7 @@ test_fs_sect_add(hid_t fapl)
fr_meta_size = H5FS_HEADER_SIZE(f);
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
/* Close the file */
@@ -776,7 +774,7 @@ test_fs_sect_add(hid_t fapl)
nclasses = NELMTS(test_classes);
init_flags = 0;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -791,7 +789,7 @@ test_fs_sect_add(hid_t fapl)
*/
init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -802,12 +800,12 @@ test_fs_sect_add(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -845,7 +843,7 @@ test_fs_sect_add(hid_t fapl)
nclasses = NELMTS(test_classes);
init_flags = 0;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -860,7 +858,7 @@ test_fs_sect_add(hid_t fapl)
*/
init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
H5FS_ADD_DESERIALIZING, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -872,7 +870,7 @@ test_fs_sect_add(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -881,20 +879,20 @@ test_fs_sect_add(hid_t fapl)
sect_node = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file and dxpl */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -905,9 +903,9 @@ error:
if(sect_node)
TEST_sect_free((H5FS_section_info_t *)sect_node);
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_fs_sect_add() */
@@ -937,7 +935,6 @@ static unsigned
test_fs_sect_find(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -950,6 +947,7 @@ test_fs_sect_find(hid_t fapl)
TEST_free_section_t *node;
htri_t node_found = FALSE;
unsigned init_flags=0;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("H5FS_sect_find(): free-space is empty");
@@ -959,6 +957,8 @@ test_fs_sect_find(hid_t fapl)
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -967,13 +967,10 @@ test_fs_sect_find(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -985,7 +982,7 @@ test_fs_sect_find(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -995,7 +992,7 @@ test_fs_sect_find(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -1004,7 +1001,7 @@ test_fs_sect_find(hid_t fapl)
TESTING("H5FS_sect_find() a section equal to requested-size from free-space");
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses,
+ if(NULL == (frsp = H5FS_open(f, fs_addr, nclasses,
test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1021,7 +1018,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1042,7 +1039,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node3, (haddr_t)(TEST_SECT_ADDR200), (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1061,7 +1058,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1080,7 +1077,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR300, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1091,7 +1088,7 @@ test_fs_sect_find(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1104,11 +1101,11 @@ test_fs_sect_find(hid_t fapl)
TEST_ERROR
/* remove sections A, C and D */
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node3) < 0)
FAIL_STACK_ERROR
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node4) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -1123,7 +1120,7 @@ test_fs_sect_find(hid_t fapl)
sect_node4 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -1132,7 +1129,7 @@ test_fs_sect_find(hid_t fapl)
TESTING("H5FS_sect_find() a section greater than requested-size from free-space");
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses,
+ if(NULL == (frsp = H5FS_open(f, fs_addr, nclasses,
test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1149,7 +1146,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1169,7 +1166,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1180,7 +1177,7 @@ test_fs_sect_find(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1194,7 +1191,7 @@ test_fs_sect_find(hid_t fapl)
node = NULL;
/* remove sections A */
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -1203,7 +1200,7 @@ test_fs_sect_find(hid_t fapl)
sect_node1 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
@@ -1212,7 +1209,7 @@ test_fs_sect_find(hid_t fapl)
TESTING("H5FS_sect_find(): cannot find a section with requested-size from free-space");
/* reopen the free-space manager */
- if(NULL == (frsp = H5FS_open(f, dxpl_id, fs_addr, nclasses,
+ if(NULL == (frsp = H5FS_open(f, fs_addr, nclasses,
test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1229,7 +1226,7 @@ test_fs_sect_find(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1241,14 +1238,14 @@ test_fs_sect_find(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* remove sections A */
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -1257,20 +1254,20 @@ test_fs_sect_find(hid_t fapl)
sect_node1 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file and dxpl */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -1285,9 +1282,9 @@ error:
if(sect_node4)
TEST_sect_free((H5FS_section_info_t *)sect_node4);
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_fs_sect_find() */
@@ -1329,7 +1326,6 @@ static unsigned
test_fs_sect_merge(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -1342,6 +1338,7 @@ test_fs_sect_merge(hid_t fapl)
unsigned init_flags=0;
htri_t node_found = FALSE;
TEST_free_section_t *node;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("the merge of sections when H5FS_sect_add() to free-space: test 1");
@@ -1354,6 +1351,8 @@ test_fs_sect_merge(hid_t fapl)
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -1362,13 +1361,10 @@ test_fs_sect_merge(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1383,7 +1379,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1403,7 +1399,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1421,7 +1417,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1439,7 +1435,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1451,7 +1447,7 @@ test_fs_sect_merge(hid_t fapl)
/* should be able to find the merged section of A, B, C & D */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1464,12 +1460,12 @@ test_fs_sect_merge(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -1496,7 +1492,7 @@ test_fs_sect_merge(hid_t fapl)
nclasses = NELMTS(test_classes);
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1511,7 +1507,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1531,7 +1527,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1544,17 +1540,17 @@ test_fs_sect_merge(hid_t fapl)
TEST_ERROR
/* should not be able to find the merged section of A & B */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* remove section A from free-space */
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
/* remove section B from free-space */
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -1566,12 +1562,12 @@ test_fs_sect_merge(hid_t fapl)
sect_node2 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -1598,7 +1594,7 @@ test_fs_sect_merge(hid_t fapl)
nclasses = NELMTS(test_classes);
init_flags = 0; /* reset */
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1613,7 +1609,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1633,7 +1629,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1653,7 +1649,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1671,7 +1667,7 @@ test_fs_sect_merge(hid_t fapl)
init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node4,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node4,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -1687,14 +1683,14 @@ test_fs_sect_merge(hid_t fapl)
TEST_ERROR
/* should not be able to find a merged section of A, B, C & D */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* should be able to find the merged section of B & C */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1708,7 +1704,7 @@ test_fs_sect_merge(hid_t fapl)
TEST_ERROR
/* should be able to find section A */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE10), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1721,7 +1717,7 @@ test_fs_sect_merge(hid_t fapl)
TEST_ERROR
/* should be able to find section D */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1734,20 +1730,20 @@ test_fs_sect_merge(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
- /* Close the file and dxpl */
+ /* Close the file */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -1760,9 +1756,9 @@ error:
if(sect_node2)
TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
- H5Pclose(dxpl_id);
+ H5FS_close(f, frsp);
H5Fclose(file);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_fs_sect_merge() */
@@ -1805,7 +1801,6 @@ static unsigned
test_fs_sect_shrink(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -1819,6 +1814,7 @@ test_fs_sect_shrink(hid_t fapl)
unsigned can_shrink=FALSE;
htri_t node_found = FALSE;
TEST_free_section_t *node;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("shrinking of sections when H5FS_sect_add() to free-space: test 1");
@@ -1828,6 +1824,8 @@ test_fs_sect_shrink(hid_t fapl)
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -1838,13 +1836,10 @@ test_fs_sect_shrink(hid_t fapl)
TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1860,7 +1855,7 @@ test_fs_sect_shrink(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE);
can_shrink = FALSE;
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -1873,7 +1868,7 @@ test_fs_sect_shrink(hid_t fapl)
TEST_ERROR
/* section A should still be there in free-space */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -1894,7 +1889,7 @@ test_fs_sect_shrink(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
can_shrink = FALSE;
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -1905,19 +1900,19 @@ test_fs_sect_shrink(hid_t fapl)
TEST_ERROR
/* section A should not be there in free-space */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -1945,7 +1940,7 @@ test_fs_sect_shrink(hid_t fapl)
/* does not allow merging */
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -1960,7 +1955,7 @@ test_fs_sect_shrink(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -1980,7 +1975,7 @@ test_fs_sect_shrink(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -1989,7 +1984,7 @@ test_fs_sect_shrink(hid_t fapl)
TEST_ERROR
/* section B should not be there in free-space */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -2001,7 +1996,7 @@ test_fs_sect_shrink(hid_t fapl)
/* section A should still be there in free-space */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE20), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -2014,12 +2009,12 @@ test_fs_sect_shrink(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -2045,7 +2040,7 @@ test_fs_sect_shrink(hid_t fapl)
TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */
init_flags = 0; /* reset */
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2060,7 +2055,7 @@ test_fs_sect_shrink(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -2080,7 +2075,7 @@ test_fs_sect_shrink(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0)
FAIL_STACK_ERROR
@@ -2090,7 +2085,7 @@ test_fs_sect_shrink(hid_t fapl)
TEST_ERROR
/* section B should not be there in free-space */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
@@ -2098,27 +2093,27 @@ test_fs_sect_shrink(hid_t fapl)
TEST_ERROR
/* section A should not be there in free-space */
- if((node_found = H5FS_sect_find(f, dxpl_id, frsp,
+ if((node_found = H5FS_sect_find(f, frsp,
(hsize_t)(TEST_SECT_SIZE30), (H5FS_section_info_t **)&node)) < 0)
FAIL_STACK_ERROR
if (node_found) TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file and dxpl */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -2127,9 +2122,9 @@ test_fs_sect_shrink(hid_t fapl)
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_sect_shrink() */
@@ -2155,7 +2150,6 @@ static unsigned
test_fs_sect_change_class(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -2167,6 +2161,7 @@ test_fs_sect_change_class(hid_t fapl)
TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL, *sect_node3=NULL;
unsigned init_flags=0;
TEST_free_section_t *node;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("the change of section class via H5FS_sect_change_class() in free-space: Test 1");
@@ -2176,6 +2171,8 @@ test_fs_sect_change_class(hid_t fapl)
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -2184,14 +2181,11 @@ test_fs_sect_change_class(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
init_flags = H5FS_CLS_GHOST_OBJ;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2206,7 +2200,7 @@ test_fs_sect_change_class(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2226,7 +2220,7 @@ test_fs_sect_change_class(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2237,7 +2231,7 @@ test_fs_sect_change_class(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node1,
TEST_FSPACE_SECT_TYPE_NONE) < 0)
TEST_ERROR
@@ -2246,7 +2240,7 @@ test_fs_sect_change_class(hid_t fapl)
if(check_stats(f, frsp, &state))
TEST_ERROR
- if(H5FS_sect_find(f, dxpl_id, frsp,
+ if(H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node) < 0)
FAIL_STACK_ERROR
@@ -2256,7 +2250,7 @@ test_fs_sect_change_class(hid_t fapl)
if(TEST_sect_free((H5FS_section_info_t *)node) < 0)
TEST_ERROR
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node2) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -2265,12 +2259,12 @@ test_fs_sect_change_class(hid_t fapl)
sect_node2 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -2297,7 +2291,7 @@ test_fs_sect_change_class(hid_t fapl)
nclasses = NELMTS(test_classes);
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2312,7 +2306,7 @@ test_fs_sect_change_class(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2324,7 +2318,7 @@ test_fs_sect_change_class(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2336,17 +2330,17 @@ test_fs_sect_change_class(hid_t fapl)
init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node3,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
/* change the class of B to A's class */
- if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node2,
TEST_FSPACE_SECT_TYPE) < 0)
TEST_ERROR
/* change the class of C to A's class */
- if (H5FS_sect_change_class(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node3,
+ if (H5FS_sect_change_class(f, frsp, (H5FS_section_info_t *)sect_node3,
TEST_FSPACE_SECT_TYPE) < 0)
TEST_ERROR
@@ -2356,7 +2350,7 @@ test_fs_sect_change_class(hid_t fapl)
TEST_ERROR
/* verify that section B has changed class */
- if(H5FS_sect_find(f, dxpl_id, frsp,
+ if(H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node) < 0)
FAIL_STACK_ERROR
@@ -2367,7 +2361,7 @@ test_fs_sect_change_class(hid_t fapl)
TEST_ERROR
/* verify that section C has changed class */
- if(H5FS_sect_find(f, dxpl_id, frsp,
+ if(H5FS_sect_find(f, frsp,
(hsize_t)TEST_SECT_SIZE80, (H5FS_section_info_t **)&node) < 0)
FAIL_STACK_ERROR
@@ -2378,7 +2372,7 @@ test_fs_sect_change_class(hid_t fapl)
TEST_ERROR
/* remove section A from free-space */
- if(H5FS_sect_remove(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0)
+ if(H5FS_sect_remove(f, frsp, (H5FS_section_info_t *)sect_node1) < 0)
FAIL_STACK_ERROR
/* Free the section node(s) */
@@ -2387,20 +2381,20 @@ test_fs_sect_change_class(hid_t fapl)
sect_node1 = NULL;
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file and dxpl */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -2413,9 +2407,9 @@ error:
if(sect_node2)
TEST_sect_free((H5FS_section_info_t *)sect_node2);
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_sect_change_class() */
@@ -2455,7 +2449,6 @@ static unsigned
test_fs_sect_extend(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -2466,6 +2459,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_free_section_t *sect_node1=NULL, *sect_node2=NULL;
unsigned init_flags=0;
htri_t status; /* Status of 'try' calls */
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("a block's extension by requested-size which is = adjoining free section's size: Test 1");
@@ -2474,16 +2468,15 @@ test_fs_sect_extend(hid_t fapl)
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
FAIL_STACK_ERROR
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
/*
* TEST 1
@@ -2491,7 +2484,7 @@ test_fs_sect_extend(hid_t fapl)
init_cparam(&cparam);
nclasses = NELMTS(test_classes);
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2506,7 +2499,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2526,7 +2519,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2538,7 +2531,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend a block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
+ if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
FAIL_STACK_ERROR
if(FALSE == status)
TEST_ERROR
@@ -2551,12 +2544,12 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -2567,7 +2560,7 @@ test_fs_sect_extend(hid_t fapl)
*/
TESTING("a block's extension by requested-size which is > adjoining free section's size: Test 2");
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2582,7 +2575,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2602,7 +2595,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2614,7 +2607,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50, 0, NULL)) < 0)
+ if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50, 0, NULL)) < 0)
FAIL_STACK_ERROR
if(TRUE == status)
TEST_ERROR
@@ -2624,12 +2617,12 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -2640,7 +2633,7 @@ test_fs_sect_extend(hid_t fapl)
*/
TESTING("a block's extension by requested-size which is < adjoining free section's size: Test 3");
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2655,7 +2648,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2675,7 +2668,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2687,7 +2680,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30, 0, NULL)) < 0)
+ if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30, 0, NULL)) < 0)
TEST_ERROR
if(FALSE == status)
TEST_ERROR
@@ -2698,12 +2691,12 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -2714,7 +2707,7 @@ test_fs_sect_extend(hid_t fapl)
*/
TESTING("a block's extension by requested-size which does not adjoin any free section: Test 4");
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2729,7 +2722,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node1,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node1,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2749,7 +2742,7 @@ test_fs_sect_extend(hid_t fapl)
init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node2,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node2,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
@@ -2761,7 +2754,7 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Extend the block by requested-size */
- if((status = H5FS_sect_try_extend(f, dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
+ if((status = H5FS_sect_try_extend(f, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40, 0, NULL)) < 0)
TEST_ERROR
if(TRUE == status)
TEST_ERROR
@@ -2771,12 +2764,12 @@ test_fs_sect_extend(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
@@ -2785,17 +2778,17 @@ test_fs_sect_extend(hid_t fapl)
/* Close the file and dxpl */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
return 0;
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_sect_extend() */
@@ -2813,7 +2806,6 @@ static unsigned
test_fs_sect_iterate(hid_t fapl)
{
hid_t file = -1; /* File ID */
- hid_t dxpl_id = -1; /* dxpl ID (for tag) */
char filename[FILENAME_LEN]; /* Filename to use */
H5F_t *f = NULL; /* Internal file object pointer */
H5FS_t *frsp = NULL; /* pointer to free space structure */
@@ -2826,6 +2818,7 @@ test_fs_sect_iterate(hid_t fapl)
TEST_iter_ud_t udata;
int i;
hsize_t tot_space, nsects;
+hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
TESTING("iteration of sections in the free-space manager");
@@ -2835,6 +2828,8 @@ test_fs_sect_iterate(hid_t fapl)
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
+if(H5CX_push() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = TRUE;
/* Get a pointer to the internal file object */
if(NULL == (f = (H5F_t *)H5I_object(file)))
@@ -2845,14 +2840,11 @@ test_fs_sect_iterate(hid_t fapl)
udata.tot_size = 0;
udata.tot_sect_count = 0;
- /* Create the dxpl and tag it with the global free space tag */
- if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
- FAIL_STACK_ERROR
- if(H5AC_tag(dxpl_id, H5AC__FREESPACE_TAG, NULL) < 0)
- FAIL_STACK_ERROR
+ /* Tag with the global free space tag */
+ H5AC_tag(H5AC__FREESPACE_TAG, NULL);
init_flags = H5FS_CLS_SEPAR_OBJ;
- if(NULL == (frsp = H5FS_create(f, dxpl_id, &fs_addr,
+ if(NULL == (frsp = H5FS_create(f, &fs_addr,
&cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF)))
FAIL_STACK_ERROR
@@ -2866,12 +2858,12 @@ test_fs_sect_iterate(hid_t fapl)
sect_size = (unsigned)((i-1) % 9) + 1;
init_sect_node(sect_node, (haddr_t)i*10, (hsize_t)sect_size, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE);
- if(H5FS_sect_add(f, dxpl_id, frsp, (H5FS_section_info_t *)sect_node,
+ if(H5FS_sect_add(f, frsp, (H5FS_section_info_t *)sect_node,
H5FS_ADD_RETURNED_SPACE, NULL) < 0)
FAIL_STACK_ERROR
} /* end for */
- if(H5FS_sect_iterate(f, dxpl_id, frsp, TEST_sects_cb, &udata) < 0)
+ if(H5FS_sect_iterate(f, frsp, TEST_sects_cb, &udata) < 0)
TEST_ERROR
H5FS_sect_stats(frsp, &tot_space, &nsects);
@@ -2882,20 +2874,20 @@ test_fs_sect_iterate(hid_t fapl)
TEST_ERROR
/* Close the free space manager */
- if(H5FS_close(f, dxpl_id, frsp) < 0)
+ if(H5FS_close(f, frsp) < 0)
FAIL_STACK_ERROR
frsp = NULL;
/* Delete free space manager */
- if(H5FS_delete(f, dxpl_id, fs_addr) < 0)
+ if(H5FS_delete(f, fs_addr) < 0)
FAIL_STACK_ERROR
fs_addr = HADDR_UNDEF;
/* Close the file and dxpl */
if(H5Fclose(file) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dxpl_id) < 0)
- FAIL_STACK_ERROR
+if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+api_ctx_pushed = FALSE;
PASSED()
@@ -2904,9 +2896,9 @@ test_fs_sect_iterate(hid_t fapl)
error:
H5E_BEGIN_TRY {
if(frsp)
- H5FS_close(f, dxpl_id, frsp);
+ H5FS_close(f, frsp);
H5Fclose(file);
- H5Pclose(dxpl_id);
+if(api_ctx_pushed) H5CX_pop();
} H5E_END_TRY;
return 1;
} /* test_fs_sect_iterate() */