summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-11-23 11:24:30 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-11-23 11:24:30 (GMT)
commit5913de51c2e84f78c80da224cc0437665fe6fcf4 (patch)
treeef7b0bfa31762338fa98dd19bca72e1bbaeff961
parent4d2eb986229d4fcf17bc2ef12802cfb43d2f0d06 (diff)
downloadhdf5-5913de51c2e84f78c80da224cc0437665fe6fcf4.zip
hdf5-5913de51c2e84f78c80da224cc0437665fe6fcf4.tar.gz
hdf5-5913de51c2e84f78c80da224cc0437665fe6fcf4.tar.bz2
[svn-r28443] Misc code cleanup and warning fixes.
Tested on Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only
-rw-r--r--src/H5AC.c1
-rw-r--r--src/H5Dvirtual.c3
-rw-r--r--src/H5Pdapl.c2
-rw-r--r--src/H5Shyper.c2
-rw-r--r--test/cork.c139
-rw-r--r--test/dsets.c17
-rw-r--r--test/file_image.c1
-rw-r--r--test/links.c11
-rw-r--r--test/swmr.c468
9 files changed, 318 insertions, 326 deletions
diff --git a/src/H5AC.c b/src/H5AC.c
index 6e36506..31008ae 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -1228,7 +1228,6 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
size_t trace_entry_size = 0;
FILE * trace_file_ptr = NULL;
#endif /* H5AC__TRACE_FILE_ENABLED */
- unsigned protect_flags = H5C__NO_FLAGS_SET;
void *thing = NULL; /* Pointer to native data structure for entry */
hbool_t log_enabled; /* TRUE if logging was set up */
hbool_t curr_logging; /* TRUE if currently logging */
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 7e52f5d..d435c0d 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -657,7 +657,10 @@ H5D__virtual_copy(H5F_t H5_ATTR_UNUSED *f_dst, H5O_layout_t *layout_dst,
{
herr_t ret_value = SUCCEED;
+#ifdef NOT_YET
FUNC_ENTER_PACKAGE
+#endif /* NOT_YET */
+ FUNC_ENTER_PACKAGE_NOERR
#ifdef NOT_YET
/* Check for copy to the same file */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index c6f8d82..41c6c78 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -834,7 +834,7 @@ H5Pset_append_flush(hid_t plist_id, unsigned ndims, const hsize_t *boundary, H5D
if(ndims > H5S_MAX_RANK)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "dimensionality is too large")
if(!boundary)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no boundary dimensions specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no boundary dimensions specified")
/* Check if the callback function is NULL and the user data is non-NULL.
* This is almost certainly an error as the user data will not be used. */
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index 28cabf0..fe013a7 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -2038,7 +2038,7 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans,
uint8_t *pp = (*p); /* Local pointer for decoding */
hsize_t u; /* Index variable */
- FUNC_ENTER_NOAPI_NOINIT
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
HDassert(spans);
diff --git a/test/cork.c b/test/cork.c
index 6f96b6a..974270a 100644
--- a/test/cork.c
+++ b/test/cork.c
@@ -69,11 +69,11 @@ static int print_index(hid_t fid);
static int verify_cork_tag(hid_t fid, haddr_t tag, hbool_t status);
/* Tests */
-static int test_objs_cork(hbool_t newformat);
-static int test_dset_cork(hbool_t newformat);
+static int test_objs_cork(hbool_t new_format);
+static int test_dset_cork(hbool_t new_format);
static int verify_old_dset_cork(void);
static int verify_obj_dset_cork(hbool_t swmr);
-static int verify_dset_cork(hbool_t swmr, hbool_t new);
+static int verify_dset_cork(hbool_t swmr, hbool_t new_format);
static int verify_group_cork(hbool_t swmr);
static int verify_named_cork(hbool_t swmr);
static int verify_multiple_cork(hbool_t swmr);
@@ -323,7 +323,6 @@ static int
verify_old_dset_cork(void)
{
/* Variable Declarations */
- int verbose = FALSE; /* Verbose file outout */
hid_t fid = -1; /* File ID */
hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
hid_t dcpl = -1, dcpl2 = -1, dcpl3 = -1; /* Dataset creation property lists */
@@ -501,7 +500,6 @@ static int
verify_obj_dset_cork(hbool_t swmr)
{
/* Variable Declarations */
- int verbose = FALSE; /* Verbose file outout */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t aid = -1; /* Attribute ID */
@@ -682,10 +680,9 @@ error:
*-------------------------------------------------------------------------
*/
static int
-verify_dset_cork(hbool_t swmr, hbool_t new)
+verify_dset_cork(hbool_t swmr, hbool_t new_format)
{
/* Variable Declarations */
- int verbose = FALSE; /* Verbose file outout */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t did = -1, did2 = -1, did3 = -1; /* Dataset IDs */
@@ -700,30 +697,30 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Testing Macro */
if(swmr) {
- if(new) {
- TESTING("cork status for chunked datasets with different indexing types (SWMR & latest)");
- } else {
- TESTING("cork status for chunked datasets with different indexing types (SWMR & non-latest)");
- }
+ if(new_format) {
+ TESTING("cork status for chunked datasets with different indexing types (SWMR & latest)");
+ } else {
+ TESTING("cork status for chunked datasets with different indexing types (SWMR & non-latest)");
+ } /* end if */
} else {
- TESTING("cork status for chunked datasets with different indexing types (non-SWMR)");
- }
+ TESTING("cork status for chunked datasets with different indexing types (non-SWMR)");
+ } /* end if */
/* Create fapl */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 )
- TEST_ERROR;
- if(new) {
- /* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
TEST_ERROR;
- }
+ if(new_format) {
+ /* Set to use latest format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
+ TEST_ERROR;
+ } /* end if */
/* Create the file */
flags = H5F_ACC_TRUNC;
if(swmr)
- flags |= H5F_ACC_SWMR_WRITE;
+ flags |= H5F_ACC_SWMR_WRITE;
if((fid = H5Fcreate(FILENAME, flags, H5P_DEFAULT, fapl)) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Create dcpl */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -734,9 +731,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Create chunked dataset with extensive array indexing: DSET_EA */
if((sid = H5Screate_simple(2, dims, max_dims)) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if((did = H5Dcreate2(fid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Get dataset object header address: DSET_EA */
if(H5Oget_info(did, &oinfo) < 0 ) TEST_ERROR;
@@ -746,17 +743,17 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Verify cork status */
if(verify_cork_tag(fid, oinfo.addr, TRUE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Create chunked dataset with fixed array indexing: DSET_FA */
if((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if((did2 = H5Dcreate2(fid, DSET_FA, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Get dataset object header address: DSET_FA */
if(H5Oget_info(did2, &oinfo2) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Cork the dataset: DSET_FA */
if(H5Odisable_mdc_flushes(did2) < 0 ) TEST_ERROR;
@@ -766,29 +763,29 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Verify the cork status for DSET_FA */
if(verify_cork_tag(fid, oinfo2.addr, TRUE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Verify the cork status for DSET_EA */
if(verify_cork_tag(fid, oinfo.addr, FALSE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Create chunked dataset with v2-Btree indexing */
max_dims[0] = H5S_UNLIMITED;
if((sid3 = H5Screate_simple(2, dims, max_dims)) < 0)
- TEST_ERROR;
+ TEST_ERROR;
if((did3 = H5Dcreate2(fid, DSET_BT2, H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Get dataset object header address: DSET_BT2 */
if(H5Oget_info(did3, &oinfo3) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Cork the dataset: DSET_BT2 */
if(H5Odisable_mdc_flushes(did3) < 0 ) TEST_ERROR;
/* Verify the cork status for DSET_BT2 */
if(verify_cork_tag(fid, oinfo3.addr, TRUE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Closing */
if(H5Dclose(did3) < 0 ) TEST_ERROR;
@@ -806,15 +803,15 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Reopen the file */
flags = H5F_ACC_RDWR;
if(swmr)
- flags |= H5F_ACC_SWMR_WRITE;
+ flags |= H5F_ACC_SWMR_WRITE;
if((fid = H5Fopen(FILENAME, flags, fapl)) < 0 ) TEST_ERROR;
/* Initialize data buffer */
for(i = 0; i < (int)dims[0]; i++) {
for(j = 0; j < (int)dims[1]; j++) {
buf[i][j] = (i + 1) * (j + 1);
- }
- }
+ } /* end for */
+ } /* end for */
/* Open and write to the dataset: DSET_EA */
if((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0 ) TEST_ERROR;
@@ -823,7 +820,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Verify the cork status for DSET_EA */
if(verify_cork_tag(fid, oinfo.addr, FALSE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Open and write to the dataset: DSET_FA */
if((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0 ) TEST_ERROR;
@@ -835,7 +832,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Verify the cork status for DSET_FA */
if(verify_cork_tag(fid, oinfo2.addr, TRUE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Open and write to the dataset: DSET_BT2 */
if((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0 ) TEST_ERROR;
@@ -844,14 +841,14 @@ verify_dset_cork(hbool_t swmr, hbool_t new)
/* Verify the cork status for DSET_BT2 */
if(verify_cork_tag(fid, oinfo3.addr, FALSE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Cork the dataset: DSET_BT2 */
if(H5Odisable_mdc_flushes(did3) < 0 ) TEST_ERROR;
/* Verify the cork status for DSET_BT2 */
if(verify_cork_tag(fid, oinfo3.addr, TRUE) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Closing */
if(H5Dclose(did) < 0 ) TEST_ERROR;
@@ -897,7 +894,6 @@ static int
verify_group_cork(hbool_t swmr)
{
/* Variable Declarations */
- int verbose = FALSE; /* Verbose file outout */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */
@@ -1047,7 +1043,6 @@ static int
verify_named_cork(hbool_t swmr)
{
/* Variable Declarations */
- int verbose = FALSE; /* Verbose file outout */
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */
@@ -1290,7 +1285,6 @@ static int
verify_multiple_cork(hbool_t swmr)
{
/* Variable Declarations */
- int verbose = FALSE; /* Verbose file outout */
hid_t fid1 = -1, fid2 = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t tid1 = -1, tid2 = -1; /* Datatype IDs */
@@ -1612,7 +1606,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_objs_cork(hbool_t newformat)
+test_objs_cork(hbool_t new_format)
{
hid_t fid; /* HDF5 File ID */
hid_t fapl; /* File access property list */
@@ -1624,29 +1618,29 @@ test_objs_cork(hbool_t newformat)
herr_t ret; /* Return value */
/* Testing Macro */
- if(newformat) {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (new library format)");
+ if(new_format) {
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (new library format)");
} else {
- TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (old library format)");
- }
+ TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled (old library format)");
+ } /* end if */
/* Create fapl */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 )
- TEST_ERROR;
+ TEST_ERROR;
/* Set to use latest format */
- if(newformat) {
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
- TEST_ERROR;
- }
+ if(new_format) {
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
+ TEST_ERROR;
+ } /* end if */
/* Create an HDF5 file */
if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Create group */
if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Check cork status of the group: not corked */
if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
@@ -1655,7 +1649,7 @@ test_objs_cork(hbool_t newformat)
/* Cork the group: an object */
if(H5Odisable_mdc_flushes(gid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Check cork status of the group: corked */
if(H5Oare_mdc_flushes_disabled(gid, &corked) < 0)
@@ -1664,22 +1658,22 @@ test_objs_cork(hbool_t newformat)
/* Close the group */
if(H5Gclose(gid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Create a transient copy of a native type */
if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Should fail to cork the datatype: not an object */
H5E_BEGIN_TRY {
- ret = H5Odisable_mdc_flushes(tid);
+ ret = H5Odisable_mdc_flushes(tid);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
/* Create a named datatype */
if(H5Tcommit2(fid, "group/datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Check cork status of the named datatype: not corked */
if(H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
@@ -1688,7 +1682,7 @@ test_objs_cork(hbool_t newformat)
/* Cork the named datatype: an object */
if(H5Odisable_mdc_flushes(tid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Check cork status of the named datatype: corked */
if(H5Oare_mdc_flushes_disabled(tid, &corked) < 0)
@@ -1697,17 +1691,17 @@ test_objs_cork(hbool_t newformat)
/* Close the named datatype */
if(H5Tclose(tid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Create dataspace */
dims[0] = DIM0;
dims[1] = DIM1;
if((sid = H5Screate_simple(RANK, dims, NULL)) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Should fail to uncork the dataspace: not an object */
H5E_BEGIN_TRY {
- ret = H5Oenable_mdc_flushes(sid);
+ ret = H5Oenable_mdc_flushes(sid);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
@@ -1722,7 +1716,7 @@ test_objs_cork(hbool_t newformat)
/* Should fail to check cork status of the attribute: not an object */
H5E_BEGIN_TRY {
- ret = H5Oare_mdc_flushes_disabled(aid, &corked);
+ ret = H5Oare_mdc_flushes_disabled(aid, &corked);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
@@ -1734,7 +1728,7 @@ test_objs_cork(hbool_t newformat)
/* Cork the dataset: an object */
if(H5Odisable_mdc_flushes(did) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Check cork status of the dataset: corked */
if(H5Oare_mdc_flushes_disabled(did, &corked) < 0)
@@ -1781,7 +1775,7 @@ test_objs_cork(hbool_t newformat)
/* Should fail to un-cork the named datatype that is not corked yet */
H5E_BEGIN_TRY {
- ret = H5Oenable_mdc_flushes(tid);
+ ret = H5Oenable_mdc_flushes(tid);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
@@ -1862,7 +1856,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-test_dset_cork(hbool_t newformat)
+test_dset_cork(hbool_t new_format)
{
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
@@ -1879,24 +1873,23 @@ test_dset_cork(hbool_t newformat)
int data[DIMS0][DIMS1]; /* Data buffer */
int rbuf[DIMS0][DIMS1]; /* Data buffer */
hbool_t corked; /* Cork status of an object */
- herr_t ret; /* Value returned from API calls */
/* Testing Macro */
- if(newformat) {
+ if(new_format) {
TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets (new library format)");
} else {
TESTING("H5Odisable_mdc_flushes/H5Oenable_mdc_flushes/H5Oare_mdc_flushes_disabled on datasets (old library format)");
- }
+ } /* end if */
/* Create fapl */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
/* Set to use latest format */
- if(newformat) {
+ if(new_format) {
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
TEST_ERROR;
- }
+ } /* end if */
/* Create a new HDF5 file */
if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
diff --git a/test/dsets.c b/test/dsets.c
index 5b0823b..e9b2696 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -479,15 +479,14 @@ test_create(hid_t file)
static herr_t
test_simple_io(const char *env_h5_drvr, hid_t fapl)
{
- char filename[FILENAME_BUF_SIZE];
- hid_t file = -1, dataset = -1, space = -1, xfer = -1;
- int i, j, n;
- hsize_t dims[2];
- void *tconv_buf = NULL;
- int f = -1;
- haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
- ssize_t read_err;
+ char filename[FILENAME_BUF_SIZE];
+ hid_t file = -1, dataset = -1, space = -1, xfer = -1;
+ int i, j, n;
+ hsize_t dims[2];
+ void *tconv_buf = NULL;
+ int f = -1;
+ haddr_t offset;
+ int rdata[DSET_DIM1][DSET_DIM2];
TESTING("simple I/O");
diff --git a/test/file_image.c b/test/file_image.c
index bc4d9b2..52d0b28 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -960,7 +960,6 @@ test_get_file_image_error_rejection(void)
void * image_ptr = NULL;
int data[100];
int i;
- int result;
hid_t fapl_id = -1;
hid_t file_id = -1;
hid_t dset_id = -1;
diff --git a/test/links.c b/test/links.c
index ad7a68c..7e63bfa 100644
--- a/test/links.c
+++ b/test/links.c
@@ -3852,7 +3852,6 @@ external_set_elink_fapl3(hbool_t new_format)
{
hid_t core_fapl = -1, stdio_fapl = -1;
hid_t lapl_id = -1, new_lapl_id = -1, l_fapl = -1, out_fapl;
- int ret;
if(new_format)
TESTING("H5Pset/get_fapl() (w/new group format)")
@@ -3911,11 +3910,11 @@ external_set_elink_fapl3(hbool_t new_format)
error:
H5E_BEGIN_TRY {
- H5Pclose(l_fapl);
- H5Pclose(lapl_id);
- H5Pclose(new_lapl_id);
- H5Pclose(core_fapl);
- H5Pclose(stdio_fapl);
+ H5Pclose(l_fapl);
+ H5Pclose(lapl_id);
+ H5Pclose(new_lapl_id);
+ H5Pclose(core_fapl);
+ H5Pclose(stdio_fapl);
} H5E_END_TRY;
return -1;
} /* end external_set_elink_fapl3() */
diff --git a/test/swmr.c b/test/swmr.c
index 907737b..4005d0b 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -65,9 +65,9 @@ static int test_metadata_read_attempts(hid_t in_fapl);
static int test_metadata_read_retry_info(hid_t in_fapl);
/* Tests for H5Fstart_swmr_write() */
-static int test_start_swmr_write(hid_t in_fapl, hbool_t new);
-static int test_err_start_swmr_write(hid_t in_fapl, hbool_t new);
-static int test_start_swmr_write_concur(hid_t in_fapl, hbool_t new);
+static int test_start_swmr_write(hid_t in_fapl, hbool_t new_format);
+static int test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format);
+static int test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format);
/* Tests for H5Pget/set_object_flush_cb() */
static herr_t flush_cb(hid_t obj_id, void *_udata);
@@ -1532,7 +1532,7 @@ error:
*
*/
static int
-test_start_swmr_write(hid_t in_fapl, hbool_t new)
+test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
{
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property */
@@ -1557,17 +1557,17 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Get a copy of the parameter fapl (non-latest-format) */
if((fapl = H5Pcopy(in_fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- if(new) {
- TESTING("H5Fstart_swmr_write() when creating/opening a file with latest format");
+ if(new_format) {
+ TESTING("H5Fstart_swmr_write() when creating/opening a file with latest format");
/* Set to use the latest library format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
} else {
- TESTING("H5Fstart_swmr_write() when creating/opening a file without latest format");
- }
+ TESTING("H5Fstart_swmr_write() when creating/opening a file without latest format");
+ } /* end if */
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -1577,70 +1577,70 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new)
*/
/* Create the file with SWMR write + non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts from the file's fapl */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != (new ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
- TEST_ERROR;
+ if(attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
+ TEST_ERROR;
/* Close the property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Create "dataset1" */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((sid1 = H5Screate_simple(1, dim, max_dim)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the chunk index type */
if(H5D__layout_idx_type_test(did1, &idx_type) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(idx_type != H5D_CHUNK_IDX_EARRAY)
FAIL_PUTS_ERROR("should be using extensible array as index");
/* Write to the dataset */
if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR for non-latest-format */
/* Should succeed in enabling SWMR for latest format */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
- if(new) {
- if(ret < 0) TEST_ERROR
+ if(new_format) {
+ if(ret < 0) TEST_ERROR
} else if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Read from the dataset */
if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Verify the data is correct */
if(wdata != rdata)
- TEST_ERROR
+ TEST_ERROR
/* Close "dataset1", dataspace, dataset creation property list */
if(H5Dclose(did1) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid1) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
@@ -1660,7 +1660,7 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/*
* Case B: when opening a file
@@ -1668,32 +1668,32 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Open the file again with write + non-latest-format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Should be 1 */
if(attempts != H5F_METADATA_READ_ATTEMPTS)
- TEST_ERROR;
+ TEST_ERROR;
/* Close the property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* open "dataset1", keep it open */
if((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Write to "dataset1" */
wdata = 88;
if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create a group */
if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
@@ -1701,93 +1701,93 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Create "dataset2" in the group, keep it open */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the chunk index type for "dataset2" */
if(H5D__layout_idx_type_test(did2, &idx_type) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using v2 B-tree chunk indexing");
/* Should succeed in enabling SWMR writing */
if(H5Fstart_swmr_write(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Should be 100 */
if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
- TEST_ERROR;
+ TEST_ERROR;
/* Close the property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Read from "dataset1" */
if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(wdata != rdata)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close "dataset1" */
if(H5Dclose(did1) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close "dataset2", dataspace, dataset creation property list */
if(H5Dclose(did2) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid2) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create "dataset3" */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the chunk index type for "dataset3" */
if(H5D__layout_idx_type_test(did3, &idx_type) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(idx_type != H5D_CHUNK_IDX_BT2)
FAIL_PUTS_ERROR("should be using v2 B-tree as index");
/* Close "dataset3", dataspace, dataset creation property list */
if(H5Dclose(did3) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Sclose(sid3) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(dcpl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the group */
if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the file access property list */
if(H5Pclose(fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -1853,7 +1853,7 @@ error:
* --fail to enable SWMR for the second opened file
* --Close the file
*
- * (E) (!new): When opening a file which is created with write + non-latest-format:
+ * (E) (!new_format): When opening a file which is created with write + non-latest-format:
* (1) Open the file with SWMR write+latest format
* --fail to open due to superblock version not 3
* (2) Open the file with SWMR write+non-latest-format
@@ -1865,7 +1865,7 @@ error:
* --fail to enable SWMR due to superblock version not 3
*/
static int
-test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
+test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
{
hid_t fid = -1; /* File ID */
hid_t fid2 = -1; /* File ID */
@@ -1881,21 +1881,21 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Create a copy of the input parameter in_fapl */
if((fapl = H5Pcopy(in_fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if((new_fapl = H5Pcopy(in_fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Set to use the latest library format */
if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- if(new) {
- TESTING("H5Fstart_swmr_write() on failure conditions for latest format");
+ if(new_format) {
+ TESTING("H5Fstart_swmr_write() on failure conditions for latest format");
if((fapl = H5Pcopy(new_fapl)) < 0)
FAIL_STACK_ERROR
} else {
- TESTING("H5Fstart_swmr_write() on failure conditions for without latest format");
+ TESTING("H5Fstart_swmr_write() on failure conditions for without latest format");
}
/* Set the filename to use for this test (dependent on fapl) */
@@ -1916,60 +1916,60 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 2 */
- if(new) {
+ if(new_format) {
- /* Create the file with write + latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ /* Create the file with write + latest format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
- /* Create and commit a named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- FAIL_STACK_ERROR;
- if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR;
+ /* Create and commit a named datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR;
- /* Should fail to enable SWMR writing when there is an opened named datatype */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Should fail to enable SWMR writing when there is an opened named datatype */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
- /* Close the datatype */
- if(H5Tclose(tid) < 0)
- FAIL_STACK_ERROR;
+ /* Close the datatype */
+ if(H5Tclose(tid) < 0)
+ FAIL_STACK_ERROR;
- /* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR;
+ /* Should succeed in enabling SWMR writing */
+ if(H5Fstart_swmr_write(fid) < 0)
+ TEST_ERROR;
- /* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
} else {
- /* Create a file with write + non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
+ /* Create a file with write + non-latest-format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
- /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
- }
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
+ } /* end if */
/*
* (B) When opening a file which is created with the latest format
@@ -1977,114 +1977,114 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Create a file with write + latest format */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 1 */
/* Open the file with SWMR write + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is already in SWMR writing mode */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 2 */
/* Open the file with read only access + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is opened with read only access */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 3 */
/* Open the file file with SWMR read access + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is opened with SWMR read access only */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 4 */
/* Open the file with write + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create and commit a named datatype */
if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create dataspace */
if((sid = H5Screate(H5S_SCALAR)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Attach an attribute to the named datatype */
if((aid = H5Acreate2(tid, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when there are opened named datatype and attribute */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the datatype */
if(H5Tclose(tid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Still fail to enable SWMR writing when the attribute is still opened */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the attribute */
if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close the dataspace */
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/*
@@ -2094,12 +2094,12 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Case 1 */
/* Create a file with write + with/without latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Open the file with write + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
@@ -2107,18 +2107,18 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Should succeed in enabling SWMR writing mode */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Should fail for a second call to enable SWMR writing mode */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 2 */
@@ -2129,24 +2129,24 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Should succeed in enabling SWMR writing mode */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Re-open the same file */
if((fid2 = H5Freopen(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing mode for fid2 */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid2);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the files */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 3 */
@@ -2160,104 +2160,104 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
/* Should succeed in enabling SWMR writing for fid */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Should fail to enable SWMR writing for fid2 */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid2);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the files */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
- if(!new) {
+ if(!new_format) {
- /*
- * (D) When opening a file which is created without the latest format:
- */
+ /*
+ * (D) When opening a file which is created without the latest format:
+ */
- /* Create a file with write + without latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ /* Create a file with write + without latest format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
- /* Case 1 */
+ /* Case 1 */
- /* Should fail to open the file with SWMR write + latest format due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, new_fapl);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Should fail to open the file with SWMR write + latest format due to superblock version not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, new_fapl);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
- /* Case 2 */
+ /* Case 2 */
- /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
- /* Case 3 */
+ /* Case 3 */
- /* Open the file with write + latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
- FAIL_STACK_ERROR;
+ /* Open the file with write + latest format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ FAIL_STACK_ERROR;
- /* Should fail to enable SWMR writing due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Should fail to enable SWMR writing due to superblock version not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
- /* Case 4 */
+ /* Case 4 */
- /* Open the file with write + non-latest-format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR;
+ /* Open the file with write + non-latest-format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR;
- /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
} /* not new */
/* Close the file access property list */
if(H5Pclose(fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Pclose(new_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Sclose(sid);
- H5Gclose(gid);
- H5Dclose(did);
- H5Fclose(fid);
- H5Fclose(fid2);
- H5Pclose(fapl);
- H5Pclose(new_fapl);
+ H5Sclose(sid);
+ H5Gclose(gid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ H5Fclose(fid2);
+ H5Pclose(fapl);
+ H5Pclose(new_fapl);
} H5E_END_TRY;
return -1;
@@ -2266,7 +2266,7 @@ error:
/*
* test_start_swmr_write_concur():
*
- * The "new" parameter indicates whether to create the file with latest format or not.
+ * The "new_format" parameter indicates whether to create the file with latest format or not.
* To have SWMR support, can use either one of the following in creating a file:
* (a) Create the file with write + latest format:
* --result in v3 superblock with latest chunk indexing types
@@ -2286,7 +2286,7 @@ error:
* Child: concurrent open of the file with write and SWMR write access (fail)
*/
static int
-test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
+test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
{
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
@@ -2298,11 +2298,11 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
char filename[NAME_BUF_SIZE]; /* File name */
/* Output message about test being performed */
- if(new) {
- TESTING("Testing H5Fstart_swmr_write()--concurrent access for latest format");
+ if(new_format) {
+ TESTING("Testing H5Fstart_swmr_write()--concurrent access for latest format");
} else {
- TESTING("Testing H5Fstart_swmr_write()--concurrent access for non-latest-format");
- }
+ TESTING("Testing H5Fstart_swmr_write()--concurrent access for non-latest-format");
+ } /* end if */
#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
@@ -2317,23 +2317,23 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new) {
- /* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
+ if(new_format) {
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
- /* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ /* Create the test file */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
} else {
- /* Create the test file without latest format but with SWMR write */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
- }
+ /* Create the test file without latest format but with SWMR write */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ } /* end if */
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Remove the message file to be sure */
HDremove(DONE_MESSAGE);
@@ -2458,17 +2458,17 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
/* Wait till parent process completes the open */
if(h5_wait_message(DONE_MESSAGE) < 0)
- exit(1);
+ HDexit(1);
/* Should fail in opening the test file */
H5E_BEGIN_TRY {
fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
} H5E_END_TRY;
if(fid >= 0)
- exit(1);
+ HDexit(1);
- exit(0);
- }
+ HDexit(0);
+ } /* end if */
/* Open the test file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
@@ -2513,17 +2513,17 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
/* Wait till parent process completes the open */
if(h5_wait_message(DONE_MESSAGE) < 0)
- exit(1);
+ HDexit(1);
/* Should fail in opening the test file */
H5E_BEGIN_TRY {
fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
} H5E_END_TRY;
if(fid >= 0)
- exit(1);
+ HDexit(1);
- exit(0);
- }
+ HDexit(0);
+ } /* end if */
/* Open the test file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
@@ -2568,16 +2568,16 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
/* Wait till parent process completes the open */
if(h5_wait_message(DONE_MESSAGE) < 0)
- exit(1);
+ HDexit(1);
/* Should fail in opening the test file */
H5E_BEGIN_TRY {
fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
} H5E_END_TRY;
if(fid >= 0)
- exit(1);
+ HDexit(1);
- exit(0);
+ HDexit(0);
}
/* Open the test file */