summaryrefslogtreecommitdiffstats
path: root/test/unlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/unlink.c')
-rw-r--r--test/unlink.c44
1 files changed, 28 insertions, 16 deletions
diff --git a/test/unlink.c b/test/unlink.c
index f031e0c..7c8b5d6 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -248,8 +248,6 @@ test_many(hid_t file)
* Programmer: Robb Matzke
* Friday, September 25, 1998
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -260,12 +258,12 @@ test_symlink(hid_t file)
TESTING("symlink removal");
/* Create a test group and symlink */
- if ((work=H5Gcreate(file, "/test_symlink", 0))<0) goto error;
- if (H5Glink(work, H5G_LINK_SOFT, "link_value", "link")<0) goto error;
- if (H5Gunlink(work, "link")<0) goto error;
+ if ((work=H5Gcreate(file, "/test_symlink", 0))<0) TEST_ERROR;
+ if (H5Glink(work, H5G_LINK_SOFT, "link_value", "link")<0) TEST_ERROR;
+ if (H5Gunlink(work, "link")<0) TEST_ERROR;
/* Cleanup */
- if (H5Gclose(work)<0) goto error;
+ if (H5Gclose(work)<0) TEST_ERROR;
PASSED();
return 0;
@@ -529,7 +527,7 @@ test_filespace(void)
hsize_t dims[FILESPACE_NDIMS]= {FILESPACE_DIM0, FILESPACE_DIM1, FILESPACE_DIM2}; /* Dataset dimensions */
hsize_t chunk_dims[FILESPACE_NDIMS]= {FILESPACE_CHUNK0, FILESPACE_CHUNK1, FILESPACE_CHUNK2}; /* Chunk dimensions */
hsize_t attr_dims[FILESPACE_ATTR_NDIMS]= {FILESPACE_ATTR_DIM0, FILESPACE_ATTR_DIM1}; /* Attribute dimensions */
- int *data; /* Pointer to dataset buffer */
+ int *data = NULL; /* Pointer to dataset buffer */
int *tmp_data; /* Temporary pointer to dataset buffer */
off_t empty_size; /* Size of an empty file */
off_t file_size; /* Size of each file created */
@@ -1231,6 +1229,10 @@ test_filespace(void)
return 0;
error:
+ /* Release dataset buffer */
+ if(data)
+ HDfree(data);
+
return 1;
} /* end test_filespace() */
@@ -1505,7 +1507,7 @@ test_unlink_rightleaf(hid_t fid)
ngroups = 150; /* Number of groups to create */
char name[256]; /* Name of object to create */
- TESTING("Deleting right-most child in non-leaf B-tree node");
+ TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
@@ -1530,6 +1532,9 @@ test_unlink_rightleaf(hid_t fid)
for (n = 0; n < ngroups; n++)
if(H5Gclose(gids[n])<0) TEST_ERROR;
+ /* Close root group ID */
+ if(H5Gclose(rootid)<0) TEST_ERROR;
+
/* Free memory */
HDfree(gids);
@@ -1566,7 +1571,7 @@ test_unlink_rightnode(hid_t fid)
ngroups = 150; /* Number of groups to create */
char name[256]; /* Name of object to create */
- TESTING("Deleting right-most child in non-leaf B-tree node");
+ TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
@@ -1591,6 +1596,9 @@ test_unlink_rightnode(hid_t fid)
if(H5Gunlink(fid,"/ZoneB8")<0) TEST_ERROR;
if(H5Gunlink(fid,"/ZoneB80")<0) TEST_ERROR;
+ /* Close root group ID */
+ if(H5Gclose(rootid)<0) TEST_ERROR;
+
/* Free memory */
HDfree(gids);
@@ -1627,7 +1635,7 @@ test_unlink_middlenode(hid_t fid)
ngroups = 250; /* Number of groups to create */
char name[256]; /* Name of object to create */
- TESTING("Deleting right-most child in non-leaf B-tree node");
+ TESTING("deleting right-most child in non-leaf B-tree node");
/* Allocate space for the group IDs */
gids = (hid_t *) HDmalloc (ngroups * sizeof(hid_t));
@@ -1795,6 +1803,9 @@ test_unlink_middlenode(hid_t fid)
if(H5Gunlink(fid,"/ZoneC8")<0) TEST_ERROR;
if(H5Gunlink(fid,"/ZoneC80")<0) TEST_ERROR;
+ /* Close root group ID */
+ if(H5Gclose(rootid)<0) TEST_ERROR;
+
/* Free memory */
HDfree(gids);
@@ -1828,7 +1839,7 @@ test_resurrect_dataset(void)
hid_t f=-1, s=-1, d=-1, fapl=-1;
char filename[1024];
- TESTING("Resurrecting dataset after deletion");
+ TESTING("resurrecting dataset after deletion");
/* Create file */
fapl = h5_fileaccess();
@@ -1902,7 +1913,7 @@ test_resurrect_datatype(void)
hid_t file=-1, type=-1, fapl=-1;
char filename[1024];
- TESTING("Resurrecting datatype after deletion");
+ TESTING("resurrecting datatype after deletion");
/* Create file */
fapl = h5_fileaccess();
@@ -1972,7 +1983,7 @@ test_resurrect_group(void)
hid_t file=-1, group=-1, fapl=-1;
char filename[1024];
- TESTING("Resurrecting group after deletion");
+ TESTING("resurrecting group after deletion");
/* Create file */
fapl = h5_fileaccess();
@@ -2047,11 +2058,11 @@ test_unlink_chunked_dataset(void)
hsize_t chunk_dims[FILESPACE_NDIMS]={FILESPACE_CHUNK0,FILESPACE_CHUNK1,FILESPACE_CHUNK2};
char filename[1024];
- TESTING("Unlinking chunked dataset");
+ TESTING("unlinking chunked dataset");
/* Create file */
fapl_id = h5_fileaccess();
- h5_fixname(FILENAME[7], fapl_id, filename, sizeof filename);
+ h5_fixname(FILENAME[9], fapl_id, filename, sizeof filename);
/* Create the file */
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id))<0) TEST_ERROR;
@@ -2084,7 +2095,7 @@ test_unlink_chunked_dataset(void)
if(H5Fclose(file_id)<0) TEST_ERROR;
/* Re-open the file */
- if((file_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT))<0) TEST_ERROR;
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id))<0) TEST_ERROR;
/* Delete the dataset */
if(H5Gunlink(file_id, DATASETNAME)<0) TEST_ERROR;
@@ -2196,6 +2207,7 @@ main(void)
nerrors += test_unlink_chunked_dataset();
/* Close */
+ if (H5Pclose(fapl2)<0) TEST_ERROR;
if (H5Fclose(file)<0) TEST_ERROR;
if (nerrors) {
printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");