mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-03-25 17:00:45 +08:00
Set V112 as the latest format and extend the arrays of version bounds.
This commit is contained in:
parent
aa696a4771
commit
0073f19897
@ -216,6 +216,7 @@ public class HDF5Constants {
|
||||
public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST();
|
||||
public static final int H5F_LIBVER_V18 = H5F_LIBVER_V18();
|
||||
public static final int H5F_LIBVER_V110 = H5F_LIBVER_V110();
|
||||
public static final int H5F_LIBVER_V112 = H5F_LIBVER_V112();
|
||||
public static final int H5F_LIBVER_NBOUNDS = H5F_LIBVER_NBOUNDS();
|
||||
public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST();
|
||||
public static final int H5F_OBJ_ALL = H5F_OBJ_ALL();
|
||||
@ -1049,6 +1050,8 @@ public class HDF5Constants {
|
||||
|
||||
private static native final int H5F_LIBVER_V110();
|
||||
|
||||
private static native final int H5F_LIBVER_V112();
|
||||
|
||||
private static native final int H5F_LIBVER_NBOUNDS();
|
||||
|
||||
private static native final int H5F_LIBVER_LATEST();
|
||||
|
@ -401,6 +401,8 @@ Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V18(JNIEnv *env, jclass cls){return
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V110(JNIEnv *env, jclass cls){return H5F_LIBVER_V110;}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1V112(JNIEnv *env, jclass cls){return H5F_LIBVER_V112;}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1NBOUNDS(JNIEnv *env, jclass cls){return H5F_LIBVER_NBOUNDS;}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;}
|
||||
|
@ -214,7 +214,7 @@ public class TestH5P {
|
||||
|
||||
@Test(expected = HDF5FunctionArgumentException.class)
|
||||
public void testH5Pset_libver_bounds_invalidhigh() throws Throwable {
|
||||
H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1);
|
||||
H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_V112, HDF5Constants.H5F_LIBVER_V112+1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -108,6 +108,7 @@ static herr_t H5A__iterate_common(hid_t loc_id, H5_index_t idx_type,
|
||||
const unsigned H5O_attr_ver_bounds[] = {
|
||||
H5O_ATTR_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_ATTR_VERSION_3, /* H5F_LIBVER_V18 */
|
||||
H5O_ATTR_VERSION_3, /* H5F_LIBVER_V110 */
|
||||
H5O_ATTR_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -50,6 +50,7 @@
|
||||
const unsigned H5O_layout_ver_bounds[] = {
|
||||
H5O_LAYOUT_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_LAYOUT_VERSION_3, /* H5F_LIBVER_V18 */ /* H5O_LAYOUT_VERSION_DEFAULT */
|
||||
H5O_LAYOUT_VERSION_4, /* H5F_LIBVER_V110 */
|
||||
H5O_LAYOUT_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -3327,7 +3327,7 @@ H5F__start_swmr_write(H5F_t *f)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version - should be at least 3")
|
||||
|
||||
/* Check for correct file format version */
|
||||
if((f->shared->low_bound != H5F_LIBVER_V110) || (f->shared->high_bound != H5F_LIBVER_V110))
|
||||
if((f->shared->low_bound < H5F_LIBVER_V110) || (f->shared->high_bound < H5F_LIBVER_V110))
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file format version does not support SWMR - needs to be 1.10 or greater")
|
||||
|
||||
/* Should not be marked for SWMR writing mode already */
|
||||
|
@ -178,11 +178,12 @@ typedef enum H5F_libver_t {
|
||||
H5F_LIBVER_ERROR = -1,
|
||||
H5F_LIBVER_EARLIEST = 0, /* Use the earliest possible format for storing objects */
|
||||
H5F_LIBVER_V18 = 1, /* Use the latest v18 format for storing objects */
|
||||
H5F_LIBVER_V110 = 2, /* Use the latest v10 format for storing objects */
|
||||
H5F_LIBVER_V110 = 2, /* Use the latest v110 format for storing objects */
|
||||
H5F_LIBVER_V112 = 3, /* Use the latest v112 format for storing objects */
|
||||
H5F_LIBVER_NBOUNDS
|
||||
} H5F_libver_t;
|
||||
|
||||
#define H5F_LIBVER_LATEST H5F_LIBVER_V110
|
||||
#define H5F_LIBVER_LATEST H5F_LIBVER_V112
|
||||
|
||||
/* File space handling strategy */
|
||||
typedef enum H5F_fspace_strategy_t {
|
||||
|
@ -76,6 +76,7 @@ H5FL_DEFINE(H5F_super_t);
|
||||
static const unsigned HDF5_superblock_ver_bounds[] = {
|
||||
HDF5_SUPERBLOCK_VERSION_DEF, /* H5F_LIBVER_EARLIEST */
|
||||
HDF5_SUPERBLOCK_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
HDF5_SUPERBLOCK_VERSION_3, /* H5F_LIBVER_V110 */
|
||||
HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -157,6 +157,7 @@ const H5O_msg_class_t H5O_MSG_FILL_NEW[1] = {{
|
||||
const unsigned H5O_fill_ver_bounds[] = {
|
||||
H5O_FILL_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_FILL_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_FILL_VERSION_3, /* H5F_LIBVER_V110 */
|
||||
H5O_FILL_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -130,6 +130,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
|
||||
const unsigned H5O_obj_ver_bounds[] = {
|
||||
H5O_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_VERSION_2, /* H5F_LIBVER_V110 */
|
||||
H5O_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -93,6 +93,7 @@ const H5O_msg_class_t H5O_MSG_PLINE[1] = {{
|
||||
const unsigned H5O_pline_ver_bounds[] = {
|
||||
H5O_PLINE_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_PLINE_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_PLINE_VERSION_2, /* H5F_LIBVER_V110 */
|
||||
H5O_PLINE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -66,6 +66,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
|
||||
const unsigned H5O_sdspace_ver_bounds[] = {
|
||||
H5O_SDSPACE_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V18 */
|
||||
H5O_SDSPACE_VERSION_2, /* H5F_LIBVER_V110 */
|
||||
H5O_SDSPACE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -513,6 +513,7 @@ H5FL_DEFINE(H5T_shared_t);
|
||||
const unsigned H5O_dtype_ver_bounds[] = {
|
||||
H5O_DTYPE_VERSION_1, /* H5F_LIBVER_EARLIEST */
|
||||
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V18 */
|
||||
H5O_DTYPE_VERSION_3, /* H5F_LIBVER_V110 */
|
||||
H5O_DTYPE_VERSION_LATEST /* H5F_LIBVER_LATEST */
|
||||
};
|
||||
|
||||
|
@ -1054,7 +1054,11 @@ H5_trace(const double *returning, const char *func, const char *type, ...)
|
||||
break;
|
||||
|
||||
case H5F_LIBVER_V110:
|
||||
HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V110);
|
||||
HDfprintf(out, "H5F_LIBVER_V110");
|
||||
break;
|
||||
|
||||
case H5F_LIBVER_V112:
|
||||
HDcompile_assert(H5F_LIBVER_LATEST == H5F_LIBVER_V112);
|
||||
HDfprintf(out, "H5F_LIBVER_LATEST");
|
||||
break;
|
||||
|
||||
|
@ -12990,7 +12990,7 @@ test_versionbounds(void)
|
||||
if (vdset > 0) /* dataset created successfully */
|
||||
{
|
||||
/* Virtual dataset is only available starting in V110 */
|
||||
VERIFY(high, H5F_LIBVER_V110, "virtual dataset");
|
||||
VERIFY(high >= H5F_LIBVER_V110, TRUE, "virtual dataset");
|
||||
|
||||
if(H5Dclose(vdset) < 0) TEST_ERROR
|
||||
vdset = -1;
|
||||
|
@ -100,6 +100,17 @@ 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;
|
||||
|
||||
@ -1940,3 +1951,17 @@ error:
|
||||
return NULL;
|
||||
} /* h5_get_dummy_vol_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 */
|
||||
|
@ -148,6 +148,7 @@ H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_co
|
||||
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 H5VL_class_t *h5_get_dummy_vol_class(void);
|
||||
H5TEST_DLL char *h5_get_version_string(H5F_libver_t libver);
|
||||
|
||||
/* Functions that will replace components of a FAPL */
|
||||
H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id);
|
||||
|
51
test/ohdr.c
51
test/ohdr.c
@ -1627,45 +1627,6 @@ error:
|
||||
return FAIL;
|
||||
} /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */
|
||||
|
||||
#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 version_string() */
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
@ -1693,7 +1654,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 */
|
||||
@ -1718,8 +1678,9 @@ main(void)
|
||||
/* Loop through all the combinations of low/high library format bounds */
|
||||
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
|
||||
for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, 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 {
|
||||
@ -1730,13 +1691,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)
|
||||
|
52
test/tfile.c
52
test/tfile.c
@ -5167,7 +5167,7 @@ test_libver_bounds_open(void)
|
||||
/* Get new low bound and verify that it has been upgraded properly */
|
||||
ret = H5Pget_libver_bounds(new_fapl, &new_low, NULL);
|
||||
CHECK(ret, FAIL, "H5Pget_libver_bounds");
|
||||
VERIFY(new_low, H5F_LIBVER_LATEST, "Low bound should be upgraded to H5F_LIBVER_LATEST");
|
||||
VERIFY(new_low >= H5F_LIBVER_V110, TRUE, "Low bound should be upgraded to at least H5F_LIBVER_V110");
|
||||
|
||||
ret = H5Pclose(new_fapl);
|
||||
CHECK(ret, FAIL, "H5Pclose");
|
||||
@ -5445,7 +5445,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 *)H5VL_object(fid);
|
||||
CHECK(f, NULL, "H5VL_object");
|
||||
}
|
||||
@ -5456,34 +5456,35 @@ 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");
|
||||
if(high >= H5F_LIBVER_V110) { /* Should succeed */
|
||||
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");
|
||||
VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "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);
|
||||
case H5F_LIBVER_V112:
|
||||
ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3);
|
||||
VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds");
|
||||
break;
|
||||
|
||||
@ -5495,7 +5496,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");
|
||||
}
|
||||
@ -5587,7 +5588,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 */
|
||||
@ -5626,7 +5626,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 *)H5VL_object(fid);
|
||||
CHECK(f, NULL, "H5VL_object");
|
||||
}
|
||||
@ -5634,26 +5634,24 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr)
|
||||
/* Verify the file open succeeds or fails */
|
||||
switch(super_vers) {
|
||||
case 3:
|
||||
if(high == H5F_LIBVER_LATEST) {
|
||||
if(high >= H5F_LIBVER_V110) {
|
||||
/* Should succeed */
|
||||
VERIFY(ok, TRUE, "H5Fopen");
|
||||
VERIFY(H5F_LIBVER_V110, f->shared->low_bound, "HDF5_superblock_ver_bounds");
|
||||
VERIFY(fid >= 0, TRUE, "H5Fopen");
|
||||
VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "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);
|
||||
@ -5664,10 +5662,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");
|
||||
|
222
test/trefer.c
222
test/trefer.c
@ -492,41 +492,42 @@ test_reference_obj(void)
|
||||
**
|
||||
****************************************************************/
|
||||
static void
|
||||
test_reference_region(void)
|
||||
test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
|
||||
{
|
||||
hid_t fid1; /* HDF5 File IDs */
|
||||
hid_t dset1, /* Dataset ID */
|
||||
dset2; /* Dereferenced dataset ID */
|
||||
hid_t sid1, /* Dataspace ID #1 */
|
||||
sid2; /* Dataspace ID #2 */
|
||||
hid_t dapl_id; /* Dataset access property list */
|
||||
hsize_t dims1[] = {SPACE1_DIM1},
|
||||
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
|
||||
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
|
||||
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
|
||||
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
|
||||
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
|
||||
hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
|
||||
hsize_t * coords; /* Coordinate buffer */
|
||||
hsize_t low[SPACE2_RANK]; /* Selection bounds */
|
||||
hsize_t high[SPACE2_RANK]; /* Selection bounds */
|
||||
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
|
||||
*rbuf; /* buffer read from disk */
|
||||
hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
|
||||
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; /* Type of object */
|
||||
int i, j; /* counting variables */
|
||||
hssize_t hssize_ret; /* hssize_t return value */
|
||||
htri_t tri_ret; /* htri_t return value */
|
||||
herr_t ret; /* Generic return value */
|
||||
haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
|
||||
hid_t dset_NA; /* Dataset id for undefined reference */
|
||||
hid_t space_NA; /* Dataspace id for undefined reference */
|
||||
hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
|
||||
hdset_reg_ref_t wdata_NA[1], /* Write buffer */
|
||||
rdata_NA[1]; /* Read buffer */
|
||||
hid_t fid1; /* HDF5 File IDs */
|
||||
hid_t fapl = -1; /* File access property list */
|
||||
hid_t dset1, /* Dataset ID */
|
||||
dset2; /* Dereferenced dataset ID */
|
||||
hid_t sid1, /* Dataspace ID #1 */
|
||||
sid2; /* Dataspace ID #2 */
|
||||
hid_t dapl_id; /* Dataset access property list */
|
||||
hsize_t dims1[] = {SPACE1_DIM1},
|
||||
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
|
||||
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
|
||||
hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
|
||||
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
|
||||
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
|
||||
hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
|
||||
hsize_t *coords; /* Coordinate buffer */
|
||||
hsize_t low[SPACE2_RANK]; /* Selection bounds */
|
||||
hsize_t high[SPACE2_RANK]; /* Selection bounds */
|
||||
hdset_reg_ref_t *wbuf, /* buffer to write to disk */
|
||||
*rbuf; /* buffer read from disk */
|
||||
hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
|
||||
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; /* Type of object */
|
||||
int i, j; /* counting variables */
|
||||
hssize_t hssize_ret; /* hssize_t return value */
|
||||
htri_t tri_ret; /* htri_t return value */
|
||||
herr_t ret; /* Generic return value */
|
||||
haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
|
||||
hid_t dset_NA; /* Dataset id for undefined reference */
|
||||
hid_t space_NA; /* Dataspace id for undefined reference */
|
||||
hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
|
||||
hdset_reg_ref_t wdata_NA[1], /* Write buffer */
|
||||
rdata_NA[1]; /* Read buffer */
|
||||
|
||||
/* Output message about test being performed */
|
||||
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
|
||||
@ -537,8 +538,16 @@ test_reference_region(void)
|
||||
dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
|
||||
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
|
||||
|
||||
/* Create file */
|
||||
fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
/* Create 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 */
|
||||
@ -627,6 +636,7 @@ test_reference_region(void)
|
||||
/* 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[0], &obj_type);
|
||||
CHECK(ret, FAIL, "H5Rget_obj_type2");
|
||||
VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
|
||||
@ -677,7 +687,7 @@ test_reference_region(void)
|
||||
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");
|
||||
|
||||
/*
|
||||
@ -822,30 +832,32 @@ test_reference_region(void)
|
||||
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");
|
||||
if(libver_high >= H5F_LIBVER_V110) {
|
||||
/* 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");
|
||||
/* 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 region space */
|
||||
ret = H5Sclose(sid2);
|
||||
CHECK(ret, FAIL, "H5Sclose");
|
||||
}
|
||||
|
||||
/* Close first space */
|
||||
ret = H5Sclose(sid1);
|
||||
@ -887,34 +899,39 @@ test_reference_region(void)
|
||||
** test_reference_region_1D(): Test H5R (reference) object reference code.
|
||||
** Tests 1-D references to various kinds of objects
|
||||
**
|
||||
** Note: The libver_low/libver_high parameters are added to create the file
|
||||
** with the low and high bounds setting in fapl.
|
||||
** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
|
||||
**
|
||||
****************************************************************/
|
||||
static void
|
||||
test_reference_region_1D(void)
|
||||
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"));
|
||||
@ -925,8 +942,16 @@ test_reference_region_1D(void)
|
||||
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 */
|
||||
@ -1022,7 +1047,7 @@ test_reference_region_1D(void)
|
||||
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 */
|
||||
@ -1156,6 +1181,10 @@ test_reference_region_1D(void)
|
||||
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");
|
||||
@ -1733,13 +1762,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(); /* Test basic H5R dataset region reference code */
|
||||
test_reference_region_1D(); /* 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user