summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVailin Choi <vchoi@hdfgroup.org>2015-11-13 04:26:56 (GMT)
committerVailin Choi <vchoi@hdfgroup.org>2015-11-13 04:26:56 (GMT)
commit1b58261bc5ea9a2de1f17014f0a3292ad128bd0e (patch)
treec812b96ae6c5e5e53da0c43d1278999401be9bd4
parent41a03ad8ed11cda8eb26d1cdf10b56f7e8d4cfb6 (diff)
downloadhdf5-1b58261bc5ea9a2de1f17014f0a3292ad128bd0e.zip
hdf5-1b58261bc5ea9a2de1f17014f0a3292ad128bd0e.tar.gz
hdf5-1b58261bc5ea9a2de1f17014f0a3292ad128bd0e.tar.bz2
[svn-r28330] Implementation for version 3 superblock and latest version support.
Tested on quail, kite, osx1010test, platypus, ostrich, moohan, emu, jam.
-rw-r--r--MANIFEST8
-rw-r--r--c++/test/tfile.cpp2
-rw-r--r--src/H5AC.c16
-rw-r--r--src/H5Aint.c12
-rw-r--r--src/H5Dint.c51
-rw-r--r--src/H5F.c8
-rw-r--r--src/H5Fint.c42
-rw-r--r--src/H5Fpkg.h4
-rw-r--r--src/H5Fprivate.h22
-rw-r--r--src/H5Fquery.c28
-rw-r--r--src/H5Fsuper.c12
-rw-r--r--src/H5Gobj.c2
-rw-r--r--src/H5HFhdr.c2
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Opkg.h4
-rw-r--r--src/H5Tcommit.c2
-rw-r--r--test/accum.c47
-rw-r--r--test/cork.c26
-rw-r--r--test/dsets.c316
-rw-r--r--test/ohdr.c37
-rw-r--r--test/swmr.c810
-rw-r--r--test/swmr_generator.c8
-rw-r--r--test/swmr_remove_writer.c27
-rw-r--r--test/swmr_writer.c27
-rw-r--r--test/testswmr.sh.in6
-rw-r--r--test/tfile.c2
-rw-r--r--tools/h5format_convert/h5fc_gentest.c102
-rw-r--r--tools/h5format_convert/testfiles/h5fc_edge_v3.h5 (renamed from tools/h5format_convert/testfiles/h5fc_edge.h5)bin2526 -> 2526 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_latest_v3.h5 (renamed from tools/h5format_convert/testfiles/h5fc_new.h5)bin6130 -> 6130 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_non_v3.h5bin0 -> 4336 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_old.h5bin5688 -> 0 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v1.h5 (renamed from tools/h5format_convert/testfiles/h5fc_all.h5)bin7672 -> 8252 bytes
-rw-r--r--tools/h5format_convert/testfiles/h5fc_v_n_all.ddl12
-rw-r--r--tools/h5format_convert/testh5fc.sh.in104
-rw-r--r--tools/misc/clear_open_chk.c2
-rw-r--r--tools/misc/h5clear_gentest.c147
-rw-r--r--tools/misc/testh5clear.sh.in93
37 files changed, 1121 insertions, 862 deletions
diff --git a/MANIFEST b/MANIFEST
index 84cf832..4412b7d 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1278,10 +1278,10 @@
./tools/h5format_convert/testfiles/h5fc_nooption.ddl
./tools/h5format_convert/testfiles/h5fc_v_n_1d.ddl
./tools/h5format_convert/testfiles/h5fc_nonexistfile.ddl
-./tools/h5format_convert/testfiles/h5fc_old.h5
-./tools/h5format_convert/testfiles/h5fc_new.h5
-./tools/h5format_convert/testfiles/h5fc_all.h5
-./tools/h5format_convert/testfiles/h5fc_edge.h5
+./tools/h5format_convert/testfiles/h5fc_non_v3.h5
+./tools/h5format_convert/testfiles/h5fc_latest_v3.h5
+./tools/h5format_convert/testfiles/h5fc_edge_v3.h5
+./tools/h5format_convert/testfiles/h5fc_v1.h5
./tools/h5format_convert/testh5fc.sh.in
# h5repack sources
diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp
index f84ce3a..6871f06 100644
--- a/c++/test/tfile.cpp
+++ b/c++/test/tfile.cpp
@@ -732,7 +732,7 @@ static void test_libver_bounds()
/* Run the tests */
test_libver_bounds_real(H5F_LIBVER_EARLIEST, H5O_VERSION_1, H5F_LIBVER_LATEST, H5O_VERSION_2);
- test_libver_bounds_real(H5F_LIBVER_LATEST, H5O_VERSION_2, H5F_LIBVER_EARLIEST, H5O_VERSION_1);
+ test_libver_bounds_real(H5F_LIBVER_LATEST, H5O_VERSION_2, H5F_LIBVER_EARLIEST, H5O_VERSION_2);
PASSED();
} /* end test_libver_bounds() */
diff --git a/src/H5AC.c b/src/H5AC.c
index a6d229e..5f62325 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -834,14 +834,6 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
- /* FIXME: (temporary)
- * Check to ensure that version 1 B-tree nodes are not being protected
- * under SWMR writes. This will be replaced with a more extensive
- * SWMR-safe metadata check in the future.
- */
- if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) && H5AC_BT_ID == type->id)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "can't insert/write version 1 B-tree nodes under SWMR writes")
-
#if H5AC__TRACE_FILE_ENABLED
/* For the insert, only the addr, size, type id and flags are really
* necessary in the trace file. Write the result to catch occult
@@ -1272,14 +1264,6 @@ H5AC_protect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr,
if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
- /* FIXME: (temporary)
- * Check to ensure that version 1 B-tree nodes are not being protected
- * under SWMR writes. This will be replaced with a more extensive
- * SWMR-safe metadata check in the future.
- */
- if((H5F_INTENT(f) & H5F_ACC_SWMR_WRITE) && H5AC_BT_ID == type->id)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "can't protect/write version 1 B-tree nodes under SWMR writes")
-
#if H5AC__TRACE_FILE_ENABLED
/* For the protect call, only the addr, size, type id, and flags are
* necessary in the trace file. Also indicate whether the call was
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 6cdf9b2..bde64c4 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -207,7 +207,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location")
/* Set the latest format for datatype, if requested */
- if(H5F_USE_LATEST_FORMAT(loc->oloc->file))
+ if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATATYPE))
if(H5T_set_latest_version(attr->shared->dt) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype")
@@ -215,7 +215,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
attr->shared->ds = H5S_copy(space, FALSE, TRUE);
/* Set the latest format for dataspace, if requested */
- if(H5F_USE_LATEST_FORMAT(loc->oloc->file))
+ if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATASPACE))
if(H5S_set_latest_version(attr->shared->ds) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace")
@@ -1863,7 +1863,7 @@ herr_t
H5A_set_version(const H5F_t *f, H5A_t *attr)
{
hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1872,8 +1872,8 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
HDassert(f);
HDassert(attr);
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(f);
+ /* Get the file's 'use the latest attribute version support' flag */
+ use_latest_format = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ATTRIBUTE);
/* Check whether datatype and dataspace are shared */
if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0)
@@ -1888,7 +1888,7 @@ H5A_set_version(const H5F_t *f, H5A_t *attr)
/* Check which version to encode attribute with */
if(use_latest_format)
- attr->shared->version = H5O_ATTR_VERSION_LATEST; /* Write out latest version of format */
+ attr->shared->version = H5O_ATTR_VERSION_LATEST; /* Write out latest attribute version */
else if(attr->shared->encoding != H5T_CSET_ASCII)
attr->shared->version = H5O_ATTR_VERSION_3; /* Write version which includes the character encoding */
else if(type_shared || space_shared)
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 596c99a..ad0484e 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -648,7 +648,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
{
htri_t relocatable; /* Flag whether the type is relocatable */
htri_t immutable; /* Flag whether the type is immutable */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -666,8 +666,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type)
if((immutable = H5T_is_immutable(type)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?")
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(file);
+ /* Get the file's 'use the latest datatype version support' flag */
+ use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE);
/* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */
if(!immutable || relocatable || use_latest_format) {
@@ -759,7 +759,7 @@ done:
static herr_t
H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
{
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
+ hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -769,8 +769,8 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space)
HDassert(dset);
HDassert(space);
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(file);
+ /* Get the file's 'use the latest dataspace version support' flag */
+ use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE);
/* Copy dataspace for dataset */
if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE)))
@@ -914,7 +914,6 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
H5O_loc_t *oloc = NULL; /* Dataset's object location */
H5O_layout_t *layout; /* Dataset's layout information */
H5T_t *type; /* Dataset's datatype */
- hbool_t use_latest_format; /* Flag indicating the newest file format should be used */
H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */
H5D_fill_value_t fill_status; /* Fill value status */
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
@@ -933,9 +932,6 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
type = dset->shared->type;
fill_prop = &dset->shared->dcpl_cache.fill;
- /* Get the file's 'use the latest version of the format' flag */
- use_latest_format = H5F_USE_LATEST_FORMAT(file);
-
/* Retrieve "defined" status of fill value */
if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined")
@@ -1012,8 +1008,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message")
/* If there is valid information for the old fill value struct, add it */
- /* (only if we aren't trying to write the latest version of the file format) */
- if(fill_prop->buf && !use_latest_format) {
+ /* (only if we aren't trying to write the 'latest fill message version support') */
+ if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) {
H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */
/* Shallow copy the fill value property */
@@ -1059,10 +1055,10 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id)
#endif /* H5O_ENABLE_BOGUS */
/* Add a modification time message, if using older format. */
- /* (If using the latest format, the modification time is part of the object
+ /* (If using the latest 'no modification time message' version support, the modification time is part of the object
* header and doesn't use a separate message -QAK)
*/
- if(!use_latest_format)
+ if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG)))
if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message")
@@ -1227,20 +1223,27 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
} /* end if */
/* Set the latest version of the layout, pline & fill messages, if requested */
- if(H5F_USE_LATEST_FORMAT(file)) {
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) {
/* Set the latest version for the I/O pipeline message */
- if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG)) {
+ if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline")
+ }
- /* Set the latest version for the fill value message */
- if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
+ /* Set the latest version for the fill message */
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG)) {
+ /* Set the latest version for the fill value message */
+ if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value")
+ }
/* Set the latest version for the layout message */
- if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
- } /* end if */
- else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG)) {
+ /* Set the latest version for the layout message */
+ if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout")
+ }
+ } else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) {
/* Use latest indexing type for layout message version >= 4 */
if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing")
diff --git a/src/H5F.c b/src/H5F.c
index 264305e..1d03132 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1579,7 +1579,7 @@ done:
* 8) Unlock the file
*
* Pre-conditions:
- * 1) The file is opened with latest library format
+ * 1) The file being opened has v3 superblock
* 2) The file is opened with H5F_ACC_RDWR
* 3) The file is not already marked for SWMR writing
* 4) Current implementaion for opened objects:
@@ -1625,9 +1625,9 @@ H5Fstart_swmr_write(hid_t file_id)
if((H5F_INTENT(file) & H5F_ACC_RDWR) == 0)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "no write intent on file")
- /* Should be using latest library format */
- if(!H5F_use_latest_format(file))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file not opened with latest library format")
+ if(file->shared->sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file superblock version should be at least 3")
+ HDassert(file->shared->latest_flags == H5F_LATEST_ALL_FLAGS);
/* Should not be marked for SWMR writing mode already */
if(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 161b00d..36139e7 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -633,6 +633,11 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size")
if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag")
+
+ /* For latest format or SWMR_WRITE, activate all latest version support */
+ if((f->shared->latest_format) || (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE))
+ f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
+
if(H5P_get(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &(f->shared->use_mdc_logging)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'use mdc logging' flag")
if(H5P_get(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &(f->shared->start_mdc_log_on_access)) < 0)
@@ -641,8 +646,6 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t
/* (Need to revisit this when the 1.10 release is made, and require
* 1.10 or later -QAK)
*/
- if(!H5F_USE_LATEST_FORMAT(f) && (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, NULL, "must use 'latest format' flag with SWMR write access")
if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get metadata cache size")
f->shared->meta_aggr.feature_flag = H5FD_FEAT_AGGREGATE_METADATA;
@@ -1242,9 +1245,13 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
if(set_flag) {
if(H5F_INTENT(file) & H5F_ACC_RDWR) { /* Set and check consistency of status_flags */
- if(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS ||
- file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write/SWMR write (may use <h5clear file> to clear file consistency flags)")
+ /* Skip check of status_flags for file with < superblock version 3 */
+ if(file->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) {
+
+ if(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS ||
+ file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write/SWMR write (may use <h5clear file> to clear file consistency flags)")
+ } /* version 3 superblock */
file->shared->sblock->status_flags |= H5F_SUPER_WRITE_ACCESS;
if(H5F_INTENT(file) & H5F_ACC_SWMR_WRITE)
@@ -1261,14 +1268,23 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id,
if(H5FD_unlock(file->shared->lf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to unlock the file")
}
- } else { /* H5F_ACC_RDONLY */
- if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) { /* Check consistency of status_flags */
- if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS && !(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
- || (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) && file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is not already open for SWMR writing")
- } else if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) ||
- (file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write (may use <h5clear file> to clear file consistency flags)")
+ } else { /* H5F_ACC_RDONLY: check consistency of status_flags */
+ /* Skip check of status_flags for file with < superblock version 3 */
+ if(file->shared->sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3) {
+
+ if(H5F_INTENT(file) & H5F_ACC_SWMR_READ) {
+ if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS &&
+ !(file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
+ ||
+ (!(file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) &&
+ file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is not already open for SWMR writing")
+
+ } else if((file->shared->sblock->status_flags & H5F_SUPER_WRITE_ACCESS) ||
+ (file->shared->sblock->status_flags & H5F_SUPER_SWMR_WRITE_ACCESS))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "file is already open for write (may use <h5clear file> to clear file consistency flags)")
+
+ } /* version 3 superblock */
}
} /* end if set_flag */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 4980c82..f9cd89f 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -59,7 +59,6 @@
#define H5F_SUPER_SWMR_WRITE_ACCESS 0x04
#define H5F_SUPER_ALL_FLAGS (H5F_SUPER_WRITE_ACCESS | H5F_SUPER_FILE_OK | H5F_SUPER_SWMR_WRITE_ACCESS)
-
/* Mask for removing private file access flags */
#define H5F_ACC_PUBLIC_FLAGS 0x007fu
@@ -133,7 +132,7 @@
#define H5F_SUPERBLOCK_VARLEN_SIZE(v, sizeof_addr, sizeof_size) ( \
(v == 0 ? H5F_SUPERBLOCK_VARLEN_SIZE_V0(sizeof_addr, sizeof_size) : 0) \
+ (v == 1 ? H5F_SUPERBLOCK_VARLEN_SIZE_V1(sizeof_addr, sizeof_size) : 0) \
- + (v == 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr) : 0))
+ + (v >= 2 ? H5F_SUPERBLOCK_VARLEN_SIZE_V2(sizeof_addr) : 0))
/* Total size of superblock, depends on superblock version */
#define H5F_SUPERBLOCK_SIZE(s) ( H5F_SUPERBLOCK_FIXED_SIZE \
@@ -304,6 +303,7 @@ struct H5F_file_t {
hsize_t alignment; /* Alignment */
unsigned gc_ref; /* Garbage-collect references? */
hbool_t latest_format; /* Always use the latest format? */
+ unsigned latest_flags; /* The latest version support */
hbool_t store_msg_crt_idx; /* Store creation index for object header messages? */
unsigned ncwfs; /* Num entries on cwfs list */
struct H5HG_heap_t **cwfs; /* Global heap cache */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 63006f7..2249d59 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -307,6 +307,7 @@
#define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size)
#define H5F_GC_REF(F) ((F)->shared->gc_ref)
#define H5F_USE_LATEST_FORMAT(F) ((F)->shared->latest_format)
+#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL))
#define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx)
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL))
#define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared)
@@ -350,6 +351,7 @@
#define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F))
#define H5F_GC_REF(F) (H5F_gc_ref(F))
#define H5F_USE_LATEST_FORMAT(F) (H5F_use_latest_format(F))
+#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL))
#define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F))
#define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL)))
#define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F))
@@ -481,7 +483,8 @@
#define HDF5_SUPERBLOCK_VERSION_DEF 0 /* The default super block format */
#define HDF5_SUPERBLOCK_VERSION_1 1 /* Version with non-default B-tree 'K' value */
#define HDF5_SUPERBLOCK_VERSION_2 2 /* Revised version with superblock extension and checksum */
-#define HDF5_SUPERBLOCK_VERSION_LATEST HDF5_SUPERBLOCK_VERSION_2 /* The maximum super block format */
+#define HDF5_SUPERBLOCK_VERSION_3 3 /* With file locking and consistency flags (at least this version for SWMR support) */
+#define HDF5_SUPERBLOCK_VERSION_LATEST HDF5_SUPERBLOCK_VERSION_3 /* The maximum super block format */
#define HDF5_FREESPACE_VERSION 0 /* of the Free-Space Info */
#define HDF5_OBJECTDIR_VERSION 0 /* of the Object Directory format */
#define HDF5_SHAREDHEADER_VERSION 0 /* of the Shared-Header Info */
@@ -565,6 +568,22 @@
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
+/* Latest format will activate the following latest version support */
+/* "latest_flags" in H5F_file_t */
+#define H5F_LATEST_DATATYPE 0x0001
+#define H5F_LATEST_DATASPACE 0x0002
+#define H5F_LATEST_ATTRIBUTE 0x0004
+#define H5F_LATEST_FILL_MSG 0x0008
+#define H5F_LATEST_PLINE_MSG 0x0010
+#define H5F_LATEST_LAYOUT_MSG 0x0020
+#define H5F_LATEST_NO_MOD_TIME_MSG 0x0040
+#define H5F_LATEST_STYLE_GROUP 0x0080
+#define H5F_LATEST_OBJ_HEADER 0x0100
+#define H5F_LATEST_SUPERBLOCK 0x0200
+#define H5F_LATEST_ALL_FLAGS (H5F_LATEST_DATATYPE | H5F_LATEST_DATASPACE | H5F_LATEST_ATTRIBUTE | H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG | H5F_LATEST_NO_MOD_TIME_MSG | H5F_LATEST_STYLE_GROUP | H5F_LATEST_OBJ_HEADER | H5F_LATEST_SUPERBLOCK)
+
+#define H5F_LATEST_DSET_MSG_FLAGS (H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG)
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -662,6 +681,7 @@ H5_DLL double H5F_rdcc_w0(const H5F_t *f);
H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f);
H5_DLL unsigned H5F_gc_ref(const H5F_t *f);
H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f);
+H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl);
H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f);
H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag);
H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index dee4b48..0baec78 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -831,6 +831,34 @@ H5F_use_latest_format(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_use_latest_flags
+ *
+ * Purpose: Retrieve the 'latest version support' for the file.
+ *
+ * Return: Success: Non-negative, the requested 'version support'
+ *
+ * Failure: (can't happen)
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Mar 5 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+unsigned
+H5F_use_latest_flags(const H5F_t *f, unsigned fl)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+ HDassert(f->shared);
+
+ FUNC_LEAVE_NOAPI(f->shared->latest_flags & (fl))
+} /* end H5F_use_latest_flags() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_get_fc_degree
*
* Purpose: Retrieve the 'file close degree' for the file.
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index d911dff..916ad13 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -317,6 +317,14 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id, hbool_t initial_read)
if(NULL == (sblock = (H5F_super_t *)H5AC_protect(f, dxpl_id, H5AC_SUPERBLOCK, (haddr_t)0, &udata, rw_flags)))
HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "unable to load superblock")
+ if(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
+ if(sblock->super_vers < HDF5_SUPERBLOCK_VERSION_3)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTPROTECT, FAIL, "invalid superblock version for SWMR_WRITE")
+
+ /* Enable all latest version support when file has v3 superblock */
+ if(sblock->super_vers >= HDF5_SUPERBLOCK_VERSION_3)
+ f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS;
+
/* Pin the superblock in the cache */
if(H5AC_pin_protected_entry(sblock) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTPIN, FAIL, "unable to pin superblock")
@@ -758,8 +766,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id)
if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &sblock->btree_k[0]) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes")
- /* Bump superblock version if we are to use the latest version of the format */
- if(f->shared->latest_format)
+ /* Bump superblock version if latest superblock version support is enabled */
+ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK))
super_vers = HDF5_SUPERBLOCK_VERSION_LATEST;
/* Bump superblock version to create superblock extension for SOHM info */
else if(f->shared->sohm_nindexes > 0)
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index f4c6f94..4991967 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -208,7 +208,7 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo,
/* Check for using the latest version of the group format */
/* (add more checks for creating "new format" groups when needed) */
- if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder
+ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_STYLE_GROUP) || linfo->track_corder
|| (pline && pline->nused))
use_latest_format = TRUE;
else
diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c
index ec60322..b46e0e0 100644
--- a/src/H5HFhdr.c
+++ b/src/H5HFhdr.c
@@ -428,7 +428,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam)
HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline")
/* Pay attention to the latest version flag for the file */
- if(H5F_USE_LATEST_FORMAT(hdr->f))
+ if(H5F_USE_LATEST_FLAGS(hdr->f, H5F_LATEST_PLINE_MSG))
/* Set the latest version for the I/O pipeline message */
if(H5O_pline_set_latest_version(&(hdr->pline)) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline")
diff --git a/src/H5O.c b/src/H5O.c
index ef5d02e..7bc2a74 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1257,7 +1257,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc,
/* Initialize file-specific information for object header */
store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
- if(H5F_USE_LATEST_FORMAT(f) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
+ if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
oh->version = H5O_VERSION_LATEST;
else
oh->version = H5O_VERSION_1;
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index db37d9f..178ca88 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -66,7 +66,7 @@
#define H5O_ALIGN_OH(O, X) \
H5O_ALIGN_VERS((O)->version, X)
#define H5O_ALIGN_F(F, X) \
- H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
+ H5O_ALIGN_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
/* Size of checksum (on disk) */
#define H5O_SIZEOF_CHKSUM 4
@@ -138,7 +138,7 @@
#define H5O_SIZEOF_MSGHDR_OH(O) \
H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)
#define H5O_SIZEOF_MSGHDR_F(F, C) \
- H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FORMAT(F) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
+ H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C))
/*
* Size of chunk "header" for each chunk
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 5ff1c73..783d9d8 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -355,7 +355,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id)
loc_init = TRUE;
/* Set the latest format, if requested */
- if(H5F_USE_LATEST_FORMAT(file))
+ if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE))
if(H5T_set_latest_version(type) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype")
diff --git a/test/accum.c b/test/accum.c
index ec4ffd0..5ac2aaa 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -57,7 +57,7 @@ unsigned test_read_after(const H5F_io_info_t *fio_info);
unsigned test_free(const H5F_io_info_t *fio_info);
unsigned test_big(const H5F_io_info_t *fio_info);
unsigned test_random_write(const H5F_io_info_t *fio_info);
-unsigned test_swmr_write_big(void);
+unsigned test_swmr_write_big(hbool_t new);
/* Helper Function Prototypes */
void accum_printf(void);
@@ -133,7 +133,8 @@ main(void)
HDremove(FILENAME);
/* This test uses a different file */
- nerrors += test_swmr_write_big();
+ nerrors += test_swmr_write_big(TRUE);
+ nerrors += test_swmr_write_big(FALSE);
if(nerrors)
goto error;
@@ -1807,7 +1808,7 @@ error:
*-------------------------------------------------------------------------
*/
unsigned
-test_swmr_write_big(void)
+test_swmr_write_big(hbool_t new)
{
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
@@ -1823,7 +1824,11 @@ test_swmr_write_big(void)
char *new_argv[] = {NULL};
char *driver = NULL; /* VFD string (from env variable) */
- TESTING("SWMR write of large metadata");
+ if(new) {
+ TESTING("SWMR write of large metadata: with latest format");
+ } else {
+ TESTING("SWMR write of large metadata: with non-latest-format");
+ }
#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
@@ -1833,27 +1838,31 @@ test_swmr_write_big(void)
#else /* defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID) */
- /* Skip this test if SWMR I/O is not supported for the VFD specified
- * by the environment variable.
- */
- driver = HDgetenv("HDF5_DRIVER");
- if (!H5FD_supports_swmr_test(driver)) {
- SKIPPED();
- HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
- return EXIT_SUCCESS;
- }
+ /* Skip this test if SWMR I/O is not supported for the VFD specified
+ * by the environment variable.
+ */
+ driver = HDgetenv("HDF5_DRIVER");
+ if (!H5FD_supports_swmr_test(driver)) {
+ SKIPPED();
+ HDputs(" Test skipped due to VFD not supporting SWMR I/O.");
+ return EXIT_SUCCESS;
+ }
/* File access property list */
if((fapl = h5_fileaccess()) < 0)
FAIL_STACK_ERROR
- /* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
+ /* Both cases will result in v3 superblock and version 2 object header for SWMR */
+ if(new) { /* latest format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
- /* Create a test file with latest format (ensure version 2 object header for SWMR) */
- if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ } else { /* non-latest-format */
+ if((fid = H5Fcreate(SWMR_FILENAME, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ }
/* Close the file */
if(H5Fclose(fid) < 0)
diff --git a/test/cork.c b/test/cork.c
index 1975e73..6f96b6a 100644
--- a/test/cork.c
+++ b/test/cork.c
@@ -73,7 +73,7 @@ static int test_objs_cork(hbool_t newformat);
static int test_dset_cork(hbool_t newformat);
static int verify_old_dset_cork(void);
static int verify_obj_dset_cork(hbool_t swmr);
-static int verify_dset_cork(hbool_t swmr);
+static int verify_dset_cork(hbool_t swmr, hbool_t new);
static int verify_group_cork(hbool_t swmr);
static int verify_named_cork(hbool_t swmr);
static int verify_multiple_cork(hbool_t swmr);
@@ -682,7 +682,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-verify_dset_cork(hbool_t swmr)
+verify_dset_cork(hbool_t swmr, hbool_t new)
{
/* Variable Declarations */
int verbose = FALSE; /* Verbose file outout */
@@ -700,17 +700,23 @@ verify_dset_cork(hbool_t swmr)
/* Testing Macro */
if(swmr) {
- TESTING("cork status for chunked datasets with different indexing types (SWMR)");
+ if(new) {
+ TESTING("cork status for chunked datasets with different indexing types (SWMR & latest)");
+ } else {
+ TESTING("cork status for chunked datasets with different indexing types (SWMR & non-latest)");
+ }
} else {
- TESTING("cork status for chunked datasets with different indexing types");
+ TESTING("cork status for chunked datasets with different indexing types (non-SWMR)");
}
/* Create fapl */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0 )
TEST_ERROR;
- /* Set to use latest format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
- TEST_ERROR;
+ if(new) {
+ /* Set to use latest format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 )
+ TEST_ERROR;
+ }
/* Create the file */
flags = H5F_ACC_TRUNC;
@@ -2163,8 +2169,10 @@ main(void)
/* Tests with/without SWMR access */
nerrs += verify_obj_dset_cork(TRUE);
nerrs += verify_obj_dset_cork(FALSE);
- nerrs += verify_dset_cork(TRUE);
- nerrs += verify_dset_cork(FALSE);
+ nerrs += verify_obj_dset_cork(TRUE);
+ nerrs += verify_dset_cork(TRUE, TRUE);
+ nerrs += verify_dset_cork(FALSE, TRUE);
+ nerrs += verify_dset_cork(TRUE, FALSE);
nerrs += verify_group_cork(TRUE);
nerrs += verify_group_cork(FALSE);
nerrs += verify_named_cork(TRUE);
diff --git a/test/dsets.c b/test/dsets.c
index 5a90e0d..1048017 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -60,9 +60,9 @@ const char *FILENAME[] = {
"copy_dcpl_newfile",/* 13 */
"partial_chunks", /* 14 */
"layout_extend", /* 15 */
- "swmr_fail", /* 16 */
- "zero_chunk", /* 17 */
- "chunk_single", /* 18 */
+ "zero_chunk", /* 16 */
+ "chunk_single", /* 17 */
+ "swmr_non_latest", /* 18 */
NULL
};
#define FILENAME_BUF_SIZE 1024
@@ -998,7 +998,7 @@ test_layout_extend(hid_t fapl)
TESTING("extendible dataset with various layout");
/* Create a file */
- h5_fixname(FILENAME[12], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[15], fapl, filename, sizeof filename);
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
@@ -8115,9 +8115,8 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
for(swmr = 0; swmr <= 1; swmr++) {
int compress; /* Whether chunks should be compressed */
- /* SWMR is only supported on the latest file format */
- if(swmr && H5F_LIBVER_LATEST != low)
- continue;
+ /* SWMR is now supported with/without latest format: */
+ /* (1) write+latest-format (2) SWMR-write+non-latest-format */
/* Skip this iteration if SWMR I/O is not supported for the VFD specified
* by the environment variable.
@@ -8202,7 +8201,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
/* Chunk index type expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
+ if(low == H5F_LIBVER_LATEST || swmr) {
/* Verify index type */
if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index");
} /* end if */
@@ -8311,7 +8310,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR
/* Chunk index tyepe expected depends on whether we are using the latest version of the format */
- if(low == H5F_LIBVER_LATEST) {
+ if(low == H5F_LIBVER_LATEST || swmr) {
/* Verify index type */
if(idx_type != H5D_CHUNK_IDX_EARRAY) FAIL_PUTS_ERROR("should be using extensible array as index");
} /* end if */
@@ -9550,7 +9549,7 @@ test_single_chunk(hid_t fapl)
TESTING("datasets w/Single Chunk indexing");
- h5_fixname(FILENAME[18], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[17], fapl, filename, sizeof filename);
/* Check if we are using the latest version of the format */
if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR
@@ -10061,10 +10060,12 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_swmr_v1_btree_ci_fail
+ * Function: test_swmr_non_latest
*
- * Purpose: Checks to see if the library will disallow writing to a version
- * 1 B-tree under SWMR semantics.
+ * Purpose: Checks that a file created with either:
+ * (a) SWMR-write + non-latest-format
+ * (b) write + latest format
+ * will generate datset with latest chunk indexing type.
*
* Return: Success: 0
* Failure: -1
@@ -10072,23 +10073,22 @@ error:
*-------------------------------------------------------------------------
*/
static herr_t
-test_swmr_v1_btree_ci_fail(const char *env_h5_driver, hid_t fapl)
+test_swmr_non_latest(const char *env_h5_driver, hid_t fapl)
{
char filename[FILENAME_BUF_SIZE];
- hid_t fid = -1; /* File ID */
- hid_t v1_fapl = -1; /* fapl that will create v1 B-tree symbol tables and indexes */
- hid_t fh_fapl = -1; /* fapl that will create fractal heap symbol tables */
- hid_t dcpl = -1; /* Dataset creation property list ID */
- hid_t sid = -1; /* Dataspace ID */
- hid_t did = -1; /* Dataset ID */
- hsize_t dims[1]; /* Size of dataset */
- hsize_t max_dims[1]; /* Maximum size of dataset */
- hsize_t chunk_dims[1]; /* Chunk dimensions */
- herr_t err = -1; /* Error return value */
- H5D_chunk_index_t idx_type; /* Chunk index type */
- int data = 42; /* Data to be written to the dataset */
-
- TESTING("expected SWMR behavior using v-1 B-trees");
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t dcpl = -1; /* Dataset creation property list ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hsize_t dim[1], dims2[2]; /* Size of dataset */
+ hsize_t max_dim[1], max_dims2[2]; /* Maximum size of dataset */
+ hsize_t chunk_dim[1], chunk_dims2[2]; /* Chunk dimensions */
+ H5D_chunk_index_t idx_type; /* Chunk index type */
+ int data; /* Data to be written to the dataset */
+ H5F_libver_t low; /* File format low bound */
+
+ TESTING("File created with write+latest-format/SWMR-write+non-latest-format: dataset with latest chunk index");
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
@@ -10099,146 +10099,191 @@ test_swmr_v1_btree_ci_fail(const char *env_h5_driver, hid_t fapl)
return 0;
}
- h5_fixname(FILENAME[16], fapl, filename, sizeof filename);
+ /* Check if we are using the latest version of the format */
+ if(H5Pget_libver_bounds(fapl, &low, NULL) < 0)
+ FAIL_STACK_ERROR
- /* Copy the file access property list */
- if((v1_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
- if((fh_fapl = H5Pcopy(fapl)) < 0) FAIL_STACK_ERROR
- if(H5Pset_libver_bounds(fh_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
-
- /* Create the test file, then close and reopen.
- *
- * We'll create the file with the file access property list that
- * uses the latest file format so that the group is indexed with a
- * fractal heap. If we don't do this, there can be issues when
- * opening the file under SWMR since the root group will use a v1
- * B-tree for the symbol table.
- *
- * The close and re-open is so that new datasets are indexed with
- * the old v1 B-tree scheme.
- */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fh_fapl)) < 0) FAIL_STACK_ERROR
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, v1_fapl)) < 0) FAIL_STACK_ERROR
+ h5_fixname(FILENAME[18], fapl, filename, sizeof filename);
- /* Create a dataset that uses v1 B-tree chunk indexing */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR
- chunk_dims[0] = 64;
- if(H5Pset_chunk(dcpl, 1, chunk_dims) < 0) FAIL_STACK_ERROR
- dims[0] = 1;
- max_dims[0] = H5S_UNLIMITED;
- if((sid = H5Screate_simple(1, dims, max_dims)) < 0) FAIL_STACK_ERROR
- if((did = H5Dcreate2(fid, DSET_DEFAULT_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
-
- /* Explicitly check that the dataset is using a v-1 B-tree index */
- if(H5D__layout_idx_type_test(did, &idx_type) < 0) FAIL_STACK_ERROR
- if(idx_type != H5D_CHUNK_IDX_BTREE)
- FAIL_PUTS_ERROR("created dataset not indexed by version 1 B-tree")
-
- /* Close the file */
+ if(low == H5F_LIBVER_LATEST) {
+ /* Create file with write+latest-format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ } else {
+ /* Create file with SWMR-write+non-latest-format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ }
+
+ /* Create a chunked dataset: this will use extensible array chunk indexing */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+
+ chunk_dim[0] = 6;
+ if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
+ FAIL_STACK_ERROR
+
+ dim[0] = 1;
+ max_dim[0] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(1, dim, max_dim)) < 0)
+ FAIL_STACK_ERROR
+
+ if((did = H5Dcreate2(fid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Write to the dataset */
+ data = 100;
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the dataset's indexing type */
+ if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("created dataset not indexed by extensible array")
+
+ /* Closing */
if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
- /* Reopen the file with SWMR write access */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fh_fapl)) < 0) FAIL_STACK_ERROR
+ /* Open the file again */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR
- /*
- * Attempt to write to a dataset that uses v-1 B-tree chunk indexing with SWMR access.
- * (dataset is empty)
- */
- did = -1;
- err = -1;
- H5E_BEGIN_TRY {
- did = H5Dopen2(fid, DSET_DEFAULT_NAME, H5P_DEFAULT);
- if(did >= 0) { /* should fail to write */
- err = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
- }
- } H5E_END_TRY;
+ /* Open the dataset in the file */
+ if((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- /* Fail on successful write */
- if(did >= 0 && err >= 0) {
- H5_FAILED();
- puts(" library allowed writing to a version 1 B-tree indexed dataset under SWMR semantics");
- goto error;
- }
+ /* Verify the dataset's indexing type */
+ if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("created dataset not indexed by extensible array")
+
+ /* Read from the dataset and verify data read is correct */
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ FAIL_STACK_ERROR
+ if(data != 100)
+ FAIL_STACK_ERROR
/* Close the dataset */
- if(did >= 0)
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- /* Close the file */
- if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+ /* Create a group in the file */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ /* Create a chunked dataset in the group: this will use v2 B-tree chunk indexing */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
- /* Reopen the file with write access */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fh_fapl)) < 0) FAIL_STACK_ERROR
+ chunk_dims2[0] = chunk_dims2[1] = 10;
+ if(H5Pset_chunk(dcpl, 2, chunk_dims2) < 0)
+ FAIL_STACK_ERROR
- /* Open the dataset */
- if((did = H5Dopen2(fid, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0)
+ dims2[0] = dims2[1] = 1;
+ max_dims2[0] = max_dims2[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims2)) < 0)
FAIL_STACK_ERROR
- /* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ if((did = H5Dcreate2(gid, DSET_CHUNKED_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
- /* Close the dataset */
+ /* Verify the dataset's indexing type */
+ if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree")
+
+ /* Closing */
if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ /* Open the file again */
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+
+ /* Open the group */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Open the dataset in the group */
+ if((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the dataset's indexing type */
+ if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree")
- /* Close the file */
+ /* Closing */
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
- /* Reopen the file with SWMR write access */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fh_fapl)) < 0) FAIL_STACK_ERROR
+ /* Reopen the file with SWMR-write */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0) FAIL_STACK_ERROR
- /*
- * Attempt to write to a dataset that uses v-1 B-tree chunk indexing with SWMR access.
- * (dataset is non-empty)
- */
- did = -1;
- err = -1;
- H5E_BEGIN_TRY {
- did = H5Dopen2(fid, DSET_DEFAULT_NAME, H5P_DEFAULT);
- if(did >= 0) { /* should fail to write */
- err = H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data);
- }
- } H5E_END_TRY;
+ /* Open the dataset in the file */
+ if((did = H5Dopen2(fid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- /* Fail on successful write */
- if(did >= 0 && err >= 0) {
- H5_FAILED();
- puts(" library allowed writing to a version 1 B-tree indexed dataset under SWMR semantics");
- goto error;
- }
+ /* Verify the dataset's indexing type */
+ if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("created dataset not indexed by extensible array")
/* Close the dataset */
- if(did >= 0)
- if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- /* Close the file */
+ /* Open the group */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Open the dataset in the group */
+ if((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+
+ /* Verify the dataset's indexing type */
+ if(H5D__layout_idx_type_test(did, &idx_type) < 0)
+ FAIL_STACK_ERROR
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("created dataset not indexed by v2 B-tree")
+
+ /* Write to the dataset in the group */
+ data = 99;
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
+ FAIL_STACK_ERROR
+
+ /* Closing */
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
- /* Reopen the file with SWMR read access */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fh_fapl)) < 0)
+ /* Open the file again with SWMR read access */
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY | H5F_ACC_SWMR_READ, fapl)) < 0)
FAIL_STACK_ERROR
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
/* Open the dataset */
- if((did = H5Dopen2(fid, DSET_DEFAULT_NAME, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ if((did = H5Dopen2(gid, DSET_CHUNKED_NAME, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- /* Should read the correct data from the dataset */
+ /* Read from the dataset and verify data read is correct */
data = 0;
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &data) < 0)
- TEST_ERROR
- if(data != 42)
- TEST_ERROR
+ FAIL_STACK_ERROR
+ if(data != 99) FAIL_STACK_ERROR
/* Closing */
if(H5Dclose(did) < 0) FAIL_STACK_ERROR
- if(H5Pclose(v1_fapl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(fh_fapl) < 0) FAIL_STACK_ERROR
- if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR
- if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
PASSED();
@@ -10247,15 +10292,14 @@ test_swmr_v1_btree_ci_fail(const char *env_h5_driver, hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Pclose(v1_fapl);
- H5Pclose(fh_fapl);
H5Pclose(dcpl);
H5Dclose(did);
H5Sclose(sid);
+ H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
return -1;
-} /* end test_swmr_v1_btree_ci_fail() */
+} /* test_swmr_non_latest() */
/*-------------------------------------------------------------------------
@@ -10285,7 +10329,7 @@ test_zero_dim_dset(hid_t fapl)
TESTING("shrinking large chunk");
- h5_fixname(FILENAME[13], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[16], fapl, filename, sizeof filename);
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -11393,9 +11437,6 @@ main(void)
h5_reset();
fapl = h5_fileaccess();
- /* Test that SWMR access fails with version 1 B-tree access */
- nerrors += (test_swmr_v1_btree_ci_fail(envval, fapl) < 0 ? 1 : 0);
-
/* Turn off the chunk cache, so all the chunks are immediately written to disk */
if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
goto error;
@@ -11492,6 +11533,7 @@ main(void)
nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
if(H5Fclose(file) < 0)
goto error;
diff --git a/test/ohdr.c b/test/ohdr.c
index 853b380..67d9116 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -48,6 +48,8 @@ const char *FILENAME[] = {
/* */
#define FILE_OHDR_SWMR "ohdr_swmr.h5"
#define DSET_NAME "COMPACT_DSET"
+#define OBJ_VERSION_LATEST 2
+
/*
* Verify that messages are moved forward into a "continuation message":
* Create an object header with several continuation chunks
@@ -305,7 +307,7 @@ error:
* greater than 512 bytes. For SWMR access, the read should be done all at one time.
*/
static herr_t
-test_ohdr_swmr(void)
+test_ohdr_swmr(hbool_t new)
{
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
@@ -318,24 +320,33 @@ test_ohdr_swmr(void)
unsigned int n = 0, u; /* Locatl index variable */
H5O_info_t obj_info; /* Information for the object */
- TESTING("exercise the coding for the re-read of the object header for SWMR access");
+ if(new) {
+ TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format");
+ } else {
+ TESTING("exercise the coding for the re-read of the object header for SWMR access: non-latest-format");
+ }
/* File access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
FAIL_STACK_ERROR
- /* Set to use latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
+ /* Create the file with/without latest format: ensure version 2 object header for SWMR */
+ if(new) {
+ /* Set to use latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ if((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ } else {
+ if((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+ }
/* Initialize data */
for(u = 0; u < compact_size; u++)
wbuf[u] = n++;
- /* Create the file with the latest format (ensure version 2 object header for SWMR) */
- if((fid = H5Fcreate(FILE_OHDR_SWMR, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- TEST_ERROR
-
/* Create a small data space for compact dataset */
dims[0] = (hsize_t)compact_size;
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
@@ -365,7 +376,7 @@ test_ohdr_swmr(void)
if(H5Fclose(fid) < 0)
FAIL_STACK_ERROR
- /* Open the file for SWMR write and latest format */
+ /* Open the file for SWMR write with/without latest format */
if((fid = H5Fopen(FILE_OHDR_SWMR, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
FAIL_STACK_ERROR
@@ -377,6 +388,9 @@ test_ohdr_swmr(void)
if(H5Oget_info(did, &obj_info) < 0)
FAIL_STACK_ERROR
+ if(obj_info.hdr.version != OBJ_VERSION_LATEST)
+ FAIL_STACK_ERROR
+
/* The size of object header should be greater than the speculative read size of 512 */
/* This will exercise the coding for the re-read of the object header for SWMR access */
if(obj_info.hdr.space.total < 512)
@@ -975,7 +989,8 @@ main(void)
if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR
/* A test to exercise the re-read of the object header for SWMR access */
- if(test_ohdr_swmr() < 0) TEST_ERROR
+ if(test_ohdr_swmr(TRUE) < 0) TEST_ERROR
+ if(test_ohdr_swmr(FALSE) < 0) TEST_ERROR
puts("All object header tests passed.");
h5_cleanup(FILENAME, fapl);
diff --git a/test/swmr.c b/test/swmr.c
index b079c98..38f4afb 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -43,6 +43,10 @@
#define H5FD_TESTING
#include "H5FDpkg.h" /* File drivers */
+#define H5D_FRIEND /*suppress error about including H5Dpkg */
+#define H5D_TESTING
+#include "H5Dpkg.h"
+
const char *FILENAME[] = {
"swmr0", /* 0 */
@@ -61,9 +65,9 @@ static int test_metadata_read_attempts(hid_t in_fapl);
static int test_metadata_read_retry_info(hid_t in_fapl);
/* Tests for H5Fstart_swmr_write() */
-static int test_start_swmr_write(hid_t in_fapl);
-static int test_err_start_swmr_write(hid_t in_fapl);
-static int test_start_swmr_write_concur(hid_t in_fapl);
+static int test_start_swmr_write(hid_t in_fapl, hbool_t new);
+static int test_err_start_swmr_write(hid_t in_fapl, hbool_t new);
+static int test_start_swmr_write_concur(hid_t in_fapl, hbool_t new);
/* Tests for H5Pget/set_object_flush_cb() */
static herr_t flush_cb(hid_t obj_id, void *_udata);
@@ -1505,35 +1509,65 @@ error:
* test_start_swmr_write():
*
* Verify SWMR writing is enabled via H5Fstart_swmr_write():
- * Case A) when creating a file
- * Case B) when opening a file
+ * Mainly test for file created with SWMR_WRITE + with/without latest format:
+ * --file will have v3 superblock and all latest version support enabled
+ *
+ * (a) Creating a file
+ * Create a file with SWMR_WRITE + non-latest-format
+ * Create a chunked dataset "dataset1" in the file -- should be using latest chunk indexing
+ * Should fail to enable SWMR as the file is already in SWMR writing mode
+ * Close the file
+ *
+ * (a) Opening a file
+ * Open the file with write + non-latest-format
+ * --file has v3 superblock and all latest version support enabled
+ * Open dataset "dataset1"--keep it open
+ * Create a chunked dataset "dataset2" in the file -- should be using latest chunk indexing -- keep it open
+ * Should succeed in enabling SWMR
+ * Should succeed in writing/reading from "dataset1"
+ * Close "dataset1" and "dataset2"
+ * Create "dataset3" -- should be using latest chunk indexing
+ * Close "dataset3"
+ * Close the file
+ *
*/
static int
-test_start_swmr_write(hid_t in_fapl)
+test_start_swmr_write(hid_t in_fapl, hbool_t new)
{
- hid_t fid = -1; /* File ID */
- hid_t fapl = -1; /* A copy of file access property */
- hid_t gid = -1; /* Group ID */
- hid_t file_fapl = -1; /* File access property for the file */
- hid_t did1 = -1, did2 = -1; /* Dataset IDs */
- hid_t sid1 = -1, sid2; /* Dataspace IDs */
- hsize_t dim[1] = {10}; /* Dimension sizes */
- hsize_t dims[2] = {5, 10}; /* Dimension sizes */
- int buf[50], rbuf[50]; /* Data buffer */
- int wdata[10], rdata[10]; /* Data buffer */
- int i; /* Local index variable */
- unsigned attempts; /* The retrieved # of read attempts */
- char filename[NAME_BUF_SIZE]; /* File name */
-
- TESTING("H5Fstart_swmr_write() when creating/opening a file");
-
- /* Get a copy of the parameter fapl */
+ hid_t fid = -1; /* File ID */
+ hid_t fapl = -1; /* File access property */
+ hid_t gid = -1; /* Group ID */
+ hid_t dcpl = -1; /* Dataset creation property */
+ hid_t file_fapl = -1; /* File access property for the file */
+ hid_t did1 = -1, did2 = -1, did3 = -1; /* Dataset IDs */
+ hid_t sid1 = -1, sid2 = -1, sid3 = -1; /* Dataspace IDs */
+ hsize_t dim[1] = {1}; /* Dimension sizes */
+ hsize_t max_dim[1] = {H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim[1] = {2}; /* Chunk dimension sizes */
+ hsize_t dim2[2] = {5, 10}; /* Dimension sizes */
+ hsize_t max_dim2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */
+ hsize_t chunk_dim2[2] = {2, 7}; /* Chunk dimension sizes */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ int wdata = 99; /* Data to write */
+ int rdata; /* Data read */
+ unsigned attempts; /* The retrieved # of read attempts */
+ char filename[NAME_BUF_SIZE]; /* File name */
+ herr_t ret; /* Return value */
+
+
+ /* Get a copy of the parameter fapl (non-latest-format) */
if((fapl = H5Pcopy(in_fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if(new) {
+ TESTING("H5Fstart_swmr_write() when creating/opening a file with latest format");
+
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
+ } else {
+ TESTING("H5Fstart_swmr_write() when creating/opening a file without latest format");
+ }
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
@@ -1542,185 +1576,218 @@ test_start_swmr_write(hid_t in_fapl)
* Case A: when creating a file
*/
- /* Create the file to work on */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR
+ /* Create the file with SWMR write + non-latest-format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts from the file's fapl */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
- /* Should be 1 */
- if(attempts != H5F_METADATA_READ_ATTEMPTS)
- TEST_ERROR;
+ /* Should be 100 */
+ if(attempts != (new ? H5F_METADATA_READ_ATTEMPTS : H5F_SWMR_METADATA_READ_ATTEMPTS))
+ TEST_ERROR;
/* Close the property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR
- /* Create a dataset */
- if((sid1 = H5Screate_simple(2, dims, NULL)) < 0)
- FAIL_STACK_ERROR;
- if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ /* Create "dataset1" */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 1, chunk_dim) < 0)
+ FAIL_STACK_ERROR
+ if((sid1 = H5Screate_simple(1, dim, max_dim)) < 0)
+ FAIL_STACK_ERROR;
+ if((did1 = H5Dcreate2(fid, "dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
- /* Initialize data buffer */
- for(i = 0; i < 50; i++)
- buf[i] = i;
+ /* Get the chunk index type */
+ if(H5D__layout_idx_type_test(did1, &idx_type) < 0)
+ FAIL_STACK_ERROR;
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using extensible array as index");
/* Write to the dataset */
- if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- FAIL_STACK_ERROR;
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ FAIL_STACK_ERROR;
- /* Enable SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR;
+ /* Should fail to enable SWMR for non-latest-format */
+ /* Should succeed in enabling SWMR for latest format */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(new) {
+ if(ret < 0) TEST_ERROR
+ } else if(ret >= 0)
+ TEST_ERROR
/* Read from the dataset */
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
+ if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ FAIL_STACK_ERROR;
/* Verify the data is correct */
- if(HDmemcmp(buf, rbuf, sizeof(rbuf)))
- TEST_ERROR
+ if(wdata != rdata)
+ TEST_ERROR
- /* Close the dataset */
+ /* Close "dataset1", dataspace, dataset creation property list */
if(H5Dclose(did1) < 0)
- FAIL_STACK_ERROR;
-
- /* Close the dataspace */
+ FAIL_STACK_ERROR;
if(H5Sclose(sid1) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR;
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Should be 100 */
if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
- TEST_ERROR;
+ TEST_ERROR;
/* Close the file access property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
+
+ /*
+ * Case B: when opening a file
+ */
- /* Open the file again */
+ /* Open the file again with write + non-latest-format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Should be 1 */
if(attempts != H5F_METADATA_READ_ATTEMPTS)
- TEST_ERROR;
+ TEST_ERROR;
/* Close the property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
- /* Open the first dataset */
+ /* open "dataset1", keep it open */
if((did1 = H5Dopen2(fid, "dataset1", H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
-
- /* Create a group */
- if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR;
- /* Create dataspace */
- if((sid2 = H5Screate_simple(1, dim, NULL)) < 0)
- FAIL_STACK_ERROR;
+ /* Write to "dataset1" */
+ wdata = 88;
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0)
+ FAIL_STACK_ERROR;
- /* Create a second dataset */
- if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- TEST_ERROR
+ /* Create a group */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
- /* Initialize data buffer to all 1s */
- HDmemset(wdata, 1, sizeof(wdata));
+ /* Create "dataset2" in the group, keep it open */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
+ FAIL_STACK_ERROR
+ if((sid2 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ FAIL_STACK_ERROR;
+ if((did2 = H5Dcreate2(gid, "dataset2", H5T_NATIVE_INT, sid2, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
- /* Write to the second dataset */
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata) < 0)
- FAIL_STACK_ERROR;
+ /* Get the chunk index type for "dataset2" */
+ if(H5D__layout_idx_type_test(did2, &idx_type) < 0)
+ FAIL_STACK_ERROR;
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree chunk indexing");
- /* Enable SWMR writing */
+ /* Should succeed in enabling SWMR writing */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR;
-
- /* Read from the second dataset */
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0)
- FAIL_STACK_ERROR;
-
- /* Verify the data is correct */
- if(HDmemcmp(wdata, rdata, sizeof(rdata)))
- TEST_ERROR
-
- /* Close the second dataset */
- if(H5Dclose(did2) < 0)
- FAIL_STACK_ERROR;
-
- /* Close the dataspace */
- if(H5Sclose(sid2) < 0)
- FAIL_STACK_ERROR;
-
- /* Close the group */
- if(H5Gclose(gid) < 0)
- FAIL_STACK_ERROR;
-
- /* Clear the data buffer */
- HDmemset(rbuf, 1, sizeof(rbuf));
-
- /* Read from the first dataset */
- if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
- FAIL_STACK_ERROR;
-
- /* Verify the data is correct */
- if(HDmemcmp(buf, rbuf, sizeof(rbuf)))
- TEST_ERROR
-
- /* Close the first dataset */
- if(H5Dclose(did1) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Get the file's access_property list */
if((file_fapl = H5Fget_access_plist(fid)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Retrieve the # of read attempts */
if(H5Pget_metadata_read_attempts(file_fapl, &attempts) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Should be 100 */
if(attempts != H5F_SWMR_METADATA_READ_ATTEMPTS)
- TEST_ERROR;
+ TEST_ERROR;
- /* Close the file's file access property list */
+ /* Close the property list */
if(H5Pclose(file_fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
+
+ /* Read from "dataset1" */
+ if(H5Dread(did1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0)
+ FAIL_STACK_ERROR;
+ if(wdata != rdata)
+ FAIL_STACK_ERROR;
+
+ /* Close "dataset1" */
+ if(H5Dclose(did1) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Close "dataset2", dataspace, dataset creation property list */
+ if(H5Dclose(did2) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Sclose(sid2) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Create "dataset3" */
+ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Pset_chunk(dcpl, 2, chunk_dim2) < 0)
+ FAIL_STACK_ERROR
+ if((sid3 = H5Screate_simple(2, dim2, max_dim2)) < 0)
+ FAIL_STACK_ERROR;
+ if((did3 = H5Dcreate2(fid, "dataset3", H5T_NATIVE_INT, sid3, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Get the chunk index type for "dataset3" */
+ if(H5D__layout_idx_type_test(did3, &idx_type) < 0)
+ FAIL_STACK_ERROR;
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using v2 B-tree as index");
+
+ /* Close "dataset3", dataspace, dataset creation property list */
+ if(H5Dclose(did3) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Sclose(sid3) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Pclose(dcpl) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ FAIL_STACK_ERROR;
/* Close the file access property list */
if(H5Pclose(fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
PASSED();
@@ -1731,10 +1798,14 @@ error:
H5Fclose(fid);
H5Pclose(fapl);
H5Pclose(file_fapl);
+ H5Gclose(gid);
+ H5Pclose(dcpl);
H5Dclose(did1);
H5Dclose(did2);
+ H5Dclose(did3);
H5Sclose(sid1);
H5Sclose(sid2);
+ H5Sclose(sid3);
} H5E_END_TRY;
return -1;
@@ -1745,32 +1816,61 @@ error:
*
* Verify failure conditions in enabling SWMR writing mode via H5Fstart_swmr_write():
* (A) When creating a file:
- * (1) the file is created with SWMR write access
- * (2) the file is not created with the latest format
- * (3) there are opened named datatype in the file
- * (B) When opening a file with the latest format:
- * (1) the file is already opened with SWMR write access
- * (2) the file is opened with read access only
- * (3) the file is opened with SWMR read access only
- * (4) there are opened named datatype/attribute in the file
- * (C) When opening a file without the latest format:
- * (1) the file is not opened with the latest format
- * (2) the file is opened with read access only
- * (3) the file is opened with SWMR read access only
- * (D) When there are multiple opens for the file:
- * (1) create a file, enable SWMR writing mode twice (fail second time)
- * (2) create a file and enable SWMR writing mode
- * reopen the same file and enable SWMR writing mode (fail)
- * (3) create a file, open the same file
- * enable SWMR writing for the file created
- * enable SWMR writing for the file opened (fail)
+ * (1) Create a file with SWMR write + with/without latest format
+ * --fail to enable SWMR because the file is already in SWMR writing mode
+ * If (latest-format):
+ * (2a) Create a file with write + latest format and with opened named datatype
+ * --fail to enable SWMR because there are opened datatype
+ * If !(latest-format):
+ * (2b) Create a file with write + non-latest-format
+ * --fail to enable SWMR because superblock version is not at least 3
+ *
+ * (B) When opening a file which is created with write + latest format:
+ * (1) Open the file with SWMR write + with/without latest format
+ * --fail to enable SWMR because the file is already in SWMR writing mode
+ * (2) Open the file with read only + with/without latest format
+ * --fail to enable SWMR because the file is not opened with write
+ * (3) Open the file with SWMR read only + with/without latest format
+ * --fail to enable SWMR because the file is not opened with write
+ * (4) Open the file with write + with/without latest format and with opened named datatype/attribute
+ * --fail to enable SWMR because there are opened datatype/attribute
+ *
+ * (C) When doing multiple opens for a file:
+ * Create a file with (a) write + latest format or (b) SMWR write + non-latest-format
+ * Close the file
+ * (1) --Open the file with write + with/without latest format
+ * --Enable SWMR writing mode twice
+ * --First time succeed, second time fail
+ * --Close the file
+ (2) --Open the file with write + with/without latest format
+ * --succeed to enable SWMR writing mode
+ * --reopen the same file
+ * --fail to enable SWMR writing mode for the reopened file
+ * --Close the file
+ (3) --Open the file with write + with/without latest format
+ * --open the same file again
+ * --succeed to enable SWMR for the first opened file
+ * --fail to enable SWMR for the second opened file
+ * --Close the file
+ *
+ * (E) (!new): When opening a file which is created with write + non-latest-format:
+ * (1) Open the file with SWMR write+latest format
+ * --fail to open due to superblock version not 3
+ * (2) Open the file with SWMR write+non-latest-format
+ * --fail to open due to superblock version not 3
+
+ * (3) Open the file with write+latest format
+ * --fail to enable SWMR due to superblock version not 3
+ * (4) Open the file with write+non-latest-format
+ * --fail to enable SWMR due to superblock version not 3
*/
static int
-test_err_start_swmr_write(hid_t in_fapl)
+test_err_start_swmr_write(hid_t in_fapl, hbool_t new)
{
hid_t fid = -1; /* File ID */
hid_t fid2 = -1; /* File ID */
hid_t fapl = -1; /* A copy of file access property */
+ hid_t new_fapl = -1; /* A copy of file access property */
hid_t gid = -1; /* Group ID */
hid_t did = -1; /* Dataset ID */
hid_t sid = -1; /* Dataspace ID */
@@ -1781,16 +1881,26 @@ test_err_start_swmr_write(hid_t in_fapl)
/* Create a copy of the input parameter in_fapl */
if((fapl = H5Pcopy(in_fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
+ if((new_fapl = H5Pcopy(in_fapl)) < 0)
+ FAIL_STACK_ERROR
/* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ FAIL_STACK_ERROR
+
+ if(new) {
+ TESTING("H5Fstart_swmr_write() on failure conditions for latest format");
+
+ if((fapl = H5Pcopy(new_fapl)) < 0)
FAIL_STACK_ERROR
+ } else {
+ TESTING("H5Fstart_swmr_write() on failure conditions for without latest format");
+ }
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- TESTING("H5Fstart_swmr_write() on failure conditions");
/*
* (A) When creating a file:
@@ -1798,342 +1908,356 @@ test_err_start_swmr_write(hid_t in_fapl)
/* Case 1 */
- /* Cannot enable SWMR writing when the file is already in SWMR writing mode */
+ /* Create the file with SWMR_WRITE + with/without latest format */
fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl);
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
-
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
-
- /* Case 2 */
- /* Cannot enable SWMR writing mode without latest format */
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, in_fapl);
+ /* Should fail to enable SWMR writing when the file is already in SWMR writing mode */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
- /* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
-
- /* Should fail to create the file with SWMR write access when not using latest format */
- H5E_BEGIN_TRY {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, in_fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
+ FAIL_STACK_ERROR;
+ /* Case 2 */
- /* Case 3 */
+ if(new) {
- /* Create a file with the latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create the file with write + latest format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
FAIL_STACK_ERROR
- /* Create and commit a named datatype */
- if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
+ /* Create and commit a named datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
FAIL_STACK_ERROR;
- if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- /* Cannot enable SWMR writing mode when there is an opened named datatype */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
+ /* Should fail to enable SWMR writing when there is an opened named datatype */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
TEST_ERROR
- /* Close the datatype */
- if(H5Tclose(tid) < 0)
+ /* Close the datatype */
+ if(H5Tclose(tid) < 0)
FAIL_STACK_ERROR;
- /* Should succeed in enabling SWMR writing */
- if(H5Fstart_swmr_write(fid) < 0)
+ /* Should succeed in enabling SWMR writing */
+ if(H5Fstart_swmr_write(fid) < 0)
TEST_ERROR;
- /* Close the file */
- if(H5Fclose(fid) < 0)
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
+
+ } else {
+
+ /* Create a file with write + non-latest-format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
+
+ if(H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
+ }
/*
- * (B) When opening a file with latest format:
+ * (B) When opening a file which is created with the latest format
*/
- /* Create and close a file with latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
+ /* Create a file with write + latest format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, new_fapl)) < 0)
+ FAIL_STACK_ERROR;
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 1 */
- /* Open the file with SWMR write access */
+ /* Open the file with SWMR write + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
- /* Cannot enable SWMR writing when already in SWMR writing mode */
+ /* Should fail to enable SWMR writing when the file is already in SWMR writing mode */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 2 */
- /* Open the file with read only access */
+ /* Open the file with read only access + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is opened with read only access */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 3 */
- /* Open the file file with SWMR read access */
+ /* Open the file file with SWMR read access + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when the file is opened with SWMR read access only */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 4 */
- /* Open the file with latest format */
+ /* Open the file with write + with/without latest format */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create and commit a named datatype */
if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Tcommit2(fid, "TID", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Create dataspace */
if((sid = H5Screate(H5S_SCALAR)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Attach an attribute to the named datatype */
if((aid = H5Acreate2(tid, "attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing when there are opened named datatype and attribute */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the datatype */
if(H5Tclose(tid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Still fail to enable SWMR writing when the attribute is still opened */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the attribute */
if(H5Aclose(aid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR;
+ TEST_ERROR;
/* Close the dataspace */
if(H5Sclose(sid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/*
- * (C) Opening a file without latest format:
+ * (C) Failure cases for multiple opens
*/
/* Case 1 */
- /* Open the file without latest format */
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, in_fapl)) < 0)
- FAIL_STACK_ERROR;
-
- /* Should fail to enable SWMR writing mode */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
+ /* Create a file with write + with/without latest format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC | (new ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR;
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
-
- /* Should fail to open the file with SWMR write access when not using latest format */
- H5E_BEGIN_TRY {
- fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, in_fapl);
- } H5E_END_TRY;
- if(fid >= 0)
- TEST_ERROR
-
- /* Case 2 */
-
- /* Open the file with read only */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, in_fapl)) < 0)
- FAIL_STACK_ERROR;
-
- /* Should fail to enable SWMR writing when the file is opened with read only */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
-
- /* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
-
- /* Case 3 */
-
- /* Open the file with SWMR read only */
- if((fid = H5Fopen(filename, H5F_ACC_SWMR_READ, in_fapl)) < 0)
- FAIL_STACK_ERROR;
-
- /* Should fail to enable SWMR writing mode when the file is opened with SWMR read only */
- H5E_BEGIN_TRY {
- ret = H5Fstart_swmr_write(fid);
- } H5E_END_TRY;
- if(ret >= 0)
- TEST_ERROR
-
- /* Close the file */
- if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
-
- /*
- * (D) Failure cases for multiple opens
- */
-
- /* Case 1 */
-
- /* Create a file with latest format */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
+
+ /* Open the file with write + with/without latest format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing mode */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR
+ TEST_ERROR
- /* Should fail for a second call to start SWMR writing mode */
+ /* Should fail for a second call to enable SWMR writing mode */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 2 */
- /* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
+ /* Open the file with write + with/without latest format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR;
/* Should succeed in enabling SWMR writing mode */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR
+ TEST_ERROR
/* Re-open the same file */
if((fid2 = H5Freopen(fid)) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Should fail to enable SWMR writing mode for fid2 */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid2);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the files */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid2) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
/* Case 3 */
- /* Create a file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- FAIL_STACK_ERROR;
+ /* Open the file with write + with/without latest format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR;
/* Open the same file */
if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
FAIL_STACK_ERROR;
- /* Should succeed in enabling SWMR writing mode for fid */
+ /* Should succeed in enabling SWMR writing for fid */
if(H5Fstart_swmr_write(fid) < 0)
- TEST_ERROR
+ TEST_ERROR
- /* Should fail to enable SWMR writing mode for fid2 */
+ /* Should fail to enable SWMR writing for fid2 */
H5E_BEGIN_TRY {
ret = H5Fstart_swmr_write(fid2);
} H5E_END_TRY;
if(ret >= 0)
- TEST_ERROR
+ TEST_ERROR
/* Close the files */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
if(H5Fclose(fid2) < 0)
+ FAIL_STACK_ERROR;
+
+ if(!new) {
+
+ /*
+ * (D) When opening a file which is created without the latest format:
+ */
+
+ /* Create a file with write + without latest format */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR;
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Case 1 */
+
+ /* Should fail to open the file with SWMR write + latest format due to superblock version not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, new_fapl);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
+
+ /* Case 2 */
+
+ /* Should fail to open the file with SWMR write + non-latest-format due to superblock version not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
+
+ /* Case 3 */
+
+ /* Open the file with write + latest format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, new_fapl)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Should fail to enable SWMR writing due to superblock version not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
+
+ if(H5Fclose(fid) < 0)
+ FAIL_STACK_ERROR;
+
+
+ /* Case 4 */
+
+ /* Open the file with write + non-latest-format */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* Should fail to enable SWMR writing because the file's superblock version is not at least 3 */
+ H5E_BEGIN_TRY {
+ ret = H5Fstart_swmr_write(fid);
+ } H5E_END_TRY;
+ if(ret >= 0)
+ TEST_ERROR
+
+ if(H5Fclose(fid) < 0)
FAIL_STACK_ERROR;
+ } /* not new */
+
/* Close the file access property list */
if(H5Pclose(fapl) < 0)
- FAIL_STACK_ERROR;
+ FAIL_STACK_ERROR;
+ if(H5Pclose(new_fapl) < 0)
+ FAIL_STACK_ERROR;
PASSED();
return 0;
error:
H5E_BEGIN_TRY {
- H5Sclose(sid);
- H5Gclose(gid);
- H5Dclose(did);
- H5Fclose(fid);
- H5Pclose(fapl);
+ H5Sclose(sid);
+ H5Gclose(gid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ H5Fclose(fid2);
+ H5Pclose(fapl);
+ H5Pclose(new_fapl);
} H5E_END_TRY;
return -1;
@@ -2142,6 +2266,13 @@ error:
/*
* test_start_swmr_write_concur():
*
+ * The "new" parameter indicates whether to create the file with latest format or not.
+ * To have SWMR support, can use either one of the following in creating a file:
+ * (a) Create the file with write + latest format:
+ * --result in v3 superblock with latest chunk indexing types
+ * (b) Create the file with SWMR write + non-latest-format:
+ * --result in v3 superblock with latest chunk indexing types
+ *
* Verify concurrent access for H5Fstart_swmr_write()--
* (1) Parent: open a file with write access
* Child: concurrent open of the file with read & SWMR read (fail)
@@ -2155,7 +2286,7 @@ error:
* Child: concurrent open of the file with write and SWMR write access (fail)
*/
static int
-test_start_swmr_write_concur(hid_t in_fapl)
+test_start_swmr_write_concur(hid_t in_fapl, hbool_t new)
{
hid_t fid; /* File ID */
hid_t fapl; /* File access property list */
@@ -2167,7 +2298,11 @@ test_start_swmr_write_concur(hid_t in_fapl)
char filename[NAME_BUF_SIZE]; /* File name */
/* Output message about test being performed */
- TESTING("Testing H5Fstart_swmr_write()--concurrent access");
+ if(new) {
+ TESTING("Testing H5Fstart_swmr_write()--concurrent access for latest format");
+ } else {
+ TESTING("Testing H5Fstart_swmr_write()--concurrent access for non-latest-format");
+ }
#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
@@ -2179,20 +2314,26 @@ test_start_swmr_write_concur(hid_t in_fapl)
if((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
- /* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- FAIL_STACK_ERROR
-
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
- /* Create the test file */
- if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if(new) {
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
FAIL_STACK_ERROR
+ /* Create the test file */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ } else {
+ /* Create the test file without latest format but with SWMR write */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, fapl)) < 0)
+ FAIL_STACK_ERROR
+ }
+
/* Close the file */
if(H5Fclose(fid) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Remove the message file to be sure */
HDremove(DONE_MESSAGE);
@@ -5242,9 +5383,17 @@ main(void)
nerrors += test_metadata_read_retry_info(fapl);
/* Tests on H5Fstart_swmr_write() */
- nerrors += test_start_swmr_write(fapl);
- nerrors += test_err_start_swmr_write(fapl);
- nerrors += test_start_swmr_write_concur(fapl);
+ /*
+ * Modify the following routines to test for files:
+ * H5Fcreate(write, latest format) or H5Fcreate(SWMR write, non-latest-format)
+ * --both result in v3 superblock and latest version suppport
+ */
+ nerrors += test_start_swmr_write(fapl, TRUE);
+ nerrors += test_start_swmr_write(fapl, FALSE);
+ nerrors += test_err_start_swmr_write(fapl, TRUE);
+ nerrors += test_err_start_swmr_write(fapl, FALSE);
+ nerrors += test_start_swmr_write_concur(fapl, TRUE);
+ nerrors += test_start_swmr_write_concur(fapl, FALSE);
/* Tests for H5Pget/set_object_flush_cb() */
nerrors += test_object_flush_cb(fapl);
@@ -5258,13 +5407,20 @@ main(void)
/*
* Tests for:
* file open flags--single process access
- * file open flags+SWMR flags--single process access
* file open flags--concurrent access
- * file open flags+SWMR flags--concurrent access
*/
nerrors += test_file_lock_same(fapl);
- nerrors += test_file_lock_swmr_same(fapl);
nerrors += test_file_lock_concur(fapl);
+ /*
+ * Tests for:
+ * file open flags+SWMR flags--single process access
+ * file open flags+SWMR flags--concurrent access
+ *
+ * Modify the following 2 routines to test for files:
+ * H5Fcreate(write, latest format) or H5Fcreate(SWMR write, non-latest-format)
+ * --both result in v3 superblock and latest version suppport
+ */
+ nerrors += test_file_lock_swmr_same(fapl);
nerrors += test_file_lock_swmr_concur(fapl);
/* Tests SWMR VFD compatibility flag.
diff --git a/test/swmr_generator.c b/test/swmr_generator.c
index a5546f2..dfe41f1 100644
--- a/test/swmr_generator.c
+++ b/test/swmr_generator.c
@@ -102,9 +102,11 @@ gen_skeleton(const char *filename, unsigned verbose, unsigned swmr_write,
if((fapl = h5_fileaccess()) < 0)
return -1;
- /* We ALWAYS select the latest file format for SWMR */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- return -1;
+ /* Can create a file for SWMR support with: (a) (write+latest-format) or (b) (SWMR write+non-latest-format) */
+ if(!swmr_write) {
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ return -1;
+ }
/* There are two chunk indexes tested here.
* With one unlimited dimension, we get the extensible array index
diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c
index a31fa9a..a9043ce 100644
--- a/test/swmr_remove_writer.c
+++ b/test/swmr_remove_writer.c
@@ -49,7 +49,7 @@
/* Local Prototypes */
/********************/
-static hid_t open_skeleton(const char *filename, unsigned verbose);
+static hid_t open_skeleton(const char *filename, unsigned verbose, unsigned old);
static int remove_records(hid_t fid, unsigned verbose, unsigned long nshrinks,
unsigned long flush_count);
static void usage(void);
@@ -74,7 +74,7 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static hid_t
-open_skeleton(const char *filename, unsigned verbose)
+open_skeleton(const char *filename, unsigned verbose, unsigned old)
{
hid_t fid; /* File ID for new HDF5 file */
hid_t fapl; /* File access property list */
@@ -88,9 +88,11 @@ open_skeleton(const char *filename, unsigned verbose)
if((fapl = h5_fileaccess()) < 0)
return -1;
- /* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- return -1;
+ if(!old) {
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ return -1;
+ }
#ifdef QAK
/* Increase the initial size of the metadata cache */
@@ -229,14 +231,14 @@ usage(void)
printf("\n");
printf("Usage error!\n");
printf("\n");
- printf("Usage: swmr_remove_writer [-q] [-f <# of shrinks between flushing\n");
+ printf("Usage: swmr_remove_writer [-q] [-o] [-f <# of shrinks between flushing\n");
printf(" file contents>] [-r <random seed>] <# of shrinks>\n");
printf("\n");
printf("<# of shrinks between flushing file contents> should be 0 (for no\n");
printf("flushing) or between 1 and (<# of shrinks> - 1)\n");
printf("\n");
- printf("Defaults to verbose (no '-q' given), flushing every 1000 shrinks\n");
- printf("('-f 1000'), and will generate a random seed (no -r given).\n");
+ printf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n");
+ printf("flushing every 1000 shrinks ('-f 1000'), and will generate a random seed (no -r given).\n");
printf("\n");
exit(1);
}
@@ -247,6 +249,7 @@ int main(int argc, const char *argv[])
long nshrinks = 0; /* # of times to shrink the dataset */
long flush_count = 1000; /* # of records to write between flushing file */
unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned old = 0; /* Whether to use non-latest-format when opening file */
unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
unsigned random_seed = 0; /* Random # seed */
unsigned u; /* Local index variable */
@@ -282,6 +285,12 @@ int main(int argc, const char *argv[])
u += 2;
break;
+ /* Use non-latest-format when opening file */
+ case 'o':
+ old = 1;
+ u++;
+ break;
+
default:
usage();
break;
@@ -332,7 +341,7 @@ int main(int argc, const char *argv[])
fprintf(stderr, "Opening skeleton file: %s\n", FILENAME);
/* Open file skeleton */
- if((fid = open_skeleton(FILENAME, verbose)) < 0) {
+ if((fid = open_skeleton(FILENAME, verbose, old)) < 0) {
fprintf(stderr, "Error opening skeleton file!\n");
exit(1);
} /* end if */
diff --git a/test/swmr_writer.c b/test/swmr_writer.c
index d748309..2136a6e 100644
--- a/test/swmr_writer.c
+++ b/test/swmr_writer.c
@@ -39,7 +39,7 @@
/* Local Prototypes */
/********************/
-static hid_t open_skeleton(const char *filename, unsigned verbose);
+static hid_t open_skeleton(const char *filename, unsigned verbose, unsigned old);
static int add_records(hid_t fid, unsigned verbose, unsigned long nrecords,
unsigned long flush_count);
static void usage(void);
@@ -64,7 +64,7 @@ static void usage(void);
*-------------------------------------------------------------------------
*/
static hid_t
-open_skeleton(const char *filename, unsigned verbose)
+open_skeleton(const char *filename, unsigned verbose, unsigned old)
{
hid_t fid; /* File ID for new HDF5 file */
hid_t fapl; /* File access property list */
@@ -76,9 +76,11 @@ open_skeleton(const char *filename, unsigned verbose)
if((fapl = h5_fileaccess()) < 0)
return -1;
- /* Set to use the latest library format */
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- return -1;
+ if(!old) {
+ /* Set to use the latest library format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ return -1;
+ }
#ifdef QAK
/* Increase the initial size of the metadata cache */
@@ -275,7 +277,7 @@ usage(void)
printf("\n");
printf("Usage error!\n");
printf("\n");
- printf("Usage: swmr_writer [-q] [-f <# of records to write between flushing\n");
+ printf("Usage: swmr_writer [-q] [-o] [-f <# of records to write between flushing\n");
printf(" file contents>] [-r <random seed>] <# of records>\n");
printf("\n");
printf("<# of records to write between flushing file contents> should be 0\n");
@@ -283,8 +285,8 @@ usage(void)
printf("\n");
printf("<# of records> must be specified.\n");
printf("\n");
- printf("Defaults to verbose (no '-q' given), flushing every 10000 records\n");
- printf("('-f 10000'), and will generate a random seed (no -r given).\n");
+ printf("Defaults to verbose (no '-q' given), latest format when opening file (no '-o' given),\n");
+ printf("flushing every 10000 records ('-f 10000'), and will generate a random seed (no -r given).\n");
printf("\n");
exit(1);
}
@@ -295,6 +297,7 @@ int main(int argc, const char *argv[])
long nrecords = 0; /* # of records to append */
long flush_count = 10000; /* # of records to write between flushing file */
unsigned verbose = 1; /* Whether to emit some informational messages */
+ unsigned old = 0; /* Whether to use non-latest-format when opening file */
unsigned use_seed = 0; /* Set to 1 if a seed was set on the command line */
unsigned random_seed = 0; /* Random # seed */
unsigned u; /* Local index variable */
@@ -330,6 +333,12 @@ int main(int argc, const char *argv[])
u += 2;
break;
+ /* Use non-latest-format when opening file */
+ case 'o':
+ old = 1;
+ u++;
+ break;
+
default:
usage();
break;
@@ -380,7 +389,7 @@ int main(int argc, const char *argv[])
fprintf(stderr, "Opening skeleton file: %s\n", FILENAME);
/* Open file skeleton */
- if((fid = open_skeleton(FILENAME, verbose)) < 0) {
+ if((fid = open_skeleton(FILENAME, verbose, old)) < 0) {
fprintf(stderr, "Error opening skeleton file!\n");
exit(1);
} /* end if */
diff --git a/test/testswmr.sh.in b/test/testswmr.sh.in
index cc5acd7..5165fd1 100644
--- a/test/testswmr.sh.in
+++ b/test/testswmr.sh.in
@@ -223,7 +223,7 @@ do
# Launch the Generator
echo launch the swmr_generator
- ./swmr_generator $compress $index_type
+ ./swmr_generator -s $compress $index_type
if test $? -ne 0; then
echo generator had error
nerrors=`expr $nerrors + 1`
@@ -234,7 +234,7 @@ do
# Launch the Writer
echo launch the swmr_writer
seed="" # Put -r <random seed> command here
- ./swmr_writer $Nrecords $seed &
+ ./swmr_writer -o $Nrecords $seed &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
#
@@ -292,7 +292,7 @@ do
# Launch the Remove Writer
echo launch the swmr_remove_writer
seed="" # Put -r <random seed> command here
- ./swmr_remove_writer $Nrecs_rem $seed &
+ ./swmr_remove_writer -o $Nrecs_rem $seed &
pid_writer=$!
$DPRINT pid_writer=$pid_writer
#
diff --git a/test/tfile.c b/test/tfile.c
index 066044f..27361b4 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -3411,7 +3411,7 @@ test_libver_bounds(void)
/* Run the tests */
test_libver_bounds_real(H5F_LIBVER_EARLIEST, 1, H5F_LIBVER_LATEST, 2);
- test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 1);
+ test_libver_bounds_real(H5F_LIBVER_LATEST, 2, H5F_LIBVER_EARLIEST, 2);
} /* end test_libver_bounds() */
/****************************************************************
diff --git a/tools/h5format_convert/h5fc_gentest.c b/tools/h5format_convert/h5fc_gentest.c
index de22691..2a8fa3e 100644
--- a/tools/h5format_convert/h5fc_gentest.c
+++ b/tools/h5format_convert/h5fc_gentest.c
@@ -26,12 +26,12 @@
#define GROUP "GROUP"
-#define OLD_FILE "h5fc_old.h5"
+#define OLD_V1_FILE "h5fc_v1.h5"
#define DSET_NON_CHUNKED "DSET_NON_CHUNKED"
#define DSET_BT1 "DSET_BT1"
#define DSET_NDATA_BT1 "DSET_NDATA_BT1"
-#define NEW_FILE "h5fc_new.h5"
+#define LATEST_V3_FILE "h5fc_latest_v3.h5"
#define DSET_EA "DSET_EA"
#define DSET_NDATA_EA "DSET_NDATA_EA"
#define DSET_BT2 "DSET_BT2"
@@ -41,9 +41,9 @@
#define DSET_NONE "DSET_NONE"
#define DSET_NDATA_NONE "DSET_NDATA_NONE"
-#define ALL_FILE "h5fc_all.h5"
+#define NON_V3_FILE "h5fc_non_v3.h5"
-#define EDGE_FILE "h5fc_edge.h5"
+#define EDGE_V3_FILE "h5fc_edge_v3.h5"
#define DSET_EDGE "DSET_EDGE"
/*
@@ -57,6 +57,7 @@ static void
gen_old(const char *fname)
{
hid_t fid = -1; /* file id */
+ hid_t fcpl = -1;
hid_t gid = -1; /* group id */
hid_t sid = -1; /* space id */
hid_t dcpl = -1; /* dataset creation property id */
@@ -67,8 +68,14 @@ gen_old(const char *fname)
int i; /* local index variable */
int buf[24]; /* data buffer */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+
+ if(H5Pset_istore_k(fcpl, 64) < 0)
+ goto error;
+
/* Create file */
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
goto error;
/* Create a group */
@@ -152,16 +159,16 @@ error:
} /* gen_old() */
/*
- * Function: gen_new()
+ * Function: gen_latest()
*
- * Create a new format file with:
+ * Create a file with write+latest-format--this will result in v3 superblock+latest version support:
* 1) 2 chunked datasets with extensible array chunk indexing type (with/without data)
* 2) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
* 3) 2 chunked datasets with fixed array chunk indexing type (with/without data)
* 4) 2 chunked datasets with implicit array chunk indexing type (with/without data)
*/
static void
-gen_new(const char *fname)
+gen_latest(const char *fname)
{
hid_t fid = -1; /* file id */
hid_t fapl = -1; /* file access property list */
@@ -341,23 +348,23 @@ error:
H5Pclose(fapl);
} H5E_END_TRY;
-} /* gen_new() */
+} /* gen_latest() */
/*
- * Function: gen_all()
+ * Function: gen_non()
*
- * Create a new format file with:
+ * Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support:
* 1) 1 chunked dataset with extensible array chunk indexing type (without data)
* 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
- * Re-open the file with old format and create:
+ * Re-open the file with write+non-latest-format and create:
+ * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
+ * 4) 1 chunked dataset with extensible array indexing type (with data)
* 5) 1 non-chunked dataset
- * 6) 2 chunked datasets with version 1 B-tree chunk indexing type (with/without data)
*/
static void
-gen_all(const char *fname)
+gen_non(const char *fname)
{
hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
hid_t gid = -1; /* group id */
hid_t sid = -1; /* space id */
hid_t dcpl = -1; /* dataset creation property id */
@@ -369,13 +376,8 @@ gen_all(const char *fname)
int i; /* local index variable */
int buf[24]; /* data buffer */
- /* Create a new format file */
- if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
-
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ /* Create a new file with SWMR_WRITE + non-latest-format */
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC|H5F_ACC_SWMR_WRITE, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
/* Create a group */
@@ -393,7 +395,7 @@ gen_all(const char *fname)
goto error;
/*
- * Create 1 chunked dataset with extensible array chunk indexing type (without data)
+ * Create a chunked dataset with extensible array chunk indexing type (without data)
*/
/* Create dataspace */
@@ -413,7 +415,7 @@ gen_all(const char *fname)
goto error;
/*
- * Create 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
+ * Create a chunked dataset with version 2 B-tree chunk indexing type (with data)
*/
/* Create dataspace */
@@ -436,8 +438,6 @@ gen_all(const char *fname)
goto error;
if(H5Dclose(did1) < 0)
goto error;
-
-
if(H5Pclose(dcpl) < 0)
goto error;
if(H5Gclose(gid) < 0)
@@ -454,7 +454,7 @@ gen_all(const char *fname)
goto error;
/*
- * Create 2 datasets with version 1 B-btree chunk indexing type (with/without data)
+ * Create a dataset with version 2 B-btree chunk indexing type (without data)
*/
/* Set chunk */
@@ -464,19 +464,34 @@ gen_all(const char *fname)
goto error;
/* Create dataspace */
- max_dims[0] = 10;
+ max_dims[0] = H5S_UNLIMITED;
max_dims[1] = H5S_UNLIMITED;
if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
goto error;
- /* Create the datasets */
- if((did1 = H5Dcreate2(fid, DSET_NDATA_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ /* Create the dataset */
+ if((did1 = H5Dcreate2(fid, DSET_NDATA_BT2, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
goto error;
- if((did2 = H5Dcreate2(gid, DSET_BT1, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ /* Close the dataspace */
+ if(H5Sclose(sid) < 0)
goto error;
- /* Write to one dataset */
+ /*
+ * Create a dataset with version extensible array chunk indexing type (with data) in the group
+ */
+
+ /* Create dataspace */
+ max_dims[0] = 10;
+ max_dims[1] = H5S_UNLIMITED;
+ if((sid = H5Screate_simple(2, dims2, max_dims)) < 0)
+ goto error;
+
+ /* Create the dataset */
+ if((did2 = H5Dcreate2(gid, DSET_EA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
+ goto error;
+
+ /* Write to the dataset */
if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
@@ -489,7 +504,7 @@ gen_all(const char *fname)
goto error;
/*
- * Create a non-chunked dataset
+ * Create a non-chunked dataset in the group
*/
/* Create dataspace */
@@ -512,8 +527,6 @@ gen_all(const char *fname)
goto error;
if(H5Pclose(dcpl) < 0)
goto error;
- if(H5Pclose(fapl) < 0)
- goto error;
error:
H5E_BEGIN_TRY {
@@ -523,15 +536,14 @@ error:
H5Dclose(did2);
H5Gclose(gid);
H5Fclose(fid);
- H5Pclose(fapl);
} H5E_END_TRY;
-} /* gen_all() */
+} /* gen_non() */
/*
* Function: gen_edge()
*
- * Create a new format file with:
+ * Create a file with write+latest-format--this will result in v3 superblock+latest version support:
* A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
* (i.e. the dataset does not filter partial edge chunks)
*/
@@ -608,16 +620,16 @@ error:
int main(void)
{
- /* Generate an old format file with datasets for testing */
- gen_old(OLD_FILE);
+ /* Generate an old format file with v1 superbock */
+ gen_old(OLD_V1_FILE);
- /* Generate a new format file with datasets for testing */
- gen_new(NEW_FILE);
+ /* Generate a latest-format file with v3 superblock */
+ gen_latest(LATEST_V3_FILE);
- /* Generate a new format file (+reopen with old format) for testing */
- gen_all(ALL_FILE);
+ /* Generate a non-latest-format file with v3 superblock */
+ gen_non(NON_V3_FILE);
/* Generate a new format file with a no-filter-edge-chunk dataset for testing */
- gen_edge(EDGE_FILE);
+ gen_edge(EDGE_V3_FILE);
return 0;
}
diff --git a/tools/h5format_convert/testfiles/h5fc_edge.h5 b/tools/h5format_convert/testfiles/h5fc_edge_v3.h5
index abf6192..701afa3 100644
--- a/tools/h5format_convert/testfiles/h5fc_edge.h5
+++ b/tools/h5format_convert/testfiles/h5fc_edge_v3.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_new.h5 b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5
index fe4d858..f7de743 100644
--- a/tools/h5format_convert/testfiles/h5fc_new.h5
+++ b/tools/h5format_convert/testfiles/h5fc_latest_v3.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_non_v3.h5 b/tools/h5format_convert/testfiles/h5fc_non_v3.h5
new file mode 100644
index 0000000..b1bffa8
--- /dev/null
+++ b/tools/h5format_convert/testfiles/h5fc_non_v3.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_old.h5 b/tools/h5format_convert/testfiles/h5fc_old.h5
deleted file mode 100644
index dc4e912..0000000
--- a/tools/h5format_convert/testfiles/h5fc_old.h5
+++ /dev/null
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_all.h5 b/tools/h5format_convert/testfiles/h5fc_v1.h5
index 33a9166..d3d66f8 100644
--- a/tools/h5format_convert/testfiles/h5fc_all.h5
+++ b/tools/h5format_convert/testfiles/h5fc_v1.h5
Binary files differ
diff --git a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl
index d4b7a2d..76c70ee 100644
--- a/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl
+++ b/tools/h5format_convert/testfiles/h5fc_v_n_all.ddl
@@ -2,12 +2,13 @@ Process command line options
It is noop...
Open the file tmp.h5
Processing all datasets in the file...
-Going to process dataset:/DSET_NDATA_BT1...
+Going to process dataset:/DSET_NDATA_BT2...
Open the dataset
Retrieve the dataset's layout
Verify the dataset is a chunked dataset
Retrieve the dataset's chunk indexing type
-Chunk indexing type is already version 1 B-tree: no further action
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
Close the dataset
Close the dataset creation property list
Going to process dataset:/DSET_NDATA_EA...
@@ -19,15 +20,16 @@ Verify the dataset's chunk indexing type is not version 1 B-tree
Not converting the dataset
Close the dataset
Close the dataset creation property list
-Going to process dataset:/GROUP/DSET_BT1...
+Going to process dataset:/GROUP/DSET_BT2...
Open the dataset
Retrieve the dataset's layout
Verify the dataset is a chunked dataset
Retrieve the dataset's chunk indexing type
-Chunk indexing type is already version 1 B-tree: no further action
+Verify the dataset's chunk indexing type is not version 1 B-tree
+Not converting the dataset
Close the dataset
Close the dataset creation property list
-Going to process dataset:/GROUP/DSET_BT2...
+Going to process dataset:/GROUP/DSET_EA...
Open the dataset
Retrieve the dataset's layout
Verify the dataset is a chunked dataset
diff --git a/tools/h5format_convert/testh5fc.sh.in b/tools/h5format_convert/testh5fc.sh.in
index ac51c08..dc5aa48 100644
--- a/tools/h5format_convert/testh5fc.sh.in
+++ b/tools/h5format_convert/testh5fc.sh.in
@@ -79,10 +79,10 @@ TMPFILE=tmp.h5
# Comment '#' without space can be used.
# --------------------------------------------------------------------
LIST_HDF5_TEST_FILES="
-$SRC_H5FORMCONV_TESTFILES/h5fc_old.h5
-$SRC_H5FORMCONV_TESTFILES/h5fc_new.h5
-$SRC_H5FORMCONV_TESTFILES/h5fc_all.h5
-$SRC_H5FORMCONV_TESTFILES/h5fc_edge.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_v1.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_latest_v3.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_non_v3.h5
+$SRC_H5FORMCONV_TESTFILES/h5fc_edge_v3.h5
"
LIST_OTHER_TEST_FILES="
@@ -284,105 +284,105 @@ TOOLTEST_OUT h5fc_nooption.ddl ''
TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5
#
#
-# h5format_convert -d h5fc_old.h5 (just -d option, file exists)
-# h5format_convert --dname h5fc_old.h5 (just --dname option, file exists)
+# h5format_convert -d h5fc_v1.h5 (just -d option, file exists)
+# h5format_convert --dname h5fc_v1.h5 (just --dname option, file exists)
# h5format_convert --dname (just --dname option)
-# h5format_convert --dname=nonexist h5fc_old.h5 (dataset does not exist, file exists)
-TOOLTEST_OUT h5fc_d_file.ddl h5fc_old.h5 -d
-TOOLTEST_OUT h5fc_d_file.ddl h5fc_old.h5 --dname
+# h5format_convert --dname=nonexist h5fc_v1.h5 (dataset does not exist, file exists)
+TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 -d
+TOOLTEST_OUT h5fc_d_file.ddl h5fc_v1.h5 --dname
TOOLTEST_OUT h5fc_dname.ddl '' --dname
-TOOLTEST_OUT h5fc_nonexistdset_file.ddl h5fc_old.h5 --dname=nonexist
+TOOLTEST_OUT h5fc_nonexistdset_file.ddl h5fc_v1.h5 --dname=nonexist
#
#
#
-# h5format_convert -d /DSET_NON_CHUNKED -v h5fc_old.h5 (verbose, non-chunked dataset)
-# h5format_convert -d /GROUP/DSET_BT1 --verbose h5fc_old.h5 (verbose, bt1 dataset)
-# h5format_convert -d /DSET_NDATA_BT1 -v -n h5fc_old.h5 (verbose, noop, bt1+nodata dataset)
-# h5format_convert -v h5fc_old.h5 (verbose, all datasets)
-TOOLTEST_OUT h5fc_v_non_chunked.ddl h5fc_old.h5 -d /DSET_NON_CHUNKED -v
-TOOLTEST_OUT h5fc_v_bt1.ddl h5fc_old.h5 -d /GROUP/DSET_BT1 --verbose
-TOOLTEST_OUT h5fc_v_ndata_bt1.ddl h5fc_old.h5 -d /DSET_NDATA_BT1 -v -n
-TOOLTEST_OUT h5fc_v_all.ddl h5fc_old.h5 -v
+# h5format_convert -d /DSET_NON_CHUNKED -v h5fc_v1.h5 (verbose, non-chunked dataset)
+# h5format_convert -d /GROUP/DSET_BT1 --verbose h5fc_v1.h5 (verbose, bt1 dataset)
+# h5format_convert -d /DSET_NDATA_BT1 -v -n h5fc_v1.h5 (verbose, noop, bt1+nodata dataset)
+# h5format_convert -v h5fc_v1.h5 (verbose, all datasets)
+TOOLTEST_OUT h5fc_v_non_chunked.ddl h5fc_v1.h5 -d /DSET_NON_CHUNKED -v
+TOOLTEST_OUT h5fc_v_bt1.ddl h5fc_v1.h5 -d /GROUP/DSET_BT1 --verbose
+TOOLTEST_OUT h5fc_v_ndata_bt1.ddl h5fc_v1.h5 -d /DSET_NDATA_BT1 -v -n
+TOOLTEST_OUT h5fc_v_all.ddl h5fc_v1.h5 -v
#
#
#
-# h5format_convert -d /DSET_EA -v -n h5fc_new.h5 (verbose, noop, one ea dataset)
-# h5format_convert -v -n h5fc_all.h5 (verbose, noop, all datasets)
-TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_new.h5 -d /DSET_EA -v -n
-TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_all.h5 -v -n
+# h5format_convert -d /DSET_EA -v -n h5fc_latest_v3.h5 (verbose, noop, one ea dataset)
+# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets)
+TOOLTEST_OUT h5fc_v_n_1d.ddl h5fc_latest_v3.h5 -d /DSET_EA -v -n
+TOOLTEST_OUT h5fc_v_n_all.ddl h5fc_non_v3.h5 -v -n
#
#
#
# No output from tests
# 1) Use the tool to convert the dataset
# 2) Verify the chunk indexing type is correct
-# h5format_convert -d /DSET_EA h5fc_new.h5
-# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_new.h5
-# h5format_convert -d /GROUP/DSET_BT2 h5fc_new.h5
-# h5format_convert -d /DSET_NDATA_BT2 h5fc_new.h5
-# h5format_convert -d /DSET_FA h5fc_new.h5
-# h5format_convert -d /GROUP/DSET_FA h5fc_new.h5
-# h5format_convert -d /DSET_NONE h5fc_new.h5
-# h5format_convert -d /GROUP/DSET_NONE h5fc_new.h5
-TOOLTEST h5fc_new.h5 -d /DSET_EA
+# h5format_convert -d /DSET_EA h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_NDATA_EA h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_BT2 h5fc_latest_v3.h5
+# h5format_convert -d /DSET_NDATA_BT2 h5fc_latest_v3.h5
+# h5format_convert -d /DSET_FA h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_FA h5fc_latest_v3.h5
+# h5format_convert -d /DSET_NONE h5fc_latest_v3.h5
+# h5format_convert -d /GROUP/DSET_NONE h5fc_latest_v3.h5
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_EA
IDX_CHECK /DSET_EA
#
-TOOLTEST h5fc_new.h5 -d /GROUP/DSET_NDATA_EA
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_EA
IDX_CHECK /GROUP/DSET_NDATA_EA
#
-TOOLTEST h5fc_new.h5 -d /GROUP/DSET_BT2
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_BT2
IDX_CHECK /GROUP/DSET_BT2
#
-TOOLTEST h5fc_new.h5 -d /DSET_NDATA_BT2
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_NDATA_BT2
IDX_CHECK /DSET_NDATA_BT2
#
-TOOLTEST h5fc_new.h5 -d /DSET_FA
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_FA
IDX_CHECK /DSET_FA
#
-TOOLTEST h5fc_new.h5 -d /GROUP/DSET_NDATA_FA
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_FA
IDX_CHECK /GROUP/DSET_NDATA_FA
#
-TOOLTEST h5fc_new.h5 -d /DSET_NONE
+TOOLTEST h5fc_latest_v3.h5 -d /DSET_NONE
IDX_CHECK /DSET_NONE
#
-TOOLTEST h5fc_new.h5 -d /GROUP/DSET_NDATA_NONE
+TOOLTEST h5fc_latest_v3.h5 -d /GROUP/DSET_NDATA_NONE
IDX_CHECK /GROUP/DSET_NDATA_NONE
#
#
#
# No output from tests: just check exit code
-# h5format_convert -d /DSET_NDATA_BT1 h5fc_old.h5 (v1-btree dataset)
-# h5format_convert -d /GROUP/DSET_NON_CHUNKED h5fc_all.h5 (non-chunked dataset)
-TOOLTEST h5fc_old.h5 -d /DSET_NDATA_BT1
-TOOLTEST h5fc_all.h5 -d /GROUP/DSET_NON_CHUNKED
+# h5format_convert -d /DSET_NDATA_BT1 h5fc_v1.h5 (v1-btree dataset)
+# h5format_convert -d /GROUP/DSET_NON_CHUNKED h5fc_non_v3.h5 (non-chunked dataset)
+TOOLTEST h5fc_v1.h5 -d /DSET_NDATA_BT1
+TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_NON_CHUNKED
#
#
#
# No output from tests: just check exit code
-# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_all.h5 (noop, one dataset)
-# h5format_convert -n h5fc_all.h5 (noop, all datasets)
-TOOLTEST h5fc_all.h5 -d /GROUP/DSET_BT2 -n
-TOOLTEST h5fc_all.h5 -n
+# h5format_convert -d /GROUP/DSET_BT2 -n h5fc_non_v3.h5 (noop, one dataset)
+# h5format_convert -n h5fc_non_v3.h5 (noop, all datasets)
+TOOLTEST h5fc_non_v3.h5 -d /GROUP/DSET_BT2 -n
+TOOLTEST h5fc_non_v3.h5 -n
#
#
#
# No output from tests: just check exit code
-# h5format_convert h5fc_all.h5
+# h5format_convert h5fc_non_v3.h5
# 1) convert all datasets
# 2) verify indexing types
-TOOLTEST h5fc_all.h5
-IDX_CHECK /DSET_NDATA_BT1
+TOOLTEST h5fc_non_v3.h5
IDX_CHECK /DSET_NDATA_EA
-IDX_CHECK /GROUP/DSET_BT1
+IDX_CHECK /DSET_NDATA_BT2
IDX_CHECK /GROUP/DSET_BT2
+IDX_CHECK /GROUP/DSET_EA
#
#
#
# No output from test: just check exit code
-# h5format_convert h5fc_edge.h5
+# h5format_convert h5fc_edge_v3.h5
# 1) convert the chunked dataset (filter, no-filter-edge-chunk)
# 2) verify the indexing type
-TOOLTEST h5fc_edge.h5
+TOOLTEST h5fc_edge_v3.h5
IDX_CHECK /DSET_EDGE
#
#
diff --git a/tools/misc/clear_open_chk.c b/tools/misc/clear_open_chk.c
index 4256da0..f3e6ba3 100644
--- a/tools/misc/clear_open_chk.c
+++ b/tools/misc/clear_open_chk.c
@@ -55,7 +55,7 @@ main(int argc, char *argv[])
fname = HDstrdup(argv[1]);
/* Try opening the file */
- if((fid = h5tools_fopen(fname, H5F_ACC_RDWR, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
+ if((fid = h5tools_fopen(fname, H5F_ACC_RDONLY, H5P_DEFAULT, NULL, NULL, (size_t)0)) < 0) {
HDfprintf(stderr, "clear_open_chk: unable to open the file\n");
return EXIT_FAILURE;
}
diff --git a/tools/misc/h5clear_gentest.c b/tools/misc/h5clear_gentest.c
index 1468432..062e938 100644
--- a/tools/misc/h5clear_gentest.c
+++ b/tools/misc/h5clear_gentest.c
@@ -17,19 +17,13 @@
/* The HDF5 test files */
const char *FILENAME[] = {
- "h5clear_sec2.h5", /* 0 -- sec2 file */
- "h5clear_core.h5", /* 1 -- core file */
- "h5clear_fam_%05d.h5", /* 2 -- family files */
- "h5clear_split", /* 3 -- split files */
- "h5clear_invalid.h5" /* 4 -- sec2 file with invalid superblock version */
+ "h5clear_sec2_v3.h5", /* 0 -- sec2 file with superblock version 3 */
+ "h5clear_log_v3.h5", /* 1 -- log file with superblock veresion 3 */
+ "h5clear_sec2_v0.h5", /* 2 -- sec2 file with superblock version 0 */
+ "h5clear_sec2_v2.h5" /* 3 -- sec2 file with superblock version 2 */
};
-#define FAMILY_SIZE 1024U
-#define CORE_INCREMENT 1024U
-
-#define SUPER_VERS_OFF 8
-#define SUPER_VERS_SIZE 1
-#define SUPER_VERS_LATEST 2
+#define KB 1024U
/*-------------------------------------------------------------------------
* Function: main
@@ -37,11 +31,15 @@ const char *FILENAME[] = {
* Purpose: To create HDF5 files with non-zero status_flags in the superblock
* via flushing and exiting without closing the library.
*
- * Due to file locking, status_flag in the superblock will be
+ * Due to file locking, status_flags in the superblock will be
* nonzero after H5Fcreate. The library will clear status_flags
* on file closing. This program, after "H5Fcreate" the files,
* exits without going through library closing. Thus, status_flags
- * for these files are not cleared and users cannot open them.
+ * for these files are not cleared.
+ * The library will check consistency of status_flags when opening
+ * a file with superblock >= v3 and will return error accordingly.
+ * The library will not check status_flags when opening a file
+ * with < v3 superblock.
*
* These files are used by "h5clear" to see if the tool clears
* status_flags properly so users can open the files afterwards.
@@ -57,6 +55,7 @@ int
main(void)
{
hid_t fid; /* File ID */
+ hid_t fcpl; /* File creation property list */
hid_t fapl, new_fapl; /* File access property lists */
char fname[512]; /* File name */
unsigned new_format; /* To use latest library format or not */
@@ -75,7 +74,7 @@ main(void)
if(H5Pset_libver_bounds(new_fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
goto error;
- /* Create file with/without latest library format */
+ /* Files created within this for loop will have v3 superblock and nonzero status_flags */
for(new_format = FALSE; new_format <= TRUE; new_format++) {
hid_t fapl2, my_fapl; /* File access property lists */
@@ -91,7 +90,7 @@ main(void)
goto error;
/* Create the file */
sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[0]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0)
goto error;
/* Flush the file */
@@ -103,19 +102,19 @@ main(void)
goto error;
/*
- * Create a core file
+ * Create a log file
*/
/* Create a copy of file access property list */
if((my_fapl = H5Pcopy(fapl2)) < 0)
goto error;
- /* Setup the fapl for the family file driver */
- if(H5Pset_fapl_core(my_fapl, (size_t)CORE_INCREMENT, TRUE) < 0)
+ /* Setup the fapl for the log driver */
+ if(H5Pset_fapl_log(my_fapl, "append.log", (unsigned long long)H5FD_LOG_ALL, (size_t)(4 * KB)) < 0)
goto error;
/* Create the file */
sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[1]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
+ if((fid = H5Fcreate(fname, H5F_ACC_TRUNC | (new_format ? 0 : H5F_ACC_SWMR_WRITE), H5P_DEFAULT, my_fapl)) < 0)
goto error;
/* Flush the file */
@@ -126,104 +125,44 @@ main(void)
if(H5Pclose(my_fapl) < 0)
goto error;
- /*
- * Create a family file
- */
- /* Create a copy of file access property list */
- if((my_fapl = H5Pcopy(fapl2)) < 0)
- goto error;
-
- /* Setup the fapl for the family file driver */
- if(H5Pset_fapl_family(my_fapl, (hsize_t)FAMILY_SIZE, H5P_DEFAULT) < 0)
- goto error;
-
- /* Create the file */
- sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[2]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- goto error;
-
- /* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
- goto error;
-
- /* Close the property list */
- if(H5Pclose(my_fapl) < 0)
- goto error;
+ } /* end for */
- /*
- * Create a split file
- */
- /* Create a copy of file access property list */
- my_fapl = H5Pcopy(fapl2);
+ /*
+ * Create a sec2 file with v0 superblock but nonzero status_flags
+ */
+ if((fid = H5Fcreate(FILENAME[2], H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ goto error;
- /* Setup the fapl for the split file driver */
- H5Pset_fapl_split(my_fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT);
+ /* Flush the file */
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
- /* Create the file */
- sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[3]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- goto error;
- /* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
- goto error;
+ /*
+ * Create a sec2 file with v2 superblock but nonzero status_flags
+ */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ goto error;
+ if(H5Pset_shared_mesg_nindexes(fcpl, 1) < 0)
+ goto error;
+ if(H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_DTYPE_FLAG, 50) < 0)
+ goto error;
- /* Close the property list */
- if(H5Pclose(my_fapl) < 0)
- goto error;
+ if((fid = H5Fcreate(FILENAME[3], H5F_ACC_TRUNC, fcpl, fapl)) < 0)
+ goto error;
- /*
- * Create a sec2 file but change its superblock version #
- */
- /* Create a copy of file access property list */
- if((my_fapl = H5Pcopy(fapl2)) < 0)
- goto error;
- /* Create the file */
- sprintf(fname, "%s%s", new_format? "latest_":"", FILENAME[4]);
- if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- goto error;
+ /* Flush the file */
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
- /* Flush the file */
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0)
- goto error;
- /* Close the property list */
- if(H5Pclose(my_fapl) < 0)
- goto error;
-
- /* Open the test file via system call "open" */
- if((fd = HDopen(fname, O_RDWR, 0666)) < 0) {
- HDfprintf(stdout, "cannot open the file\n");
- goto error;
- }
-
- /* Position the file to superblock version via system call "lseek" */
- if(HDlseek(fd, (off_t)SUPER_VERS_OFF, SEEK_SET) < 0) {
- HDfprintf(stdout, "cannot lseek the file superblock version\n");
- goto error;
- }
-
- /* Change to an incorrect superblock version */
- super_vers = SUPER_VERS_LATEST + 1;
- /* Write to the file via system call "write" */
- if((bytes_written = HDwrite(fd, &super_vers, (size_t)SUPER_VERS_SIZE)) < 0) {
- HDfprintf(stdout, "cannot write to the file with incorrect superblock version\n");
- goto error;
- }
-
- /* Close the file via system call "close" */
- if(HDclose(fd) < 0) {
- HDfprintf(stdout, "cannot close the file\n");
- goto error;
- }
-
- } /* end for */
-
/* Close the property lists */
if(H5Pclose(fapl) < 0)
goto error;
if(H5Pclose(new_fapl) < 0)
goto error;
+ if(H5Pclose(fcpl) < 0)
+ goto error;
fflush(stdout);
fflush(stderr);
diff --git a/tools/misc/testh5clear.sh.in b/tools/misc/testh5clear.sh.in
index 0e3a48b..aeac03e 100644
--- a/tools/misc/testh5clear.sh.in
+++ b/tools/misc/testh5clear.sh.in
@@ -43,55 +43,46 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012'
}
-# Algorithm:
-# Try to open the test file--should fail
-# Use "h5clear" to clear the status_flags in the test file
-# Try to open the test file again--should succeed
-# $1 is the filename to H5Fopen() via h5clear
+# (1) Use "h5clear" to clear the status_flags in the test file
+# (2) Open the test file via "clear_open_chk"
+# $1 is the filename for testing
TOOLTEST() {
TESTING $H5CLEAR $1
fname=$1
- #
- # Try to open the test file
- $OPENCHK_BIN $fname 2>/dev/null # should fail; ignore error message
- if test $? -eq $SUCCEED; then
- echo ".....$OPENCHK: should fail"
- nerrors=`expr $nerrors + 1`
+ # Use "h5clear" to clear the status_flags in the test file
+ $RUNSERIAL $H5CLEAR_BIN $fname
+ if test $? -ne $SUCCEED; then
+ echo ".....$H5CLEAR: should succeed"
+ nerrors=`expr $nerrors + 1`
else
- # Run h5clear to clear the status_flags in the test file
- $RUNSERIAL $H5CLEAR_BIN $fname
+ # Open the test file via "clear_open_chk"
+ $OPENCHK_BIN $fname
if test $? -ne $SUCCEED; then
- echo ".....$H5CLEAR: should succeed"
+ echo "......$OPENCHK: should succeed"
nerrors=`expr $nerrors + 1`
else
- # Try to open the test file again
- $OPENCHK_BIN $fname
- if test $? -ne $SUCCEED; then
- echo "......$OPENCHK: should succeed"
- nerrors=`expr $nerrors + 1`
- else
- echo "PASSED"
- fi
+ echo "PASSED"
fi
fi
}
-# The input file has an incorrect superblock version #
-# Algorithm:
-# Use "h5clear" to clear status_flags in the test file--should fail to open the file
-# $1 is the filename to H5Fopen() via h5clear
-TOOLFAIL() {
- TESTING $H5CLEAR $1
+
+
+# Use "clear_open_chk" to check if the file open succeeds or fails
+# $1 is the filename to open
+# $2 is the expected return from "clear_open_chk"
+OPENCHK() {
fname=$1
- # Run h5clear to clear the status_flags in the test file
- $RUNSERIAL $H5CLEAR_BIN $fname 2>/dev/null # should fail: ignore error message
- if test $? -eq $SUCCEED; then
- echo ".....$H5CLEAR: should fail"
- nerrors=`expr $nerrors + 1`
- else
- echo "PASSED"
+ expected=$2
+ #
+ $OPENCHK_BIN $fname 2>/dev/null
+ actual=$?
+ if test $actual -ne $expected; then
+ echo "Unexpected return from $OPENCHK"
+ nerrors=`expr $nerrors + 1`
fi
}
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -103,21 +94,27 @@ if test $? -ne 0; then # Error returned from generating test files
echo "$GENTEST: .....fail in generating test files"
nerrors=`expr $nerrors + 1`
else
- TOOLTEST h5clear_sec2.h5
- TOOLTEST h5clear_core.h5
- TOOLTEST h5clear_fam_%05d.h5
- TOOLTEST h5clear_split
+ # Initial file open fails
+ # After "h5clear" the file, the subsequent file open succeeds
+ OPENCHK h5clear_sec2_v3.h5 $FAIL
+ TOOLTEST h5clear_sec2_v3.h5
+ #
+ OPENCHK h5clear_log_v3.h5 $FAIL
+ TOOLTEST h5clear_log_v3.h5
+ #
+ OPENCHK latest_h5clear_sec2_v3.h5 $FAIL
+ TOOLTEST latest_h5clear_sec2_v3.h5
+ #
+ OPENCHK latest_h5clear_log_v3.h5 $FAIL
+ TOOLTEST latest_h5clear_log_v3.h5
+fi
#
-# files created with latest library format
- TOOLTEST latest_h5clear_sec2.h5
- TOOLTEST latest_h5clear_core.h5
- TOOLTEST latest_h5clear_fam_%05d.h5
- TOOLTEST latest_h5clear_split
#
-# files created with incorrect superblock version #
-TOOLFAIL h5clear_invalid.h5
-TOOLFAIL latest_h5clear_invalid.h5
-fi
+# File open succeeds because the library does not check status_flags for file with < v3 superblock
+OPENCHK h5clear_sec2_v0.h5 $SUCCEED
+TOOLTEST h5clear_sec2_v0.h5
+OPENCHK h5clear_sec2_v2.h5 $SUCCEED
+TOOLTEST h5clear_sec2_v2.h5
#
# Clean up test files
if test -z "$HDF5_NOCLEANUP"; then