summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-08-19 16:21:27 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-08-19 16:21:27 (GMT)
commit6909d2033f0d7d87c9fc03dfc778ea3e9437032a (patch)
treeeb5fdf5bb781fa955f2acfbc69d724c2647206dd
parent69e2f53edbfba4bee9865cec3df78c0cbab42182 (diff)
downloadhdf5-6909d2033f0d7d87c9fc03dfc778ea3e9437032a.zip
hdf5-6909d2033f0d7d87c9fc03dfc778ea3e9437032a.tar.gz
hdf5-6909d2033f0d7d87c9fc03dfc778ea3e9437032a.tar.bz2
[svn-r27527] Add tests to hit code coverage assertions in H5Olayout.c.
Fix issue in VDS delete routine. Tested: ummon
-rw-r--r--src/H5Dvirtual.c18
-rw-r--r--src/H5Olayout.c3
-rw-r--r--test/vds.c46
3 files changed, 54 insertions, 13 deletions
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 638ad6d..9a25494 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -519,7 +519,6 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
} /* end for */
} /* end if */
else {
- HDassert(0 && "checking code coverage..."); //VDSINC
/* Zero out other fields related to list, just to be sure */
layout->storage.u.virt.list = NULL;
layout->storage.u.virt.list_nalloc = 0;
@@ -704,15 +703,18 @@ H5D__virtual_delete(H5F_t *f, hid_t dxpl_id, H5O_storage_t *storage)
HDassert(storage);
HDassert(storage->type == H5D_VIRTUAL);
+ /* Check for global heap block */
+ if(storage->u.virt.serial_list_hobjid.addr != HADDR_UNDEF) {
#ifdef NOT_YET
- /* Unlink the global heap block */
- if((heap_rc = H5HG_link(f, dxpl_id, (H5HG_t *)&(storage->u.virt.serial_list_hobjid), -1)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap refence count")
- if(heap_rc == 0)
+ /* Unlink the global heap block */
+ if((heap_rc = H5HG_link(f, dxpl_id, (H5HG_t *)&(storage->u.virt.serial_list_hobjid), -1)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTMODIFY, FAIL, "unable to adjust global heap refence count")
+ if(heap_rc == 0)
#endif /* NOT_YET */
- /* Delete the global heap block */
- if(H5HG_remove(f, dxpl_id, (H5HG_t *)&(storage->u.virt.serial_list_hobjid)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
+ /* Delete the global heap block */
+ if(H5HG_remove(f, dxpl_id, (H5HG_t *)&(storage->u.virt.serial_list_hobjid)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
+ } /* end if */
/* Clear global heap ID in storage */
storage->u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index c462c80..6018539 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -578,8 +578,6 @@ H5O_layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c
HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block")
} /* end if */
- HDassert((mesg->storage.u.virt.list_nused > 0) && "checking code coverage...");//VDSINC
-
/* Heap information */
H5F_addr_encode(f, &p, mesg->storage.u.virt.serial_list_hobjid.addr);
UINT32ENCODE(p, mesg->storage.u.virt.serial_list_hobjid.idx);
@@ -817,7 +815,6 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
break;
case H5D_VIRTUAL: /* Virtual dataset */
- HDassert(0 && "checking code coverage...");//VDSINC
/* Free the file space virtual dataset */
if(H5D__virtual_delete(f, dxpl_id, &mesg->storage) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
diff --git a/test/vds.c b/test/vds.c
index 2804227..fab2c4f 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -362,7 +362,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
if(H5Fclose(file) < 0)
TEST_ERROR
file = -1;
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR
} /* end if */
@@ -375,10 +375,16 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
if((*ex_dcpl = H5Dget_create_plist(dset)) < 0)
TEST_ERROR
- /* Close dataset and file */
+ /* Close dataset */
if(H5Dclose(dset) < 0)
TEST_ERROR
dset = -1;
+
+ /* Delete dataset */
+ if(H5Ldelete(file, "vdset", H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Close file */
if(H5Fclose(file) < 0)
TEST_ERROR
file = -1;
@@ -894,7 +900,9 @@ test_api(test_api_config_t config, hid_t fapl)
if(H5Pclose(ex_dcpl) < 0)
TEST_ERROR
ex_dcpl = -1;
+
#else /* VDS_POINT_SELECTIONS */
+
/*
* Test 3: Verify point selections fail
*/
@@ -1035,6 +1043,40 @@ test_api(test_api_config_t config, hid_t fapl)
ex_dcpl = -1;
+ /*
+ * Test 7: Empty VDS
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspace */
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all (should not be necessary, but just to be sure) */
+ if(H5Sselect_all(vspace[0]) < 0)
+ TEST_ERROR
+
+ /* Get examination DCPL */
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ TEST_ERROR
+
+ /* Test H5Pget_virtual_count */
+ if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ TEST_ERROR
+ if(size_out != (size_t)0)
+ TEST_ERROR
+
+ /* Close */
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Pclose(ex_dcpl) < 0)
+ TEST_ERROR
+ ex_dcpl = -1;
+
+
/* Close */
if(H5Pclose(dcpl) < 0)
TEST_ERROR