summaryrefslogtreecommitdiffstats
path: root/test/swmr.c
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2020-10-01 14:04:36 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2020-10-01 14:04:36 (GMT)
commitf1ba03cea5b82699a984c80bd2deac14fdc8df18 (patch)
treeebe777c3e0b83f4c4cec9212731da9ebe0a0cfd3 /test/swmr.c
parent10343c197906415388f2a4c8d292e21d25cf7381 (diff)
downloadhdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.zip
hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.gz
hdf5-f1ba03cea5b82699a984c80bd2deac14fdc8df18.tar.bz2
Source formatted
Diffstat (limited to 'test/swmr.c')
-rw-r--r--test/swmr.c4202
1 files changed, 2097 insertions, 2105 deletions
diff --git a/test/swmr.c b/test/swmr.c
index bab91bd..df52037 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -12,53 +12,49 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/***********************************************************
-*
-* Test program: swmr
-*
-* To test new public routines from SWMR project:
-* H5Pget/set_metadata_read_attempts()
-* H5Fget_metadata_read_retry_info()
-* H5Fstart_swmr_write()
-* H5Pget/set_object_flush_cb()
-* H5Pget/set_append_flush()
-*
-*************************************************************/
+ *
+ * Test program: swmr
+ *
+ * To test new public routines from SWMR project:
+ * H5Pget/set_metadata_read_attempts()
+ * H5Fget_metadata_read_retry_info()
+ * H5Fstart_swmr_write()
+ * H5Pget/set_object_flush_cb()
+ * H5Pget/set_append_flush()
+ *
+ *************************************************************/
#include "h5test.h"
#include "H5Iprivate.h"
-#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5VLprivate.h" /* Virtual Object Layer */
/*
* This file needs to access private information from the H5F package.
* This file also needs to access the file, file driver, dataset,
* and object header testing code.
*/
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
#define H5F_TESTING
-#include "H5Fpkg.h" /* File access */
+#include "H5Fpkg.h" /* File access */
-#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
#define H5D_TESTING
-#include "H5Dpkg.h" /* Datasets */
+#include "H5Dpkg.h" /* Datasets */
-#define H5FD_FRIEND /*suppress error about including H5FDpkg */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
#define H5FD_TESTING
-#include "H5FDpkg.h" /* File drivers */
+#include "H5FDpkg.h" /* File drivers */
-#define H5O_FRIEND /*suppress error about including H5Opkg */
+#define H5O_FRIEND /*suppress error about including H5Opkg */
#define H5O_TESTING
-#include "H5Opkg.h" /* Object headers */
-
-
-const char *FILENAME[] = {
- "swmr0", /* 0 */
- "swmr1", /* 1 */
- "swmr2", /* 2 */
- NULL
-};
+#include "H5Opkg.h" /* Object headers */
+const char *FILENAME[] = {"swmr0", /* 0 */
+ "swmr1", /* 1 */
+ "swmr2", /* 2 */
+ NULL};
-#define NAME_BUF_SIZE 1024 /* Length of file name */
+#define NAME_BUF_SIZE 1024 /* Length of file name */
/* Tests for H5Pget/set_metadata_read_attempts(), H5Fget_metadata_read_retry_info */
static int test_metadata_read_attempts(hid_t in_fapl);
@@ -72,15 +68,15 @@ static int test_start_swmr_write_stress_ohdr(hid_t in_fapl);
/* Tests for H5Pget/set_object_flush_cb() */
static herr_t flush_cb(hid_t obj_id, void *_udata);
-static int test_object_flush_cb(hid_t in_fapl);
+static int test_object_flush_cb(hid_t in_fapl);
/* Tests for H5Pget/set_append_flush() */
static herr_t append_cb(hid_t dset_id, hsize_t *cur_dims, void *_udata);
static herr_t append_cb2(hid_t dset_id, hsize_t *cur_dims, void *_udata);
-static int test_append_flush_generic(void);
-static int test_append_flush_dataset_chunked(hid_t in_fapl);
-static int test_append_flush_dataset_fixed(hid_t in_fapl);
-static int test_append_flush_dataset_multiple(hid_t in_fapl);
+static int test_append_flush_generic(void);
+static int test_append_flush_dataset_chunked(hid_t in_fapl);
+static int test_append_flush_dataset_fixed(hid_t in_fapl);
+static int test_append_flush_dataset_multiple(hid_t in_fapl);
/* Tests for file open flags/SWMR flags: single process access */
static int test_file_lock_same(hid_t fapl);
@@ -116,15 +112,15 @@ static int test_multiple_same(hid_t in_fapl, hbool_t new_format);
static int
test_metadata_read_attempts(hid_t in_fapl)
{
- hid_t fapl = -1; /* File access property list */
- hid_t file_fapl = -1; /* The file's access property list */
- hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
- hid_t driver_id = -1; /* ID for this VFD */
- unsigned long driver_flags = 0; /* VFD feature flags */
- hbool_t compat_w_default_vfd; /* current VFD compat w/ H5P_DEFAULT? */
- unsigned attempts; /* The # of read attempts */
- char filename[NAME_BUF_SIZE]; /* File name */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1; /* File access property list */
+ hid_t file_fapl = -1; /* The file's access property list */
+ hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t driver_id = -1; /* ID for this VFD */
+ unsigned long driver_flags = 0; /* VFD feature flags */
+ hbool_t compat_w_default_vfd; /* current VFD compat w/ H5P_DEFAULT? */
+ unsigned attempts; /* The # of read attempts */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
TESTING("H5Pget/set_metadata_read_attempts()");
@@ -148,7 +144,7 @@ test_metadata_read_attempts(hid_t in_fapl)
}
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
@@ -161,50 +157,51 @@ test_metadata_read_attempts(hid_t in_fapl)
* file access property list.
*/
/* Get # of read attempts -- should be the default: 1 */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 1)
+ if (attempts != 1)
TEST_ERROR
/* Set the # of read attempts to 0--should fail */
- H5E_BEGIN_TRY {
- ret = H5Pset_metadata_read_attempts(fapl, 0);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_metadata_read_attempts(fapl, 0); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Set the # of read attempts to a # > 0--should succeed */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
TEST_ERROR
/* Retrieve the # of read attempts -- should be 9 */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 9)
+ if (attempts != 9)
TEST_ERROR
- /* Set the # of read attempts to the default for non-SWMR access: H5F_METADATA_READ_ATTEMPTS --should succeed */
- if(H5Pset_metadata_read_attempts(fapl, H5F_METADATA_READ_ATTEMPTS) < 0)
+ /* Set the # of read attempts to the default for non-SWMR access: H5F_METADATA_READ_ATTEMPTS --should
+ * succeed */
+ if (H5Pset_metadata_read_attempts(fapl, H5F_METADATA_READ_ATTEMPTS) < 0)
TEST_ERROR
/* Retrieve the # of read attempts -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
- /* Set the # of read attempts to the default for SWMR access: H5F_SWMR_METADATA_READ_ATEMPTS --should succeed */
- if(H5Pset_metadata_read_attempts(fapl, H5F_SWMR_METADATA_READ_ATTEMPTS) < 0)
+ /* Set the # of read attempts to the default for SWMR access: H5F_SWMR_METADATA_READ_ATEMPTS --should
+ * succeed */
+ if (H5Pset_metadata_read_attempts(fapl, H5F_SWMR_METADATA_READ_ATTEMPTS) < 0)
TEST_ERROR
/* Retrieve the # of read attempts -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/*
@@ -216,173 +213,173 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Test 1 */
/* Create a file with non-SWMR access and default fapl */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 2 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access and default read attempts */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 3 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access and fapl (non-default & set to 9) */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be 9 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 9)
+ if (attempts != 9)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 4 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 1) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 1) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access and fapl (non-default & set to 1) */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be 1 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 1)
+ if (attempts != 1)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 5 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR_READ and fapl (non-default read attempts but unset) */
- if((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/*
@@ -394,241 +391,241 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Test 1 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file with non-SWMR access and default read attempts */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 2 */
/* Open the file with non-SWMR access and default fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 3 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open the file with non-SWMR access and fapl (non-default & set to 9) */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be 9 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 9)
+ if (attempts != 9)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 4 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 1) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 1) < 0)
FAIL_STACK_ERROR
/* Open the file with non-SWMR access and fapl (non-default & set to 1) */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be 1 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != 1)
+ if (attempts != 1)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Test 5 */
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Open the file with non-SWMR_READ and fapl (non-default but unset) */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file's fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Open file again with non-SWMR access and default fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open file again with SWMR access and default read attempts */
- if((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -640,85 +637,85 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Open file again with SWMR access and default read attempts */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open file again with SWMR access and fapl (non-default & set to 9) */
- if((fid2 = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, (H5F_ACC_RDONLY | H5F_ACC_SWMR_READ), fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Re-open fid1 */
- if((fid = H5Freopen(fid1)) < 0)
+ if ((fid = H5Freopen(fid1)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Re-open fid2 */
- if((fid = H5Freopen(fid2)) < 0)
+ if ((fid = H5Freopen(fid2)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_SWMR_METADATA_READ_ATTEMPTS, not 9 */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close all the files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
@@ -730,110 +727,111 @@ test_metadata_read_attempts(hid_t in_fapl)
*/
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Open file again with non-SWMR access and default fapl */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Get a copy of the parameter fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the # of read attempts */
- if(H5Pset_metadata_read_attempts(fapl, 9) < 0)
+ if (H5Pset_metadata_read_attempts(fapl, 9) < 0)
FAIL_STACK_ERROR
/* Open file again with non-SWMR access and fapl (non-default & set to 9) */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Close fapl */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
/* Re-open fid1 */
- if((fid = H5Freopen(fid1)) < 0)
+ if ((fid = H5Freopen(fid1)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Re-open fid2 */
- if((fid = H5Freopen(fid2)) < 0)
+ if ((fid = H5Freopen(fid2)) < 0)
FAIL_STACK_ERROR
/* Get file's fapl */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from file fapl -- should be H5F_METADATA_READ_ATTEMPTS */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR
/* Close the file's fapl */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close all the files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(file_fapl);
H5Fclose(fid);
H5Fclose(fid1);
H5Fclose(fid2);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
} /* test_metadata_read_attempts() */
/*
@@ -846,80 +844,80 @@ error:
static int
test_metadata_read_retry_info(hid_t in_fapl)
{
- hid_t fapl, new_fapl; /* File access property list */
- hid_t fid, fid1; /* File IDs */
- H5F_retry_info_t info, info1; /* The collection of metadata retries */
- H5F_t *f = NULL, *f1 = NULL; /* Internal file object pointers */
- unsigned i, j, n; /* Local index variables */
- hid_t did1, did2; /* Dataset IDs */
- hid_t sid; /* Dataspace ID */
- hid_t dcpl; /* Dataset creation property list */
- hsize_t dims[2] = {6, 10}; /* Dataset dimensions */
- char filename[NAME_BUF_SIZE]; /* File name */
- int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */
- hsize_t max_dims_1un[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t max_dims_2un[2] = {500, H5S_UNLIMITED}; /* Dataset maximum dimensions */
- hsize_t chunk_dims[2] = {2, 2}; /* Chunk dimensions */
+ hid_t fapl, new_fapl; /* File access property list */
+ hid_t fid, fid1; /* File IDs */
+ H5F_retry_info_t info, info1; /* The collection of metadata retries */
+ H5F_t * f = NULL, *f1 = NULL; /* Internal file object pointers */
+ unsigned i, j, n; /* Local index variables */
+ hid_t did1, did2; /* Dataset IDs */
+ hid_t sid; /* Dataspace ID */
+ hid_t dcpl; /* Dataset creation property list */
+ hsize_t dims[2] = {6, 10}; /* Dataset dimensions */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ int buf[6][10], chkbuf1[6][10], chkbuf2[6][10]; /* Buffers for data */
+ hsize_t max_dims_1un[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t max_dims_2un[2] = {500, H5S_UNLIMITED}; /* Dataset maximum dimensions */
+ hsize_t chunk_dims[2] = {2, 2}; /* Chunk dimensions */
/* Output message about test being performed */
TESTING("H5Fset_metadata_read_retry_info()");
/* Get a copy of the parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file without SWMR access */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 1 unlimited dimension: extensible array indexing will be used */
- if((sid = H5Screate_simple(2, dims, max_dims_1un)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims_1un)) < 0)
FAIL_STACK_ERROR
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
- if((did1 = H5Dcreate2(fid, "DSET_1UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "DSET_1UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 2 unlimited dimension: v2 Btree indexing will be used */
- if((sid = H5Screate_simple(2, dims, max_dims_2un)) < 0)
+ if ((sid = H5Screate_simple(2, dims, max_dims_2un)) < 0)
FAIL_STACK_ERROR
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dcreate2(fid, "DSET_2UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, "DSET_2UNLIM", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize buffer data */
- for(i = n = 0; i < 6; i++)
- for(j = 0; j < 10; j++)
- buf[i][j] = (int)n++;
+ for (i = n = 0; i < 6; i++)
+ for (j = 0; j < 10; j++)
+ buf[i][j] = (int)n++;
/* Write to the 2 datasets */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
FAIL_STACK_ERROR
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -931,68 +929,67 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.retries should all be NULL
*/
/* Open the file without SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 0 */
- if(info.nbins != 0)
+ if (info.nbins != 0)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
-
/*
* Open a file with SWMR access, default # of read attempts--
* info.nbins should be 2
* info.retries should all be NULL
*/
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 2 */
- if(info.nbins != 2)
+ if (info.nbins != 2)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1000,33 +997,33 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 1
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 10) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 10) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 1 */
- if(info.nbins != 1)
+ if (info.nbins != 1)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1034,32 +1031,32 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 3
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 3 */
- if(info.nbins != 3)
+ if (info.nbins != 3)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1067,33 +1064,33 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 4
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 10000) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 10000) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 4 */
- if(info.nbins != 4)
+ if (info.nbins != 4)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1101,75 +1098,74 @@ test_metadata_read_retry_info(hid_t in_fapl)
* info.nbins should be 0
* info.retries should all be NULL
*/
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_metadata_read_attempts(new_fapl, 1) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 1) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 0 */
- if(info.nbins != 0)
+ if (info.nbins != 0)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
-
/*
* Case 2: tests on retries info
*/
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid, "DSET_1UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read data from the dataset */
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf1) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid, "DSET_2UNLIM", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Read data from the dataset */
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chkbuf2) < 0)
FAIL_STACK_ERROR
/* Retrieve retry information */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 2 */
- if(info.nbins != 2)
+ if (info.nbins != 2)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
TEST_ERROR
/* Get a pointer to the internal file object */
- if((f = (H5F_t *)H5VL_object(fid)) == NULL)
+ if ((f = (H5F_t *)H5VL_object(fid)) == NULL)
FAIL_STACK_ERROR
/*
@@ -1180,45 +1176,45 @@ test_metadata_read_retry_info(hid_t in_fapl)
*/
/* v2 B-tree leaf node: log retry 99 for 500 times */
- for(i = 0; i < 500; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_BT2_LEAF_ID, 99) < 0)
+ for (i = 0; i < 500; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_BT2_LEAF_ID, 99) < 0)
FAIL_STACK_ERROR
}
/* Extensive array data block: log retry 10 for 1000 times */
- for(i = 0; i < 1000; i++)
- if(H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 10) < 0)
+ for (i = 0; i < 1000; i++)
+ if (H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 10) < 0)
FAIL_STACK_ERROR
/* File's superblock: log retry 1 for 1 time */
- if(H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Verify retries for v2 B-tree leaf node */
- if(info.retries[4][0] != 0)
+ if (info.retries[4][0] != 0)
TEST_ERROR
- if(info.retries[4][1] != 500)
+ if (info.retries[4][1] != 500)
TEST_ERROR
/* Verify retries for extensive array data block */
- if(info.retries[15][0] != 0)
+ if (info.retries[15][0] != 0)
TEST_ERROR
- if(info.retries[15][1] != 1000)
+ if (info.retries[15][1] != 1000)
TEST_ERROR
/* Verify retries for file's superblock */
- if(info.retries[20][0] != 1)
+ if (info.retries[20][0] != 1)
TEST_ERROR
- if(info.retries[20][1] != 0)
+ if (info.retries[20][1] != 0)
TEST_ERROR
/* Free memory for info.retries */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
}
@@ -1231,145 +1227,145 @@ test_metadata_read_retry_info(hid_t in_fapl)
*/
/* Object header: log retry 5 for 5 times */
- for(i = 0; i < 5; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_OHDR_ID, 5) < 0)
+ for (i = 0; i < 5; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_OHDR_ID, 5) < 0)
TEST_ERROR
}
/* Extensive array data block: log retry 4 for 1 time */
- if(H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 4) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_EARRAY_DBLOCK_ID, 4) < 0)
TEST_ERROR
/* Fixed array header : log retry 50 for 10000 times */
- for(i = 0; i < 10000; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_FARRAY_HDR_ID, 50) < 0)
+ for (i = 0; i < 10000; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_FARRAY_HDR_ID, 50) < 0)
TEST_ERROR
}
/* File's superblock: log retry 1 for 1 more time */
- if(H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/*
* Verify info has both previous + current retries information:
*/
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- switch(i) {
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ switch (i) {
case 0: /* Object header */
- if(info.retries[i][0] != 5)
+ if (info.retries[i][0] != 5)
TEST_ERROR
- if(info.retries[i][1] != 0)
+ if (info.retries[i][1] != 0)
TEST_ERROR
break;
case 4: /* v2 B-tree leaf node */
- if(info.retries[i][0] != 0)
+ if (info.retries[i][0] != 0)
TEST_ERROR
- if(info.retries[i][1] != 500)
+ if (info.retries[i][1] != 500)
TEST_ERROR
break;
case 15: /* Extensive array data block */
- if(info.retries[i][0] != 1)
+ if (info.retries[i][0] != 1)
TEST_ERROR
- if(info.retries[i][1] != 1000)
+ if (info.retries[i][1] != 1000)
TEST_ERROR
break;
case 17: /* Fixed array header */
- if(info.retries[i][0] != 0)
+ if (info.retries[i][0] != 0)
TEST_ERROR
- if(info.retries[i][1] != 10000)
+ if (info.retries[i][1] != 10000)
TEST_ERROR
break;
case 20: /* File's superblock */
- if(info.retries[i][0] != 2)
+ if (info.retries[i][0] != 2)
TEST_ERROR
- if(info.retries[i][1] != 0)
+ if (info.retries[i][1] != 0)
TEST_ERROR
break;
default:
- if(info.retries[i] != NULL)
+ if (info.retries[i] != NULL)
TEST_ERROR
break;
}
}
/* Free memory for info.retries */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
/* Closing */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Get a copy of the file access property list */
- if((new_fapl = H5Pcopy(fapl)) < 0)
+ if ((new_fapl = H5Pcopy(fapl)) < 0)
FAIL_STACK_ERROR
/* Set the number of metadata read attempts to 101 */
- if(H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
+ if (H5Pset_metadata_read_attempts(new_fapl, 101) < 0)
FAIL_STACK_ERROR
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, new_fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, new_fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if((f = (H5F_t *)H5VL_object(fid)) == NULL)
+ if ((f = (H5F_t *)H5VL_object(fid)) == NULL)
FAIL_STACK_ERROR
/* File's superblock: log retry 1 for 1 time */
- if(H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
+ if (H5F_track_metadata_read_retries(f, H5AC_SUPERBLOCK_ID, 1) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Should be 3 */
- if(info.nbins != 3)
+ if (info.nbins != 3)
TEST_ERROR
/* Verify retries info */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- switch(i) {
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ switch (i) {
case 20: /* File's superblock */
- if(info.retries[i][0] != 1)
+ if (info.retries[i][0] != 1)
TEST_ERROR
- if(info.retries[i][1] != 0)
+ if (info.retries[i][1] != 0)
TEST_ERROR
- if(info.retries[i][2] != 0)
+ if (info.retries[i][2] != 0)
TEST_ERROR
break;
default:
- if(info.retries[i] != NULL)
+ if (info.retries[i] != NULL)
TEST_ERROR
break;
}
}
/* Free memory */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++)
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
/* Closing */
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -1385,39 +1381,39 @@ test_metadata_read_retry_info(hid_t in_fapl)
* retries should all be NULL
*/
/* Open the file without SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Re-open fid */
- if((fid1 = H5Freopen(fid)) < 0)
+ if ((fid1 = H5Freopen(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information for fid */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Retrieve retries information for fid1*/
- if(H5Fget_metadata_read_retry_info(fid1, &info1)< 0)
+ if (H5Fget_metadata_read_retry_info(fid1, &info1) < 0)
FAIL_STACK_ERROR
/* Should be 0 */
- if(info.nbins != 0)
+ if (info.nbins != 0)
TEST_ERROR
- if(info1.nbins != 0)
+ if (info1.nbins != 0)
TEST_ERROR
/* Should be all NULL */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ if (info.retries[i] != NULL)
TEST_ERROR
- if(info1.retries[i] != NULL)
+ if (info1.retries[i] != NULL)
TEST_ERROR
}
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
/*
@@ -1427,95 +1423,96 @@ test_metadata_read_retry_info(hid_t in_fapl)
* --increment retries for metadata item: free-space sections (retries[9][1])--
*/
/* Open the file with SWMR access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object for fid */
- if((f = (H5F_t *)H5VL_object(fid)) == NULL)
+ if ((f = (H5F_t *)H5VL_object(fid)) == NULL)
FAIL_STACK_ERROR
/* Re-open fid */
- if((fid1 = H5Freopen(fid)) < 0)
+ if ((fid1 = H5Freopen(fid)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object for fid1 */
- if((f1 = (H5F_t *)H5VL_object(fid1)) == NULL)
+ if ((f1 = (H5F_t *)H5VL_object(fid1)) == NULL)
FAIL_STACK_ERROR
/* For fid: fixed array data block page--log retry 9 for 500 times */
- for(i = 0; i < 500; i++) {
- if(H5F_track_metadata_read_retries(f, H5AC_FARRAY_DBLK_PAGE_ID, 9) < 0)
+ for (i = 0; i < 500; i++) {
+ if (H5F_track_metadata_read_retries(f, H5AC_FARRAY_DBLK_PAGE_ID, 9) < 0)
FAIL_STACK_ERROR
}
/* For fid1: free-space sections--log retry 99 for 1000 times */
- for(i = 0; i < 1000; i++) {
- if(H5F_track_metadata_read_retries(f1, H5AC_FSPACE_SINFO_ID, 99) < 0)
+ for (i = 0; i < 1000; i++) {
+ if (H5F_track_metadata_read_retries(f1, H5AC_FSPACE_SINFO_ID, 99) < 0)
FAIL_STACK_ERROR
}
/* Retrieve the collection of metadata read retries for fid */
- if(H5Fget_metadata_read_retry_info(fid, &info) < 0)
+ if (H5Fget_metadata_read_retry_info(fid, &info) < 0)
FAIL_STACK_ERROR
/* Retrieve the collection of metadata read retries for fid1 */
- if(H5Fget_metadata_read_retry_info(fid1, &info1) < 0)
+ if (H5Fget_metadata_read_retry_info(fid1, &info1) < 0)
FAIL_STACK_ERROR
/* Verify nbins for fid & fid1: should be 2 */
- if(info.nbins != 2)
+ if (info.nbins != 2)
TEST_ERROR
- if(info1.nbins != 2)
+ if (info1.nbins != 2)
TEST_ERROR
/* Verify retries for fid: fixed array data block page */
- if(info.retries[19][0] != 500)
+ if (info.retries[19][0] != 500)
TEST_ERROR
- if(info.retries[19][1] != 0)
+ if (info.retries[19][1] != 0)
TEST_ERROR
/* Verify retries for fid: free-space sections */
/* (Since file was re-opened) */
- if(info.retries[9][0] != 0)
+ if (info.retries[9][0] != 0)
TEST_ERROR
- if(info.retries[9][1] != 1000)
+ if (info.retries[9][1] != 1000)
TEST_ERROR
/* Verify retries for fid1: free-space sections */
- if(info1.retries[9][0] != 0)
+ if (info1.retries[9][0] != 0)
TEST_ERROR
- if(info1.retries[9][1] != 1000)
+ if (info1.retries[9][1] != 1000)
TEST_ERROR
/* Verify retries for fid1: fixed array data block page */
/* (Since file was re-opened) */
- if(info1.retries[19][0] != 500)
+ if (info1.retries[19][0] != 500)
TEST_ERROR
- if(info1.retries[19][1] != 0)
+ if (info1.retries[19][1] != 0)
TEST_ERROR
/* Free memory for info.retries and info1.retries */
- for(i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
- if(info.retries[i] != NULL)
+ for (i = 0; i < H5F_NUM_METADATA_READ_RETRY_TYPES; i++) {
+ if (info.retries[i] != NULL)
H5free_memory(info.retries[i]);
- if(info1.retries[i] != NULL)
+ if (info1.retries[i] != NULL)
H5free_memory(info1.retries[i]);
} /* end for */
/* Closing */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(new_fapl);
H5Dclose(did1);
@@ -1524,14 +1521,13 @@ error:
H5Pclose(dcpl);
H5Fclose(fid);
H5Fclose(fid1);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_metadata_read_retry_info() */
-
-
/*
* Tests for H5Fstart_swmr_write()
*/
@@ -1567,39 +1563,39 @@ error:
static int
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 */
- hid_t gid = -1; /* Group ID */
- hid_t dcpl = -1; /* Dataset creation property */
- hid_t file_fapl = -1; /* File access property for the file */
- hid_t did1 = -1, did2 = -1, did3 = -1; /* Dataset IDs */
- hid_t did1_a = -1, did1_b = -1;
- hid_t sid1 = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
- hsize_t dim[1] = {1}; /* Dimension sizes */
- hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dim[1] = {2}; /* Chunk dimension sizes */
- hsize_t dim2[2] = {5, 10}; /* Dimension sizes */
- hsize_t max_dim2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
- hsize_t chunk_dim2[2] = {2, 7}; /* Chunk dimension sizes */
- H5D_chunk_index_t idx_type; /* Dataset chunk index type */
- int wdata = 99; /* Data to write */
- int rdata; /* Data read */
- unsigned attempts; /* The retrieved # of read attempts */
- char filename[NAME_BUF_SIZE]; /* File name */
- herr_t ret; /* Return value */
-
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property */
+ hid_t gid = -1; /* Group ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t file_fapl = -1; /* File access property for the file */
+ hid_t did1 = -1, did2 = -1, did3 = -1; /* Dataset IDs */
+ hid_t did1_a = -1, did1_b = -1;
+ hid_t sid1 = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
+ hsize_t dim[1] = {1}; /* Dimension sizes */
+ hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim[1] = {2}; /* Chunk dimension sizes */
+ hsize_t dim2[2] = {5, 10}; /* Dimension sizes */
+ hsize_t max_dim2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim2[2] = {2, 7}; /* Chunk dimension sizes */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ int wdata = 99; /* Data to write */
+ int rdata; /* Data read */
+ unsigned attempts; /* The retrieved # of read attempts */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ herr_t ret; /* Return value */
/* Get a copy of the parameter fapl (non-latest-format) */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if(new_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 {
+ /* 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");
} /* end if */
@@ -1611,89 +1607,91 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
*/
/* Create the file with SWMR write + non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ 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)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts from the file's fapl */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
+ if (attempts != (new_format ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
TEST_ERROR;
/* Close the property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR
/* Create "dataset1" */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
FAIL_STACK_ERROR
- if((sid1 = H5Screate_simple(1, dim, max_dim)) < 0)
+ if ((sid1 = H5Screate_simple(1, dim, max_dim)) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Get the chunk index type */
- if(H5D__layout_idx_type_test(did1, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did1, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ 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)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
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_format) {
- if(ret < 0) TEST_ERROR
- } else if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (new_format) {
+ if (ret < 0)
+ TEST_ERROR
+ }
+ else if (ret >= 0)
TEST_ERROR
/* Read from the dataset */
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(wdata != rdata)
+ if (wdata != rdata)
TEST_ERROR
/* Close "dataset1", dataspace, dataset creation property list */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid1) < 0)
+ if (H5Sclose(sid1) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR;
/* Close the file access property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/*
@@ -1701,151 +1699,151 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
*/
/* Open the file again with write + non-latest-format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 1 */
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_METADATA_READ_ATTEMPTS)
TEST_ERROR;
/* Close the property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR;
/* open "dataset1", keep it open */
- if((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* open "dataset1" second time */
- if((did1_a = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
+ if ((did1_a = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* open "dataset1" third time */
- if((did1_b = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
+ if ((did1_b = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Write to "dataset1" */
wdata = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Create "dataset2" in the group, keep it open */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
FAIL_STACK_ERROR
- if((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ if ((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
FAIL_STACK_ERROR;
- if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Get the chunk index type for "dataset2" */
- if(H5D__layout_idx_type_test(did2, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did2, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ 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)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Get the file's access_property list */
- if((file_fapl = H5Fget_access_plist(fid)) < 0)
+ if ((file_fapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
- if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
+ if (H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
FAIL_STACK_ERROR
/* Should be 100 */
- if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
+ if (attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
TEST_ERROR;
/* Close the property list */
- if(H5Pclose(file_fapl) < 0)
+ if (H5Pclose(file_fapl) < 0)
FAIL_STACK_ERROR;
rdata = 0;
/* Read from "dataset1" via did1_b (multiple opens) */
- if(H5Dread(did1_b, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1_b, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
- if(wdata != rdata)
+ if (wdata != rdata)
FAIL_STACK_ERROR;
- if(H5Dclose(did1_b) < 0)
+ if (H5Dclose(did1_b) < 0)
FAIL_STACK_ERROR;
/* Read from "dataset1" */
rdata = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
- if(wdata != rdata)
+ if (wdata != rdata)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
rdata = 0;
/* Read from "dataset1" via did1_a (multiple opens) */
- if(H5Dread(did1_a, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ if (H5Dread(did1_a, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
FAIL_STACK_ERROR;
- if(wdata != rdata)
+ if (wdata != rdata)
FAIL_STACK_ERROR;
- if(H5Dclose(did1_a) < 0)
+ if (H5Dclose(did1_a) < 0)
FAIL_STACK_ERROR;
/* Close "dataset2", dataspace, dataset creation property list */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid2) < 0)
+ if (H5Sclose(sid2) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
/* Create "dataset3" */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
FAIL_STACK_ERROR
- if((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ if ((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0)
FAIL_STACK_ERROR;
- if((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Get the chunk index type for "dataset3" */
- if(H5D__layout_idx_type_test(did3, &idx_type) < 0)
+ if (H5D__layout_idx_type_test(did3, &idx_type) < 0)
FAIL_STACK_ERROR;
- if(idx_type != H5D_CHUNK_IDX_BT2)
+ 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)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid3) < 0)
+ if (H5Sclose(sid3) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
/* Close the group */
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR;
/* Close the file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -1853,7 +1851,8 @@ test_start_swmr_write(hid_t in_fapl, hbool_t new_format)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Fclose(fid);
H5Pclose(fapl);
H5Pclose(file_fapl);
@@ -1867,7 +1866,8 @@ error:
H5Sclose(sid1);
H5Sclose(sid2);
H5Sclose(sid3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_start_swmr_write() */
@@ -1928,42 +1928,42 @@ error:
static int
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 */
- hid_t fapl = -1; /* A copy of file access property */
- hid_t new_fapl = -1; /* A copy of file access property */
- hid_t gid = -1; /* Group ID */
- hid_t did = -1; /* Dataset ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t aid = -1; /* Attribute ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t bad_fid = -1; /* Test fid (should never represent a real ID) */
- herr_t ret; /* Return value */
- char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t fid = -1; /* File ID */
+ hid_t fid2 = -1; /* File ID */
+ hid_t fapl = -1; /* A copy of file access property */
+ hid_t new_fapl = -1; /* A copy of file access property */
+ hid_t gid = -1; /* Group ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t bad_fid = -1; /* Test fid (should never represent a real ID) */
+ herr_t ret; /* Return value */
+ char filename[NAME_BUF_SIZE]; /* File name */
/* Create a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- if((new_fapl = H5Pcopy(in_fapl)) < 0)
+ if ((new_fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
- if(new_format) {
+ if (new_format) {
TESTING("H5Fstart_swmr_write() on failure conditions for latest format");
- if((fapl = H5Pcopy(new_fapl)) < 0)
- FAIL_STACK_ERROR
- } else {
+ if ((fapl = H5Pcopy(new_fapl)) < 0)
+ FAIL_STACK_ERROR
+ }
+ else {
TESTING("H5Fstart_swmr_write() on failure conditions for without latest format");
}
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
-
/*
* (A) When creating a file:
*/
@@ -1971,65 +1971,62 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
/* Case 1 */
/* Create the file with SWMR_WRITE + with/without latest format */
- fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl);
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl);
/* 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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 2 */
- if(new_format) {
+ if (new_format) {
/* Create the file with write + latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ 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)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR;
- if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ 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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
- } else {
+ }
+ else {
/* Create a file with write + non-latest-format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ 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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
} /* end if */
@@ -2038,117 +2035,111 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
*/
/* Create a file with write + latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
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)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
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)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
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)
+ if ((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 4 */
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create and commit a named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ if ((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR;
- if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if (H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
/* Create dataspace */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR;
/* Attach an attribute to the named datatype */
- if((aid = H5Acreate2(tid, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(tid, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the datatype */
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the attribute */
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR;
/* Close the dataspace */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
/*
* (C) Failure cases for multiple opens
*/
@@ -2156,163 +2147,158 @@ test_err_start_swmr_write(hid_t in_fapl, hbool_t new_format)
/* Case 1 */
/* Create a file with write + with/without latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ 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)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
/* Case 2 */
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Re-open the same file */
- if((fid2 = H5Freopen(fid)) < 0)
+ if ((fid2 = H5Freopen(fid)) < 0)
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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the files */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR;
/* Case 3 */
/* Open the file with write + with/without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Open the same file */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing for fid */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Should fail to enable SWMR writing for fid2 */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid2);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid2); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Close the files */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR;
- if(!new_format) {
+ if (!new_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)
+ /* 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)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Case 1 */
- /* Should fail to open the file with SWMR write + latest format due to superblock version not at least 3 */
- H5E_BEGIN_TRY {
- bad_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, new_fapl);
- } H5E_END_TRY;
- if(bad_fid >= 0)
+ /* Should fail to open the file with SWMR write + latest format due to superblock version not at least
+ * 3 */
+ H5E_BEGIN_TRY { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, new_fapl); }
+ H5E_END_TRY;
+ if (bad_fid >= 0)
TEST_ERROR
/* 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 {
- bad_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(bad_fid >= 0)
+ /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at
+ * least 3 */
+ H5E_BEGIN_TRY { bad_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (bad_fid >= 0)
TEST_ERROR
/* Case 3 */
/* Open the file with write + latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ 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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
-
/* Case 4 */
/* Open the file with write + non-latest-format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ 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)
+ H5E_BEGIN_TRY { ret = H5Fstart_swmr_write(fid); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
} /* not new */
/* Close the file access property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(new_fapl) < 0)
+ if (H5Pclose(new_fapl) < 0)
FAIL_STACK_ERROR;
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Gclose(gid);
H5Dclose(did);
@@ -2324,7 +2310,8 @@ error:
* It never needs to be closed in the normal case.
*/
H5Fclose(bad_fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_err_start_swmr_write() */
@@ -2364,81 +2351,83 @@ test_start_swmr_write_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSE
return 0;
} /* test_start_swmr_write_concur() */
-#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
+#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
static int
test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
- hid_t fapl; /* File access property list */
- pid_t childpid=0; /* Child process ID */
- pid_t tmppid; /* Child process ID returned by waitpid */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int child_exit_val; /* Exit status of the child */
- char filename[NAME_BUF_SIZE]; /* File name */
-
- hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
+ hid_t fid = -1, fid1 = -1, fid2 = -1; /* File IDs */
+ hid_t fapl; /* File access property list */
+ pid_t childpid = 0; /* Child process ID */
+ pid_t tmppid; /* Child process ID returned by waitpid */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int child_exit_val; /* Exit status of the child */
+ char filename[NAME_BUF_SIZE]; /* File name */
+
+ hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
hsize_t chunk_dims[1] = {1};
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- hsize_t dims[1] = {1};
- int wdata = 0;
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t dims[1] = {1};
+ int wdata = 0;
int out_pdf[2];
int in_pdf[2];
int notify = 0;
/* Output message about test being performed */
- if(new_format) {
+ if (new_format) {
TESTING("H5Fstart_swmr_write()--concurrent access for latest format");
- } else {
+ }
+ else {
TESTING("H5Fstart_swmr_write()--concurrent access for non-latest-format");
} /* end if */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new_format) {
+ if (new_format) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- } else {
+ }
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
- /* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ /* Create a chunked dataset with 1 extendible dimension */
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/*
@@ -2448,67 +2437,70 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail */
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
/* Open the test file */
- fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl);
+ }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* child process terminated abnormally */
+ }
+ else /* child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -2518,264 +2510,264 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Create 2 pipes */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
- if(HDpipe(in_pdf) < 0)
+ if (HDpipe(in_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid1 = -1, child_fid2; /* File IDs */
- hid_t child_did1 = -1, child_did2 = -1; /* Dataset IDs */
- int child_notify = 0;
- int rdata = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid1 = -1, child_fid2; /* File IDs */
+ hid_t child_did1 = -1, child_did2 = -1; /* Dataset IDs */
+ int child_notify = 0;
+ int rdata = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
- /* close unused read end for in_pdf */
- if(HDclose(in_pdf[0]) < 0)
+ /* close unused read end for in_pdf */
+ if (HDclose(in_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should succeed in opening the test file 2 times */
- if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
- if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
- /* open "dataset" 2 times */
- if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
+ /* open "dataset" 2 times */
+ if ((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
- if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
- /* Read from "dataset" via child_did1 */
- rdata = 0;
- if(H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ /* Read from "dataset" via child_did1 */
+ rdata = 0;
+ if (H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
HDexit(EXIT_FAILURE);
- if(rdata != 88)
+ if (rdata != 88)
HDexit(EXIT_FAILURE);
- /* Notify parent process */
+ /* Notify parent process */
child_notify = 2;
- if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
- HDexit(EXIT_FAILURE);
+ if (HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
+ HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 3) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 3) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
- /* Refresh "dataset" via child_did2 */
- if(H5Drefresh(child_did2) < 0)
+ /* Refresh "dataset" via child_did2 */
+ if (H5Drefresh(child_did2) < 0)
HDexit(EXIT_FAILURE);
- /* Read from "dataset" child_did2 */
- rdata = 0;
- if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ /* Read from "dataset" child_did2 */
+ rdata = 0;
+ if (H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
HDexit(EXIT_FAILURE);
- if(rdata != 99)
+ if (rdata != 99)
HDexit(EXIT_FAILURE);
- /* Read from "dataset" child_did1 */
- rdata = 0;
- if(H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ /* Read from "dataset" child_did1 */
+ rdata = 0;
+ if (H5Dread(child_did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
HDexit(EXIT_FAILURE);
- if(rdata != 99)
+ if (rdata != 99)
HDexit(EXIT_FAILURE);
- /* Close the dataset */
- if(H5Dclose(child_did1))
+ /* Close the dataset */
+ if (H5Dclose(child_did1))
HDexit(EXIT_FAILURE);
- if(H5Dclose(child_did2))
+ if (H5Dclose(child_did2))
HDexit(EXIT_FAILURE);
- /* Close the file */
- if(H5Fclose(child_fid1) < 0)
+ /* Close the file */
+ if (H5Fclose(child_fid1) < 0)
HDexit(EXIT_FAILURE);
- if(H5Fclose(child_fid2) < 0)
+ if (H5Fclose(child_fid2) < 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
- if(HDclose(in_pdf[1]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
+ if (HDclose(in_pdf[1]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Close unused write end for in_pdf */
- if(HDclose(in_pdf[1]) < 0)
+ if (HDclose(in_pdf[1]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* open "dataset", keep it open */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((did3 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- /* Write to "dataset" */
+ /* Write to "dataset" */
wdata = 88;
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid1) < 0)
+ if (H5Fstart_swmr_write(fid1) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Wait for notification from child process */
- while(notify != 2) {
- if(HDread(in_pdf[0], &notify, sizeof(int)) < 0)
+ while (notify != 2) {
+ if (HDread(in_pdf[0], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
}
- /* Write to "dataset" */
+ /* Write to "dataset" */
wdata = 99;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid1, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Notify child process */
notify = 3;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the dataset */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR
/* Close the pipes */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
- if(HDclose(in_pdf[0]) < 0)
+ if (HDclose(in_pdf[0]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
-
/*
* Case (3):
* Verify concurrent file open with H5F_ACC_RDONLY
* will fail with H5Fstart_swmr_write()
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail in opening the test file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -2785,74 +2777,74 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Should fail in opening the test file */
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -2862,90 +2854,92 @@ test_start_swmr_write_concur(hid_t in_fapl, hbool_t new_format)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* 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)
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing mode */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(sid);
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -2962,20 +2956,20 @@ error:
static int
test_start_swmr_write_stress_ohdr(hid_t in_fapl)
{
- hid_t fid = -1; /* File IDs */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* File name */
- hid_t did = -1, did2 = -1; /* Dataset IDs */
- hid_t sid = -1; /* Dataspace ID */
- hid_t tid = -1; /* Datatype ID */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t aid = -1; /* Attribute ID */
- hsize_t chunk_dims[2] = {10, 10};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- char fill[256]; /* Fill value for dataset */
- char attr_data[32]; /* Data value for attribute */
- hsize_t dims[2] = {1,1};
- unsigned chunk_num; /* Object header chunk # for dataspace message */
+ hid_t fid = -1; /* File IDs */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t did = -1, did2 = -1; /* Dataset IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t aid = -1; /* Attribute ID */
+ hsize_t chunk_dims[2] = {10, 10};
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ char fill[256]; /* Fill value for dataset */
+ char attr_data[32]; /* Data value for attribute */
+ hsize_t dims[2] = {1, 1};
+ unsigned chunk_num; /* Object header chunk # for dataspace message */
/* Output message about test being performed */
TESTING("H5Fstart_swmr_write()--stress object header messages");
@@ -2984,122 +2978,123 @@ test_start_swmr_write_stress_ohdr(hid_t in_fapl)
HDmemset(fill, 0, sizeof(fill));
HDmemset(attr_data, 0, sizeof(attr_data));
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_size(tid, 256) < 0)
+ if (H5Tset_size(tid, 256) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fill_value(dcpl, tid, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, tid, &fill) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Retrieve the chunk # for the dataspace message */
chunk_num = UINT_MAX;
- if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
+ if (H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
FAIL_STACK_ERROR;
/* Should be in chunk #0 for now */
- if(0 != chunk_num)
+ if (0 != chunk_num)
TEST_ERROR;
/* Create a second chunked dataset with 2 extendible dimensions */
/* (So that the original dataset's object header can't be extended) */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_size(tid, 256) < 0)
+ if (H5Tset_size(tid, 256) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fill_value(dcpl, tid, &fill) < 0)
+ if (H5Pset_fill_value(dcpl, tid, &fill) < 0)
FAIL_STACK_ERROR;
- if((did2 = H5Dcreate2(fid, "dataset2", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dataset2", tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Close the second dataset */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
/* Close the objects for the dataset creation */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Create attribute on original dataset, to push dataspace header message out of header chunk #0 */
- if((sid = H5Screate(H5S_SCALAR)) < 0)
+ if ((sid = H5Screate(H5S_SCALAR)) < 0)
FAIL_STACK_ERROR;
- if((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if ((tid = H5Tcopy(H5T_C_S1)) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_size(tid, 32) < 0)
+ if (H5Tset_size(tid, 32) < 0)
FAIL_STACK_ERROR;
- if(H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
+ if (H5Tset_strpad(tid, H5T_STR_NULLTERM) < 0)
FAIL_STACK_ERROR;
- if((aid = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((aid = H5Acreate2(did, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Awrite(aid, tid, attr_data) < 0)
+ if (H5Awrite(aid, tid, attr_data) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Tclose(tid) < 0)
+ if (H5Tclose(tid) < 0)
FAIL_STACK_ERROR
- if(H5Aclose(aid) < 0)
+ if (H5Aclose(aid) < 0)
FAIL_STACK_ERROR
/* Retrieve the chunk # for the dataspace message */
chunk_num = UINT_MAX;
- if(H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
+ if (H5O__msg_get_chunkno_test(did, H5O_SDSPACE_ID, &chunk_num) < 0)
FAIL_STACK_ERROR;
/* Should be in chunk #0 for now */
- if(1 != chunk_num)
+ if (1 != chunk_num)
TEST_ERROR;
/* Enable SWMR write */
- if(H5Fstart_swmr_write(fid) < 0)
+ if (H5Fstart_swmr_write(fid) < 0)
FAIL_STACK_ERROR;
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the FAPL */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Sclose(aid);
H5Sclose(tid);
H5Sclose(sid);
@@ -3108,7 +3103,8 @@ error:
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_start_swmr_write_stress_ohdr() */
@@ -3121,7 +3117,7 @@ error:
static herr_t
flush_cb(hid_t H5_ATTR_UNUSED obj_id, void *_udata)
{
- unsigned *flush_ct = (unsigned*)_udata;
+ unsigned *flush_ct = (unsigned *)_udata;
++(*flush_ct);
return 0;
}
@@ -3145,20 +3141,20 @@ flush_cb(hid_t H5_ATTR_UNUSED obj_id, void *_udata)
static int
test_object_flush_cb(hid_t in_fapl)
{
- hid_t fapl = -1; /* A copy of file access property list */
- hid_t ffapl = -1; /* A file's file access property list */
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t did1 = -1, did2 = -1; /* Dataset IDs */
- hid_t sid = -1; /* Dataspace ID */
- hsize_t dims[2] = {5, 10}; /* Dataset dimension sizes */
- int buf[50]; /* Data buffer */
- H5F_flush_cb_t ret_cb; /* The callback function set in object flush property */
- void *ret_ct; /* The user data set in object flush property */
- unsigned flush_ct = 0; /* The user data for object flush property */
- char filename[NAME_BUF_SIZE]; /* File name */
- int i; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t fapl = -1; /* A copy of file access property list */
+ hid_t ffapl = -1; /* A file's file access property list */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t did1 = -1, did2 = -1; /* Dataset IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hsize_t dims[2] = {5, 10}; /* Dataset dimension sizes */
+ int buf[50]; /* Data buffer */
+ H5F_flush_cb_t ret_cb; /* The callback function set in object flush property */
+ void * ret_ct; /* The user data set in object flush property */
+ unsigned flush_ct = 0; /* The user data for object flush property */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ int i; /* Local index variable */
+ herr_t ret; /* Generic return value */
TESTING("H5Pget/set_obj_flush_cb()");
@@ -3167,10 +3163,9 @@ test_object_flush_cb(hid_t in_fapl)
* To verify the failure condition in setting object flush property
*/
/* Should fail if the callback function is not defined but user data is defined */
- H5E_BEGIN_TRY {
- ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_object_flush_cb(fapl, NULL, &flush_ct); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/*
@@ -3180,14 +3175,14 @@ test_object_flush_cb(hid_t in_fapl)
*/
/* Create a copy of file access property list */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Retrieve object flush property values for the default file access property list */
- if(H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Should be null */
- if(ret_cb != NULL || ret_ct != NULL)
+ if (ret_cb != NULL || ret_ct != NULL)
TEST_ERROR
/*
@@ -3196,22 +3191,22 @@ test_object_flush_cb(hid_t in_fapl)
* non-default file access property list.
*/
/* Set the object flush property */
- if(H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
+ if (H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
TEST_ERROR
/* Increment the counter */
++flush_ct;
/* Retrieve object flush property values for the non-default file access property list */
- if(H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(fapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3222,40 +3217,40 @@ test_object_flush_cb(hid_t in_fapl)
/* Reset values */
flush_ct = 0;
- ret_cb = NULL;
- ret_ct = NULL;
+ ret_cb = NULL;
+ ret_ct = NULL;
/* Make a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file: without setting object flush property in fapl */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_ct != NULL)
+ if (ret_cb != NULL || ret_ct != NULL)
TEST_ERROR
/* Closing */
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/*
@@ -3267,95 +3262,95 @@ test_object_flush_cb(hid_t in_fapl)
*/
/* Reset values */
flush_ct = 0;
- ret_cb = NULL;
- ret_ct = NULL;
+ ret_cb = NULL;
+ ret_ct = NULL;
/* Set the object flush property */
- if(H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
+ if (H5Pset_object_flush_cb(fapl, flush_cb, &flush_ct) < 0)
FAIL_STACK_ERROR
/* Open the test file: with object flush property setting in fapl */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
/* Create a dataset */
- if((sid = H5Screate_simple(2, dims, dims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, dims)) < 0)
FAIL_STACK_ERROR;
/* Create a dataset */
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Initialize data buffer */
- for(i = 0; i < 50; i++)
- buf[i] = i + 1;
+ for (i = 0; i < 50; i++)
+ buf[i] = i + 1;
/* Write to the dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
FAIL_STACK_ERROR;
/* Flush the dataset object */
- if(H5Oflush(did1) < 0)
+ if (H5Oflush(did1) < 0)
FAIL_STACK_ERROR;
/* Get the file's file access property list */
- if((ffapl = H5Fget_access_plist(fid)) < 0)
+ if ((ffapl = H5Fget_access_plist(fid)) < 0)
FAIL_STACK_ERROR;
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 1)
TEST_ERROR
/* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Flush the group */
- if(H5Gflush(gid) < 0)
+ if (H5Gflush(gid) < 0)
TEST_ERROR
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 2)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 2)
TEST_ERROR
/* Create a dataset */
- if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Flush the dataset */
- if(H5Dflush(did2) < 0)
+ if (H5Dflush(did2) < 0)
FAIL_STACK_ERROR;
/* Retrieve the object flush property values */
- if(H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
+ if (H5Pget_object_flush_cb(ffapl, &ret_cb, &ret_ct) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != flush_cb || *(unsigned *)ret_ct != 3)
+ if (ret_cb != flush_cb || *(unsigned *)ret_ct != 3)
TEST_ERROR
/* Closing */
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Gclose(gid) < 0)
+ if (H5Gclose(gid) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(ffapl) < 0)
+ if (H5Pclose(ffapl) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3363,7 +3358,8 @@ test_object_flush_cb(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Pclose(ffapl);
H5Sclose(sid);
@@ -3371,7 +3367,8 @@ error:
H5Dclose(did2);
H5Gclose(gid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_object_flush_cb() */
@@ -3380,7 +3377,6 @@ error:
* Tests for H5Pset/get_append_flush()
*/
-
/* The callback function for append flush property */
static herr_t
append_cb(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void *_udata)
@@ -3390,7 +3386,6 @@ append_cb(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void *
return 0;
} /* append_cb() */
-
/* The callback function for append flush property */
static herr_t
append_cb2(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void *_udata)
@@ -3400,8 +3395,6 @@ append_cb2(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
return 0;
} /* append_cb2() */
-
-
/*
* test_append_flush_generic()
*
@@ -3423,17 +3416,16 @@ append_cb2(hid_t H5_ATTR_UNUSED dset_id, hsize_t H5_ATTR_UNUSED *cur_dims, void
static int
test_append_flush_generic(void)
{
- hid_t dapl = -1; /* A copy of dataset access property */
- hsize_t boundary[3]; /* The boundary for append flush property */
- unsigned count = 0; /* The user data for append flush property */
- hsize_t ret_boundary[3]; /* The boundary set in append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in append flush property */
- unsigned *ret_count; /* The user data set in append flush property */
- herr_t ret; /* The return value */
+ hid_t dapl = -1; /* A copy of dataset access property */
+ hsize_t boundary[3]; /* The boundary for append flush property */
+ unsigned count = 0; /* The user data for append flush property */
+ hsize_t ret_boundary[3]; /* The boundary set in append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in append flush property */
+ unsigned * ret_count; /* The user data set in append flush property */
+ herr_t ret; /* The return value */
TESTING("H5Fget/set_append_flush() for a generic dataset access property list");
-
/*
* Case (1)
* To verify the retrieved append flush property values:
@@ -3441,21 +3433,21 @@ test_append_flush_generic(void)
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(dapl, 2, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(dapl, 2, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
FAIL_STACK_ERROR
/* Verify expected values */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0)
TEST_ERROR;
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
/* Close the property list */
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3468,28 +3460,25 @@ test_append_flush_generic(void)
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Invalid dataset rank: zero value */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 0, NULL, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Invalid dataset rank: > H5S_MAX_RANK */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, H5S_MAX_RANK+1, NULL, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, H5S_MAX_RANK + 1, NULL, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* No boundary specified */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, NULL, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Set up a valid boundary */
@@ -3497,28 +3486,25 @@ test_append_flush_generic(void)
boundary[1] = 1;
/* Undefined callback function but defined user data */
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, NULL, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Invalid boundary size: negative value */
boundary[0] = (hsize_t)-1;
boundary[1] = 1;
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/* Invalid boundary size: H5S_UNLIMITED */
boundary[0] = 1;
boundary[1] = H5S_UNLIMITED;
- H5E_BEGIN_TRY {
- ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count);
- } H5E_END_TRY;
- if(ret >= 0)
+ H5E_BEGIN_TRY { ret = H5Pset_append_flush(dapl, 2, boundary, append_cb, &count); }
+ H5E_END_TRY;
+ if (ret >= 0)
TEST_ERROR
/*
@@ -3529,29 +3515,29 @@ test_append_flush_generic(void)
* -- the # of boundary sizes retrieved does not exceed MIN(input ndims, the ndims set)
*/
boundary[0] = boundary[1] = 1;
- boundary[2] = 0;
- count = 1;
- if(H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
+ boundary[2] = 0;
+ count = 1;
+ if (H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR;
++count;
/* Verify expected values: with boundary rank > set boundary rank */
- if(H5Pget_append_flush(dapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(dapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
- if(ret_boundary[0] != 1 || ret_boundary[1] != 1 || boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 1 || boundary[2] != 0)
TEST_ERROR;
- if(ret_cb == NULL || ret_count == NULL || *ret_count != 2)
+ if (ret_cb == NULL || ret_count == NULL || *ret_count != 2)
TEST_ERROR
/* Verify expected values: with boundary rank < set boundary rank */
HDmemset(ret_boundary, 0, sizeof(ret_boundary));
- if(H5Pget_append_flush(dapl, 1, ret_boundary, NULL, NULL) < 0)
+ if (H5Pget_append_flush(dapl, 1, ret_boundary, NULL, NULL) < 0)
TEST_ERROR
- if(ret_boundary[0] != 1 || ret_boundary[1] != 0 || boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 0 || boundary[2] != 0)
TEST_ERROR;
/* Closing */
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3559,9 +3545,8 @@ test_append_flush_generic(void)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(dapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { H5Pclose(dapl); }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_generic() */
@@ -3585,26 +3570,26 @@ error:
static int
test_append_flush_dataset_chunked(hid_t in_fapl)
{
- hid_t fid = -1; /* file ID */
+ hid_t fid = -1; /* file ID */
hid_t fapl = -1; /* A copy of file access property */
- hid_t did1 = -1, did2 = -1; /* The datset ID */
- hid_t sid = -1; /* The dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
- hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t did1 = -1, did2 = -1; /* The datset ID */
+ hid_t sid = -1; /* The dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t dapl = -1; /* A copy of dataset access property */
hid_t ddapl = -1; /* The dataset access property of the opened dataset */
- hsize_t boundary[3]; /* Boundary size */
- unsigned count = 0; /* User data */
+ hsize_t boundary[3]; /* Boundary size */
+ unsigned count = 0; /* User data */
- hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
- unsigned *ret_count; /* The user data set in the append flush property */
+ hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
+ unsigned * ret_count; /* The user data set in the append flush property */
- char filename[NAME_BUF_SIZE]; /* file name */
+ char filename[NAME_BUF_SIZE]; /* file name */
- hsize_t dims[2] = {100, 0}; /* The dataset dimension sizes */
- hsize_t maxdims[2] = {100, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {5,2}; /* The chunk dimesion sizes */
+ hsize_t dims[2] = {100, 0}; /* The dataset dimension sizes */
+ hsize_t maxdims[2] = {100, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {5, 2}; /* The chunk dimesion sizes */
TESTING("H5Fget/set_append_flush() for a chunked dataset's access property list");
@@ -3617,47 +3602,46 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
*/
/* Get a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3670,44 +3654,41 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
* -- boundary (non-zero) is set for a non-extendible dimension
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
/* Set boundary dimension rank > the rank of dataset to be created */
HDmemset(boundary, 0, sizeof(boundary));
- if(H5Pset_append_flush(dapl, 3, boundary, NULL, NULL) < 0)
+ if (H5Pset_append_flush(dapl, 3, boundary, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Should fail to Create the dataset */
- H5E_BEGIN_TRY {
- did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl);
- } H5E_END_TRY;
- if(did2 >= 0)
+ H5E_BEGIN_TRY { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); }
+ H5E_END_TRY;
+ if (did2 >= 0)
TEST_ERROR
/* Set boundary for a non-extendible dimension */
boundary[0] = boundary[1] = 1;
- if(H5Pset_append_flush(dapl, 2, boundary, NULL, NULL) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, NULL, NULL) < 0)
FAIL_STACK_ERROR
/* Should fail to create the dataset */
- H5E_BEGIN_TRY {
- did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl);
- } H5E_END_TRY;
- if(did2 >= 0)
+ H5E_BEGIN_TRY { did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl); }
+ H5E_END_TRY;
+ if (did2 >= 0)
TEST_ERROR
/* Create and close the dataset */
- if((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
/* Should fail to open the dataset */
- H5E_BEGIN_TRY {
- did2 = H5Dopen2(fid, "dataset2", dapl);
- } H5E_END_TRY;
- if(did2 >= 0)
+ H5E_BEGIN_TRY { did2 = H5Dopen2(fid, "dataset2", dapl); }
+ H5E_END_TRY;
+ if (did2 >= 0)
TEST_ERROR
/*
@@ -3721,52 +3702,52 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
boundary[0] = 0;
boundary[1] = 1;
- if(H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
+ if (H5Pset_append_flush(dapl, 2, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
FAIL_STACK_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
HDmemset(ret_boundary, 0, sizeof(ret_boundary));
- ret_cb = NULL;
+ ret_cb = NULL;
ret_count = NULL;
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != append_cb || ret_count != &count)
+ if (ret_cb != append_cb || ret_count != &count)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
TEST_ERROR
HDmemset(ret_boundary, 0, sizeof(ret_boundary));
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 1, ret_boundary, NULL, NULL) < 0)
+ if (H5Pget_append_flush(ddapl, 1, ret_boundary, NULL, NULL) < 0)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3774,7 +3755,8 @@ test_append_flush_dataset_chunked(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dapl);
H5Pclose(ddapl);
@@ -3783,7 +3765,8 @@ error:
H5Pclose(fapl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_dataset_chunked() */
@@ -3801,21 +3784,21 @@ error:
static int
test_append_flush_dataset_fixed(hid_t in_fapl)
{
- hid_t fid = -1; /* file ID */
+ hid_t fid = -1; /* file ID */
hid_t fapl = -1; /* A copy of file access property */
- hid_t did1 = -1, did2 = -1; /* The datset ID */
- hid_t sid = -1; /* The dataspace ID */
- hid_t dapl = -1; /* A copy of dataset access property */
+ hid_t did1 = -1, did2 = -1; /* The datset ID */
+ hid_t sid = -1; /* The dataspace ID */
+ hid_t dapl = -1; /* A copy of dataset access property */
hid_t ddapl = -1; /* The dataset access property of the opened dataset */
- hsize_t boundary[3]; /* Boundary size */
- unsigned count = 0; /* User data */
+ hsize_t boundary[3]; /* Boundary size */
+ unsigned count = 0; /* User data */
- hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
- unsigned *ret_count; /* The user data set in the append flush property */
+ hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
+ unsigned * ret_count; /* The user data set in the append flush property */
- char filename[NAME_BUF_SIZE]; /* file name */
+ char filename[NAME_BUF_SIZE]; /* file name */
hsize_t dims[1] = {100};
@@ -3830,43 +3813,42 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
*/
/* Get a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a dataset */
- if((sid = H5Screate_simple(1, dims, dims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, dims)) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
/*
@@ -3880,57 +3862,57 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
* zero boundary, null callback function, null user data
*/
/* Create a copy of dataset access property list */
- if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
boundary[0] = 1;
boundary[1] = boundary[2] = 0;
- if(H5Pset_append_flush(dapl, 3, boundary, append_cb, &count) < 0)
+ if (H5Pset_append_flush(dapl, 3, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR
/* Should succeed to create the dataset: append flush property has no effect */
- if((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, dapl)) < 0)
+ if ((did2 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, dapl)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
/* Should succeed in opening the dataset: append flush property has no effect */
- if((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
TEST_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR
/*
* Case (3)--
@@ -3941,39 +3923,39 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
*/
HDmemset(boundary, 0, sizeof(boundary));
- if(H5Pset_append_flush(dapl, 1, boundary, append_cb, &count) < 0)
+ if (H5Pset_append_flush(dapl, 1, boundary, append_cb, &count) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl)) < 0)
FAIL_STACK_ERROR
/* Get the dataset's access property list */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 1, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 1, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values */
- if(ret_cb != NULL || ret_count != NULL)
+ if (ret_cb != NULL || ret_count != NULL)
TEST_ERROR
- if(ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl) < 0)
+ if (H5Pclose(dapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -3981,7 +3963,8 @@ test_append_flush_dataset_fixed(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dapl);
H5Pclose(ddapl);
H5Dclose(did1);
@@ -3989,7 +3972,8 @@ error:
H5Pclose(fapl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_dataset_fixed() */
@@ -4018,29 +4002,29 @@ error:
static int
test_append_flush_dataset_multiple(hid_t in_fapl)
{
- hid_t fid = -1; /* file ID */
+ hid_t fid = -1; /* file ID */
hid_t fapl = -1; /* A copy of file access property */
- hid_t did1 = -1, did2 = -1; /* The datset ID */
- hid_t sid = -1; /* The dataspace ID */
- hid_t dcpl = -1; /* A copy of dataset creation property */
+ hid_t did1 = -1, did2 = -1; /* The datset ID */
+ hid_t sid = -1; /* The dataspace ID */
+ hid_t dcpl = -1; /* A copy of dataset creation property */
hid_t dapl1 = -1; /* A copy of dataset access property */
hid_t dapl2 = -1; /* A copy of dataset access property */
hid_t ddapl = -1; /* The dataset access property of the opened dataset */
- hsize_t boundary1[3]; /* Boundary size */
- hsize_t boundary2[3]; /* Boundary size */
- unsigned count1 = 0; /* User data */
- unsigned count2 = 0; /* User data */
+ hsize_t boundary1[3]; /* Boundary size */
+ hsize_t boundary2[3]; /* Boundary size */
+ unsigned count1 = 0; /* User data */
+ unsigned count2 = 0; /* User data */
- hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
- H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
- unsigned *ret_count; /* The user data set in the append flush property */
+ hsize_t ret_boundary[3]; /* Boundary size set in the append flush property */
+ H5D_append_cb_t ret_cb; /* The callback function set in the append flush property */
+ unsigned * ret_count; /* The user data set in the append flush property */
- char filename[NAME_BUF_SIZE]; /* file name */
+ char filename[NAME_BUF_SIZE]; /* file name */
- hsize_t dims[2] = {0, 0}; /* The dataset dimension sizes */
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {5,2}; /* The chunk dimesion sizes */
+ hsize_t dims[2] = {0, 0}; /* The dataset dimension sizes */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* The dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {5, 2}; /* The chunk dimesion sizes */
TESTING("H5Fget/set_append_flush() for multiple opens of a chunked dataset");
@@ -4055,85 +4039,85 @@ test_append_flush_dataset_multiple(hid_t in_fapl)
*/
/* Create a copy of dataset access property list */
- if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
- if((dapl2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ if ((dapl2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
FAIL_STACK_ERROR
boundary1[0] = 0;
boundary1[1] = 1;
- count1 = 0;
- if(H5Pset_append_flush(dapl1, 2, boundary1, append_cb, &count1) < 0)
+ count1 = 0;
+ if (H5Pset_append_flush(dapl1, 2, boundary1, append_cb, &count1) < 0)
FAIL_STACK_ERROR
boundary2[0] = 1;
boundary2[1] = 0;
- count2 = 0;
- if(H5Pset_append_flush(dapl2, 2, boundary2, append_cb2, &count2) < 0)
+ count2 = 0;
+ if (H5Pset_append_flush(dapl2, 2, boundary2, append_cb2, &count2) < 0)
FAIL_STACK_ERROR
/* Get a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
/* Create the test file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Create a chunked dataset with 2 extendible dimensions */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl1)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, dapl1)) < 0)
FAIL_STACK_ERROR;
/* Open the dataset */
- if((did2 = H5Dopen2(fid, "dataset1", dapl2)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset1", dapl2)) < 0)
FAIL_STACK_ERROR;
/* Get the dataset's access property list for did1 */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl1 */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb || ret_count != &count1)
+ if (ret_cb != append_cb || ret_count != &count1)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
/* Get the dataset's access property list for did2 */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl1 */
- if(ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 0 || ret_boundary[1] != 1 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb || ret_count != &count1)
+ if (ret_cb != append_cb || ret_count != &count1)
TEST_ERROR
/* Close the dataset's access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
H5Dclose(did1);
H5Dclose(did2);
@@ -4149,70 +4133,69 @@ test_append_flush_dataset_multiple(hid_t in_fapl)
* H5Pget_append_flush(did2, ...)
* -- should return append flush property values set in dapl1
*/
- if((did1 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dcreate2(fid, "dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
/* Open the dataset with append flush setting in dapl2 */
- if((did1 = H5Dopen2(fid, "dataset2", dapl2)) < 0)
+ if ((did1 = H5Dopen2(fid, "dataset2", dapl2)) < 0)
FAIL_STACK_ERROR;
/* Open the dataset with append flush setting in dapl1 */
- if((did2 = H5Dopen2(fid, "dataset2", dapl1)) < 0)
+ if ((did2 = H5Dopen2(fid, "dataset2", dapl1)) < 0)
FAIL_STACK_ERROR;
/* Get the dataset's access property list for did1 */
- if((ddapl = H5Dget_access_plist(did1)) < 0)
+ if ((ddapl = H5Dget_access_plist(did1)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl2 */
- if(ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb2 || ret_count != &count2)
+ if (ret_cb != append_cb2 || ret_count != &count2)
TEST_ERROR
/* Close the access property list */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
-
/* Get the dataset's access property list for did2 */
- if((ddapl = H5Dget_access_plist(did2)) < 0)
+ if ((ddapl = H5Dget_access_plist(did2)) < 0)
FAIL_STACK_ERROR
/* Retrieve the append flush property values */
- if(H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
+ if (H5Pget_append_flush(ddapl, 3, ret_boundary, &ret_cb, (void **)&ret_count) < 0)
TEST_ERROR
/* Verify expected values: should be the setting in dapl2 */
- if(ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
+ if (ret_boundary[0] != 1 || ret_boundary[1] != 0 || ret_boundary[2] != 0)
TEST_ERROR;
- if(ret_cb != append_cb2 || ret_count != &count2)
+ if (ret_cb != append_cb2 || ret_count != &count2)
TEST_ERROR
/* Closing */
- if(H5Pclose(ddapl) < 0)
+ if (H5Pclose(ddapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl2) < 0)
+ if (H5Pclose(dapl2) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dapl1) < 0)
+ if (H5Pclose(dapl1) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -4220,7 +4203,8 @@ test_append_flush_dataset_multiple(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(dcpl);
H5Pclose(dapl1);
H5Pclose(dapl2);
@@ -4230,13 +4214,12 @@ error:
H5Pclose(fapl);
H5Sclose(sid);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_append_flush_dataset_multiple() */
-
-
/****************************************************************
**
** test_file_lock_same():
@@ -4248,15 +4231,15 @@ error:
static int
test_file_lock_same(hid_t in_fapl)
{
- hid_t fid = -1, fid2 = -1; /* File IDs */
- hid_t fapl = -1; /* File access property list */
- unsigned intent; /* File access flags */
- char filename[NAME_BUF_SIZE]; /* file name */
+ hid_t fid = -1, fid2 = -1; /* File IDs */
+ hid_t fapl = -1; /* File access property list */
+ unsigned intent; /* File access flags */
+ char filename[NAME_BUF_SIZE]; /* file name */
/* Output message about test being performed */
TESTING("File open with different combinations of flags--single process access");
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
@@ -4266,122 +4249,121 @@ test_file_lock_same(hid_t in_fapl)
* Case 1: 1) RDWR 2) RDWR : should succeed
*/
/* Create file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check file intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Open the same file with RDWR */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid2, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (H5Fget_intent(fid2, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/*
* Case 2: 1) RDWR 2) RDONLY : should succeed
*/
/* Open file with RDWR */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Open file with RDONLY */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent: should get intent from 1st open */
- if(H5Fget_intent(fid2, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDWR)
- TEST_ERROR
+ if (H5Fget_intent(fid2, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDWR)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/*
* Case 3: 1) RDONLY 2) RDWR : should fail
*/
/* Open file with RDONLY */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDONLY)
- TEST_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Open file with RDWR should fail */
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close first file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/*
* Case 4: 1) RDONLY 2) RDONLY : should succeed
*/
/* Open file with RDONLY */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDONLY)
- TEST_ERROR
+ if (H5Fget_intent(fid, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Open file with RDONLY */
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get and check the intent */
- if(H5Fget_intent(fid2, &intent) < 0)
- FAIL_STACK_ERROR
- if(intent != H5F_ACC_RDONLY)
- TEST_ERROR
+ if (H5Fget_intent(fid2, &intent) < 0)
+ FAIL_STACK_ERROR
+ if (intent != H5F_ACC_RDONLY)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR
+ if (H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4389,11 +4371,13 @@ test_file_lock_same(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(fid);
- H5Fclose(fid2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ H5Fclose(fid2);
+ }
+ H5E_END_TRY;
return -1;
} /* end test_file_lock_same() */
@@ -4409,30 +4393,30 @@ error:
static int
test_file_lock_swmr_same(hid_t in_fapl)
{
- hid_t fid, fid2; /* File IDs */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
+ hid_t fid, fid2; /* File IDs */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
/* Output message about test being performed */
TESTING("File open with different combinations of flags + SWMR flags--single process access");
/* Get a copy of the parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4442,38 +4426,34 @@ test_file_lock_swmr_same(hid_t in_fapl)
/*
* Case a: RDWR|SWRM_READ : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Case b: RDWR|SWMM_WRTE|SWMR_READ : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Case c: RDONLY|SWMM_WRITE : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Case d: RDONLY|SWMM_WRITE|SWMR_READ : should fail
*/
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_WRITE|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_WRITE | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
+ TEST_ERROR
/*
* Cases 1 - 12: combinations of different flags for 1st and 2nd opens
@@ -4482,195 +4462,190 @@ test_file_lock_swmr_same(hid_t in_fapl)
/*
* Case 1: 1) RDWR 2) RDWR|SWMR_WRITE : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 2: 1) RDWR 2) RDONLY|SWMR_READ : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- TEST_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
- TEST_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 3: 1) RDWR|SWMR_WRITE 2)RDWR : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 4: 1) RDWR|SWMR_WRITE 2) RDWR|SWMR_WRITE : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 5: 1) RDWR|SWMR_WRITE 2) RDONLY|SWMR_READ : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 6: 1) RDWR|SWMR_WRITE 2) RDONLY : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 7: 1) RDONLY|SWMR_READ 2)RDWR : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 8: 1) RDONLY|SWMR_READ 2) RDWR|SWMR_WRITE : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 9: 1) RDONLY|SWMR_READ 2) RDONLY|SWMR_READ : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 10: 1) RDONLY|SWMR_READ 2) RDONLY : should succeed
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
TEST_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close file */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/*
* Case 11: 1) RDONLY 2) RDWR|SWMR_WRITE: should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
- if(fid2 >= 0)
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 12: 1) RDONLY 2) RDONLY|SWMR_READ : should fail
*/
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- H5E_BEGIN_TRY {
- fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
- if(fid2 >=0 )
- TEST_ERROR
+ H5E_BEGIN_TRY { fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
+ if (fid2 >= 0)
+ TEST_ERROR
/* Close file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -4678,16 +4653,17 @@ test_file_lock_swmr_same(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Fclose(fid);
- H5Fclose(fid2);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY
+ {
+ H5Pclose(fapl);
+ H5Fclose(fid);
+ H5Fclose(fid2);
+ }
+ H5E_END_TRY;
return -1;
} /* end test_file_lock_swmr_same() */
-
/****************************************************************
**
** test_file_lock_concur():
@@ -4714,30 +4690,30 @@ test_file_lock_concur(hid_t H5_ATTR_UNUSED in_fapl)
static int
test_file_lock_concur(hid_t in_fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
- pid_t childpid=0; /* Child process ID */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int out_pdf[2];
- int notify = 0;
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
+ pid_t childpid = 0; /* Child process ID */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int out_pdf[2];
+ int notify = 0;
/* Output message about test being performed */
TESTING("File open with different combinations of flags--concurrent access");
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4745,148 +4721,148 @@ test_file_lock_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
- /* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
- TEST_ERROR
- } else
+ if (WIFEXITED(child_status)) {
+ /* Check exit status of the child */
+ if (WEXITSTATUS(child_status) != 0)
+ TEST_ERROR
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 2: 1) RDWR 2) RDONLY : should fail
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Opens the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Opens the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4894,74 +4870,74 @@ test_file_lock_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Opens the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
} /* end if */
- /* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ /* close unused read end for out_pdf */
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Opens the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -4969,41 +4945,40 @@ test_file_lock_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Opens the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
+ if (child_fid >= 0) {
/* Close the file */
- if(H5Fclose(child_fid) < 0)
- HDexit(EXIT_FAILURE);
+ if (H5Fclose(child_fid) < 0)
+ HDexit(EXIT_FAILURE);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
- HDexit(EXIT_FAILURE);
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
+ HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
@@ -5012,40 +4987,41 @@ test_file_lock_concur(hid_t in_fapl)
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Create file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -5053,10 +5029,12 @@ test_file_lock_concur(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -5090,34 +5068,34 @@ test_file_lock_swmr_concur(hid_t H5_ATTR_UNUSED in_fapl)
static int
test_file_lock_swmr_concur(hid_t in_fapl)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
- pid_t childpid=0; /* Child process ID */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int out_pdf[2];
- int notify = 0;
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
+ pid_t childpid = 0; /* Child process ID */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int out_pdf[2];
+ int notify = 0;
/* Output message about test being performed */
TESTING("File open with different combintations of flags + SWMR flags--concurrent access");
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
/* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5125,74 +5103,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5200,74 +5178,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
- FAIL_STACK_ERROR
+ if ((childpid = HDfork()) < 0)
+ FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ /* Close unused write end for out_pdf */
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
- FAIL_STACK_ERROR
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5275,299 +5253,299 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 4: 1) RDWR|SWMR_WRITE 2) RDWR|SWMR_WRITE : should fail
*/
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
- FAIL_STACK_ERROR
+ if ((childpid = HDfork()) < 0)
+ FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
- FAIL_STACK_ERROR
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 5: 1) RDWR|SWMR_WRITE 2) RDONLY|SWMR_READ : should succeed
*/
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
- FAIL_STACK_ERROR
+ if ((childpid = HDfork()) < 0)
+ FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
- FAIL_STACK_ERROR
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
- FAIL_STACK_ERROR
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
* Case 6: 1) RDWR|SWMR_WRITE 2) RDONLY : should fail
*/
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5575,74 +5553,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5650,74 +5628,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5725,77 +5703,77 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5803,76 +5781,77 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- if((child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((child_fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
- /* Notify child process */
+ /* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5880,74 +5859,74 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
- FAIL_STACK_ERROR
+ if (HDpipe(out_pdf) < 0)
+ FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl); }
+ H5E_END_TRY;
/* Should fail */
- if(child_fid == FAIL)
+ if (child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ /* Close the pipe */
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* Close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/*
@@ -5955,81 +5934,81 @@ test_file_lock_swmr_concur(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
}
/* Open the test file */
- H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl);
- } H5E_END_TRY;
+ H5E_BEGIN_TRY { child_fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl); }
+ H5E_END_TRY;
/* Should succeed */
- if(child_fid >= 0) {
- if(H5Fclose(child_fid) < 0)
+ if (child_fid >= 0) {
+ if (H5Fclose(child_fid) < 0)
FAIL_STACK_ERROR
HDexit(EXIT_SUCCESS);
}
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_FAILURE);
}
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
FAIL_STACK_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
- } else
+ }
+ else
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
@@ -6037,17 +6016,17 @@ test_file_lock_swmr_concur(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* end test_file_lock_swmr_concur() */
-
-
#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */
/****************************************************************
@@ -6066,35 +6045,33 @@ test_file_lock_env_var(hid_t in_fapl)
HDputs(" Test skipped due to fork or waitpid not defined.");
return 0;
#else
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* file name */
- pid_t childpid=0; /* Child process ID */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int out_pdf[2];
- int notify = 0;
-
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* file name */
+ pid_t childpid = 0; /* Child process ID */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int out_pdf[2];
+ int notify = 0;
TESTING("File locking environment variable");
-
/* Set the environment variable */
- if(HDsetenv("HDF5_USE_FILE_LOCKING", "FALSE", TRUE) < 0)
+ if (HDsetenv("HDF5_USE_FILE_LOCKING", "FALSE", TRUE) < 0)
TEST_ERROR
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
TEST_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
/* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Open a file for read-only and then read-write. This would
@@ -6104,77 +6081,77 @@ test_file_lock_env_var(hid_t in_fapl)
*/
/* Create 1 pipe */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
TEST_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
TEST_ERROR
- if(childpid == 0) {
+ if (childpid == 0) {
/* Child process */
- hid_t child_fid; /* File ID */
- int child_notify = 0;
+ hid_t child_fid; /* File ID */
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1) {
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1) {
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
} /* end while */
/* Open the test file */
- if((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
/* Close the pipe */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
} /* end if */
/* close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
TEST_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
TEST_ERROR;
/* Close the pipe */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
TEST_ERROR;
/* Wait for child process to complete */
- if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
+ if (HDwaitpid(childpid, &child_status, child_wait_option) < 0)
TEST_ERROR
/* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
+ if (WIFEXITED(child_status)) {
/* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
+ if (WEXITSTATUS(child_status) != 0)
TEST_ERROR
} /* end if */
else
TEST_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
TEST_ERROR
/* Close the copied property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
TEST_ERROR
PASSED();
@@ -6182,64 +6159,63 @@ test_file_lock_env_var(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
-
#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */
} /* end test_file_lock_env_var() */
-
static int
test_swmr_vfd_flag(void)
{
- hid_t fid = -1; /* file ID */
- hid_t sec2_fapl = -1; /* fapl ID of a VFD that supports SWMR writes (sec2) */
- hid_t bad_fapl = -1; /* fapl ID of a VFD that does not support SWMR writes (stdio) */
- char filename[NAME_BUF_SIZE]; /* file name */
+ hid_t fid = -1; /* file ID */
+ hid_t sec2_fapl = -1; /* fapl ID of a VFD that supports SWMR writes (sec2) */
+ hid_t bad_fapl = -1; /* fapl ID of a VFD that does not support SWMR writes (stdio) */
+ char filename[NAME_BUF_SIZE]; /* file name */
TESTING("SWMR-enabled VFD flag functionality");
/* Attempt to open a file using a SWMR-compatible VFD. */
- if((sec2_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((sec2_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fapl_sec2(sec2_fapl) < 0)
+ if (H5Pset_fapl_sec2(sec2_fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(sec2_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(sec2_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
h5_fixname(FILENAME[0], sec2_fapl, filename, sizeof(filename));
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, sec2_fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, sec2_fapl)) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
/* Attempt to open a file using a non-SWMR-compatible VFD. */
- if((bad_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ if ((bad_fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_fapl_stdio(bad_fapl) < 0)
+ if (H5Pset_fapl_stdio(bad_fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pset_libver_bounds(bad_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(bad_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
fid = -1;
h5_fixname(FILENAME[0], bad_fapl, filename, sizeof(filename));
- H5E_BEGIN_TRY {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl);
- } H5E_END_TRY;
- if(fid >= 0)
+ H5E_BEGIN_TRY { fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, bad_fapl); }
+ H5E_END_TRY;
+ if (fid >= 0)
TEST_ERROR;
- if(H5Pclose(sec2_fapl) < 0)
+ if (H5Pclose(sec2_fapl) < 0)
FAIL_STACK_ERROR;
- if(H5Pclose(bad_fapl) < 0)
+ if (H5Pclose(bad_fapl) < 0)
FAIL_STACK_ERROR;
PASSED();
@@ -6247,11 +6223,13 @@ test_swmr_vfd_flag(void)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Pclose(sec2_fapl);
H5Pclose(bad_fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_swmr_vfd_flag() */
@@ -6265,18 +6243,18 @@ error:
static int
test_bug_refresh(hid_t in_fapl)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl;
+ hid_t fid = -1; /* File ID */
+ hid_t fapl;
H5F_t *f;
- hid_t gid1, gid2, gid3, gid4, gid5, gid6, gid7, gid8, gid9;
- char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t gid1, gid2, gid3, gid4, gid5, gid6, gid7, gid8, gid9;
+ char filename[NAME_BUF_SIZE]; /* File name */
/* Create a copy of the input parameter in_fapl */
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if (H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
@@ -6285,45 +6263,54 @@ test_bug_refresh(hid_t in_fapl)
TESTING("H5Orefresh failure conditions");
/* Create a file with the latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
/* Get a pointer to the internal file object */
- if(NULL == (f = (H5F_t *)H5VL_object(fid)))
+ if (NULL == (f = (H5F_t *)H5VL_object(fid)))
FAIL_STACK_ERROR
/* Create groups: compact to dense storage */
- if((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid1 = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid2 = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid2 = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid3 = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid3 = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid4 = H5Gcreate2(fid, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid4 = H5Gcreate2(fid, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid5 = H5Gcreate2(fid, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid5 = H5Gcreate2(fid, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid6 = H5Gcreate2(fid, "group6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid6 = H5Gcreate2(fid, "group6", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid7 = H5Gcreate2(fid, "group7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid7 = H5Gcreate2(fid, "group7", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid8 = H5Gcreate2(fid, "group8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid8 = H5Gcreate2(fid, "group8", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
- if((gid9 = H5Gcreate2(fid, "group9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if ((gid9 = H5Gcreate2(fid, "group9", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
if (H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
TEST_ERROR
- if(H5Grefresh(gid1) < 0) TEST_ERROR
- if(H5Grefresh(gid2) < 0) TEST_ERROR
- if(H5Grefresh(gid3) < 0) TEST_ERROR
- if(H5Grefresh(gid4) < 0) TEST_ERROR
- if(H5Grefresh(gid5) < 0) TEST_ERROR
- if(H5Grefresh(gid6) < 0) TEST_ERROR
- if(H5Grefresh(gid7) < 0) TEST_ERROR
- if(H5Grefresh(gid8) < 0) TEST_ERROR
- if(H5Grefresh(gid9) < 0) TEST_ERROR
+ if (H5Grefresh(gid1) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid2) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid3) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid4) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid5) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid6) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid7) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid8) < 0)
+ TEST_ERROR
+ if (H5Grefresh(gid9) < 0)
+ TEST_ERROR
H5Gclose(gid1);
H5Gclose(gid2);
@@ -6340,7 +6327,8 @@ test_bug_refresh(hid_t in_fapl)
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Gclose(gid1);
H5Gclose(gid2);
H5Gclose(gid3);
@@ -6352,7 +6340,8 @@ error:
H5Gclose(gid9);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
} /* test_bug_refresh() */
@@ -6395,27 +6384,27 @@ test_refresh_concur(hid_t H5_ATTR_UNUSED in_fapl, hbool_t H5_ATTR_UNUSED new_for
return 0;
} /* test_refresh_concur() */
-#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
+#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
static int
test_refresh_concur(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid; /* File ID */
- hid_t fapl; /* File access property list */
- pid_t childpid=0; /* Child process ID */
- pid_t tmppid; /* Child process ID returned by waitpid */
- int child_status; /* Status passed to waitpid */
- int child_wait_option=0; /* Options passed to waitpid */
- int child_exit_val; /* Exit status of the child */
- char filename[NAME_BUF_SIZE]; /* File name */
-
- hid_t did = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
+ hid_t fid; /* File ID */
+ hid_t fapl; /* File access property list */
+ pid_t childpid = 0; /* Child process ID */
+ pid_t tmppid; /* Child process ID returned by waitpid */
+ int child_status; /* Status passed to waitpid */
+ int child_wait_option = 0; /* Options passed to waitpid */
+ int child_exit_val; /* Exit status of the child */
+ char filename[NAME_BUF_SIZE]; /* File name */
+
+ hid_t did = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
hsize_t chunk_dims[1] = {1};
- hsize_t maxdims[1] = {H5S_UNLIMITED};
- hsize_t dims[1] = { 1 };
- hsize_t new_dims[1] = {2};
+ hsize_t maxdims[1] = {H5S_UNLIMITED};
+ hsize_t dims[1] = {1};
+ hsize_t new_dims[1] = {2};
int out_pdf[2];
int in_pdf[2];
@@ -6423,271 +6412,274 @@ test_refresh_concur(hid_t in_fapl, hbool_t new_format)
int wbuf[2];
/* Output message about test being performed */
- if(new_format) {
+ if (new_format) {
TESTING("H5Drefresh()--concurrent access for latest format");
- } else {
+ }
+ else {
TESTING("H5Drefresh()--concurrent access for non-latest-format");
} /* end if */
-
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new_format) {
+ if (new_format) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- } else {
+ }
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(1, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(1, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 1, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Create 2 pipes */
- if(HDpipe(out_pdf) < 0)
+ if (HDpipe(out_pdf) < 0)
FAIL_STACK_ERROR
- if(HDpipe(in_pdf) < 0)
+ if (HDpipe(in_pdf) < 0)
FAIL_STACK_ERROR
/* Fork child process */
- if((childpid = HDfork()) < 0)
+ if ((childpid = HDfork()) < 0)
FAIL_STACK_ERROR
- if(childpid == 0) { /* Child process */
- hid_t child_fid1 = -1; /* File ID */
- hid_t child_fid2 = -1; /* File ID */
- hid_t child_did1 = -1, child_did2 = -1;
- hid_t child_sid = -1;
+ if (childpid == 0) { /* Child process */
+ hid_t child_fid1 = -1; /* File ID */
+ hid_t child_fid2 = -1; /* File ID */
+ hid_t child_did1 = -1, child_did2 = -1;
+ hid_t child_sid = -1;
hsize_t tdims[1];
- int rbuf[2] = {0, 0};
- int child_notify = 0;
+ int rbuf[2] = {0, 0};
+ int child_notify = 0;
/* Close unused write end for out_pdf */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
/* close unused read end for in_pdf */
- if(HDclose(in_pdf[0]) < 0)
+ if (HDclose(in_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 1)
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 1)
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
/* Open the file 2 times */
- if((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid1 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
- if((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY|H5F_ACC_SWMR_READ, fapl)) < 0)
+ if ((child_fid2 = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
HDexit(EXIT_FAILURE);
/* Open the dataset 2 times */
- if((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((child_did1 = H5Dopen2(child_fid1, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
- if((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((child_did2 = H5Dopen2(child_fid2, "dataset", H5P_DEFAULT)) < 0)
HDexit(EXIT_FAILURE);
/* Get the dataset's dataspace via did1 */
- if((child_sid = H5Dget_space(child_did1)) < 0)
+ if ((child_sid = H5Dget_space(child_did1)) < 0)
HDexit(EXIT_FAILURE);
- if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
HDexit(EXIT_FAILURE);
- if(tdims[0] != 1)
+ if (tdims[0] != 1)
HDexit(EXIT_FAILURE);
/* Read from the dataset via did2 */
- if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
HDexit(EXIT_FAILURE);
/* Verify the data is correct */
- if(rbuf[0] != 99)
+ if (rbuf[0] != 99)
HDexit(EXIT_FAILURE);
/* Notify parent process */
child_notify = 2;
- if(HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
+ if (HDwrite(in_pdf[1], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
/* Wait for notification from parent process */
- while(child_notify != 3)
- if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
+ while (child_notify != 3)
+ if (HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
/* Refresh dataset via did1 */
- if(H5Drefresh(child_did1) < 0)
+ if (H5Drefresh(child_did1) < 0)
HDexit(EXIT_FAILURE);
/* Get the dataset's dataspace and verify */
- if((child_sid = H5Dget_space(child_did1)) < 0)
+ if ((child_sid = H5Dget_space(child_did1)) < 0)
HDexit(EXIT_FAILURE);
- if(H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
+ if (H5Sget_simple_extent_dims(child_sid, tdims, NULL) < 0)
HDexit(EXIT_FAILURE);
- if(tdims[0] != 2)
+ if (tdims[0] != 2)
HDexit(EXIT_FAILURE);
/* Read from the dataset */
- if(H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if (H5Dread(child_did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
HDexit(EXIT_FAILURE);
/* Verify the data is correct */
- if(rbuf[0] != 100 || rbuf[1] != 100)
+ if (rbuf[0] != 100 || rbuf[1] != 100)
HDexit(EXIT_FAILURE);
/* Close the 2 datasets */
- if(H5Dclose(child_did1) < 0)
+ if (H5Dclose(child_did1) < 0)
HDexit(EXIT_FAILURE);
- if(H5Dclose(child_did2) < 0)
+ if (H5Dclose(child_did2) < 0)
HDexit(EXIT_FAILURE);
/* Close the 2 files */
- if(H5Fclose(child_fid1) < 0)
+ if (H5Fclose(child_fid1) < 0)
HDexit(EXIT_FAILURE);
- if(H5Fclose(child_fid2) < 0)
+ if (H5Fclose(child_fid2) < 0)
HDexit(EXIT_FAILURE);
/* Close the pipes */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
- if(HDclose(in_pdf[1]) < 0)
+ if (HDclose(in_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
HDexit(EXIT_SUCCESS);
}
/* Close unused read end for out_pdf */
- if(HDclose(out_pdf[0]) < 0)
+ if (HDclose(out_pdf[0]) < 0)
FAIL_STACK_ERROR
/* Close unused write end for in_pdf */
- if(HDclose(in_pdf[1]) < 0)
+ if (HDclose(in_pdf[1]) < 0)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset */
- if((did = H5Dopen2(fid, "dataset", H5P_DEFAULT)) < 0)
+ if ((did = H5Dopen2(fid, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Write to the dataset */
wbuf[0] = wbuf[1] = 99;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Notify child process */
notify = 1;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
-
/* Wait for notification from child process */
- while(notify != 2) {
- if(HDread(in_pdf[0], &notify, sizeof(int)) < 0)
+ while (notify != 2) {
+ if (HDread(in_pdf[0], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
}
/* Cork the metadata cache, to prevent the object header from being
* flushed before the data has been written */
- if(H5Odisable_mdc_flushes(did) < 0)
+ if (H5Odisable_mdc_flushes(did) < 0)
FAIL_STACK_ERROR;
/* Extend the dataset */
- if(H5Dset_extent(did, new_dims) < 0)
+ if (H5Dset_extent(did, new_dims) < 0)
FAIL_STACK_ERROR;
/* Write to the dataset */
wbuf[0] = wbuf[1] = 100;
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
+ if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0)
FAIL_STACK_ERROR;
/* Uncork the metadata cache */
- if(H5Oenable_mdc_flushes(did) < 0)
+ if (H5Oenable_mdc_flushes(did) < 0)
FAIL_STACK_ERROR;
/* Flush to disk */
- if(H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
+ if (H5Fflush(fid, H5F_SCOPE_LOCAL) < 0)
FAIL_STACK_ERROR;
/* Notify child process */
notify = 3;
- if(HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
+ if (HDwrite(out_pdf[1], &notify, sizeof(int)) < 0)
FAIL_STACK_ERROR;
/* Close the pipes */
- if(HDclose(out_pdf[1]) < 0)
+ if (HDclose(out_pdf[1]) < 0)
FAIL_STACK_ERROR;
- if(HDclose(in_pdf[0]) < 0)
+ if (HDclose(in_pdf[0]) < 0)
FAIL_STACK_ERROR;
/* Wait for child process to complete */
- if((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0)
FAIL_STACK_ERROR
/* Check exit status of child process */
- if(WIFEXITED(child_status)) {
- if((child_exit_val = WEXITSTATUS(child_status)) != 0)
+ if (WIFEXITED(child_status)) {
+ if ((child_exit_val = WEXITSTATUS(child_status)) != 0)
TEST_ERROR
- } else /* Child process terminated abnormally */
+ }
+ else /* Child process terminated abnormally */
TEST_ERROR
/* Close the dataset */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Sclose(sid);
H5Pclose(dcpl);
H5Pclose(fapl);
H5Fclose(fid);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -6710,302 +6702,303 @@ error:
static int
test_multiple_same(hid_t in_fapl, hbool_t new_format)
{
- hid_t fid = -1, fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
- hid_t fapl; /* File access property list */
- char filename[NAME_BUF_SIZE]; /* File name */
- hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
- hid_t sid = -1;
- hid_t dcpl = -1;
+ hid_t fid = -1, fid1 = -1, fid2 = -1, fid3 = -1; /* File IDs */
+ hid_t fapl; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ hid_t did = -1, did1 = -1, did2 = -1, did3 = -1;
+ hid_t sid = -1;
+ hid_t dcpl = -1;
hsize_t chunk_dims[2] = {1, 2};
- hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
- hsize_t dims[2] = {1, 1};
- int rbuf = 0;
- int wbuf = 0;
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t dims[2] = {1, 1};
+ int rbuf = 0;
+ int wbuf = 0;
/* Output message about test being performed */
- if(new_format) {
+ if (new_format) {
TESTING("multiple--single process access for latest format");
- } else {
+ }
+ else {
TESTING("multiple--single process access for non-latest-format");
} /* end if */
-
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ if ((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- if(new_format) {
+ if (new_format) {
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- } else {
+ }
+ 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)
+ if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC | H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
} /* end if */
/* Create a chunked dataset with 1 extendible dimension */
- if((sid = H5Screate_simple(2, dims, maxdims)) < 0)
+ if ((sid = H5Screate_simple(2, dims, maxdims)) < 0)
FAIL_STACK_ERROR;
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
FAIL_STACK_ERROR
- if(H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
+ if (H5Pset_chunk(dcpl, 2, chunk_dims) < 0)
FAIL_STACK_ERROR;
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ if ((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR;
/* Closing */
- if(H5Dclose(did) < 0)
+ if (H5Dclose(did) < 0)
FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0)
+ if (H5Sclose(sid) < 0)
FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0)
+ if (H5Pclose(dcpl) < 0)
FAIL_STACK_ERROR
/* Close the file */
- if(H5Fclose(fid) < 0)
+ if (H5Fclose(fid) < 0)
FAIL_STACK_ERROR
/* Case 1 */
/* Open the file 3 times: SWMR-write, read-write, read-only */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset 3 times with fid1, fid2, fid3 */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
-
/* Write to the dataset via did1 */
wbuf = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh via did2 */
- if(H5Drefresh(did2) < 0)
+ if (H5Drefresh(did2) < 0)
FAIL_STACK_ERROR;
/* Read from the dataset via did2 */
rbuf = 0;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(rbuf != 88)
+ if (rbuf != 88)
FAIL_STACK_ERROR;
/* Write to the dataset via did3 */
wbuf = 99;
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh via did1 */
- if(H5Drefresh(did1) < 0)
+ if (H5Drefresh(did1) < 0)
FAIL_STACK_ERROR;
/* Read from the dataset via did1 */
rbuf = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(rbuf != 99)
+ if (rbuf != 99)
FAIL_STACK_ERROR;
/* Close datasets */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
/* Close files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
FAIL_STACK_ERROR
/* Case 2 */
/* Open the file 3 times: read-write, read-only, read-write */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset 3 times with fid1, fid2, fid3 */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the dataset via did1 */
wbuf = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh via did2 */
- if(H5Drefresh(did2) < 0)
+ if (H5Drefresh(did2) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did2 */
rbuf = 0;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Write to dataset via did3 */
wbuf = 99;
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Enable SWMR write */
- if(H5Fstart_swmr_write(fid1) < 0)
+ if (H5Fstart_swmr_write(fid1) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did1 and verify data is correct */
rbuf = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Write to dataset via did2 */
wbuf = 100;
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh dataset via did3 */
- if(H5Drefresh(did3) < 0)
+ if (H5Drefresh(did3) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did3 and verify data is correct */
rbuf = 0;
- if(H5Dread(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Close datasets */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
/* Close files */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR;
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
FAIL_STACK_ERROR
/* Case 3 */
/* Open the file 3 times: read-write, read-only, read-only */
- if((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if ((fid1 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid2 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
- if((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if ((fid3 = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Open the dataset 3 times with fid1, fid2, fid3 */
- if((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
+ if ((did1 = H5Dopen2(fid1, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
+ if ((did2 = H5Dopen2(fid2, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- if((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
+ if ((did3 = H5Dopen2(fid3, "dataset", H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
/* Write to the dataset via did1 */
wbuf = 88;
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Refresh dataset via did2 */
- if(H5Drefresh(did2) < 0)
+ if (H5Drefresh(did2) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did2 and verify data is correct */
rbuf = 0;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Close dataset via did2 */
- if(H5Dclose(did2) < 0)
+ if (H5Dclose(did2) < 0)
FAIL_STACK_ERROR;
/* Close file via fid2 */
- if(H5Fclose(fid2) < 0)
+ if (H5Fclose(fid2) < 0)
FAIL_STACK_ERROR
/* Write to dataset via did3 */
wbuf = 99;
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
+ if (H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wbuf) < 0)
FAIL_STACK_ERROR;
/* Close dataset via did3 */
- if(H5Dclose(did3) < 0)
+ if (H5Dclose(did3) < 0)
FAIL_STACK_ERROR;
/* Close file via fid3 */
- if(H5Fclose(fid3) < 0)
+ if (H5Fclose(fid3) < 0)
FAIL_STACK_ERROR
/* Enable SWMR writing */
- if(H5Fstart_swmr_write(fid1) < 0)
+ if (H5Fstart_swmr_write(fid1) < 0)
FAIL_STACK_ERROR;
/* Read from dataset via did1 and verify data is correct */
rbuf = 0;
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
+ if (H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rbuf) < 0)
FAIL_STACK_ERROR;
- if(rbuf != wbuf)
+ if (rbuf != wbuf)
FAIL_STACK_ERROR;
/* Close dataset via did1 */
- if(H5Dclose(did1) < 0)
+ if (H5Dclose(did1) < 0)
FAIL_STACK_ERROR;
/* Close file via fid1 */
- if(H5Fclose(fid1) < 0)
+ if (H5Fclose(fid1) < 0)
FAIL_STACK_ERROR
/* Close the property list */
- if(H5Pclose(fapl) < 0)
+ if (H5Pclose(fapl) < 0)
FAIL_STACK_ERROR
PASSED();
return 0;
error:
- H5E_BEGIN_TRY {
+ H5E_BEGIN_TRY
+ {
H5Dclose(did);
H5Dclose(did1);
H5Dclose(did2);
@@ -7017,7 +7010,8 @@ error:
H5Fclose(fid1);
H5Fclose(fid2);
H5Fclose(fid3);
- } H5E_END_TRY;
+ }
+ H5E_END_TRY;
return -1;
@@ -7031,17 +7025,17 @@ error:
int
main(void)
{
- int nerrors = 0; /* The # of errors */
- hid_t fapl = -1; /* File access property list ID */
- char *driver = NULL; /* VFD string (from env variable) */
- char *lock_env_var = NULL; /* file locking env var pointer */
- hbool_t use_file_locking; /* read from env var */
+ int nerrors = 0; /* The # of errors */
+ hid_t fapl = -1; /* File access property list ID */
+ char * driver = NULL; /* VFD string (from env variable) */
+ char * lock_env_var = NULL; /* file locking env var pointer */
+ hbool_t use_file_locking; /* read from env var */
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
driver = HDgetenv("HDF5_DRIVER");
- if(!H5FD__supports_swmr_test(driver)) {
+ if (!H5FD__supports_swmr_test(driver)) {
HDprintf("This VFD does not support SWMR I/O\n");
return EXIT_SUCCESS;
} /* end if */
@@ -7051,7 +7045,7 @@ main(void)
* disabled.
*/
lock_env_var = HDgetenv("HDF5_USE_FILE_LOCKING");
- if(lock_env_var && !HDstrcmp(lock_env_var, "FALSE"))
+ if (lock_env_var && !HDstrcmp(lock_env_var, "FALSE"))
use_file_locking = FALSE;
else
use_file_locking = TRUE;
@@ -7097,7 +7091,7 @@ main(void)
nerrors += test_append_flush_dataset_fixed(fapl);
nerrors += test_append_flush_dataset_multiple(fapl);
- if(use_file_locking) {
+ if (use_file_locking) {
/*
* Tests for:
* file open flags--single process access
@@ -7121,7 +7115,7 @@ main(void)
/* Tests SWMR VFD compatibility flag.
* Only needs to run when the VFD is the default (sec2).
*/
- if(NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2"))
+ if (NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2"))
nerrors += test_swmr_vfd_flag();
/* This test changes the HDF5_USE_FILE_LOCKING environment variable
@@ -7129,7 +7123,7 @@ main(void)
*/
nerrors += test_file_lock_env_var(fapl);
- if(nerrors)
+ if (nerrors)
goto error;
HDprintf("All tests passed.\n");
@@ -7140,9 +7134,7 @@ main(void)
error:
nerrors = MAX(1, nerrors);
- HDprintf("***** %d SWMR TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d SWMR TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return EXIT_FAILURE;
} /* end main() */
-