summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Dint.c3
-rw-r--r--src/H5Dlayout.c1
-rw-r--r--src/H5Doh.c11
-rw-r--r--src/H5Dpkg.h3
-rw-r--r--src/H5Dprivate.h5
-rw-r--r--src/H5Dvirtual.c33
-rw-r--r--src/H5HG.c44
-rw-r--r--src/H5HGprivate.h1
-rw-r--r--src/H5Olayout.c15
-rw-r--r--src/H5Pdcpl.c113
-rw-r--r--test/Makefile.am2
-rw-r--r--test/vds.c326
12 files changed, 429 insertions, 128 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 61a2ed7..056b07b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1912,9 +1912,10 @@ H5D__get_offset(const H5D_t *dset)
HDassert(dset);
switch(dset->shared->layout.type) {
+ case H5D_VIRTUAL:
+ HDassert(0 && "checking code coverage...");//VDSINC
case H5D_CHUNKED:
case H5D_COMPACT:
- case H5D_VIRTUAL:
break;
case H5D_CONTIGUOUS:
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c
index 0dbe4db..5929163 100644
--- a/src/H5Dlayout.c
+++ b/src/H5Dlayout.c
@@ -174,7 +174,6 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ
break;
case H5D_VIRTUAL:
- HDassert((layout->storage.u.virt.list_nused > 0) && "checking code coverage...");//VDSINC
ret_value += H5F_SIZEOF_ADDR(f); /* Address of global heap */
ret_value += 4; /* Global heap index */
break;
diff --git a/src/H5Doh.c b/src/H5Doh.c
index a688fe7..39a270f 100644
--- a/src/H5Doh.c
+++ b/src/H5Doh.c
@@ -399,7 +399,16 @@ H5O__dset_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't determine chunked dataset btree info")
} /* end if */
else if(layout.type == H5D_VIRTUAL && H5D__virtual_is_space_alloc(&layout.storage)) {
- HDassert(0 && "Not yet implemented...");//VDSINC
+ size_t virtual_heap_size;
+ /* Need to write a test for this. No assert here for now because the
+ * code is reached by h5_verify_cached_stabs() but it is not properly
+ * tested. VDSINC */
+ /* Get size of global heap object for virtual dataset */
+ if(H5HG_get_obj_size(f, dxpl_id, &(layout.storage.u.virt.serial_list_hobjid), &virtual_heap_size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get global heap size for virtual dataset mapping")
+
+ /* Return heap size */
+ bh_info->heap_size = (hsize_t)virtual_heap_size;
} /* end if */
/* Check for External File List message in the object header */
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index ac6896f..847cec9 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -654,6 +654,9 @@ H5_DLL herr_t H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src
H5O_copy_t *cpy_info, hid_t dxpl_id);
/* Functions that operate on virtual dataset storage */
+H5_DLL herr_t H5D__virtual_copy_layout(H5O_layout_t *layout);
+H5_DLL herr_t H5D__virtual_reset_layout(H5O_layout_t *layout);
+H5_DLL herr_t H5D__virtual_delete(H5F_t *f, hid_t dxpl_id, H5O_storage_t *storage);
H5_DLL herr_t H5D__virtual_copy(H5F_t *f_src,
const H5O_storage_virtual_t *storage_src, H5F_t *f_dst,
H5O_storage_virtual_t *storage_dst, H5T_t *dt_src, H5O_copy_t *cpy_info,
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index 11c9fac..b2d88ee 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -177,11 +177,6 @@ H5_DLL herr_t H5D_vlen_reclaim(hid_t type_id, H5S_t *space, hid_t plist_id,
/* Functions that operate on chunked storage */
H5_DLL herr_t H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr);
-/* Functions that operate on virtual storage */
-herr_t H5D_virtual_copy_layout(H5O_layout_t *layout);
-herr_t H5D_virtual_reset_layout(H5O_layout_t *layout);
-herr_t H5D_virtual_delete(H5F_t *f, hid_t dxpl_id, H5O_storage_t *storage);
-
/* Functions that operate on indexed storage */
H5_DLL herr_t H5D_btree_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream,
int indent, int fwidth, unsigned ndims);
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 5e9decd..7e74af7 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -99,7 +99,7 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{
/*-------------------------------------------------------------------------
- * Function: H5D_virtual_copy_layout
+ * Function: H5D__virtual_copy_layout
*
* Purpose: Deep copies virtual storage layout message in memory.
* This function assumes that the top-level struct has
@@ -114,19 +114,18 @@ const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1] = {{
*-------------------------------------------------------------------------
*/
herr_t
-H5D_virtual_copy_layout(H5O_layout_t *layout)
+H5D__virtual_copy_layout(H5O_layout_t *layout)
{
H5O_storage_virtual_ent_t *orig_list = NULL;
size_t i;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
HDassert(layout);
HDassert(layout->type == H5D_VIRTUAL);
if(layout->storage.u.virt.list_nused > 0) {
- HDassert(0 && "checking code coverage...");//VDSINC
HDassert(layout->storage.u.virt.list);
/* Save original entry list for use as the "source" */
@@ -164,15 +163,15 @@ done:
/* Release allocated resources on failure */
if((ret_value < 0) && orig_list
&& (orig_list != layout->storage.u.virt.list))
- if(H5D_virtual_reset_layout(layout) < 0)
+ if(H5D__virtual_reset_layout(layout) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset virtual layout")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_virtual_copy_layout() */
+} /* end H5D__virtual_copy_layout() */
/*-------------------------------------------------------------------------
- * Function: H5D_virtual_reset_layout
+ * Function: H5D__virtual_reset_layout
*
* Purpose: Frees internal structures in a virtual storage layout
* message in memory. This function is safe to use on
@@ -188,12 +187,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_virtual_reset_layout(H5O_layout_t *layout)
+H5D__virtual_reset_layout(H5O_layout_t *layout)
{
size_t i;
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
HDassert(layout);
HDassert(layout->type == H5D_VIRTUAL);
@@ -215,15 +214,16 @@ H5D_virtual_reset_layout(H5O_layout_t *layout)
} /* end for */
/* Free the list */
- layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)(layout->storage.u.virt.list);
+ layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_xfree(layout->storage.u.virt.list);
-done:
+ /* Note the lack of a done: label. This is because there are no HGOTO_ERROR
+ * calls. If one is added, a done: label must also be added */
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_virtual_reset_layout() */
+} /* end H5D__virtual_reset_layout() */
/*-------------------------------------------------------------------------
- * Function: H5D_virtual_delete
+ * Function: H5D__virtual_delete
*
* Purpose: Delete the file space for a virtual dataset
*
@@ -235,7 +235,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D_virtual_delete(H5F_t *f, hid_t dxpl_id, H5O_storage_t *storage)
+H5D__virtual_delete(H5F_t *f, hid_t dxpl_id, H5O_storage_t *storage)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -258,7 +258,7 @@ H5D_virtual_delete(H5F_t *f, hid_t dxpl_id, H5O_storage_t *storage)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5D_virtual_delete */
+} /* end H5D__virtual_delete */
/*-------------------------------------------------------------------------
@@ -279,7 +279,6 @@ H5D__virtual_construct(H5F_t UNUSED *f, H5D_t UNUSED *dset)
FUNC_ENTER_STATIC_NOERR
/* No-op for now VDSINC */
- HDassert(0 && "checking code coverage...");//VDSINC
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__virtual_construct() */
@@ -306,7 +305,6 @@ H5D__virtual_is_space_alloc(const H5O_storage_t *storage)
FUNC_ENTER_PACKAGE_NOERR
- HDassert(0 && "checking code coverage...");//VDSINC
/* Need to decide what to do here. For now just return TRUE if the global
* heap block has been allocated. VDSINC */
ret_value = storage->u.virt.serial_list_hobjid.addr != HADDR_UNDEF;
@@ -408,7 +406,6 @@ H5D__virtual_flush(H5D_t UNUSED *dset, hid_t UNUSED dxpl_id)
FUNC_ENTER_STATIC_NOERR
/* No-op for now VDSINC */
- HDassert(0 && "checking code coverage...");//VDSINC
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5D__virtual_flush() */
diff --git a/src/H5HG.c b/src/H5HG.c
index d55eaab..71520f1 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -718,6 +718,50 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HG_get_obj_size
+ *
+ * Purpose: Returns the size of a global heap object.
+ * Return: Success: Non-negative
+ *
+ * Failure: Negative
+ *
+ * Programmer: Neil Fortner
+ * Thursday, February 12, 2015
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HG_get_obj_size(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, size_t *obj_size)
+{
+ H5HG_heap_t *heap = NULL; /* Pointer to global heap object */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_TAG(dxpl_id, H5AC__GLOBALHEAP_TAG, FAIL)
+
+ /* Check args */
+ HDassert(f);
+ HDassert(hobj);
+ HDassert(obj_size);
+
+ /* Load the heap */
+ if(NULL == (heap = H5HG_protect(f, dxpl_id, hobj->addr, H5AC_READ)))
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
+
+ HDassert(hobj->idx < heap->nused);
+ HDassert(heap->obj[hobj->idx].begin);
+
+ /* Set object size */
+ *obj_size = heap->obj[hobj->idx].size;
+
+done:
+ if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release object header")
+
+ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
+} /* end H5HG_get_obj_size() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HG_remove
*
* Purpose: Removes the specified object from the global heap.
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index 3765c47..ad0da76 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -60,6 +60,7 @@ H5_DLL herr_t H5HG_insert(H5F_t *f, hid_t dxpl_id, size_t size, void *obj,
H5HG_t *hobj/*out*/);
H5_DLL void *H5HG_read(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, void *object, size_t *buf_size/*out*/);
H5_DLL int H5HG_link(H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust);
+H5_DLL herr_t H5HG_get_obj_size(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj, size_t *obj_size);
H5_DLL herr_t H5HG_remove(H5F_t *f, hid_t dxpl_id, H5HG_t *hobj);
/* Support routines */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index 0e43824..9d4fff7 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -317,6 +317,9 @@ H5O_layout_decode(H5F_t *f, hid_t dxpl_id, H5O_t UNUSED *open_oh,
HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "incorrect heap block size")
} /* end if */
+ /* Set the layout operations */
+ mesg->ops = H5D_LOPS_VIRTUAL;
+
break;
case H5D_LAYOUT_ERROR:
@@ -333,7 +336,7 @@ done:
if(ret_value == NULL)
if(mesg) {
if(mesg->type == H5D_VIRTUAL)
- if(H5D_virtual_reset_layout(mesg) < 0)
+ if(H5D__virtual_reset_layout(mesg) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to reset virtual layout")
mesg = H5FL_FREE(H5O_layout_t, mesg);
} /* end if */
@@ -596,11 +599,9 @@ H5O_layout_copy(const void *_mesg, void *_dest)
H5D_chunk_idx_reset(&dest->storage.u.chunk, FALSE);
/* Deep copy the entry list for virtual datasets */
- if(mesg->type == H5D_VIRTUAL) {
- HDassert((mesg->storage.u.virt.list_nused > 0) && "checking code coverage...");//VDSINC
- if(H5D_virtual_copy_layout(dest) < 0)
+ if(mesg->type == H5D_VIRTUAL)
+ if(H5D__virtual_copy_layout(dest) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, NULL, "unable to copy virtual layout")
- } //VDSINC
/* Set return value */
ret_value = dest;
@@ -677,7 +678,7 @@ H5O_layout_reset(void *_mesg)
mesg->storage.u.compact.buf = H5MM_xfree(mesg->storage.u.compact.buf);
else if(H5D_VIRTUAL == mesg->type)
/* Free the virtual entry list */
- if(H5D_virtual_reset_layout(mesg) < 0)
+ if(H5D__virtual_reset_layout(mesg) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to reset virtual layout")
/* Reset the message */
@@ -768,7 +769,7 @@ H5O_layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg)
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)
+ if(H5D__virtual_delete(f, dxpl_id, &mesg->storage) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free raw data")
break;
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index 6abe17d..ebd1e0a 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -85,7 +85,6 @@
#define H5D_CRT_LAYOUT_ENC H5P__dcrt_layout_enc
#define H5D_CRT_LAYOUT_DEC H5P__dcrt_layout_dec
#define H5D_CRT_LAYOUT_DEL H5P__dcrt_layout_del
-#define H5D_CRT_LAYOUT_COPY H5P__dcrt_layout_copy
#define H5D_CRT_LAYOUT_CMP H5P__dcrt_layout_cmp
#define H5D_CRT_LAYOUT_CLOSE H5P__dcrt_layout_close
/* Definitions for fill value. size=0 means fill value will be 0 as
@@ -137,7 +136,6 @@ static herr_t H5P__dcrt_close(hid_t dxpl_id, void *close_data);
static herr_t H5P__dcrt_layout_enc(const void *value, void **pp, size_t *size);
static herr_t H5P__dcrt_layout_dec(const void **pp, void *value);
static herr_t H5P__dcrt_layout_del(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P__dcrt_layout_copy(const char *name, size_t size, void *value);
static int H5P__dcrt_layout_cmp(const void *value1, const void *value2, size_t size);
static herr_t H5P__dcrt_layout_close(const char *name, size_t size, void *value);
static herr_t H5P__fill_value_enc(const void *value, void **pp, size_t *size);
@@ -226,7 +224,7 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
/* Register the storage layout property */
if(H5P_register_real(pclass, H5D_CRT_LAYOUT_NAME, H5D_CRT_LAYOUT_SIZE, &H5D_def_layout_g,
NULL, NULL, NULL, H5D_CRT_LAYOUT_ENC, H5D_CRT_LAYOUT_DEC,
- H5D_CRT_LAYOUT_DEL, H5D_CRT_LAYOUT_COPY, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0)
+ H5D_CRT_LAYOUT_DEL, NULL, H5D_CRT_LAYOUT_CMP, H5D_CRT_LAYOUT_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
/* Register the fill value property */
@@ -330,6 +328,7 @@ H5P__dcrt_copy(hid_t dst_plist_id, hid_t src_plist_id, void UNUSED *copy_data)
case H5D_VIRTUAL:
dst_layout.storage.u.virt.serial_list_hobjid.addr = HADDR_UNDEF;
dst_layout.storage.u.virt.serial_list_hobjid.idx = 0;
+ break;
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
@@ -585,58 +584,23 @@ done:
static herr_t
H5P__dcrt_layout_del(hid_t UNUSED prop_id, const char UNUSED *name, size_t UNUSED size, void *value)
{
- H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(layout);
+ HDassert(value);
- /* Reset the old layout befopre overwriting it if necessary */
- if(layout->type == H5D_VIRTUAL)
- if(H5D_virtual_reset_layout(layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to reset virtual layout")
+ /* Reset the old layout */
+ if(((H5O_layout_t *)value)->type == H5D_VIRTUAL) /* Temp hack until proper fix is in trunk */
+ if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release layout message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_layout_del() */
-/*--------------------------------------------------------------------------
- * Function: H5P__dcrt_layout_copy
- *
- * Purpose: Copy the layout property
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Neil Fortner
- * Monday, Feb 9, 2015
- *
- *--------------------------------------------------------------------------
- */
-static herr_t
-H5P__dcrt_layout_copy(const char UNUSED *name, size_t UNUSED size, void *value)
-{
- H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_STATIC
-
- HDassert(layout);
-
- layout = (H5O_layout_t *)value;
-
- if(layout->type == H5D_VIRTUAL)
- if(H5D_virtual_copy_layout(layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual layout")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5P__dcrt_layout_copy() */
-
-
/*-------------------------------------------------------------------------
* Function: H5P__dcrt_layout_cmp
*
@@ -728,18 +692,17 @@ done:
static herr_t
H5P__dcrt_layout_close(const char UNUSED *name, size_t UNUSED size, void *value)
{
- H5O_layout_t *layout = (H5O_layout_t *)value; /* Create local aliases for values */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
- HDassert(layout);
+ HDassert(value);
- /* Reset the old layout befopre overwriting it if necessary */
- if(layout->type == H5D_VIRTUAL)
- if(H5D_virtual_reset_layout(layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to reset virtual layout")
+ /* Reset the old layout */
+ if(((H5O_layout_t *)value)->type == H5D_VIRTUAL) /* Temp hack until proper fix is in trunk */
+ if(H5O_msg_reset(H5O_LAYOUT_ID, value) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release layout message")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1291,12 +1254,9 @@ H5P__set_layout(H5P_genplist_t *plist, const H5O_layout_t *layout)
if(H5P_get(plist, H5D_CRT_LAYOUT_NAME, &old_layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get layout")
- /* Reset the old layout before overwriting it if necessary */
- if(old_layout.type == H5D_VIRTUAL) {
- HDassert((layout->storage.u.virt.list_nused > 0) && "checking code coverage...");//VDSINC
- if(H5D_virtual_reset_layout(&old_layout) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "unable to reset virtual layout")
- } //VDSINC
+ /* Reset the old layout before overwriting it */
+ if(H5O_msg_reset(H5O_LAYOUT_ID, &old_layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTFREE, FAIL, "can't release layout message")
/* Set layout value */
if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, layout) < 0)
@@ -1684,6 +1644,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
/* Allocate initial entry list */
if(NULL == (layout.storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc(H5D_VIRTUAL_DEF_LIST_SIZE * sizeof(H5O_storage_virtual_ent_t))))
HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't allocate virtual dataset mapping list")
+ layout.storage.u.virt.list_nalloc = H5D_VIRTUAL_DEF_LIST_SIZE;
} /* end if */
else if(layout.storage.u.virt.list_nused
== layout.storage.u.virt.list_nalloc) {
@@ -1708,10 +1669,17 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name,
layout.storage.u.virt.list_nused++;
adding_entry = FALSE;
- /* Set chunk information in property list if we are adding a new layout */
- if(new_layout)
+ /* Set chunk information in property list. If we are adding a new layout,
+ * use H5P__set_layout so other fields are initialized properly. If we are
+ * extending the layout, just use H5P_set directly so we don't mess with
+ * anything else. */
+ if(new_layout) {
if(H5P__set_layout(plist, &layout) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout")
+ } /* end if */
+ else
+ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set layout")
done:
if(adding_entry) {
@@ -1752,7 +1720,6 @@ H5Pget_virtual_count(hid_t dcpl_id, size_t *count/*out*/)
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dcpl_id, count);
- HDassert(0 && "checking code coverage...");//VDSINC
if(count) {
/* Get the plist structure */
@@ -1791,12 +1758,11 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_layout_t layout; /* Layout information */
- H5S_t *space; /* Dataspace pointer */
+ H5S_t *space = NULL; /* Dataspace pointer */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("i", "iz", dcpl_id, index);
- HDassert(0 && "checking code coverage...");//VDSINC
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -1809,8 +1775,9 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual space */
- if(index >= layout.storage.u.virt.list_nalloc)
+ if(index >= layout.storage.u.virt.list_nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
if(NULL == (space = H5S_copy(layout.storage.u.virt.list[index].virtual_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection")
@@ -1819,6 +1786,11 @@ H5Pget_virtual_vspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space")
done:
+ /* Free space on failure */
+ if((ret_value < 0) && space)
+ if(H5S_close(space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_vspace() */
@@ -1840,12 +1812,11 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
{
H5P_genplist_t *plist; /* Property list pointer */
H5O_layout_t layout; /* Layout information */
- H5S_t *space; /* Dataspace pointer */
+ H5S_t *space = NULL; /* Dataspace pointer */
hid_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("i", "iz", dcpl_id, index);
- HDassert(0 && "checking code coverage...");//VDSINC
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -1858,8 +1829,9 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual space */
- if(index >= layout.storage.u.virt.list_nalloc)
+ if(index >= layout.storage.u.virt.list_nused)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
if(NULL == (space = H5S_copy(layout.storage.u.virt.list[index].source_select, FALSE, TRUE)))
HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection")
@@ -1868,6 +1840,11 @@ H5Pget_virtual_srcspace(hid_t dcpl_id, size_t index)
HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register data space")
done:
+ /* Free space on failure */
+ if((ret_value < 0) && space)
+ if(H5S_close(space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
+
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_virtual_srcspace() */
@@ -1894,7 +1871,6 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "izxz", dcpl_id, index, name, size);
- HDassert(0 && "checking code coverage...");//VDSINC
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -1907,6 +1883,9 @@ H5Pget_virtual_filename(hid_t dcpl_id, size_t index, char *name/*out*/,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual filename */
+ if(index >= layout.storage.u.virt.list_nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
HDassert(layout.storage.u.virt.list[index].source_file_name);
if(name && (size > 0))
(void)HDstrncpy(name, layout.storage.u.virt.list[index].source_file_name, size);
@@ -1939,7 +1918,6 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "izxz", dcpl_id, index, name, size);
- HDassert(0 && "checking code coverage...");//VDSINC
/* Get the plist structure */
if(NULL == (plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE)))
@@ -1952,6 +1930,9 @@ H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a virtual storage layout")
/* Get the virtual filename */
+ if(index >= layout.storage.u.virt.list_nused)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "invalid index (out of range)")
+ HDassert(layout.storage.u.virt.list_nused <= layout.storage.u.virt.list_nalloc);
HDassert(layout.storage.u.virt.list[index].source_dset_name);
if(name && (size > 0))
(void)HDstrncpy(name, layout.storage.u.virt.list[index].source_dset_name, size);
diff --git a/test/Makefile.am b/test/Makefile.am
index f698282..1546288 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -151,7 +151,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \
split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \
file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \
- vds_[1-4].h5
+ vds_1.h5
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
diff --git a/test/vds.c b/test/vds.c
index 2667e6a..a37f2b0 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -21,15 +21,26 @@
*/
#include "h5test.h"
#include "H5srcdir.h"
+#include "H5Dprivate.h" /* For H5D_VIRTUAL_DEF_LIST_SIZE */
+
+typedef enum {
+ TEST_API_BASIC,
+ TEST_API_COPY_PLIST,
+ TEST_API_CREATE_DSET,
+ TEST_API_REOPEN_DSET,
+ TEST_API_REOPEN_FILE,
+ TEST_API_NTESTS
+} test_api_config_t;
const char *FILENAME[] = {
"vds_1",
- "vds_2",
- "vds_3",
- "vds_4",
NULL
};
+#define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1)
+
+#define FILENAME_BUF_SIZE 1024
+
/*-------------------------------------------------------------------------
* Function: test_api
@@ -47,14 +58,102 @@ const char *FILENAME[] = {
*
*-------------------------------------------------------------------------
*/
+/* Helper function to get DCPL for examination depending on config */
static int
-test_api(void)
+test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
+ hid_t *ex_dcpl, hid_t vspace, char *filename)
{
+ hid_t file = -1; /* File */
+ hid_t dset = -1; /* Virtual dataset */
+
+ HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS));
+ HDassert(fapl >= 0);
+ HDassert(dcpl >= 0);
+ HDassert(ex_dcpl);
+ HDassert(*ex_dcpl < 0);
+ HDassert(vspace >= 0);
+ HDassert(filename);
+
+ /* Take different action depending on test configuration */
+ if(config >= TEST_API_CREATE_DSET) {
+ /* Create file and dataset */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if((dset = H5Dcreate2(file, "vdset", H5T_NATIVE_INT, vspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Reopen dataset if requested */
+ if(config >= TEST_API_REOPEN_DSET) {
+ /* Close dataset */
+ if(H5Dclose(dset) < 0)
+ TEST_ERROR
+ dset = -1;
+
+ /* Reopen file if requested */
+ if(config == TEST_API_REOPEN_FILE) {
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+ file = -1;
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Open dataset */
+ if((dset = H5Dopen2(file, "vdset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get DCPL from dataset */
+ if((*ex_dcpl = H5Dget_create_plist(dset)) < 0)
+ TEST_ERROR
+
+ /* Close dataset and file */
+ if(H5Dclose(dset) < 0)
+ TEST_ERROR
+ dset = -1;
+ if(H5Fclose(file) < 0)
+ TEST_ERROR
+ file = -1;
+ } /* end if */
+ else if(config == TEST_API_COPY_PLIST) {
+ /* Copy property list */
+ if((*ex_dcpl = H5Pcopy(dcpl)) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ /* Simply copy the id to ex_dcpl and increment the ref count so ex_dcpl
+ * can be closed */
+ if(H5Iinc_ref(dcpl) < 0)
+ TEST_ERROR
+ *ex_dcpl = dcpl;
+ } /* end else */
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ if(file >= 0)
+ (void)H5Fclose(file);
+ if(dset >= 0)
+ (void)H5Dclose(dset);
+ } H5E_END_TRY;
+
+ return -1;
+} /* end test_api_get_ex_dcpl() */
+
+/* Main test function */
+static int
+test_api(test_api_config_t config, hid_t fapl)
+{
+ char filename[FILENAME_BUF_SIZE];
hid_t dcpl = -1; /* Dataset creation property list */
- hid_t src_space[4] = {-1, -1, -1, -1}; /* Source dataspaces */
+ hid_t ex_dcpl = -1; /* Temporary dcpl for examination */
+ hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- char *src_file[4] = {"src_file1", "src_file2.", "src_file3..", "src_file4..."}; /* Source file names (different lengths) */
- char *src_dset[4] = {"src_dset1....", "src_dset2.....", "src_dset3......", "src_dset4......."}; /* Source dataset names (different lengths) */
+ const char *src_file[4] = {"src_file1", "src_file2.", "src_file3..", "src_file4..."}; /* Source file names (different lengths) */
+ const char *src_dset[4] = {"src_dset1....", "src_dset2.....", "src_dset3......", "src_dset4......."}; /* Source dataset names (different lengths) */
+ char tmp_filename[32];
+ char tmp_dsetname[32];
hsize_t dims[2] = {10, 20}; /* Data space current size */
hsize_t start[2]; /* Hyperslab start */
hsize_t stride[2]; /* Hyperslab stride */
@@ -64,9 +163,31 @@ test_api(void)
ssize_t ssize_out;
hid_t space_out = -1;
char name_out[32];
+ hsize_t blocklist[4];
unsigned i;
- TESTING("virtual dataset API functions");
+ switch(config) {
+ case TEST_API_BASIC:
+ TESTING("virtual dataset API functions")
+ break;
+ case TEST_API_COPY_PLIST:
+ TESTING("virtual dataset API functions with copied plists")
+ break;
+ case TEST_API_CREATE_DSET:
+ TESTING("virtual dataset create")
+ break;
+ case TEST_API_REOPEN_DSET:
+ TESTING("virtual dataset create with reopened dataset")
+ break;
+ case TEST_API_REOPEN_FILE:
+ TESTING("virtual dataset create with reopened file")
+ break;
+ case TEST_API_NTESTS:
+ default:
+ TEST_ERROR
+ } /* end switch */
+
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
/* Create DCPL */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -76,7 +197,7 @@ test_api(void)
* Test 1: All - all selection
*/
/* Create source dataspace */
- if((src_space[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR
/* Create virtual dataspace */
@@ -84,23 +205,35 @@ test_api(void)
TEST_ERROR
/* Select all (should not be necessary, but just to be sure) */
- if(H5Sselect_all(src_space[0]) < 0)
+ if(H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
if(H5Sselect_all(vspace[0]) < 0)
TEST_ERROR
/* Add virtual layout mapping */
- if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], src_space[0]) < 0)
+ if(H5Pset_virtual(dcpl, vspace[0], src_file[0], src_dset[0], srcspace[0]) < 0)
+ TEST_ERROR
+
+ /* Get examination DCPL */
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
TEST_ERROR
+ /* Close dataspaces */
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+
/* Test H5Pget_virtual_count */
- if(H5Pget_virtual_count(dcpl, &size_out) < 0)
+ if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
TEST_ERROR
if(size_out != 1)
TEST_ERROR
/* Test H5Pget_virtual_vspace */
- if((space_out = H5Pget_virtual_vspace(dcpl, 0)) < 0)
+ if((space_out = H5Pget_virtual_vspace(ex_dcpl, 0)) < 0)
TEST_ERROR
if(H5Sget_select_type(space_out) != H5S_SEL_ALL)
TEST_ERROR
@@ -109,7 +242,7 @@ test_api(void)
space_out = -1;
/* Test H5Pget_virtual_srcspace */
- if((space_out = H5Pget_virtual_srcspace(dcpl, 0)) < 0)
+ if((space_out = H5Pget_virtual_srcspace(ex_dcpl, 0)) < 0)
TEST_ERROR
if(H5Sget_select_type(space_out) != H5S_SEL_ALL)
TEST_ERROR
@@ -118,12 +251,12 @@ test_api(void)
space_out = -1;
/* Test H5Pget_virtual_filename */
- if((ssize_out = H5Pget_virtual_filename(dcpl, 0, NULL, 0)) < 0)
+ if((ssize_out = H5Pget_virtual_filename(ex_dcpl, 0, NULL, 0)) < 0)
TEST_ERROR
if((size_t)ssize_out != HDstrlen(src_file[0]))
TEST_ERROR
HDassert((size_t)ssize_out < sizeof(name_out));
- if((ssize_out = H5Pget_virtual_filename(dcpl, 0, name_out, sizeof(name_out))) < 0)
+ if((ssize_out = H5Pget_virtual_filename(ex_dcpl, 0, name_out, sizeof(name_out))) < 0)
TEST_ERROR
if((size_t)ssize_out != HDstrlen(src_file[0]))
TEST_ERROR
@@ -131,12 +264,12 @@ test_api(void)
TEST_ERROR
/* Test H5Pget_virtual_dsetname */
- if((ssize_out = H5Pget_virtual_dsetname(dcpl, 0, NULL, 0)) < 0)
+ if((ssize_out = H5Pget_virtual_dsetname(ex_dcpl, 0, NULL, 0)) < 0)
TEST_ERROR
if((size_t)ssize_out != HDstrlen(src_dset[0]))
TEST_ERROR
HDassert((size_t)ssize_out < sizeof(name_out));
- if((ssize_out = H5Pget_virtual_dsetname(dcpl, 0, name_out, sizeof(name_out))) < 0)
+ if((ssize_out = H5Pget_virtual_dsetname(ex_dcpl, 0, name_out, sizeof(name_out))) < 0)
TEST_ERROR
if((size_t)ssize_out != HDstrlen(src_dset[0]))
TEST_ERROR
@@ -144,13 +277,146 @@ test_api(void)
TEST_ERROR
/* Close */
- if(H5Sclose(src_space[0]) < 0)
+ if(H5Pclose(ex_dcpl) < 0)
+ TEST_ERROR
+ ex_dcpl = -1;
+
+
+ /*
+ * Test X: Enough Selections to trigger doubling of mapping list
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[0] = 1;
+ if((srcspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select all in source space (should not be necessary, but just to be sure) */
+ if(H5Sselect_all(srcspace[0]) < 0)
TEST_ERROR
- src_space[0] = -1;
+
+ /* Create virtual dataspace */
+ dims[0] = LIST_DOUBLE_SIZE;
+ if((vspace[0] = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Init hyperslab values */
+ start[0] = 0;
+ start[1] = 0;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 1;
+ block[1] = 20;
+
+ /* Build virtual layout */
+ for(i = 0; i < LIST_DOUBLE_SIZE; i++) {
+ /* Select row in virual dataspace */
+ start[0] = (hsize_t)i;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, NULL, count, block) < 0)
+ TEST_ERROR
+
+ /* Create file and dataset names */
+ (void)HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i);
+ tmp_filename[sizeof(tmp_filename) - 1] = '\0';
+ (void)HDsnprintf(tmp_dsetname, sizeof(tmp_dsetname), "src_dset%u", i);
+ tmp_dsetname[sizeof(tmp_dsetname) - 1] = '\0';
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], tmp_filename, tmp_dsetname, srcspace[0]) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get examination DCPL */
+ if(test_api_get_ex_dcpl(config, fapl, dcpl, &ex_dcpl, vspace[0], filename) < 0)
+ TEST_ERROR
+
+ /* Close dataspaces */
+ if(H5Sclose(srcspace[0]) < 0)
+ TEST_ERROR
+ srcspace[0] = -1;
if(H5Sclose(vspace[0]) < 0)
TEST_ERROR
vspace[0] = -1;
+ /* Test H5Pget_virtual_count */
+ if(H5Pget_virtual_count(ex_dcpl, &size_out) < 0)
+ TEST_ERROR
+ if(size_out != LIST_DOUBLE_SIZE)
+ TEST_ERROR
+
+ /* Verify virtual layout */
+ for(i = 0; i < LIST_DOUBLE_SIZE; i++) {
+ /* Test H5Pget_virtual_vspace */
+ if((space_out = H5Pget_virtual_vspace(ex_dcpl, i)) < 0)
+ TEST_ERROR
+ if(H5Sget_select_type(space_out) != H5S_SEL_HYPERSLABS)
+ TEST_ERROR
+ if((ssize_out = H5Sget_select_hyper_nblocks(space_out)) < 0)
+ TEST_ERROR
+ if(ssize_out != 1)
+ TEST_ERROR
+ if(H5Sget_select_hyper_blocklist(space_out, 0, 1, blocklist) < 0)
+ TEST_ERROR
+ if(blocklist[0] != (hsize_t)i)
+ TEST_ERROR
+ if(blocklist[1] != 0)
+ TEST_ERROR
+ if(blocklist[2] != (hsize_t)i)
+ TEST_ERROR
+ if(blocklist[3] != 19)
+ TEST_ERROR
+ if(H5Sclose(space_out) < 0)
+ TEST_ERROR
+ space_out = -1;
+
+ /* Test H5Pget_virtual_srcspace */
+ if((space_out = H5Pget_virtual_srcspace(ex_dcpl, i)) < 0)
+ TEST_ERROR
+ if(H5Sget_select_type(space_out) != H5S_SEL_ALL)
+ TEST_ERROR
+ if(H5Sclose(space_out) < 0)
+ TEST_ERROR
+ space_out = -1;
+
+ /* Test H5Pget_virtual_filename */
+ (void)HDsnprintf(tmp_filename, sizeof(tmp_filename), "src_file%u", i);
+ tmp_filename[sizeof(tmp_filename) - 1] = '\0';
+ if((ssize_out = H5Pget_virtual_filename(ex_dcpl, i, NULL, 0)) < 0)
+ TEST_ERROR
+ if((size_t)ssize_out != HDstrlen(tmp_filename))
+ TEST_ERROR
+ HDassert((size_t)ssize_out < sizeof(name_out));
+ if((ssize_out = H5Pget_virtual_filename(ex_dcpl, i, name_out, sizeof(name_out))) < 0)
+ TEST_ERROR
+ if((size_t)ssize_out != HDstrlen(tmp_filename))
+ TEST_ERROR
+ if(HDstrncmp(name_out, tmp_filename, (size_t)ssize_out + 1) != 0)
+ TEST_ERROR
+
+ /* Test H5Pget_virtual_dsetname */
+ (void)HDsnprintf(tmp_dsetname, sizeof(tmp_dsetname), "src_dset%u", i);
+ tmp_dsetname[sizeof(tmp_dsetname) - 1] = '\0';
+ if((ssize_out = H5Pget_virtual_dsetname(ex_dcpl, i, NULL, 0)) < 0)
+ TEST_ERROR
+ if((size_t)ssize_out != HDstrlen(tmp_dsetname))
+ TEST_ERROR
+ HDassert((size_t)ssize_out < sizeof(name_out));
+ if((ssize_out = H5Pget_virtual_dsetname(ex_dcpl, i, name_out, sizeof(name_out))) < 0)
+ TEST_ERROR
+ if((size_t)ssize_out != HDstrlen(tmp_dsetname))
+ TEST_ERROR
+ if(HDstrncmp(name_out, tmp_dsetname, (size_t)ssize_out + 1) != 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Close */
+ if(H5Pclose(ex_dcpl) < 0)
+ TEST_ERROR
+ ex_dcpl = -1;
+
/* Close */
if(H5Pclose(dcpl) < 0)
@@ -162,9 +428,9 @@ test_api(void)
error:
H5E_BEGIN_TRY {
- for(i = 0; i < (sizeof(src_space) / sizeof(src_space[0])); i++) {
- if(src_space[i] >= 0)
- (void)H5Sclose(src_space[i]);
+ for(i = 0; i < (sizeof(srcspace) / sizeof(srcspace[0])); i++) {
+ if(srcspace[i] >= 0)
+ (void)H5Sclose(srcspace[i]);
if(vspace[i] >= 0)
(void)H5Sclose(vspace[i]);
} /* end for */
@@ -172,6 +438,8 @@ error:
(void)H5Sclose(space_out);
if(dcpl >= 0)
(void)H5Pclose(dcpl);
+ if(ex_dcpl >= 0)
+ (void)H5Pclose(ex_dcpl);
} H5E_END_TRY;
return 1;
@@ -196,7 +464,8 @@ int
main(void)
{
char filename[FILENAME_BUF_SIZE];
- hid_t file, grp, fapl;
+ hid_t fapl;
+ int test_api_config;
int nerrors = 0;
/* Testing setup */
@@ -205,15 +474,16 @@ main(void)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- nerrors += test_api();
+ for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++)
+ nerrors += test_api((test_api_config_t)test_api_config, fapl);
/* Verify symbol table messages are cached */
- //nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); VDSINC
+ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
if(nerrors)
goto error;
printf("All virtual dataset tests passed.\n");
- //h5_cleanup(FILENAME, fapl); VDSINC
+ h5_cleanup(FILENAME, fapl);
return 0;
@@ -222,5 +492,5 @@ error:
printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
return 1;
-}
+}