summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2015-06-03 18:00:58 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2015-06-03 18:00:58 (GMT)
commit5d12a79db20305b7c08e505a683a4c1e38e9039a (patch)
treed033bb9898996b35d679bbec64da056d0bd1a444
parent9a8c664ff0d9884b8ce2bde543685245cb73f6bb (diff)
downloadhdf5-5d12a79db20305b7c08e505a683a4c1e38e9039a.zip
hdf5-5d12a79db20305b7c08e505a683a4c1e38e9039a.tar.gz
hdf5-5d12a79db20305b7c08e505a683a4c1e38e9039a.tar.bz2
[svn-r27145] Add some testing for printf-style source dataset name resolution.
Various bug fixes, including a temporary fix for printf with FIRST_MISSING view. Other cleanup. Tested: ummon
-rw-r--r--src/H5Dint.c1
-rw-r--r--src/H5Dvirtual.c301
-rw-r--r--src/H5Oprivate.h29
-rw-r--r--src/H5Pdapl.c1
-rw-r--r--src/H5Pdcpl.c32
-rw-r--r--src/H5Shyper.c155
-rw-r--r--test/Makefile.am2
-rw-r--r--test/h5test.c109
-rw-r--r--test/h5test.h1
-rw-r--r--test/vds.c2784
10 files changed, 3090 insertions, 325 deletions
diff --git a/src/H5Dint.c b/src/H5Dint.c
index c3c13ef..69f2d81 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -1573,7 +1573,6 @@ H5D_close(H5D_t *dataset)
/* Close sub datasets */
for(j = 0; j < dataset->shared->layout.storage.u.virt.list[i].sub_dset_nused; j++)
if(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
HDassert(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset != dataset);
if(H5D_close(dataset->shared->layout.storage.u.virt.list[i].sub_dset[j].dset) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to close source dataset")
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index 87cbd21..baaea16 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -223,7 +223,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout)
/* Allocate memory for the list */
if(NULL == (layout->storage.u.virt.list = (H5O_storage_virtual_ent_t *)H5MM_calloc(layout->storage.u.virt.list_nused * sizeof(H5O_storage_virtual_ent_t))))
- HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "unable to allocate memory for virtual dataset entry list")
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for virtual dataset entry list")
layout->storage.u.virt.list_nalloc = layout->storage.u.virt.list_nused;
/* Copy the list entries, though set source_dset.dset and sub_dset to
@@ -318,11 +318,9 @@ H5D__virtual_reset_layout(H5O_layout_t *layout)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
/* Free sub_dset */
- for(j = 0; j < layout->storage.u.virt.list[i].sub_dset_nalloc; j++) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ for(j = 0; j < layout->storage.u.virt.list[i].sub_dset_nalloc; j++)
if(H5D__virtual_reset_source_dset(&layout->storage.u.virt.list[i], &layout->storage.u.virt.list[i].sub_dset[j]) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to reset source dataset")
- } //VDSINC
layout->storage.u.virt.list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_xfree(layout->storage.u.virt.list[i].sub_dset);
/* Free parsed_source_file_name */
@@ -525,6 +523,7 @@ static herr_t
H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
size_t *buf_size)
{
+ size_t p_offset; /* Offset of p within buf */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -539,30 +538,30 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf,
/* Allocate or extend buffer if necessary */
if(!*buf) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
HDassert(!*p);
HDassert(*buf_size == 0);
/* Allocate buffer */
if(NULL == (*buf = (char *)H5MM_malloc(src_len + (size_t)1)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate name segment struct")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
*buf_size = src_len + (size_t)1;
*p = *buf;
} /* end if */
- else if(((size_t)(*p - *buf) + src_len + (size_t)1) > *buf_size) {
- HDassert(0 && "Checking code coverage..."); //VDSINC
+ else if(((p_offset = (size_t)(*p - *buf)) + src_len + (size_t)1)
+ > *buf_size) {
char *tmp_buf;
size_t tmp_buf_size;
/* Calculate new size of buffer */
- tmp_buf_size = MAX((size_t)(*p - *buf) + src_len + (size_t)1,
+ tmp_buf_size = MAX(p_offset + src_len + (size_t)1,
*buf_size * (size_t)2);
/* Reallocate buffer */
if(NULL == (tmp_buf = (char *)H5MM_realloc(*buf, tmp_buf_size)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to reallocate name segment buffer")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to reallocate name segment buffer")
*buf = tmp_buf;
*buf_size = tmp_buf_size;
+ *p = *buf + p_offset;
} /* end if */
/* Copy string to *p. Note that since src in not NULL terminated, we must
@@ -627,22 +626,18 @@ H5D_virtual_parse_source_name(const char *source_name,
HDassert(pct >= p);
/* Allocate name segment struct if necessary */
- if(!*tmp_parsed_name_p) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(!*tmp_parsed_name_p)
if(NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate name segment struct")
- } //VDSINC
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
/* Check for type of format specifier */
if(pct[1] == 'b') {
/* Check for blank string before specifier */
- if(pct != p) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(pct != p)
/* Append string to name segment */
if(H5D__virtual_str_append(p, (size_t)(pct - p), &name_seg_p, &(*tmp_parsed_name_p)->name_segment,
&name_seg_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to append name segment")
- } //VDSINC
/* Update other variables */
tmp_parsed_name_p = &(*tmp_parsed_name_p)->next;
@@ -652,7 +647,6 @@ H5D_virtual_parse_source_name(const char *source_name,
name_seg_size = 0;
} /* end if */
else if(pct[1] == '%') {
- HDassert(0 && "Checking code coverage..."); //VDSINC
/* Append string to name segment (include first '%') */
if(H5D__virtual_str_append(p, (size_t)(pct - p) + (size_t)1, &name_seg_p, &(*tmp_parsed_name_p)->name_segment,
&name_seg_size) < 0)
@@ -670,19 +664,15 @@ H5D_virtual_parse_source_name(const char *source_name,
/* Copy last segment of name, if any, unless there were no substitutions */
if(tmp_nsubs > 0) {
HDassert(p >= source_name);
- if(*p == '\0') {
- HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(*p == '\0')
HDassert((size_t)(p - source_name) == tmp_strlen);
- } //VDSINC
else {
HDassert((size_t)(p - source_name) < tmp_strlen);
/* Allocate name segment struct if necessary */
- if(!*tmp_parsed_name_p) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(!*tmp_parsed_name_p)
if(NULL == (*tmp_parsed_name_p = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate name segment struct")
- } /* end if */
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
/* Append string to name segment */
if(H5D__virtual_str_append(p, tmp_strlen - (size_t)(p - source_name), &name_seg_p, &(*tmp_parsed_name_p)->name_segment,
@@ -735,14 +725,13 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst,
/* Walk over parsed name, duplicating it */
while(p_src) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
/* Allocate name segment struct */
if(NULL == (*p_dst = H5FL_CALLOC(H5O_storage_virtual_name_seg_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate name segment struct")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name segment struct")
/* Duplicate name segment */
if(NULL == ((*p_dst)->name_segment = HDstrdup(p_src->name_segment)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to duplicate name segment")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment")
/* Advance pointers */
p_src = p_src->next;
@@ -784,7 +773,6 @@ H5D_virtual_free_parsed_name(H5O_storage_virtual_name_seg_t *name_seg)
/* Walk name segments, freeing them */
while(name_seg) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
(void)H5MM_xfree(name_seg->name_segment);
next_seg = name_seg->next;
(void)H5FL_FREE(H5O_storage_virtual_name_seg_t, name_seg);
@@ -823,7 +811,6 @@ H5D__virtual_build_source_name(char *source_name,
/* Check for static name */
if(nsubs == 0) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
HDassert(!parsed_name);
*built_name = source_name;
} /* end if */
@@ -852,14 +839,13 @@ H5D__virtual_build_source_name(char *source_name,
/* Allocate name buffer */
if(NULL == (tmp_name = (char *)H5MM_malloc(name_len)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate name buffer")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate name buffer")
p = tmp_name;
/* Build name */
do {
/* Add name segment */
if(name_seg->name_segment) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
seg_len = HDstrlen(name_seg->name_segment);
HDassert(seg_len > 0);
HDassert(seg_len < name_len_rem);
@@ -870,7 +856,6 @@ H5D__virtual_build_source_name(char *source_name,
/* Add block number */
if(nsubs_rem > 0) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
HDassert(blockno_len < name_len_rem);
if(HDsnprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write block number to string")
@@ -922,7 +907,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
hsize_t clip_size;
int rank;
hbool_t changed = FALSE; /* Whether the VDS extent changed */
- size_t i;
+ size_t i, j;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -949,7 +934,6 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
hsize_t first_missing = 0; /* First missing dataset in the current block of missing datasets */
- hsize_t j;
/* Search for source datasets */
HDassert(storage->printf_gap != HSIZE_UNDEF);
@@ -957,10 +941,9 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
/* Check for running out of space in sub_dset array */
if(j >= (hsize_t)storage->list[i].sub_dset_nalloc) {
if(storage->list[i].sub_dset_nalloc == 0) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
/* Allocate sub_dset */
if(NULL == (storage->list[i].sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_calloc(H5D_VIRTUAL_DEF_SUB_DSET_SIZE * sizeof(H5O_storage_virtual_srcdset_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate sub dataset array")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to allocate sub dataset array")
storage->list[i].sub_dset_nalloc = H5D_VIRTUAL_DEF_SUB_DSET_SIZE;
} /* end if */
else {
@@ -969,7 +952,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
HDassert(0 && "Checking code coverage..."); //VDSINC
/* Extend sub_dset */
if(NULL == (tmp_sub_dset = (H5O_storage_virtual_srcdset_t *)H5MM_realloc(storage->list[i].sub_dset, 2 * storage->list[i].sub_dset_nalloc * sizeof(H5O_storage_virtual_srcdset_t))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to extend sub dataset array")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to extend sub dataset array")
/* Clear new space in sub_dset */
(void)HDmemset(&storage->list[i].sub_dset[storage->list[i].sub_dset_nalloc], 0, storage->list[i].sub_dset_nalloc * sizeof(H5O_storage_virtual_srcdset_t));
@@ -980,80 +963,84 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
} /* end if */
/* Check if the dataset is already open */
- if(storage->list[i].sub_dset[j].dset) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(storage->list[i].sub_dset[j].dset)
first_missing = j + 1;
- } //VDSINC
else {
/* Resolve file name */
- if(!storage->list[i].sub_dset[j].file_name) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(!storage->list[i].sub_dset[j].file_name)
if(H5D__virtual_build_source_name(storage->list[i].source_dset.file_name, storage->list[i].parsed_source_file_name, storage->list[i].psfn_static_strlen, storage->list[i].psfn_nsubs, j, &storage->list[i].sub_dset[j].file_name) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source file name")
- } //VDSINC
/* Resolve dset name */
- if(!storage->list[i].sub_dset[j].dset_name) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(!storage->list[i].sub_dset[j].dset_name)
if(H5D__virtual_build_source_name(storage->list[i].source_dset.dset_name, storage->list[i].parsed_source_dset_name, storage->list[i].psdn_static_strlen, storage->list[i].psdn_nsubs, j, &storage->list[i].sub_dset[j].dset_name) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to build source dataset name")
- } //VDSINC
/* Resolve virtual selection for block */
- if(!storage->list[i].sub_dset[j].virtual_select) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(!storage->list[i].sub_dset[j].virtual_select)
if(NULL == (storage->list[i].sub_dset[j].virtual_select = H5S_hyper_get_unlim_block(storage->list[i].source_dset.virtual_select, j)))
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get block in unlimited selection")
- } //VDSINC
/* Open source dataset */
if(H5D__virtual_open_source_dset(dset, &storage->list[i], &storage->list[i].sub_dset[j], dxpl_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset")
/* Update first_missing */
- if(storage->list[i].sub_dset[j].dset) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(storage->list[i].sub_dset[j].dset)
first_missing = j + 1;
- } //VDSINC
} /* end else */
} /* end for */
/* Check if the size changed */
- if(first_missing != (hsize_t)storage->list[i].sub_dset_nused) {
+ if((first_missing == (hsize_t)storage->list[i].sub_dset_nused)
+ && (storage->list[i].clip_size_virtual != HSIZE_UNDEF))
+ /* Use cached clip_size */
+ clip_size = storage->list[i].clip_size_virtual;
+ else {
/* Check for no datasets */
- if(first_missing == 0) {
- HDassert(0 && "Checking code coverage..."); //VDSINC
+ if(first_missing == 0)
/* Set clip size to 0 */
clip_size = (hsize_t)0;
- } //VDSINC
else {
hsize_t bounds_start[H5S_MAX_RANK];
hsize_t bounds_end[H5S_MAX_RANK];
- //HDassert(0 && "Checking code coverage..."); //VDSINC
- /* Get bounds from last valid virtual selection */
- if(H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing - (hsize_t)1].virtual_select, bounds_start, bounds_end) < 0)
+ /* Get clip size from selection */
+ if(storage->view == H5D_VDS_LAST_AVAILABLE) {
+ /* Get bounds from last valid virtual selection */
+ if(H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing - (hsize_t)1].virtual_select, bounds_start, bounds_end) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
- /* Set clip_size to bounds_end in unlimited dimension */
- clip_size = bounds_end[storage->list[i].unlim_dim_virtual]
- + (hsize_t)1;
+ /* Set clip_size to bounds_end in unlimited
+ * dimension */
+ clip_size = bounds_end[storage->list[i].unlim_dim_virtual]
+ + (hsize_t)1;
+ } /* end if */
+ else {
+ /* Get bounds from first missing virtual selection
+ */
+ if(H5S_SELECT_BOUNDS(storage->list[i].sub_dset[first_missing].virtual_select, bounds_start, bounds_end) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get selection bounds")
+
+ /* Set clip_size to bounds_start in unlimited
+ * dimension */
+ clip_size = bounds_start[storage->list[i].unlim_dim_virtual];
+ } /* end else */
} /* end else */
/* Clip entry root virtual select (virtual_select for all
- * sub dsets) */
- if(H5S_hyper_clip_unlim(storage->list[i].source_dset.virtual_select, clip_size))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
+ * sub dsets) if we are setting the extent by the last
+ * available data. Note that if we used the cached
+ * clip_size above, the selection will already be clipped to
+ * the correct size. */
+ if(storage->view == H5D_VDS_LAST_AVAILABLE)
+ if(H5S_hyper_clip_unlim(storage->list[i].source_dset.virtual_select, clip_size))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
/* Set sub_dset_nused and clip_size_virtual */
storage->list[i].sub_dset_nused = (size_t)first_missing;
storage->list[i].clip_size_virtual = clip_size;
- } /* end if */
- else {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
- /* Use cached clip_size */
- clip_size = storage->list[i].clip_size_virtual;
- } //VDSINC
+ } /* end else */
} /* end if */
else {
HDassert(storage->list[i].unlim_dim_source >= 0);
@@ -1123,7 +1110,7 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
if(new_dims[i] == HSIZE_UNDEF)
new_dims[i] = curr_dims[i];
else if(new_dims[i] < storage->min_dims[i]) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ HDassert(0 && "Checking code coverage..."); //VDSINC
new_dims[i] = storage->min_dims[i];
} //VDSINC
if(new_dims[i] != curr_dims[i])
@@ -1140,17 +1127,23 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
/* Iterate over mappings again to update source selections and virtual
* mapping extents */
- for(i = 0; i < storage->list_nalloc; i++)
- /* Check for unlimited dimension */
- if(storage->list[i].unlim_dim_source >= 0) {
- HDassert(storage->list[i].unlim_dim_virtual >= 0);
-
- /* Update virtual mapping extent. Note this function does not
- * clip the selection. */
- if(changed)
- if(H5S_set_extent(storage->list[i].source_dset.virtual_select, new_dims) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space")
+ for(i = 0; i < storage->list_nalloc; i++) {
+ /* Update virtual mapping extent. Note this function does not clip
+ * the selection. */
+ if(changed) {
+ /* Update top level virtual_select */
+ if(H5S_set_extent(storage->list[i].source_dset.virtual_select, new_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space")
+
+ /* Update sub dataset virtual_selects */
+ for(j = 0; j < storage->list[i].sub_dset_nalloc; j++)
+ if(storage->list[i].sub_dset[j].virtual_select)
+ if(H5S_set_extent(storage->list[i].sub_dset[j].virtual_select, new_dims) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to modify size of data space")
+ } /* end if */
+ /* Check for unlimited dimension */
+ if(storage->list[i].unlim_dim_virtual >= 0) {
/* Check if we are setting extent by the minimum of mappings */
if(storage->view == H5D_VDS_FIRST_MISSING) {
/* Clip virtual selection to extent (only necessary if the
@@ -1160,30 +1153,36 @@ H5D__virtual_set_extent_unlim(const H5D_t *dset, hid_t dxpl_id)
if(H5S_hyper_clip_to_extent(storage->list[i].source_dset.virtual_select))
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
- /* Check if the virtual extent in the unlimited dimension
- * changed since the last time the VDS extent/mapping was
- * updated */
- if(new_dims[storage->list[i].unlim_dim_virtual]
- == storage->list[i].unlim_extent_virtual)
- /* Use cached result for clip size */
- clip_size = storage->list[i].clip_size_source;
- else {
- /* Get size that source selection will be clipped to to
- * match size of virtual selection */
- if(H5S_hyper_get_clip_extent(storage->list[i].source_select, storage->list[i].source_dset.virtual_select, &clip_size, FALSE) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get hyperslab clip size")
-
- /* Update cached values unlim_extent_virtual and
- * clip_size_source */
- storage->list[i].unlim_extent_virtual = new_dims[storage->list[i].unlim_dim_virtual];
- storage->list[i].clip_size_source = clip_size;
- } /* end else */
+ /* Only clip source_select if this is not a "printf" style
+ * mapping */
+ if(!(storage->list[i].parsed_source_file_name
+ || storage->list[i].parsed_source_dset_name)) {
+ /* Check if the virtual extent in the unlimited
+ * dimension changed since the last time the VDS
+ * extent/mapping was updated */
+ if(new_dims[storage->list[i].unlim_dim_virtual]
+ == storage->list[i].unlim_extent_virtual)
+ /* Use cached result for clip size */
+ clip_size = storage->list[i].clip_size_source;
+ else {
+ /* Get size that source selection will be clipped to
+ * to match size of virtual selection */
+ if(H5S_hyper_get_clip_extent(storage->list[i].source_select, storage->list[i].source_dset.virtual_select, &clip_size, FALSE) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get hyperslab clip size")
+
+ /* Update cached values unlim_extent_virtual and
+ * clip_size_source */
+ storage->list[i].unlim_extent_virtual = new_dims[storage->list[i].unlim_dim_virtual];
+ storage->list[i].clip_size_source = clip_size;
+ } /* end else */
- /* Clip source_select */
- if(H5S_hyper_clip_unlim(storage->list[i].source_select, clip_size))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
+ /* Clip source_select */
+ if(H5S_hyper_clip_unlim(storage->list[i].source_select, clip_size))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "failed to clip unlimited selection")
+ } /* end if */
} /* end if */
} /* end if */
+ } /* end for */
} /* end if */
/* Call H5D__mark so dataspace is updated on disk? VDSINC */
@@ -1210,22 +1209,25 @@ herr_t
H5D__virtual_init(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const H5D_t *dset,
hid_t dapl_id)
{
+ H5O_storage_virtual_t *storage; /* Convenience pointer */
H5P_genplist_t *dapl; /* Data access property list object pointer */
- size_t i; /* Local index variable */
+ size_t i; /* Local index variables */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dset);
- HDassert(dset->shared->layout.storage.u.virt.list || (dset->shared->layout.storage.u.virt.list_nused == 0));
+ storage = &dset->shared->layout.storage.u.virt;
+ HDassert(storage->list || (storage->list_nused == 0));
/* Patch the virtual selection dataspaces */
- for(i = 0; i < dset->shared->layout.storage.u.virt.list_nused; i++) {
- if(dset->shared->layout.storage.u.virt.list[i].virtual_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
- if(H5S_extent_copy(dset->shared->layout.storage.u.virt.list[i].source_dset.virtual_select, dset->shared->space) < 0)
+ for(i = 0; i < storage->list_nused; i++) {
+ if(storage->list[i].virtual_space_status != H5O_VIRTUAL_STATUS_CORRECT) {
+ if(H5S_extent_copy(storage->list[i].source_dset.virtual_select, dset->shared->space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual dataspace extent")
- dset->shared->layout.storage.u.virt.list[i].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
+ storage->list[i].virtual_space_status = H5O_VIRTUAL_STATUS_CORRECT;
+ HDassert(storage->list[i].sub_dset_nalloc == 0);
} /* end if */
} /* end for */
@@ -1234,12 +1236,16 @@ H5D__virtual_init(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const H5D_t *dset,
HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for dapl ID")
/* Get view option */
- if(H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &dset->shared->layout.storage.u.virt.view) < 0)
+ if(H5P_get(dapl, H5D_ACS_VDS_VIEW_NAME, &storage->view) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual view option")
- /* Get printf gap */
- if(H5P_get(dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &dset->shared->layout.storage.u.virt.printf_gap) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual printf gap")
+ /* Get printf gap if view is H5D_VDS_LAST_AVAILABLE, otherwise set to 0 */
+ if(storage->view == H5D_VDS_LAST_AVAILABLE) {
+ if(H5P_get(dapl, H5D_ACS_VDS_PRINTF_GAP_NAME, &storage->printf_gap) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get virtual printf gap")
+ } /* end if */
+ else
+ storage->printf_gap = (hsize_t)0;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1320,6 +1326,8 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
H5S_t *projected_mem_space = NULL; /* Memory space for selection in a single mapping */
H5S_t *projected_src_space = NULL; /* File space for selection in a single source dataset */
hssize_t select_nelmts; /* Number of elements in selection */
+ H5S_t *tmp_space = NULL; /* Copied virtual_select VDSINC */
+ H5S_t *virtual_select; /* Pointer to real virtual_select VDSINC */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1327,9 +1335,41 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
HDassert(virtual_ent);
HDassert(source_dset);
+ /* Quick hack to make this work with printf VDSINC */
+ if(source_dset == &virtual_ent->source_dset) {
+ virtual_select = source_dset->virtual_select;
+ } /* end if */
+ else {
+ hsize_t start[H5S_MAX_RANK];
+ hsize_t count[H5S_MAX_RANK];
+
+ /* Copy virtual selection */
+ if(NULL == (tmp_space = H5S_copy(source_dset->virtual_select, FALSE, TRUE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy virtual selection")
+
+ /* Get virtual extent dimensions */
+ if(H5S_get_simple_extent_dims(tmp_space, count, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get virtual dataspace dimensions")
+
+ /* Set start to zeroes */
+ (void)HDmemset(start, 0, sizeof(start));
+
+ /* Clip tmp_space selection to extent */
+ if(H5S_select_hyperslab(tmp_space, H5S_SELECT_AND, start, NULL, count, NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "can't clip selection to extent")
+
+ /* Check for no elements selected */
+ if((select_nelmts = (hssize_t)H5S_GET_SELECT_NPOINTS(tmp_space)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "unable to get number of elements in selection")
+ if(select_nelmts == 0)
+ HGOTO_DONE(SUCCEED)
+
+ virtual_select = tmp_space;
+ } /* end else */
+
/* Project intersection of file space and mapping virtual space onto
* memory space */
- if(H5S_select_project_intersection(file_space, mem_space, source_dset->virtual_select, &projected_mem_space) < 0)
+ if(H5S_select_project_intersection(file_space, mem_space, virtual_select, &projected_mem_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto memory space")
/* Get number of elements in projected dataspace */
@@ -1351,7 +1391,7 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
/* Project intersection of file space and mapping virtual space onto
* mapping source space */
- if(H5S_select_project_intersection(source_dset->virtual_select, virtual_ent->source_select, file_space, &projected_src_space) < 0)
+ if(H5S_select_project_intersection(virtual_select, virtual_ent->source_select, file_space, &projected_src_space) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space")
/* Perform read on source dataset */
@@ -1372,16 +1412,23 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
done:
/* Release allocated resources on failure */
- if(projected_src_space) {
- HDassert(ret_value < 0);
- if(H5S_close(projected_src_space) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space")
- } /* end if */
- if(projected_mem_space) {
- HDassert(ret_value < 0);
- if(H5S_close(projected_mem_space) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space")
+ if(ret_value < 0) {
+ if(projected_src_space)
+ if(H5S_close(projected_src_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected source space")
+ if(projected_mem_space)
+ if(H5S_close(projected_mem_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close projected memory space")
} /* end if */
+ else {
+ HDassert(!projected_src_space);
+ HDassert(!projected_mem_space);
+ } /* end else */
+
+ /* Release tmp_space VDSINC */
+ if(tmp_space)
+ if(H5S_close(tmp_space) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "can't close temporary space")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__virtual_read_one() */
@@ -1429,11 +1476,9 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info,
if(storage->list[i].parsed_source_file_name
|| storage->list[i].parsed_source_dset_name) {
/* Iterate over sub-source dsets */
- for(j = 0; j < storage->list[i].sub_dset_nused; j++) {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
+ for(j = 0; j < storage->list[i].sub_dset_nused; j++)
if(H5D__virtual_read_one(io_info, type_info, file_space, mem_space, &storage->list[i], &storage->list[i].sub_dset[j]) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read source dataset")
- } //VDSINC
} /* end if */
else
/* Read from source dataset */
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 6351dd5..6dc39d4 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -413,22 +413,25 @@ typedef struct H5O_storage_compact_t {
} H5O_storage_compact_t;
typedef struct H5O_storage_virtual_srcdset_t {
- struct H5D_t *dset; /* Source dataset */
+ /* Stored */
char *file_name; /* Source file name used for virtual dataset mapping */
char *dset_name; /* Source dataset name used for virtual dataset mapping */
struct H5S_t *virtual_select; /* Selection in the virtual dataset that is mapped to source selection */
+
+ /* Not stored */
+ struct H5D_t *dset; /* Source dataset */
} H5O_storage_virtual_srcdset_t;
typedef struct H5O_storage_virtual_name_seg_t {
- char *name_segment;
- struct H5O_storage_virtual_name_seg_t *next;
+ char *name_segment; /* String for this name segment */
+ struct H5O_storage_virtual_name_seg_t *next; /* Next name segment */
} H5O_storage_virtual_name_seg_t;
typedef enum H5O_virtual_space_status_t {
- H5O_VIRTUAL_STATUS_INVALID = 0, /* Space extent is invalid */
+ H5O_VIRTUAL_STATUS_INVALID = 0, /* Space extent is invalid */
H5O_VIRTUAL_STATUS_SEL_BOUNDS, /* Space extent set to bounds of selection */
H5O_VIRTUAL_STATUS_USER, /* Space extent provided by application */
- H5O_VIRTUAL_STATUS_CORRECT /* Space extent matches dataset */
+ H5O_VIRTUAL_STATUS_CORRECT /* Space extent matches dataset */
} H5O_virtual_space_status_t;
typedef struct H5O_storage_virtual_ent_t {
@@ -438,14 +441,14 @@ typedef struct H5O_storage_virtual_ent_t {
/* Not stored */
H5O_storage_virtual_srcdset_t *sub_dset; /* Array of sub-source dataset info structs */
- size_t sub_dset_nalloc;
- size_t sub_dset_nused;
- H5O_storage_virtual_name_seg_t *parsed_source_file_name;
- size_t psfn_static_strlen;
- size_t psfn_nsubs;
- H5O_storage_virtual_name_seg_t *parsed_source_dset_name;
- size_t psdn_static_strlen;
- size_t psdn_nsubs;
+ size_t sub_dset_nalloc; /* Number of slots allocated in sub_dset */
+ size_t sub_dset_nused; /* Number of slots "used" in sub_dset - essentially the farthest sub dataset in the extent */
+ H5O_storage_virtual_name_seg_t *parsed_source_file_name; /* Parsed version of source_dset.file_name */
+ size_t psfn_static_strlen; /* Length of parsed_source_file_name without block number substitutions */
+ size_t psfn_nsubs; /* Number of block number substitutions in parsed_source_file_name */
+ H5O_storage_virtual_name_seg_t *parsed_source_dset_name; /* Parsed version of source_dset.dset_name */
+ size_t psdn_static_strlen; /* Length of parsed_source_dset_name without block number substitutions */
+ size_t psdn_nsubs; /* Number of block number substitutions in parsed_source_dset_name */
int unlim_dim_source; /* Unlimited dimension in source_select */
int unlim_dim_virtual; /* Unlimited dimension in virtual_select */
hsize_t unlim_extent_source; /* Extent of unlimited dimension in source dset last time virtual_select was patched to match selection */
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index c11d22f..dea45f2 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -476,7 +476,6 @@ H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size)
FUNC_ENTER_API(FAIL)
- HDassert(0 && "Checking code coverage..."); //VDSINC
/* Check argument */
if(gap_size == HSIZE_UNDEF)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid printf gap size")
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index e647f29..ff7098d 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -1724,22 +1724,22 @@ done:
/* Check if the entry has been partly allocated but not added to the
* property list or not included in list_nused */
- if((ret_value < 0) && ent) {
- HDassert(ret_value < 0);
-
- /* Free incomplete entry */
- ent->source_dset.file_name = (char *)H5MM_xfree(ent->source_dset.file_name);
- ent->source_dset.dset_name = (char *)H5MM_xfree(ent->source_dset.dset_name);
- if(ent->source_dset.virtual_select && H5S_close(ent->source_dset.virtual_select) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection")
- ent->source_dset.virtual_select = NULL;
- if(ent->source_select && H5S_close(ent->source_select) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
- ent->source_select = NULL;
- H5D_virtual_free_parsed_name(ent->parsed_source_file_name);
- ent->parsed_source_file_name = NULL;
- H5D_virtual_free_parsed_name(ent->parsed_source_dset_name);
- ent->parsed_source_dset_name = NULL;
+ if(ret_value < 0) {
+ /* Free incomplete entry if present */
+ if(ent) {
+ ent->source_dset.file_name = (char *)H5MM_xfree(ent->source_dset.file_name);
+ ent->source_dset.dset_name = (char *)H5MM_xfree(ent->source_dset.dset_name);
+ if(ent->source_dset.virtual_select && H5S_close(ent->source_dset.virtual_select) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release virtual selection")
+ ent->source_dset.virtual_select = NULL;
+ if(ent->source_select && H5S_close(ent->source_select) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release source selection")
+ ent->source_select = NULL;
+ H5D_virtual_free_parsed_name(ent->parsed_source_file_name);
+ ent->parsed_source_file_name = NULL;
+ H5D_virtual_free_parsed_name(ent->parsed_source_dset_name);
+ ent->parsed_source_dset_name = NULL;
+ } /* end if */
/* Free list if necessary */
if(free_list)
diff --git a/src/H5Shyper.c b/src/H5Shyper.c
index a3e6781..399d009 100644
--- a/src/H5Shyper.c
+++ b/src/H5Shyper.c
@@ -6550,33 +6550,20 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
opt_block = int_block;
for(u=0; u<space->extent.rank; u++) {
/* contiguous hyperslabs have the block size equal to the stride */
- if(stride[u]==block[u]) {
- if(count[u] == H5S_UNLIMITED) {
- if(block[u] == 1) {
- int_block[u] = H5S_UNLIMITED;
- int_count[u] = 1;
- int_stride[u] = 1;
- } /* end if */
- else {
- int_block[u] = block[u];
- int_count[u] = H5S_UNLIMITED;
- int_stride[u] = stride[u];
- } /* end else */
- } /* end if */
- else {
- int_count[u]=1;
- int_stride[u]=1;
- if(block[u]==1)
- int_block[u]=count[u];
- else
- int_block[u]=block[u]*count[u];
- } /* end else */
+ if((stride[u] == block[u]) && (count[u] != H5S_UNLIMITED)) {
+ int_count[u]=1;
+ int_stride[u]=1;
+ if(block[u]==1)
+ int_block[u]=count[u];
+ else
+ int_block[u]=block[u]*count[u];
} /* end if */
else {
if(count[u]==1)
int_stride[u]=1;
else {
- HDassert(stride[u] > block[u]);
+ HDassert((stride[u] > block[u]) || ((stride[u] == block[u])
+ && (count[u] == H5S_UNLIMITED)));
int_stride[u]=stride[u];
} /* end else */
int_count[u]=count[u];
@@ -6761,7 +6748,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Patch count and block to remove unlimited and include the
* existing selection */
- H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, space->select.offset[unlim_dim], bounds_end[unlim_dim]);
+ H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, space->select.offset[unlim_dim], bounds_end[unlim_dim] + (hsize_t)1);
HDassert((tmp_count == 1) || (opt_count != _ones));
HDassert((tmp_block == 1) || (opt_block != _ones));
if(opt_count != _ones) {
@@ -7276,33 +7263,20 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
opt_block = int_block;
for(u=0; u<space->extent.rank; u++) {
/* contiguous hyperslabs have the block size equal to the stride */
- if(stride[u]==block[u]) {
- if(count[u] == H5S_UNLIMITED) {
- if(block[u] == 1) {
- int_block[u] = H5S_UNLIMITED;
- int_count[u] = 1;
- int_stride[u] = 1;
- } /* end if */
- else {
- int_block[u] = block[u];
- int_count[u] = H5S_UNLIMITED;
- int_stride[u] = stride[u];
- } /* end else */
- } /* end if */
- else {
- int_count[u]=1;
- int_stride[u]=1;
- if(block[u]==1)
- int_block[u]=count[u];
- else
- int_block[u]=block[u]*count[u];
- } /* end else */
+ if((stride[u] == block[u]) && (count[u] != H5S_UNLIMITED)) {
+ int_count[u]=1;
+ int_stride[u]=1;
+ if(block[u]==1)
+ int_block[u]=count[u];
+ else
+ int_block[u]=block[u]*count[u];
} /* end if */
else {
if(count[u]==1)
int_stride[u]=1;
else {
- HDassert(stride[u] > block[u]);
+ HDassert((stride[u] > block[u]) || ((stride[u] == block[u])
+ && (count[u] == H5S_UNLIMITED)));
int_stride[u]=stride[u];
} /* end else */
int_count[u]=count[u];
@@ -7479,7 +7453,7 @@ H5S_select_hyperslab (H5S_t *space, H5S_seloper_t op,
/* Patch count and block to remove unlimited and include the
* existing selection */
- H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, space->select.offset[unlim_dim], bounds_end[unlim_dim]);
+ H5S__hyper_get_clip_diminfo(start[unlim_dim], opt_stride[unlim_dim], &tmp_count, &tmp_block, space->select.offset[unlim_dim], bounds_end[unlim_dim] + (hsize_t)1);
HDassert((tmp_count == 1) || (opt_count != _ones));
HDassert((tmp_block == 1) || (opt_block != _ones));
if(opt_count != _ones) {
@@ -9368,7 +9342,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Allocate space for the hyperslab selection information (note this sets
* diminfo_valid to FALSE, diminfo arrays to 0, and span list to NULL) */
if((proj_space->select.sel_info.hslab = H5FL_CALLOC(H5S_hyper_sel_t)) == NULL)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab info")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate hyperslab info")
/* Set selection type */
proj_space->select.type = H5S_sel_hyper;
@@ -9542,7 +9516,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
* current dimension */
low = curr_span_up_dim[i - 1] % proj_space->extent.size[i - 1];
if(H5S_hyper_append_span(&prev_span[i - 1], &curr_span_tree[i - 1], low, low, curr_span_tree[i], NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSELECT, FAIL, "can't allocate hyperslab span")
/* Reset lower dimension's span tree and previous
* span since we just committed it and will start
@@ -9567,7 +9541,7 @@ H5S__hyper_project_intersection(const H5S_t *src_space, const H5S_t *dst_space,
/* Append span in lowest dimension */
if(H5S_hyper_append_span(&prev_span[proj_rank - 1], &curr_span_tree[proj_rank - 1], low, high, NULL, NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSELECT, FAIL, "can't allocate hyperslab span")
/* Update remaining offset and length */
proj_off += (hsize_t)span_len;
@@ -9590,7 +9564,7 @@ loop_end:
/* Append remaining span tree to higher dimension */
low = curr_span_up_dim[i - 1] % proj_space->extent.size[i - 1];
if(H5S_hyper_append_span(&prev_span[i - 1], &curr_span_tree[i - 1], low, low, curr_span_tree[i], NULL) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't allocate hyperslab span")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSELECT, FAIL, "can't allocate hyperslab span")
/* Reset span tree */
if(H5S_hyper_free_span_info(curr_span_tree[i]) < 0)
@@ -9687,15 +9661,13 @@ H5S__hyper_get_clip_diminfo(hsize_t start, hsize_t stride, hsize_t *count,
*count = 0;
} /* end if */
/* Check for single block in unlimited dimension */
- else if(*count == (hsize_t)1) {
- HDassert(*block == H5S_UNLIMITED);
-
+ else if((*block == H5S_UNLIMITED) || (*block == stride)) {
/* Calculate actual block size for this clip size */
*block = (hsize_t)((hssize_t)clip_size - ((hssize_t)start + offset));
+ *count = (hsize_t)1;
} /* end if */
else {
HDassert(*count == H5S_UNLIMITED);
- HDassert(*block != H5S_UNLIMITED);
HDassert((hssize_t)clip_size > offset);
/* Calculate initial count (last block may be partial) */
@@ -9734,6 +9706,8 @@ herr_t
H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
{
H5S_hyper_sel_t *hslab; /* Convenience pointer to hyperslab info */
+
+ H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_diminfo in unlimited dimension */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -9744,6 +9718,8 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
HDassert(hslab);
HDassert(hslab->unlim_dim >= 0);
+ diminfo = &hslab->opt_diminfo[hslab->unlim_dim];
+
/* Check for no need to change size */
if(((hssize_t)clip_size - space->select.offset[hslab->unlim_dim])
== hslab->unlim_dim_clip_size)
@@ -9757,14 +9733,14 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
} /* end if */
/* Initialize opt_diminfo with opt_unlim_diminfo */
- hslab->opt_diminfo[hslab->unlim_dim] = hslab->opt_unlim_diminfo[hslab->unlim_dim];
+ *diminfo = hslab->opt_unlim_diminfo[hslab->unlim_dim];
/* Get initial diminfo */
- H5S__hyper_get_clip_diminfo(hslab->opt_diminfo[hslab->unlim_dim].start, hslab->opt_diminfo[hslab->unlim_dim].stride, &hslab->opt_diminfo[hslab->unlim_dim].count, &hslab->opt_diminfo[hslab->unlim_dim].block, space->select.offset[hslab->unlim_dim], clip_size);
+ H5S__hyper_get_clip_diminfo(diminfo->start, diminfo->stride, &diminfo->count, &diminfo->block, space->select.offset[hslab->unlim_dim], clip_size);
/* Check for nothing returned */
- if((hslab->opt_diminfo[hslab->unlim_dim].block == 0)
- || (hslab->opt_diminfo[hslab->unlim_dim].count == 0)) {
+ if((diminfo->block == 0)
+ || (diminfo->count == 0)) {
/* Set num_elem */
space->select.num_elem = (hsize_t)0;
@@ -9774,25 +9750,20 @@ H5S_hyper_clip_unlim(H5S_t *space, hsize_t clip_size)
/* Check for single block in unlimited dimension */
else if(hslab->opt_unlim_diminfo[hslab->unlim_dim].count == (hsize_t)1) {
/* Calculate number of elements */
- space->select.num_elem = hslab->opt_diminfo[hslab->unlim_dim].block
- * hslab->num_elem_non_unlim;
+ space->select.num_elem = diminfo->block * hslab->num_elem_non_unlim;
/* Mark that opt_diminfo is valid */
hslab->diminfo_valid = TRUE;
} /* end if */
else {
/* Calculate number of elements */
- space->select.num_elem = hslab->opt_diminfo[hslab->unlim_dim].count
- * hslab->opt_diminfo[hslab->unlim_dim].block
+ space->select.num_elem = diminfo->count * diminfo->block
* hslab->num_elem_non_unlim;
/* Check if last block is partial. If superset is set, just keep the
* last block complete to speed computation. */
- if(((hslab->opt_diminfo[hslab->unlim_dim].stride
- * (hslab->opt_diminfo[hslab->unlim_dim].count - (hsize_t)1))
- + hslab->opt_diminfo[hslab->unlim_dim].block)
- > ((hsize_t)((hssize_t)clip_size
- - ((hssize_t)hslab->opt_diminfo[hslab->unlim_dim].start
+ if(((diminfo->stride * (diminfo->count - (hsize_t)1)) + diminfo->block)
+ > ((hsize_t)((hssize_t)clip_size - ((hssize_t)diminfo->start
+ space->select.offset[hslab->unlim_dim])))) {
hsize_t start[H5S_MAX_RANK];
hsize_t block[H5S_MAX_RANK];
@@ -9908,6 +9879,7 @@ H5S_hyper_get_clip_extent(const H5S_t *clip_space, const H5S_t *match_space,
{
const H5S_hyper_sel_t *clip_hslab; /* Convenience pointer to hyperslab info */
const H5S_hyper_sel_t *match_hslab; /* Convenience pointer to hyperslab info */
+ const H5S_hyper_dim_t *diminfo; /* Convenience pointer to opt_unlim_diminfo in unlimited dimension */
hsize_t num_slices;
hsize_t count;
hsize_t rem_slices;
@@ -9926,59 +9898,45 @@ H5S_hyper_get_clip_extent(const H5S_t *clip_space, const H5S_t *match_space,
HDassert(match_hslab->unlim_dim >= 0);
HDassert(clip_hslab->num_elem_non_unlim == match_hslab->num_elem_non_unlim);
+ diminfo = &clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim];
+
/* Calculate number of slices */
num_slices = match_space->select.num_elem / match_hslab->num_elem_non_unlim;
if(num_slices == 0) {
HDassert(incl_trail && "Checking code coverage..."); //VDSINC
HDassert(!incl_trail && "Checking code coverage..."); //VDSINC
- *clip_size = incl_trail
- ? clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].start
- : 0;
+ *clip_size = incl_trail ? diminfo->start : 0;
} //VDSINC
- else if(clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].block == H5S_UNLIMITED) {
+ else if((diminfo->block == H5S_UNLIMITED)
+ || (diminfo->block == diminfo->stride))
/* Unlimited block, just set the extent large enough for the block size
* to match num_slices */
- HDassert(clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].count == (hsize_t)1);
-
- *clip_size =
- clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].start
- + num_slices;
- } /* end if */
+ *clip_size = diminfo->start + num_slices;
else {
/* Unlimited count, need to match extent so a block (possibly) gets cut
* off so the number of slices matches num_slices */
- HDassert(clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].count == H5S_UNLIMITED);
+ HDassert(diminfo->count == H5S_UNLIMITED);
/* Calculate number of complete blocks in clip_space */
- count = num_slices / clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].block;
+ count = num_slices / diminfo->block;
/* Calculate slices remaining */
- rem_slices = num_slices - (count
- * clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].block);
+ rem_slices = num_slices - (count * diminfo->block);
if(rem_slices > 0)
/* Must end extent in middle of partial block (or beginning of empty
* block if include_trailing_space and rem_slices == 0) */
- *clip_size =
- clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].start
- + (count
- * clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].stride)
+ *clip_size = diminfo->start + (count * diminfo->stride)
+ rem_slices;
else {
if(incl_trail)
/* End extent just before first missing block */
- *clip_size =
- clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].start
- + (count
- * clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].stride);
+ *clip_size = diminfo->start + (count * diminfo->stride);
else
/* End extent at end of last block */
- *clip_size =
- clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].start
- + ((count - (hsize_t)1)
- * clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].stride)
- + clip_hslab->opt_unlim_diminfo[clip_hslab->unlim_dim].block;
+ *clip_size = diminfo->start + ((count - (hsize_t)1)
+ * diminfo->stride) + diminfo->block;
} /* end else */
} /* end else */
@@ -10024,17 +9982,16 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
HDassert(hslab->unlim_dim >= 0);
HDassert(hslab->opt_unlim_diminfo[hslab->unlim_dim].count == H5S_UNLIMITED);
- /* Set block to clip_size in unlimited dimension, H5S_MAX_SIZE in
- * others so only unlimited dimension is clipped */
+ /* Set start to select block_indexth block in unlimited dimension and set
+ * count to 1 in that dimension to only select that block. Copy all other
+ * diminfo parameters. */
for(i = 0; i < space->extent.rank; i++) {
if((int)i == hslab->unlim_dim){
- //HDassert(0 && "Checking code coverage..."); //VDSINC
start[i] = hslab->opt_unlim_diminfo[i].start + (block_index
* hslab->opt_unlim_diminfo[i].stride);
count[i] = (hsize_t)1;
} /* end if */
else {
- //HDassert(0 && "Checking code coverage..."); //VDSINC
start[i] = hslab->opt_unlim_diminfo[i].start;
count[i] = hslab->opt_unlim_diminfo[i].count;
} /* end else */
@@ -10052,7 +10009,7 @@ H5S_hyper_get_unlim_block(const H5S_t *space, hsize_t block_index)
(void)HDmemset(space_out->select.offset, 0, (size_t)space_out->extent.rank * sizeof(space_out->select.offset[0]));
space_out->select.offset_changed = FALSE;
- /* "And" selection with calculate block to perform clip operation */
+ /* Select block as defined by start/stride/count/block computed above */
if(H5S_select_hyperslab(space_out, H5S_SELECT_SET, start, stride, count, block) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTINIT, NULL, "can't select hyperslab")
diff --git a/test/Makefile.am b/test/Makefile.am
index e45fbd3..7588dc0 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-2].h5
+ vds_virt.h5 vds_src_[0-1].h5
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
diff --git a/test/h5test.c b/test/h5test.c
index 693760c..88a8afa 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -122,69 +122,94 @@ h5_errors(hid_t estack, void UNUSED *client_data)
/*-------------------------------------------------------------------------
- * Function: h5_cleanup
+ * Function: h5_close_files
*
- * Purpose: Cleanup temporary test files.
+ * Purpose: Cleanup temporary test files (always closes).
* base_name contains the list of test file names.
- * The file access property list is also closed.
*
- * Return: Non-zero if cleanup actions were performed; zero otherwise.
+ * Return: void
*
- * Programmer: Albert Cheng
+ * Programmer: Neil Fortner
+ * June 1, 2015
+ * Original: Albert Cheng
* May 28, 1998
*
*-------------------------------------------------------------------------
*/
-int
-h5_cleanup(const char *base_name[], hid_t fapl)
+void
+h5_close_files(const char *base_name[], hid_t fapl)
{
- int retval = 0;
+ int i;
- if(GetTestCleanup()) {
- int i;
+ for(i = 0; base_name[i]; i++) {
+ char filename[1024];
+ char temp[2048];
+ hid_t driver;
- for(i = 0; base_name[i]; i++) {
- char filename[1024];
- char temp[2048];
- hid_t driver;
+ if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
+ continue;
- if(NULL == h5_fixname(base_name[i], fapl, filename, sizeof(filename)))
- continue;
+ driver = H5Pget_driver(fapl);
- driver = H5Pget_driver(fapl);
+ if(driver == H5FD_FAMILY) {
+ int j;
- if(driver == H5FD_FAMILY) {
- int j;
+ for(j = 0; /*void*/; j++) {
+ HDsnprintf(temp, sizeof temp, filename, j);
- for(j = 0; /*void*/; j++) {
- HDsnprintf(temp, sizeof temp, filename, j);
+ if(HDaccess(temp, F_OK) < 0)
+ break;
- if(HDaccess(temp, F_OK) < 0)
- break;
+ HDremove(temp);
+ } /* end for */
+ } else if(driver == H5FD_CORE) {
+ hbool_t backing; /* Whether the core file has backing store */
- HDremove(temp);
- } /* end for */
- } else if(driver == H5FD_CORE) {
- hbool_t backing; /* Whether the core file has backing store */
+ H5Pget_fapl_core(fapl, NULL, &backing);
- H5Pget_fapl_core(fapl, NULL, &backing);
+ /* If the file was stored to disk with bacing store, remove it */
+ if(backing)
+ HDremove(filename);
+ } else if (driver == H5FD_MULTI) {
+ H5FD_mem_t mt;
- /* If the file was stored to disk with bacing store, remove it */
- if(backing)
- HDremove(filename);
- } else if (driver == H5FD_MULTI) {
- H5FD_mem_t mt;
+ HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
- HDassert(HDstrlen(multi_letters)==H5FD_MEM_NTYPES);
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
+ HDremove(temp); /*don't care if it fails*/
+ } /* end for */
+ } else {
+ HDremove(filename);
+ }
+ } /* end for */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
- HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
- HDremove(temp); /*don't care if it fails*/
- } /* end for */
- } else {
- HDremove(filename);
- }
- } /* end for */
+ return;
+} /* end h5_close_files() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: h5_cleanup
+ *
+ * Purpose: Cleanup temporary test files.
+ * base_name contains the list of test file names.
+ * The file access property list is also closed.
+ *
+ * Return: Non-zero if cleanup actions were performed; zero otherwise.
+ *
+ * Programmer: Albert Cheng
+ * May 28, 1998
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+h5_cleanup(const char *base_name[], hid_t fapl)
+{
+ int retval = 0;
+
+ if(GetTestCleanup()) {
+ /* Close files in base_name */
+ h5_close_files(base_name, fapl);
retval = 1;
} /* end if */
diff --git a/test/h5test.h b/test/h5test.h
index ce224d8..e033322 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -142,6 +142,7 @@ extern "C" {
/* Generally useful testing routines */
H5TEST_DLL int h5_cleanup(const char *base_name[], hid_t fapl);
+H5TEST_DLL void h5_close_files(const char *base_name[], hid_t fapl);
H5TEST_DLL char *h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL char *h5_fixname_no_suffix(const char *base_name, hid_t fapl, char *fullname, size_t size);
H5TEST_DLL hid_t h5_fileaccess(void);
diff --git a/test/vds.c b/test/vds.c
index 40d2f8d..6d93e82 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -32,15 +32,17 @@ typedef enum {
} test_api_config_t;
const char *FILENAME[] = {
- "vds_1",
- "vds_2",
+ "vds_virt",
+ "vds_src_0",
+ "vds_src_1",
NULL
};
/* I/O test config flags */
#define TEST_IO_CLOSE_SRC 0x01u
#define TEST_IO_DIFFERENT_FILE 0x02u
-#define TEST_IO_NTESTS 0x04u
+#define TEST_IO_REOPEN_VIRT 0x04u
+#define TEST_IO_NTESTS 0x08u
//VDSINC add close source, virtual file
#define LIST_DOUBLE_SIZE (H5D_VIRTUAL_DEF_LIST_SIZE + 1)
@@ -996,7 +998,7 @@ test_basic_io(unsigned config, hid_t fapl)
hid_t dcpl = -1; /* Dataset creation property list */
hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
+ hid_t memspace = -1; /* Memory dataspace */
hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
hid_t vdset = -1; /* Virtual dataset */
hsize_t dims[2] = {10, 26}; /* Data space current size */
@@ -1086,6 +1088,20 @@ test_basic_io(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
@@ -1240,6 +1256,20 @@ test_basic_io(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Read data through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
if(H5Dread(vdset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
@@ -1405,6 +1435,20 @@ test_basic_io(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Read first source dataset through virtual dataset */
HDmemset(rbuf[0], 0, sizeof(rbuf));
if(H5Dread(vdset, H5T_NATIVE_INT, vspace[0], vspace[0], H5P_DEFAULT, rbuf[0]) < 0)
@@ -1623,6 +1667,20 @@ test_basic_io(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Read data through virtual dataset by hyperslab */
/* Reset rbuf */
HDmemset(rbuf[0], 0, sizeof(rbuf));
@@ -1911,6 +1969,20 @@ test_basic_io(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Read data through virtual dataset by hyperslab */
/* Reset rbuf */
HDmemset(rbuf[0], 0, sizeof(rbuf));
@@ -2221,6 +2293,20 @@ test_basic_io(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Read data through virtual dataset */
/* Reset rbuf */
HDmemset(rbuf[0], 0, sizeof(rbuf));
@@ -2583,7 +2669,7 @@ test_unlim(unsigned config, hid_t fapl)
hid_t dapl = -1; /* Dataset access property list */
hid_t srcspace[4] = {-1, -1, -1, -1}; /* Source dataspaces */
hid_t vspace[4] = {-1, -1, -1, -1}; /* Virtual dset dataspaces */
- hid_t memspace = -1; /* Memory dataspace */
+ hid_t memspace = -1; /* Memory dataspace */
hid_t filespace = -1; /* File dataspace */
hid_t srcdset[4] = {-1, -1, -1, -1}; /* Source datsets */
hid_t vdset = -1; /* Virtual dataset */
@@ -2746,6 +2832,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -2794,11 +2894,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING */
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -2890,6 +2998,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -2940,11 +3062,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE */
+ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -3052,13 +3182,25 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
- /* Get VDS space dimensions. Note that since we are using
- * H5D_VDS_FIRST_MISSING and we only extended one source dataset the
- * dimensions will not have changed. */
+ /* Get VDS space dimensions */
if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
TEST_ERROR
if(ndims != 2)
@@ -3126,11 +3268,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != -1)
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING */
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -3354,6 +3504,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -3401,11 +3565,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING */
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -3502,6 +3674,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -3551,11 +3737,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE */
+ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -3661,6 +3855,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -3733,11 +3941,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != -1)
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING */
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -4008,6 +4224,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -4055,11 +4285,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING */
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -4151,6 +4389,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -4199,18 +4451,24 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE */
+ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
/* Update erbuf to reflect new data that is now visible due to the change to
- * H5D_VDS_LAST_AVAILABLE (second new slice) */
- /* Update erbuf to reflect only new data that is now visible under
- * H5D_VDS_FIRST_MISSING (first slice) */
+ * H5D_VDS_LAST_AVAILABLE */
for(i = 0; i < 10; i++) {
erbuf[i][12] = buf[i][0];
erbuf[i][13] = buf[i][1];
@@ -4316,6 +4574,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -4364,11 +4636,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != erbuf[i][j])
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING */
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -4476,6 +4756,20 @@ test_unlim(unsigned config, hid_t fapl)
} /* end if */
} /* end if */
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
/* Get VDS space */
if((filespace = H5Dget_space(vdset)) < 0)
TEST_ERROR
@@ -4529,11 +4823,19 @@ test_unlim(unsigned config, hid_t fapl)
if(rbuf[i][j] != -1)
TEST_ERROR
- /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE */
+ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
+ * as well if config option specified */
if(H5Dclose(vdset) < 0)
TEST_ERROR
if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
TEST_ERROR
@@ -4600,7 +4902,7 @@ test_unlim(unsigned config, hid_t fapl)
TEST_ERROR
/* Verify read data - algorithmically check for only 2 middle rows being
- * read so we don't have to wipe out erbuf and then restore it afterwards */
+ * read */
for(i = 0; i < (int)mdims[0]; i++)
for(j = 0; j < (int)mdims[1]; j++)
if((i == 4) || (i == 5)) {
@@ -4710,6 +5012,2439 @@ error:
/*-------------------------------------------------------------------------
+ * Function: test_printf
+ *
+ * Purpose: Tests VDS with unlimited selections and printf style
+ * source dataset resolution
+ *
+ * Return: Success: 0
+ *
+ * Failure: number of errors
+ *
+ * Programmer: Neil Fortner
+ * Tuesday, May 26, 2015
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_printf(unsigned config, hid_t fapl)
+{
+ char srcfilename[FILENAME_BUF_SIZE];
+ char srcfilename2[FILENAME_BUF_SIZE];
+ char vfilename[FILENAME_BUF_SIZE];
+ char printf_srcfilename[FILENAME_BUF_SIZE];
+ const char *printf_srcfilename_fmt = "vds_src_%b";
+ hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
+ hid_t vfile = -1; /* File with virtual dset */
+ hid_t dcpl = -1; /* Dataset creation property list */
+ hid_t dapl = -1; /* Dataset access property list */
+ hid_t srcspace = -1; /* Source dataspaces */
+ hid_t vspace[2] = {-1, -1}; /* Virtual dset dataspaces */
+ hid_t memspace = -1; /* Memory dataspace */
+ hid_t filespace = -1; /* File dataspace */
+ hid_t srcdset[6] = {-1, -1, -1, -1, -1, -1}; /* Source datsets */
+ hid_t vdset = -1; /* Virtual dataset */
+ hsize_t dims[2] = {10, 0}; /* Data space current size */
+ hsize_t mdims[2] = {10, 20}; /* Data space maximum size */
+ hsize_t start[4] = {0, 0}; /* Hyperslab start */
+ hsize_t stride[4]; /* Hyperslab stride */
+ hsize_t count[4]; /* Hyperslab count */
+ hsize_t block[4]; /* Hyperslab block */
+ int buf[10][20]; /* Write and expected read buffer */
+ int rbuf[10][20]; /* Read buffer */
+ int erbuf[10][20]; /* Expected read buffer */
+ int ndims; /* Number of dimensions */
+ int i, j;
+
+ TESTING("virtual dataset I/O with printf source")
+
+ h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
+ h5_fixname(FILENAME[1], fapl, srcfilename, sizeof srcfilename);
+ h5_fixname(FILENAME[2], fapl, srcfilename2, sizeof srcfilename2);
+ h5_fixname(printf_srcfilename_fmt, fapl, printf_srcfilename, sizeof printf_srcfilename);
+
+ /* Create DCPL */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Create DAPL */
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0)
+ TEST_ERROR
+
+ /* Create memory space */
+ if((memspace = H5Screate_simple(2, mdims, NULL)) < 0)
+ TEST_ERROR
+
+
+ /*
+ * Test 1: 1 Source dataset mapping, 10x5 blocks
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 5;
+ if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual space */
+ stride[0] = 1;
+ stride[1] = 5;
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 5;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename : ".", "src_dset%b", srcspace) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR
+
+ /* Close srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 0)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Reopen srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if(config & TEST_IO_DIFFERENT_FILE)
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 2 source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] = (i * (int)mdims[1]) + j;
+
+ /* Initialize erbuf */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ erbuf[i][j] = -1;
+
+ /* Write to srcdset[0] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j] = buf[i][j];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[1] */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j + 5] = buf[i][j];
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 10)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Reopen srcfile if config option specified */
+ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 3rd source dataset */
+ if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset2", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[2] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j + 10] = buf[i][j];
+
+ /* Close srcdset[2] and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 15)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ else if(!(config & TEST_IO_DIFFERENT_FILE)) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace) < 0)
+ TEST_ERROR
+ srcspace = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+
+
+ /*
+ * Test 2: 1 Source dataset mapping, 10x1 blocks, test printf gap setting
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 1;
+ if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual space */
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 1;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename : ".", "src_dset%b", srcspace) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR
+
+ /* Close srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 0)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Reopen srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if(config & TEST_IO_DIFFERENT_FILE)
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create source datasets in a pattern with increasing gaps:
+ * XX-X--X---X----X */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset3", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset6", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[4] = H5Dcreate2(srcfile[0], "src_dset10", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[5] = H5Dcreate2(srcfile[0], "src_dset15", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] = (i * (int)mdims[1]) + j;
+
+ /* Initialize erbuf */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ erbuf[i][j] = -1;
+
+ /* Write to srcdset[0] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][0] = buf[i][0];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[1] */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][1] = buf[i][0];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[2] */
+ if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][3] = buf[i][0];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[3] */
+ if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][6] = buf[i][0];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[4] */
+ if(H5Dwrite(srcdset[4], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][10] = buf[i][0];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[5] */
+ if(H5Dwrite(srcdset[5], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][15] = buf[i][0];
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ for(i = 0; i < 6; i++) {
+ if(H5Dclose(srcdset[i]) < 0)
+ TEST_ERROR
+ srcdset[i] = -1;
+ } /* end for */
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 2)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with printf gap set to 1, reopen file as well if
+ * config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_printf_gap(dapl, (size_t)1) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 4)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with printf gap set to 2, reopen file as well if
+ * config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_printf_gap(dapl, (size_t)2) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 7)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with printf gap set to 3, reopen file as well if
+ * config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_printf_gap(dapl, (size_t)3) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 11)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with printf gap set to 4, reopen file as well if
+ * config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_printf_gap(dapl, (size_t)4) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 16)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 2)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Reset dapl */
+ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ for(i = 0; i < 6; i++) {
+ if(H5Dclose(srcdset[i]) < 0)
+ TEST_ERROR
+ srcdset[i] = -1;
+ } /* end for */
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ else if(!(config & TEST_IO_DIFFERENT_FILE)) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace) < 0)
+ TEST_ERROR
+ srcspace = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+
+
+ /*
+ * Test 3: 1 Source dataset mapping, 10x5 blocks, printf source file
+ */
+ /* Clean up files so the source files do not exist yet */
+ h5_close_files(FILENAME, fapl);
+
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 5;
+ if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual space */
+ stride[0] = 1;
+ stride[1] = 5;
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 5;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], printf_srcfilename, "src_dset", srcspace) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 0)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Create 2 source files, one source dataset */
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] = (i * (int)mdims[1]) + j;
+
+ /* Initialize erbuf */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ erbuf[i][j] = -1;
+
+ /* Write to srcdset[0] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j] = buf[i][j];
+
+ /* Close srcdset and srcfiles if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ if(H5Fclose(srcfile[1]) < 0)
+ TEST_ERROR
+ srcfile[1] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 5)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Reopen srcfile[1] if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 2nd source dataset */
+ if((srcdset[1] = H5Dcreate2(srcfile[1], "src_dset", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[1] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j + 5] = buf[i][j];
+
+ /* Close srcdset[1] and srcfile[1] if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[1]) < 0)
+ TEST_ERROR
+ srcfile[1] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 10)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ if(H5Fclose(srcfile[1]) < 0)
+ TEST_ERROR
+ srcfile[1] = -1;
+ } /* end if */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace) < 0)
+ TEST_ERROR
+ srcspace = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+
+
+ /*
+ * Test 4: 1 Source dataset mapping, 10x5 blocks, printf source file and
+ * source dset, extra %%s in source dataset name
+ */
+ /* Clean up files so the source files do not exist yet */
+ h5_close_files(FILENAME, fapl);
+
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace */
+ dims[1] = 5;
+ if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual space */
+ stride[0] = 1;
+ stride[1] = 5;
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 5;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+
+ /* Add virtual layout mapping */
+ if(H5Pset_virtual(dcpl, vspace[0], printf_srcfilename, "%%src%%_dset%%%b", srcspace) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, dapl)) < 0)
+ TEST_ERROR
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 0)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Create 2 source files, one source dataset */
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "%src%_dset%0", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcfile[1] = H5Fcreate(srcfilename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] = (i * (int)mdims[1]) + j;
+
+ /* Initialize erbuf */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ erbuf[i][j] = -1;
+
+ /* Write to srcdset[0] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j] = buf[i][j];
+
+ /* Close srcdset and srcfiles if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ if(H5Fclose(srcfile[1]) < 0)
+ TEST_ERROR
+ srcfile[1] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 5)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Reopen srcfile[1] if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if((srcfile[1] = H5Fopen(srcfilename2, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 2nd source dataset */
+ if((srcdset[1] = H5Dcreate2(srcfile[1], "%src%_dset%1", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[1] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ for(j = 0; j < 5; j++)
+ erbuf[i][j + 5] = buf[i][j];
+
+ /* Close srcdset[1] and srcfile[1] if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[1]) < 0)
+ TEST_ERROR
+ srcfile[1] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 10)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ if(H5Fclose(srcfile[1]) < 0)
+ TEST_ERROR
+ srcfile[1] = -1;
+ } /* end if */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace) < 0)
+ TEST_ERROR
+ srcspace = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+
+
+ /*
+ * Test 5: 2 Source mappings, interleaved slices, single element wide,
+ * hyperslab selection in source, extra %%s in source dataset names
+ */
+ /* Clear virtual layout in DCPL */
+ if(H5Pset_layout(dcpl, H5D_VIRTUAL) < 0)
+ TEST_ERROR
+
+ /* Create virtual dataspaces */
+ dims[0] = 10;
+ dims[1] = 10;
+ if((vspace[0] = H5Screate_simple(2, dims, mdims)) < 0)
+ TEST_ERROR
+ if((vspace[1] = H5Screate_simple(2, dims, mdims)) < 0)
+ TEST_ERROR
+
+ /* Create source dataspace (2 elements wide) */
+ dims[1] = 2;
+ if((srcspace = H5Screate_simple(2, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Select hyperslab in source space */
+ count[0] = 10;
+ count[1] = 1;
+ if(H5Sselect_hyperslab(srcspace, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ TEST_ERROR
+
+ /* Select hyperslabs in virtual spaces */
+ stride[0] = 1;
+ stride[1] = 2;
+ count[0] = 1;
+ count[1] = H5S_UNLIMITED;
+ block[0] = 10;
+ block[1] = 1;
+ if(H5Sselect_hyperslab(vspace[0], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+ start[1] = 1;
+ if(H5Sselect_hyperslab(vspace[1], H5S_SELECT_SET, start, stride, count, block) < 0)
+ TEST_ERROR
+ start[1] = 0;
+
+ /* Add virtual layout mappings */
+ if(H5Pset_virtual(dcpl, vspace[0], config & TEST_IO_DIFFERENT_FILE ? srcfilename : ".", "src_dset_a%b%%", srcspace) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual(dcpl, vspace[1], config & TEST_IO_DIFFERENT_FILE ? srcfilename : ".", "src_dset_b%b%%%%", srcspace) < 0)
+ TEST_ERROR
+
+ /* Create virtual file */
+ if((vfile = H5Fcreate(vfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create source file if requested */
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if((srcfile[0] = H5Fcreate(srcfilename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+ else {
+ srcfile[0] = vfile;
+ if(H5Iinc_ref(srcfile[0]) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Create virtual dataset */
+ if((vdset = H5Dcreate2(vfile, "v_dset", H5T_NATIVE_INT, vspace[0], H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Close srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 0)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Reopen srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC)
+ if(config & TEST_IO_DIFFERENT_FILE)
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 2 source datasets */
+ if((srcdset[0] = H5Dcreate2(srcfile[0], "src_dset_a0%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((srcdset[1] = H5Dcreate2(srcfile[0], "src_dset_b0%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Populate write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] = (i * (int)mdims[1]) + j;
+
+ /* Initialize erbuf */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ erbuf[i][j] = -1;
+
+ /* Write to srcdset[0] */
+ block[0] = 10;
+ block[1] = 2;
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[0], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][0] = buf[i][0];
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[1] */
+ if(H5Dwrite(srcdset[1], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][1] = buf[i][0];
+
+ /* Close srcdsets and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[0]) < 0)
+ TEST_ERROR
+ srcdset[0] = -1;
+ if(H5Dclose(srcdset[1]) < 0)
+ TEST_ERROR
+ srcdset[1] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 2)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Reopen srcfile if config option specified */
+ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 3rd source dataset */
+ if((srcdset[2] = H5Dcreate2(srcfile[0], "src_dset_b1%%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[2] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[2], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][3] = buf[i][0];
+
+ /* Close srcdset[2] and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[2]) < 0)
+ TEST_ERROR
+ srcdset[2] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 4)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+
+ /* Close VDS and reopen with view set to H5D_VDS_FIRST_MISSING, reopen file
+ * as well if config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_view(dapl, H5D_VDS_FIRST_MISSING) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions. Make sure that the 4th slice is no longer
+ * visible due to the change to H5D_VDS_FIRST_MISSING. */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 2)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Reopen srcfile if config option specified */
+ if((config & TEST_IO_CLOSE_SRC) && (config & TEST_IO_DIFFERENT_FILE))
+ if((srcfile[0] = H5Fopen(srcfilename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create 4th source dataset */
+ if((srcdset[3] = H5Dcreate2(srcfile[0], "src_dset_a2%", H5T_NATIVE_INT, srcspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Adjust write buffer */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ buf[i][j] += (int)mdims[0] * (int)mdims[1];
+
+ /* Write to srcdset[3] */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, block, NULL) < 0)
+ TEST_ERROR
+ if(H5Dwrite(srcdset[3], H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, buf[0]) < 0)
+ TEST_ERROR
+
+ /* Update erbuf */
+ for(i = 0; i < 10; i++)
+ erbuf[i][4] = buf[i][0];
+
+ /* Close srcdset[3] and srcfile if config option specified */
+ if(config & TEST_IO_CLOSE_SRC) {
+ if(H5Dclose(srcdset[3]) < 0)
+ TEST_ERROR
+ srcdset[3] = -1;
+
+ if(config & TEST_IO_DIFFERENT_FILE) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ } /* end if */
+
+ /* Reopen virtual dataset and file if config option specified */
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+ } /* end if */
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 2)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with view set to H5D_VDS_LAST_AVAILABLE, reopen file
+ * as well if config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions. Make sure that the 4th slice is now visible
+ * due to the change to H5D_VDS_LAST_AVAILABLE. */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 4)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Close VDS and reopen with printf_gap set to 1, reopen file as well if
+ * config option specified */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)1) < 0)
+ TEST_ERROR
+ if(config & TEST_IO_REOPEN_VIRT) {
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if((vfile = H5Fopen(vfilename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+ } /* end if */
+ if((vdset = H5Dopen2(vfile, "v_dset", dapl)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space */
+ if((filespace = H5Dget_space(vdset)) < 0)
+ TEST_ERROR
+
+ /* Get VDS space dimensions. Make sure that the 6th slice is now visible
+ * due to the change to printf_gap. */
+ if((ndims = H5Sget_simple_extent_ndims(filespace)) < 0)
+ TEST_ERROR
+ if(ndims != 2)
+ TEST_ERROR
+ if(H5Sget_simple_extent_dims(filespace, dims, mdims) < 0)
+ TEST_ERROR
+ if(dims[0] != 10)
+ TEST_ERROR
+ if(dims[1] != 5)
+ TEST_ERROR
+ if(mdims[0] != 10)
+ TEST_ERROR
+ if(mdims[1] != 20)
+ TEST_ERROR
+
+ /* Close filespace */
+ if(H5Sclose(filespace) < 0)
+ TEST_ERROR
+
+ /* Read data through virtual dataset */
+ /* Reset rbuf */
+ //HDmemset(rbuf[0], 0, sizeof(rbuf)); VDSINC
+ /* Initialize erbuf - used now instead of setting fill value because fill
+ * values do not work VDSINC */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++)
+ rbuf[i][j] = -1;
+
+ /* Select hyperslab in memory space */
+ if(H5Sselect_hyperslab(memspace, H5S_SELECT_SET, start, NULL, dims, NULL) < 0)
+ TEST_ERROR
+
+ /* Read data */
+ if(H5Dread(vdset, H5T_NATIVE_INT, memspace, H5S_ALL, H5P_DEFAULT, rbuf[0]) < 0)
+ TEST_ERROR
+
+ /* Verify read data */
+ for(i = 0; i < (int)mdims[0]; i++)
+ for(j = 0; j < (int)mdims[1]; j++) {
+ if(j >= (int)dims[1]) {
+ if(rbuf[i][j] != -1)
+ TEST_ERROR
+ } /* end if */
+ else
+ if(rbuf[i][j] != erbuf[i][j])
+ TEST_ERROR
+ } /* end for */
+
+ /* Reset dapl */
+ if(H5Pset_virtual_printf_gap(dapl, (hsize_t)0) < 0)
+ TEST_ERROR
+ if(H5Pset_virtual_view(dapl, H5D_VDS_LAST_AVAILABLE) < 0)
+ TEST_ERROR
+
+ /* Close */
+ if(!(config & TEST_IO_CLOSE_SRC)) {
+ for(i = 0; i < 4; i++) {
+ if(H5Dclose(srcdset[i]) < 0)
+ TEST_ERROR
+ srcdset[i] = -1;
+ } /* end for */
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ else if(!(config & TEST_IO_DIFFERENT_FILE)) {
+ if(H5Fclose(srcfile[0]) < 0)
+ TEST_ERROR
+ srcfile[0] = -1;
+ } /* end if */
+ if(H5Dclose(vdset) < 0)
+ TEST_ERROR
+ vdset = -1;
+ if(H5Fclose(vfile) < 0)
+ TEST_ERROR
+ vfile = -1;
+ if(H5Sclose(srcspace) < 0)
+ TEST_ERROR
+ srcspace = -1;
+ if(H5Sclose(vspace[0]) < 0)
+ TEST_ERROR
+ vspace[0] = -1;
+ if(H5Sclose(vspace[1]) < 0)
+ TEST_ERROR
+ vspace[1] = -1;
+
+
+ /* Close */
+ if(H5Pclose(dcpl) < 0)
+ TEST_ERROR
+ dcpl = -1;
+ if(H5Pclose(dapl) < 0)
+ TEST_ERROR
+ dapl = -1;
+ if(H5Sclose(memspace) < 0)
+ TEST_ERROR
+ memspace = -1;
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ for(i = 0; i < (int)(sizeof(srcdset) / sizeof(srcdset[0])); i++) {
+ if(srcdset[i] >= 0)
+ (void)H5Dclose(srcdset[i]);
+ } /* end for */
+ if(vdset >= 0)
+ (void)H5Dclose(vdset);
+ for(i = 0; i < (int)(sizeof(srcfile) / sizeof(srcfile[0])); i++) {
+ if(srcfile[i] >= 0)
+ (void)H5Fclose(srcfile[i]);
+ } /* end for */
+ if(vfile >= 0)
+ (void)H5Fclose(vfile);
+ if(srcspace >= 0)
+ (void)H5Sclose(srcspace);
+ for(i = 0; i < (int)(sizeof(vspace) / sizeof(vspace[0])); i++) {
+ if(vspace[i] >= 0)
+ (void)H5Sclose(vspace[i]);
+ } /* end for */
+ if(filespace >= 0)
+ (void)H5Sclose(filespace);
+ if(memspace >= 0)
+ (void)H5Sclose(memspace);
+ if(dcpl >= 0)
+ (void)H5Pclose(dcpl);
+ if(dapl >= 0)
+ (void)H5Pclose(dapl);
+ } H5E_END_TRY;
+
+ return 1;
+} /* end test_printf() */
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Tests datasets with virtual layout
@@ -4741,9 +7476,10 @@ main(void)
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);
for(bit_config = 0; bit_config < TEST_IO_NTESTS; bit_config++) {
- printf("Config: %s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file");
+ printf("Config: %s%s%s\n", bit_config & TEST_IO_CLOSE_SRC ? "closed source dataset, " : "", bit_config & TEST_IO_DIFFERENT_FILE ? "different source file" : "same source file", bit_config & TEST_IO_REOPEN_VIRT ? ", reopen virtual file" : "");
nerrors += test_basic_io(bit_config, fapl);
nerrors += test_unlim(bit_config, fapl);
+ nerrors += test_printf(bit_config, fapl);
} /* end for */
/* Verify symbol table messages are cached */
@@ -4761,5 +7497,5 @@ error:
printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
return 1;
-}
+} /* end main() */