summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2019-04-10 15:58:59 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2019-04-10 15:58:59 (GMT)
commit4feb2100591c802ea450dc26dae4e0546479fa96 (patch)
tree7519ef68d09ca5ef6c6e3de372eca4540ac1f688
parent1fb34f7e8cb960bdf8132cd4cf63b5c7cf11a969 (diff)
downloadhdf5-4feb2100591c802ea450dc26dae4e0546479fa96.zip
hdf5-4feb2100591c802ea450dc26dae4e0546479fa96.tar.gz
hdf5-4feb2100591c802ea450dc26dae4e0546479fa96.tar.bz2
Make corresponding changes for version bounds in V110.
This is based on PR#1639 merged to develop branch.
-rw-r--r--test/h5test.c24
-rw-r--r--test/h5test.h1
-rw-r--r--test/ohdr.c52
-rw-r--r--test/tfile.c41
-rw-r--r--test/trefer.c230
5 files changed, 184 insertions, 164 deletions
diff --git a/test/h5test.c b/test/h5test.c
index 62eb6bf..0d7603f 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -97,6 +97,16 @@ static const char *multi_letters = "msbrglo";
/* The # of seconds to wait for the message file--used by h5_wait_message() */
#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */
+/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */
+/* This is used by h5_get_version_string() */
+const char *LIBVER_NAMES[] = {
+ "earliest", /* H5F_LIBVER_EARLIEST = 0 */
+ "v18", /* H5F_LIBVER_V18 = 1 */
+ "v110", /* H5F_LIBVER_V110 = 2 */
+ "latest", /* H5F_LIBVER_V112 = 3 */
+ NULL
+};
+
/* Previous error reporting function */
static H5E_auto2_t err_func = NULL;
@@ -1931,3 +1941,17 @@ error:
return NULL;
} /* h5_get_dummy_vfd_class */
+/*-------------------------------------------------------------------------
+ * Function: h5_get_version_string
+ *
+ * Purpose: Get the string that corresponds to the libvery version bound.
+ *
+ * Return: The string
+ *
+ *-------------------------------------------------------------------------
+ */
+char *
+h5_get_version_string(H5F_libver_t libver)
+{
+ return(LIBVER_NAMES[libver]);
+} /* end of h5_get_version_string */
diff --git a/test/h5test.h b/test/h5test.h
index 8e87192..afd3a4c 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -142,6 +142,7 @@ H5TEST_DLL int print_func(const char *format, ...);
H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name);
H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl);
H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void);
+H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver);
/* Functions that will replace VFD-dependent functions that violate
* the single responsibility principle. Unlike their predecessors,
diff --git a/test/ohdr.c b/test/ohdr.c
index 3f61660..73ae8ac 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -1628,46 +1628,6 @@ error:
return FAIL;
} /* test_unknown() */
-#define STR_EARLIEST "earliest"
-#define STR_V18 "v18"
-#define STR_LATEST "latest"
-static char *
-version_string(H5F_libver_t libver)
-{
- char *str = NULL;
-
- str = (char *) HDmalloc(20);
- if (str == NULL) {
- HDfprintf(stderr, "Allocation failed\n");
- HDexit(1);
- }
-
- switch(libver) {
- case H5F_LIBVER_EARLIEST:
- HDstrcpy(str, STR_EARLIEST);
- break;
-
- case H5F_LIBVER_V18:
- HDstrcpy(str, STR_V18);
- break;
-
- case H5F_LIBVER_V110:
- HDassert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
- HDstrcpy(str, STR_LATEST);
- break;
-
- case H5F_LIBVER_ERROR:
- case H5F_LIBVER_NBOUNDS:
- default:
- HDsprintf(str, "%ld", (long)libver);
- break;
- } /* end switch */
-
- /* Return the formed version bound string */
- return str;
-} /* end of version_string */
-
-
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1696,7 +1656,6 @@ main(void)
H5O_loc_t oh_loc; /* Object header locations */
H5F_libver_t low, high; /* File format bounds */
time_t time_new, ro;
- char msg[80]; /* Message for file format version */
int i; /* Local index variable */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
herr_t ret; /* Generic return value */
@@ -1713,8 +1672,9 @@ main(void)
/* Loop through all the combinations of low/high library format bounds */
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
- char *low_string = NULL;
- char *high_string = NULL;
+ char *low_string = NULL; /* Message for library version low bound */
+ char *high_string = NULL; /* Message for library version high bound */
+ char msg[80]; /* Message for file format version */
/* Set version bounds before opening the file */
H5E_BEGIN_TRY {
@@ -1725,13 +1685,11 @@ main(void)
continue;
/* Display info about testing */
- low_string = version_string(low);
- high_string = version_string(high);
+ low_string = h5_get_version_string(low);
+ high_string = h5_get_version_string(high);
sprintf(msg, "Using file format version: (%s, %s)", low_string,
high_string);
HDputs(msg);
- HDfree(high_string);
- HDfree(low_string);
/* test on object continuation block */
if(test_cont(filename, fapl) < 0)
diff --git a/test/tfile.c b/test/tfile.c
index 2784204..a0a165f 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -5341,7 +5341,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} H5E_END_TRY;
/* Get the internal file pointer if the create succeeds */
- if((ok = fid >= 0)) {
+ if(fid >= 0) {
f = (H5F_t *)H5I_object(fid);
CHECK(f, NULL, "H5I_object");
}
@@ -5353,32 +5353,32 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
if(is_swmr) { /* SWMR is enabled */
if(high == H5F_LIBVER_LATEST) { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fcreate");
+ VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds");
VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
} else /* Should fail */
- VERIFY(ok, FALSE, "H5Fcreate");
+ VERIFY(fid >= 0, FALSE, "H5Fcreate");
} else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fcreate");
+ VERIFY(fid >= 0, TRUE, "H5Fcreate");
VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
switch(low) {
case H5F_LIBVER_EARLIEST:
- ok = (f->shared->sblock->super_vers == 0 ||
- f->shared->sblock->super_vers == 1 ||
- f->shared->sblock->super_vers == 2);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 ||
+ f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
case H5F_LIBVER_V18:
- ok = (f->shared->sblock->super_vers == 2);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
case H5F_LIBVER_V110:
- ok = (f->shared->sblock->super_vers == 3);
+ ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3);
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
break;
@@ -5390,7 +5390,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} /* end switch */
}
- if(ok) { /* Close the file */
+ if(fid >= 0) { /* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
}
@@ -5482,7 +5482,6 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
hid_t new_fapl = -1; /* File access property list */
unsigned super_vers; /* Superblock version */
H5F_libver_t low, high; /* Low and high bounds */
- hbool_t ok; /* The result is ok or not */
herr_t ret; /* Return value */
/* Create the file with the input fcpl and fapl */
@@ -5521,7 +5520,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
} H5E_END_TRY;
/* Get the internal file pointer if the open succeeds */
- if((ok = fid >= 0)) {
+ if(fid >= 0) {
f = (H5F_t *)H5I_object(fid);
CHECK(f, NULL, "H5I_object");
}
@@ -5531,24 +5530,22 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
case 3:
if(high == H5F_LIBVER_LATEST) {
/* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
} else /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
break;
case 2:
if(is_swmr) /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
-
- ok = f->shared->low_bound >= H5F_LIBVER_V18;
- VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -5559,10 +5556,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
case 1:
case 0:
if(is_swmr) /* Should fail */
- VERIFY(ok, FALSE, "H5Fopen");
+ VERIFY(fid >= 0, FALSE, "H5Fopen");
else { /* Should succeed */
- VERIFY(ok, TRUE, "H5Fopen");
- VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds");
+ VERIFY(fid >= 0, TRUE, "H5Fopen");
+ VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
diff --git a/test/trefer.c b/test/trefer.c
index b7a1d59..1f85b07 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -503,7 +503,7 @@ test_reference_obj(void)
**
****************************************************************/
static void
-test_reference_region(hbool_t new_format)
+test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
hid_t fid1; /* HDF5 File IDs */
hid_t fapl = -1; /* File access property list */
@@ -549,11 +549,7 @@ test_reference_region(hbool_t new_format)
hsize_t start3, count3, block3;
/* Output message about test being performed */
- if(new_format) {
- MESSAGE(5, ("Testing Dataset Region Reference Functions for new format\n"));
- } else {
- MESSAGE(5, ("Testing Dataset Region Reference Functions for old format\n"));
- }
+ MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
@@ -564,12 +560,12 @@ test_reference_region(hbool_t new_format)
/* Set to use the latest file format */
fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
- if(new_format) {
- ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
- CHECK(ret, FAIL, "H5Pset_libver_bounds");
- }
- /* Create file */
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
@@ -676,19 +672,32 @@ test_reference_region(hbool_t new_format)
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
/* Store third dataset region */
- ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[2], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ H5E_BEGIN_TRY {
+ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ } H5E_END_TRY;
+
+ if(libver_high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Rcreate");
+ else {
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[2], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ }
/* Store fourth dataset region */
- ret = H5Rcreate(&wbuf[3], fid1, "/Dataset3", H5R_DATASET_REGION, sid3);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[3], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ H5E_BEGIN_TRY {
+ ret = H5Rcreate(&wbuf[3], fid1, "/Dataset3", H5R_DATASET_REGION, sid3);
+ } H5E_END_TRY;
+ if(libver_high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Rcreate");
+ else {
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[3], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ }
/* Write selection to disk */
ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
@@ -791,25 +800,27 @@ test_reference_region(hbool_t new_format)
/* Try to open the referenced dataset with dataspace exceeding 32 bits */
- dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[3]);
- CHECK(dset3, FAIL, "H5Rdereference2");
-
- /* Check what H5Rget_obj_type2 function returns */
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[3], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
-
- /* Check information in the referenced dataset */
- sid3 = H5Dget_space(dset3);
- CHECK(sid3, FAIL, "H5Dget_space");
- ret_particles = H5Sget_select_npoints(sid3);
- VERIFY(ret_particles, total_particles, "H5Sget_select_npoints");
-
- /* Close the dataspace and dataset */
- ret = H5Sclose(sid3);
- CHECK(ret, FAIL, "H5Sclose");
- ret = H5Dclose(dset3);
- CHECK(ret, FAIL, "H5Dclose");
+ if(libver_high == H5F_LIBVER_V110) {
+ dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[3]);
+ CHECK(dset3, FAIL, "H5Rdereference2");
+
+ /* Check what H5Rget_obj_type2 function returns */
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[3], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Check information in the referenced dataset */
+ sid3 = H5Dget_space(dset3);
+ CHECK(sid3, FAIL, "H5Dget_space");
+ ret_particles = H5Sget_select_npoints(sid3);
+ VERIFY(ret_particles, total_particles, "H5Sget_select_npoints");
+
+ /* Close the dataspace and dataset */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Dclose(dset3);
+ CHECK(ret, FAIL, "H5Dclose");
+ }
/* Try to open objects */
dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
@@ -906,30 +917,33 @@ test_reference_region(hbool_t new_format)
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
- /* Get the unlimited selection */
- sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
- CHECK(sid2, FAIL, "H5Rget_region");
-
- /* Verify correct hyperslab selected */
- hssize_ret = H5Sget_select_npoints(sid2);
- VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
- tri_ret = H5Sis_regular_hyperslab(sid2);
- CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
- VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
- ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
- CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
- VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
- VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
- VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
- VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
- VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
- VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
- /* Close region space */
- ret = H5Sclose(sid2);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Get the unlimited selection */
+ if(libver_high == H5F_LIBVER_V110) {
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+ tri_ret = H5Sis_regular_hyperslab(sid2);
+ CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
+ VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
+ ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+ VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
+ VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
+ VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
+ VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
+ VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+ }
/* Close first space */
ret = H5Sclose(sid1);
@@ -973,32 +987,33 @@ test_reference_region(hbool_t new_format)
**
****************************************************************/
static void
-test_reference_region_1D(hbool_t new_format)
+test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dset1, /* Dataset ID */
- dset3; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid3; /* Dataspace ID #3 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims3[] = {SPACE3_DIM1};
- hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
- hsize_t * coords; /* Coordinate buffer */
- hsize_t low[SPACE3_RANK]; /* Selection bounds */
- hsize_t high[SPACE3_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Object type */
- int i; /* counting variables */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims3[] = {SPACE3_DIM1};
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
@@ -1009,8 +1024,16 @@ test_reference_region_1D(hbool_t new_format)
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
- /* Create file */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
CHECK(fid1, FAIL, "H5Fcreate");
/* Create dataspace for datasets */
@@ -1106,7 +1129,7 @@ test_reference_region_1D(hbool_t new_format)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the dataset */
@@ -1240,6 +1263,10 @@ test_reference_region_1D(hbool_t new_format)
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
+ /* Close file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
@@ -1817,15 +1844,28 @@ test_reference_compat(void)
void
test_reference(void)
{
+ H5F_libver_t low, high; /* Low and high bounds */
+
/* Output message about test being performed */
MESSAGE(5, ("Testing References\n"));
test_reference_params(); /* Test for correct parameter checking */
test_reference_obj(); /* Test basic H5R object reference code */
- test_reference_region(FALSE); /* Test basic H5R dataset region reference code */
- test_reference_region(TRUE); /* Test basic H5R dataset region reference code */
- test_reference_region_1D(FALSE); /* Test H5R dataset region reference code for 1-D datasets */
- test_reference_region_1D(TRUE); /* Test H5R dataset region reference code for 1-D datasets */
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ test_reference_region(low, high); /* Test basic H5R dataset region reference code */
+ test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
+
+ } /* end high bound */
+ } /* end low bound */
+
test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
test_reference_group(); /* Test operations on dereferenced groups */
#ifndef H5_NO_DEPRECATED_SYMBOLS