diff options
Diffstat (limited to 'test/filenotclosed.c')
-rw-r--r-- | test/filenotclosed.c | 65 |
1 files changed, 32 insertions, 33 deletions
diff --git a/test/filenotclosed.c b/test/filenotclosed.c index 2d050eb..13ce9fd 100644 --- a/test/filenotclosed.c +++ b/test/filenotclosed.c @@ -16,11 +16,10 @@ * application does not close the file. (See HDFFV-10160) */ - #include "h5test.h" -#define FILENAME "filenotclosed" -#define DATASET_NAME "dset" +#define FILENAME "filenotclosed" +#define DATASET_NAME "dset" /*------------------------------------------------------------------------- * Function: catch_signal @@ -33,12 +32,12 @@ * *------------------------------------------------------------------------- */ -static void catch_signal(int H5_ATTR_UNUSED signo) +static void +catch_signal(int H5_ATTR_UNUSED signo) { HDexit(EXIT_FAILURE); } /* catch_signal() */ - /*------------------------------------------------------------------------- * Function: main * @@ -55,22 +54,22 @@ static void catch_signal(int H5_ATTR_UNUSED signo) int main(void) { - hid_t fapl = -1; /* File access property lists */ - hid_t fid = -1; /* File ID */ - hid_t did = -1; /* Dataset ID */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t sid = -1; /* Dataspace ID */ - hsize_t cur_dim[1] = {5}; /* Current dimension sizes */ - hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */ - hsize_t chunk_dim[1] = {10}; /* Chunk dimension sizes */ - int buf[5] = {1, 2, 3, 4, 5}; /* The data to be written to the dataset */ - char filename[100]; /* File name */ - const char *env_h5_drvr; /* File Driver value from environment */ - hbool_t contig_addr_vfd; /* Contiguous address vfd */ - - /* Get the VFD to use */ + hid_t fapl = -1; /* File access property lists */ + hid_t fid = -1; /* File ID */ + hid_t did = -1; /* Dataset ID */ + hid_t dcpl = -1; /* Dataset creation property list */ + hid_t sid = -1; /* Dataspace ID */ + hsize_t cur_dim[1] = {5}; /* Current dimension sizes */ + hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */ + hsize_t chunk_dim[1] = {10}; /* Chunk dimension sizes */ + int buf[5] = {1, 2, 3, 4, 5}; /* The data to be written to the dataset */ + char filename[100]; /* File name */ + const char *env_h5_drvr; /* File Driver value from environment */ + hbool_t contig_addr_vfd; /* Contiguous address vfd */ + + /* Get the VFD to use */ env_h5_drvr = HDgetenv("HDF5_DRIVER"); - if(env_h5_drvr == NULL) + if (env_h5_drvr == NULL) env_h5_drvr = "nomatch"; /* Skip test when using VFDs that has different address spaces for each @@ -79,7 +78,7 @@ main(void) * split/multi driver. Please see HDFFV-10160. */ contig_addr_vfd = (hbool_t)(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi")); - if(!contig_addr_vfd) { + if (!contig_addr_vfd) { SKIPPED(); puts(" Temporary skipped for a spilt/multi driver"); HDexit(EXIT_SUCCESS); @@ -88,51 +87,51 @@ main(void) h5_reset(); /* To exit from the file for SIGABRT signal */ - if(HDsignal(SIGABRT, catch_signal) == SIG_ERR) + if (HDsignal(SIGABRT, catch_signal) == SIG_ERR) TEST_ERROR fapl = h5_fileaccess(); h5_fixname(FILENAME, fapl, filename, sizeof(filename)); /* Set to latest 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) TEST_ERROR /* Create the 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 /* Create the dcpl and set the chunk size */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR - if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0) + if (H5Pset_chunk(dcpl, 1, chunk_dim) < 0) TEST_ERROR /* Create the dataspace */ - if((sid = H5Screate_simple(1, cur_dim, max_dim)) < 0) + if ((sid = H5Screate_simple(1, cur_dim, max_dim)) < 0) TEST_ERROR /* Create the dataset */ - if((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + if ((did = H5Dcreate2(fid, DATASET_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR /* Write to the dataset */ - if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) + if (H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR /* Close the dataset */ - if(H5Dclose(did) < 0) + if (H5Dclose(did) < 0) TEST_ERROR /* Close the dataspace */ - if(H5Sclose(sid) < 0) + if (H5Sclose(sid) < 0) TEST_ERROR /* Close the property lists */ - if(H5Pclose(dcpl) < 0) + if (H5Pclose(dcpl) < 0) TEST_ERROR - if(H5Pclose(fapl) < 0) + if (H5Pclose(fapl) < 0) TEST_ERROR /* The file is not closed. */ |