summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2020-02-21 20:30:34 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2020-02-21 20:30:34 (GMT)
commit51b8c63864c72de9a7b40c00673fe07510fec27e (patch)
tree298e9a2584860a24f55d2bce1fc60faed2bef2dd /test
parentc4f785bc93c5f4e8677b325c321e0f9ed41c3baa (diff)
parentc5ab2285639a801f87a77987db1a0b609a020314 (diff)
downloadhdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.zip
hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.gz
hdf5-51b8c63864c72de9a7b40c00673fe07510fec27e.tar.bz2
Merge develop
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt7
-rw-r--r--test/CMakeVFDTests.cmake2
-rw-r--r--test/H5srcdir.h49
-rw-r--r--test/Makefile.am8
-rw-r--r--test/accum.c8
-rw-r--r--test/big.c5
-rw-r--r--test/cache.c482
-rw-r--r--test/cache_api.c23
-rw-r--r--test/cache_common.c534
-rw-r--r--test/cache_common.h525
-rw-r--r--test/cache_tagging.c76
-rw-r--r--test/chunk_info.c2
-rw-r--r--test/cork.c260
-rw-r--r--test/direct_chunk.c14
-rw-r--r--test/dsets.c952
-rw-r--r--test/dt_arith.c34
-rw-r--r--test/dtypes.c50
-rw-r--r--test/earray.c4
-rw-r--r--test/efc.c48
-rw-r--r--test/enc_dec_plist.c4
-rw-r--r--test/err_compat.c35
-rw-r--r--test/error_test.c36
-rw-r--r--test/extend.c181
-rw-r--r--test/external_env.c3
-rw-r--r--test/farray.c4
-rw-r--r--test/fheap.c39
-rw-r--r--test/file_image.c5
-rw-r--r--test/fillval.c25
-rw-r--r--test/flushrefresh.c65
-rw-r--r--test/gen_filespace.c3
-rw-r--r--test/gen_new_super.c4
-rw-r--r--test/gen_nullspace.c4
-rw-r--r--test/gen_plist.c2
-rw-r--r--test/gen_specmetaread.c5
-rw-r--r--test/genall5.c80
-rw-r--r--test/getname.c18
-rw-r--r--test/h5test.c89
-rw-r--r--test/links.c5410
-rw-r--r--test/mf.c28
-rw-r--r--test/mount.c159
-rw-r--r--test/mtime.c26
-rw-r--r--test/ntypes.c10
-rw-r--r--test/null_vol_connector.c151
-rw-r--r--test/objcopy.c1181
-rw-r--r--test/objcopy_ref.c1698
-rw-r--r--test/ohdr.c38
-rw-r--r--test/page_buffer.c27
-rw-r--r--test/set_extent.c10
-rw-r--r--test/stab.c24
-rw-r--r--test/swmr_common.c24
-rw-r--r--test/tarray.c20
-rw-r--r--test/tattr.c193
-rw-r--r--test/testhdf5.c3
-rw-r--r--test/testhdf5.h2
-rw-r--r--test/tfile.c107
-rw-r--r--test/th5o.c479
-rw-r--r--test/th5s.c78
-rw-r--r--test/thread_id.c192
-rw-r--r--test/tid.c25
-rw-r--r--test/titerate.c174
-rw-r--r--test/tmisc.c170
-rw-r--r--test/trefer.c2237
-rw-r--r--test/trefer_deprec.c1827
-rw-r--r--test/trefer_shutdown.c83
-rw-r--r--test/tselect.c3
-rw-r--r--test/tsohm.c32
-rw-r--r--test/ttsafe_cancel.c2
-rw-r--r--test/tunicode.c4
-rw-r--r--test/tvlstr.c23
-rw-r--r--test/tvltypes.c186
-rw-r--r--test/unlink.c33
-rw-r--r--test/unregister.c23
-rw-r--r--test/use_common.c38
-rw-r--r--test/use_disable_mdc_flushes.c21
-rw-r--r--test/vds.c183
-rw-r--r--test/vds_env.c4
-rw-r--r--test/vds_swmr.h24
-rw-r--r--test/vds_swmr_gen.c6
-rw-r--r--test/vds_swmr_reader.c6
-rw-r--r--test/vfd.c230
-rw-r--r--test/vol.c57
-rw-r--r--test/vol_plugin.c85
82 files changed, 14867 insertions, 4154 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8184d7f..a2fb31d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -194,6 +194,7 @@ set (testhdf5_SOURCES
${HDF5_TEST_SOURCE_DIR}/tmeta.c
${HDF5_TEST_SOURCE_DIR}/tmisc.c
${HDF5_TEST_SOURCE_DIR}/trefer.c
+ ${HDF5_TEST_SOURCE_DIR}/trefer_deprec.c
${HDF5_TEST_SOURCE_DIR}/trefstr.c
${HDF5_TEST_SOURCE_DIR}/tselect.c
${HDF5_TEST_SOURCE_DIR}/tskiplist.c
@@ -250,6 +251,7 @@ set (H5_TESTS
external
external_env
efc
+ objcopy_ref
objcopy
links
unlink
@@ -285,6 +287,7 @@ set (H5_TESTS
cache_logging
cork
swmr
+ thread_id
vol
)
@@ -523,4 +526,6 @@ else ()
endif ()
set_target_properties (use_disable_mdc_flushes PROPERTIES FOLDER test)
-include (CMakeTests.cmake)
+if (HDF5_TEST_SERIAL)
+ include (CMakeTests.cmake)
+endif ()
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index cf938f5..d4a5ddc 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -15,7 +15,7 @@
### T E S T I N G ###
##############################################################################
##############################################################################
-# included from CMakeTEsts.cmake
+# included from CMakeTests.cmake
set (VFD_LIST
sec2
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index 32fe8c9..b02d432 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -21,50 +21,19 @@
#define _H5SRCDIR_H
/* Include the header file with the correct relative path for the srcdir string */
-#include "H5srcdir_str.h"
-
-/* Buffer to construct path in and return pointer to */
-static char srcdir_path[1024] = "";
-
-/* Buffer to construct file in and return pointer to */
-static char srcdir_testpath[1024] = "";
+#ifdef __cplusplus
+extern "C" {
+#endif
/* Just return the srcdir path */
-static const char *
-H5_get_srcdir(void)
-{
- const char *srcdir = HDgetenv("srcdir");
-
- /* Check for using the srcdir from configure time */
- if(NULL == srcdir)
- srcdir = config_srcdir;
-
- /* Build path to all test files */
- if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
- HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir);
- return(srcdir_path);
- } /* end if */
- else
- return(NULL);
-} /* end H5_get_srcdir() */
+H5TEST_DLL const char *H5_get_srcdir(void);
/* Append the test file name to the srcdir path and return the whole string */
-static const char *H5_get_srcdir_filename(const char *filename)
-{
- const char *srcdir = H5_get_srcdir();
+H5TEST_DLL const char *H5_get_srcdir_filename(const char *filename);
+
+#ifdef __cplusplus
+}
+#endif
- /* Check for error */
- if(NULL == srcdir)
- return(NULL);
- else {
- /* Build path to test file */
- if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
- HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
- return(srcdir_testpath);
- } /* end if */
- else
- return(NULL);
- } /* end else */
-} /* end H5_get_srcdir_filename() */
#endif /* _H5SRCDIR_H */
diff --git a/test/Makefile.am b/test/Makefile.am
index a19079d..dd0a579 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -59,11 +59,11 @@ TEST_PROG= testhdf5 \
stab gheap evict_on_close farray earray btree2 fheap \
pool accum hyperslab istore bittests dt_arith page_buffer \
dtypes dsets chunk_info cmpd_dset filter_fail extend direct_chunk \
- external efc objcopy links unlink twriteorder big mtime fillval mount \
+ external efc objcopy objcopy_ref links unlink twriteorder big mtime fillval mount \
flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \
enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \
dangle dtransform reserved cross_read freespace mf vds file_image \
- unregister cache_logging cork swmr vol
+ unregister cache_logging cork swmr thread_id vol
# List programs to be built when testing here.
# error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh.
@@ -190,7 +190,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \
tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 ttime.h5 \
- trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 twriteorder.dat \
+ trefer[1-3].h5 trefer_*.h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 twriteorder.dat \
flush.h5 flush-swmr.h5 noflush.h5 noflush-swmr.h5 flush_extend.h5 \
flush_extend-swmr.h5 noflush_extend.h5 noflush_extend-swmr.h5 \
enum1.h5 titerate.h5 ttsafe.h5 tarray1.h5 tgenprop.h5 \
@@ -218,7 +218,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
# Sources for testhdf5 executable
testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \
tgenprop.c th5o.c th5s.c tcoords.c theap.c tid.c titerate.c tmeta.c tmisc.c \
- trefer.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \
+ trefer.c trefer_deprec.c trefstr.c tselect.c tskiplist.c tsohm.c ttime.c ttst.c tunicode.c \
tvlstr.c tvltypes.c
# Sources for Use Cases
diff --git a/test/accum.c b/test/accum.c
index 91acf0f..f7d02fd 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -1838,7 +1838,6 @@ test_swmr_write_big(hbool_t newest_format)
pid_t pid; /* Process ID */
#endif /* H5_HAVE_UNISTD_H */
int status; /* Status returned from child process */
- char *new_argv[] = {NULL};
char *driver = NULL; /* VFD string (from env variable) */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
@@ -1968,6 +1967,13 @@ test_swmr_write_big(hbool_t newest_format)
FAIL_STACK_ERROR;
}
else if(0 == pid) { /* Child process */
+ /* By convention, argv[0] tells the name of program invoked.
+ *
+ * execv on NetBSD 8 will actually return EFAULT if there is a
+ * NULL at argv[0], so we follow the convention unconditionally.
+ */
+ char swmr_reader[] = SWMR_READER;
+ char * const new_argv[] = {swmr_reader, NULL};
/* Run the reader */
status = HDexecv(SWMR_READER, new_argv);
HDprintf("errno from execv = %s\n", strerror(errno));
diff --git a/test/big.c b/test/big.c
index 46acc5e..481da58 100644
--- a/test/big.c
+++ b/test/big.c
@@ -281,8 +281,7 @@ error:
* 'name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static int
enough_room(hid_t fapl)
{
@@ -323,7 +322,7 @@ done:
return ret_value;
}
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
diff --git a/test/cache.c b/test/cache.c
index 1a726fa..349d048 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -18,7 +18,48 @@
* H5C.c
*/
#include "cache_common.h"
-
+#include "H5MFprivate.h"
+
+
+H5C_t * saved_cache = NULL; /* store the pointer to the instance of
+ * of H5C_t created by H5Fcreate()
+ * here between test cache setup and
+ * shutdown.
+ */
+
+haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the
+ * space allocated for cache items in the file between
+ * cache setup & takedown
+ */
+
+hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
+ * cache setup and takedown. Note
+ * that if saved_fapl_id == H5P_DEFAULT,
+ * we assume that there is no fapl to
+ * close.
+ */
+
+hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between
+ * cache setup and takedown. Note
+ * that if saved_fcpl_id == H5P_DEFAULT,
+ * we assume that there is no fcpl to
+ * close.
+ */
+
+hid_t saved_fid = -1; /* store the file id here between cache setup
+ * and takedown.
+ */
+hbool_t write_permitted = TRUE;
+hbool_t try_core_file_driver = FALSE;
+hbool_t core_file_driver_failed = FALSE;
+
+
+/* global variable declarations: */
+
+const char *FILENAME[] = {
+ "cache_test",
+ NULL
+};
/* private typedef declarations: */
@@ -205,6 +246,12 @@ static void check_stats__smoke_check_1(H5F_t * file_ptr);
#endif /* H5C_COLLECT_CACHE_STATS */
+static H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged);
+
+static void takedown_cache(H5F_t * file_ptr,
+ hbool_t dump_stats,
+ hbool_t dump_detailed_stats);
+
/**************************************************************************/
/**************************************************************************/
/********************************* tests: *********************************/
@@ -19867,7 +19914,7 @@ check_auto_cache_resize(hbool_t cork_ageout, unsigned paged)
/* NOTE: upper_hr_threshold MUST be type double (not float)
* or the cache test will fail on 64-bit systems.
*/
- auto_size_ctl.upper_hr_threshold = H5_DOUBLE(0.999); /* for ease of testing */
+ auto_size_ctl.upper_hr_threshold = 0.999; /* for ease of testing */
auto_size_ctl.decrement = 0.5f;
@@ -36417,6 +36464,437 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
#endif /* H5C_COLLECT_CACHE_STATS */
+/* Call back functions: */
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: check_if_write_permitted
+ *
+ * Purpose: Determine if a write is permitted under the current
+ * circumstances, and set *write_permitted_ptr accordingly.
+ * As a general rule it is, but when we are running in parallel
+ * mode with collective I/O, we must ensure that a read cannot
+ * cause a write.
+ *
+ * In the event of failure, the value of *write_permitted_ptr
+ * is undefined.
+ *
+ * Return: Non-negative on success/Negative on failure.
+ *
+ * Programmer: John Mainzer, 5/15/04
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_ptr)
+{
+ HDassert( write_permitted_ptr );
+
+ *write_permitted_ptr = write_permitted;
+
+ return(SUCCEED);
+} /* check_write_permitted() */
+
+
+/*****************************************************************************
+ *
+ * Function: setup_cache()
+ *
+ * Purpose: Open an HDF file. This will allocate an instance and
+ * initialize an associated instance of H5C_t. However,
+ * we want to test an instance of H5C_t, so allocate and
+ * initialize one with the file ID returned by the call to
+ * H5Fcreate(). Return a pointer to this instance of H5C_t.
+ *
+ * Observe that we open a HDF file because the cache now
+ * writes directly to file, and we need the file I/O facilities
+ * associated with the file.
+ *
+ * To avoid tripping on error check code, must allocate enough
+ * space in the file to hold all the test entries and their
+ * alternates. This is a little sticky, as the addresses of
+ * all the test entries are determined at compile time.
+ *
+ * Deal with this by choosing BASE_ADDR large enough that
+ * the base address of the allocate space will be less than
+ * or equal to BASE_ADDR, and then requesting an extra BASE_ADDR
+ * bytes, so we don't have to wory about exceeding the allocation.
+ *
+ * Return: Success: Ptr to H5C_t
+ *
+ * Failure: NULL
+ *
+ * Programmer: JRM -- 9/13/07
+ *
+ *****************************************************************************/
+
+H5F_t *
+setup_cache(size_t max_cache_size,
+ size_t min_clean_size,
+ unsigned paged)
+{
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hbool_t verbose = TRUE;
+ int mile_stone = 1;
+ hid_t fid = -1;
+ H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
+ H5F_t * ret_val = NULL;
+ haddr_t actual_base_addr;
+ hid_t fapl_id = H5P_DEFAULT;
+ hid_t fcpl_id = H5P_DEFAULT;
+
+ if(show_progress) /* 1 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ saved_fid = -1;
+
+ if(pass) {
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
+ }
+ }
+
+ if(pass && paged) {
+ /* Set up paged aggregation strategy */
+ if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_file_space_strategy() failed.\n";
+ H5Pclose(fcpl_id);
+ fcpl_id = H5P_DEFAULT;
+ }
+ }
+
+ if(pass && paged) {
+ /* Set up file space page size to BASE_ADDR */
+ if(H5Pset_file_space_page_size(fcpl_id, (hsize_t)BASE_ADDR) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_file_space_page_size() failed.\n";
+ H5Pclose(fcpl_id);
+ fcpl_id = H5P_DEFAULT;
+ }
+ }
+
+ if(pass)
+ saved_fcpl_id = fcpl_id;
+
+ /* setup the file name */
+ if(pass) {
+ if(NULL == h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))) {
+ pass = FALSE;
+ failure_mssg = "h5_fixname() failed.\n";
+ }
+ }
+
+ if(show_progress) /* 2 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ if(pass && try_core_file_driver) {
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
+ }
+ else if(H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) {
+ H5Pclose(fapl_id);
+ fapl_id = H5P_DEFAULT;
+ pass = FALSE;
+ failure_mssg = "H5P_set_fapl_core() failed.\n";
+ }
+ else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) {
+ core_file_driver_failed = TRUE;
+
+ if(verbose)
+ HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC);
+ } else {
+ saved_fapl_id = fapl_id;
+ }
+ }
+
+ if(show_progress) /* 3 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ /* if we either aren't using the core file driver, or a create
+ * with the core file driver failed, try again with a regular file.
+ * If this fails, we are cooked.
+ */
+ if(pass && fid < 0) {
+ fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ saved_fid = fid;
+
+ if(fid < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Fcreate() failed.";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC);
+ } /* end if */
+ } /* end if */
+
+ /* Push API context */
+ H5CX_push();
+
+ if(show_progress) /* 4 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ if(pass) {
+ HDassert(fid >= 0);
+ saved_fid = fid;
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Fflush() failed.";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
+ }
+ else {
+ file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE);
+ if(file_ptr == NULL) {
+ pass = FALSE;
+ failure_mssg = "Can't get file_ptr.";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
+ }
+ }
+ }
+
+ if(show_progress) /* 5 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ if(pass) {
+
+ /* A bit of fancy footwork here:
+ *
+ * The call to H5Fcreate() allocates an instance of H5C_t,
+ * initializes it, and stores its address in f->shared->cache.
+ *
+ * We don't want to use this cache, as it has a bunch of extra
+ * initialization that may change over time, and in any case
+ * it will not in general be configured the way we want it.
+ *
+ * We used to deal with this problem by storing the file pointer
+ * in another instance of H5C_t, and then ignoring the original
+ * version. However, this strategy doesn't work any more, as
+ * we can't store the file pointer in the instance of H5C_t,
+ * and we have modified many cache routines to use a file
+ * pointer to look up the target cache.
+ *
+ * Thus we now make note of the address of the instance of
+ * H5C_t created by the call to H5Fcreate(), set
+ * file_ptr->shared->cache to NULL, call H5C_create()
+ * to allocate a new instance of H5C_t for test purposes,
+ * and store than new instance's address in
+ * file_ptr->shared->cache.
+ *
+ * On shut down, we call H5C_dest on our instance of H5C_t,
+ * set file_ptr->shared->cache to point to the original
+ * instance, and then close the file normally.
+ */
+
+ HDassert(saved_cache == NULL);
+ saved_cache = file_ptr->shared->cache;
+ file_ptr->shared->cache = NULL;
+
+ cache_ptr = H5C_create(max_cache_size,
+ min_clean_size,
+ (NUMBER_OF_ENTRY_TYPES - 1),
+ types,
+ check_write_permitted,
+ TRUE,
+ NULL,
+ NULL);
+
+ file_ptr->shared->cache = cache_ptr;
+ }
+
+ if(show_progress) /* 6 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ if(pass) {
+ if(cache_ptr == NULL) {
+ pass = FALSE;
+ failure_mssg = "H5C_create() failed.";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC);
+ }
+ else if(cache_ptr->magic != H5C__H5C_T_MAGIC) {
+ pass = FALSE;
+ failure_mssg = "Bad cache_ptr magic.";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC);
+ }
+ }
+
+ if(show_progress) /* 7 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ if(pass) { /* allocate space for test entries */
+ actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
+
+ if(actual_base_addr == HADDR_UNDEF) {
+ pass = FALSE;
+ failure_mssg = "H5MF_alloc() failed.";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC);
+ } else if(actual_base_addr > BASE_ADDR) {
+ /* If this happens, must increase BASE_ADDR so that the
+ * actual_base_addr is <= BASE_ADDR. This should only happen
+ * if the size of the superblock is increase.
+ */
+ pass = FALSE;
+ failure_mssg = "actual_base_addr > BASE_ADDR";
+
+ if(verbose)
+ HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", FUNC);
+ }
+
+ saved_actual_base_addr = actual_base_addr;
+ }
+
+ if(show_progress) /* 8 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ if(pass) {
+ /* Need to set this else all cache tests will fail */
+ cache_ptr->ignore_tags = TRUE;
+
+ H5C_stats__reset(cache_ptr);
+ ret_val = file_ptr;
+ }
+
+ if(show_progress) /* 9 */
+ HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
+ FUNC, mile_stone++, (int)pass);
+
+ return(ret_val);
+} /* setup_cache() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: takedown_cache()
+ *
+ * Purpose: Flush the specified cache and destroy it. If requested,
+ * dump stats first. Then close and delete the associate
+ * file.
+ *
+ * If pass is FALSE, do nothing.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 9/14/07
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+takedown_cache(H5F_t * file_ptr,
+ hbool_t dump_stats,
+ hbool_t dump_detailed_stats)
+{
+ char filename[512];
+
+ if ( file_ptr != NULL ) {
+ H5C_t * cache_ptr = file_ptr->shared->cache;
+
+ if ( dump_stats ) {
+
+ H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
+ }
+
+ if ( H5C_prep_for_file_close(file_ptr) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "unexpected failure of prep for file close.\n";
+ }
+
+ flush_cache(file_ptr, TRUE, FALSE, FALSE);
+
+ H5C_dest(file_ptr);
+
+ if ( saved_cache != NULL ) {
+
+ file_ptr->shared->cache = saved_cache;
+ saved_cache = NULL;
+ }
+
+ }
+
+ if ( saved_fapl_id != H5P_DEFAULT ) {
+
+ H5Pclose(saved_fapl_id);
+ saved_fapl_id = H5P_DEFAULT;
+ }
+
+ if ( saved_fcpl_id != H5P_DEFAULT ) {
+ H5Pclose(saved_fcpl_id);
+ saved_fcpl_id = H5P_DEFAULT;
+ }
+
+ if ( saved_fid != -1 ) {
+
+ if ( H5F_addr_defined(saved_actual_base_addr) ) {
+
+ if ( NULL == file_ptr ) {
+ file_ptr = (H5F_t *)H5VL_object_verify(saved_fid, H5I_FILE);
+ HDassert ( file_ptr );
+ }
+
+ H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, saved_actual_base_addr,
+ (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
+ saved_actual_base_addr = HADDR_UNDEF;
+ }
+
+ if ( H5Fclose(saved_fid) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "couldn't close test file.";
+
+ } else {
+
+ saved_fid = -1;
+
+ }
+
+ /* Pop API context */
+ H5CX_pop();
+
+ if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) {
+
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
+ == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname() failed.\n";
+ }
+
+ if ( HDremove(filename) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "couldn't delete test file.";
+
+ }
+ }
+ }
+
+ return;
+
+} /* takedown_cache() */
+
/*-------------------------------------------------------------------------
* Function: main
*
diff --git a/test/cache_api.c b/test/cache_api.c
index 87b9567..ca2e0ca 100644
--- a/test/cache_api.c
+++ b/test/cache_api.c
@@ -24,6 +24,11 @@
/* global variable declarations: */
+const char *FILENAME[] = {
+ "cache_api_test",
+ NULL
+};
+
/* macro definitions */
/* private function declarations: */
@@ -207,7 +212,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
/* setup the file name */
if ( pass ) {
- if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename))
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
== NULL ) {
pass = FALSE;
@@ -355,7 +360,7 @@ check_fapl_mdc_api_calls(unsigned paged, hid_t fcpl_id)
/* setup the file name */
if ( pass ) {
- if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename))
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
== NULL ) {
pass = FALSE;
@@ -688,7 +693,7 @@ check_file_mdc_api_calls(unsigned paged, hid_t fcpl_id)
/* setup the file name */
if ( pass ) {
- if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename))
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
== NULL ) {
pass = FALSE;
@@ -1034,7 +1039,7 @@ mdc_api_call_smoke_check(int express_test, unsigned paged, hid_t fcpl_id)
/* setup the file name */
if ( pass ) {
- if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename))
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
== NULL ) {
pass = FALSE;
@@ -1659,7 +1664,7 @@ init_invalid_configs(void) {
configs[13].lower_hr_threshold = 1.00000001f;
/* 14 -- increment too small */
- configs[14].increment = H5_DOUBLE(0.999999999999);
+ configs[14].increment = 0.999999999999;
/* 15 -- invalid flash_incr_mode */
configs[15].flash_incr_mode = (enum H5C_cache_flash_incr_mode)-1;
@@ -1692,7 +1697,7 @@ init_invalid_configs(void) {
/* 23 -- decrement too big */
configs[23].decr_mode = H5C_decr__threshold;
- configs[23].decrement = H5_DOUBLE(1.0000000001);
+ configs[23].decrement = 1.0000000001;
/* 24 -- epochs_before_eviction too small */
configs[24].epochs_before_eviction = 0;
@@ -1704,13 +1709,13 @@ init_invalid_configs(void) {
configs[26].empty_reserve = -0.0000000001f;
/* 27 -- empty_reserve too big */
- configs[27].empty_reserve = H5_DOUBLE(1.00000000001);
+ configs[27].empty_reserve = 1.00000000001;
/* 28 -- upper_hr_threshold too small */
configs[28].upper_hr_threshold = -0.000000001f;
/* 29 -- upper_hr_threshold too big */
- configs[29].upper_hr_threshold = H5_DOUBLE(1.00000001);
+ configs[29].upper_hr_threshold = 1.00000001;
/* 30 -- upper_hr_threshold <= lower_hr_threshold */
configs[30].lower_hr_threshold = 0.9f;
@@ -1963,7 +1968,7 @@ check_file_mdc_api_errs(unsigned paged, hid_t fcpl_id)
HDfprintf(stdout, "%s: calling h5_fixname().\n", FUNC);
}
- if ( h5_fixname(FILENAME[1], H5P_DEFAULT, filename, sizeof(filename))
+ if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
== NULL ) {
pass = FALSE;
diff --git a/test/cache_common.c b/test/cache_common.c
index 24962bc..038a0ed 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -17,52 +17,13 @@
* This file contains common code for tests of the cache
* implemented in H5C.c
*/
+#include "H5private.h"
#include "H5CXprivate.h" /* API Contexts */
-#include "H5MFprivate.h"
#include "H5MMprivate.h"
#include "cache_common.h"
-
-/* global variable declarations: */
-
-const char *FILENAME[] = {
- "cache_test",
- "cache_api_test",
- NULL
-};
-
-hid_t saved_fapl_id = H5P_DEFAULT; /* store the fapl id here between
- * cache setup and takedown. Note
- * that if saved_fapl_id == H5P_DEFAULT,
- * we assume that there is no fapl to
- * close.
- */
-
-hid_t saved_fcpl_id = H5P_DEFAULT; /* store the fcpl id here between
- * cache setup and takedown. Note
- * that if saved_fcpl_id == H5P_DEFAULT,
- * we assume that there is no fcpl to
- * close.
- */
-hid_t saved_fid = -1; /* store the file id here between cache setup
- * and takedown.
- */
-
-H5C_t * saved_cache = NULL; /* store the pointer to the instance of
- * of H5C_t created by H5Fcreate()
- * here between test cache setup and
- * shutdown.
- */
-
-haddr_t saved_actual_base_addr = HADDR_UNDEF; /* Store the address of the
- space allocated for cache items in the file between
- cache setup & takedown */
-
-hbool_t write_permitted = TRUE;
hbool_t pass = TRUE; /* set to false on error */
-hbool_t try_core_file_driver = FALSE;
-hbool_t core_file_driver_failed = FALSE;
const char *failure_mssg = NULL;
static test_entry_t *pico_entries = NULL, *orig_pico_entries = NULL;
@@ -578,35 +539,6 @@ addr_to_type_and_index(haddr_t addr,
/* Call back functions: */
-/*-------------------------------------------------------------------------
- *
- * Function: check_if_write_permitted
- *
- * Purpose: Determine if a write is permitted under the current
- * circumstances, and set *write_permitted_ptr accordingly.
- * As a general rule it is, but when we are running in parallel
- * mode with collective I/O, we must ensure that a read cannot
- * cause a write.
- *
- * In the event of failure, the value of *write_permitted_ptr
- * is undefined.
- *
- * Return: Non-negative on success/Negative on failure.
- *
- * Programmer: John Mainzer, 5/15/04
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_ptr)
-{
- HDassert( write_permitted_ptr );
-
- *write_permitted_ptr = write_permitted;
-
- return(SUCCEED);
-} /* check_write_permitted() */
-
/*-------------------------------------------------------------------------
* Function: get_initial_load_size & friends
@@ -622,7 +554,7 @@ check_write_permitted(const H5F_t H5_ATTR_UNUSED *f, hbool_t *write_permitted_pt
*-------------------------------------------------------------------------
*/
static herr_t
-get_initial_load_size(void *udata, size_t *image_length, int32_t entry_type)
+get_initial_load_size(void *udata, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
@@ -732,7 +664,7 @@ notify_get_initial_load_size(void *udata, size_t *image_length)
*/
static herr_t
get_final_load_size(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED image_len,
- void *udata, size_t *actual_len, int32_t entry_type)
+ void *udata, size_t *actual_len, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
@@ -792,7 +724,8 @@ variable_get_final_load_size(const void *image, size_t image_len,
*/
static htri_t
-verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata, int32_t entry_type)
+verify_chksum(const void H5_ATTR_UNUSED *image, size_t H5_ATTR_UNUSED len, void *udata,
+ int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
@@ -845,8 +778,8 @@ variable_verify_chksum(const void *image, size_t len, void *udata)
*-------------------------------------------------------------------------
*/
static void *
-deserialize(const void *image, size_t len, void *udata, hbool_t *dirty,
- int32_t entry_type)
+deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *udata, hbool_t *dirty,
+ int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
test_entry_t *base_addr;
@@ -1002,12 +935,10 @@ notify_deserialize(const void *image, size_t len, void *udata, hbool_t *dirty)
*-------------------------------------------------------------------------
*/
herr_t
-image_len(const void *thing, size_t *image_length, int32_t entry_type)
+image_len(const void *thing, size_t *image_length, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
const test_entry_t *entry;
- test_entry_t *base_addr;
int32_t type;
- int32_t idx;
HDassert(thing);
HDassert(image_length);
@@ -1017,14 +948,12 @@ image_len(const void *thing, size_t *image_length, int32_t entry_type)
HDassert(entry->self == entry);
type = entry->type;
- idx = entry->index;
HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
HDassert(type == entry_type);
- HDassert((idx >= 0) && (idx <= max_indices[type]));
+ HDassert((entry->index >= 0) && (entry->index <= max_indices[type]));
- base_addr = entries[type];
- HDassert(entry == &(base_addr[idx]));
+ HDassert(entry == &(entries[type][entry->index]));
if(type != VARIABLE_ENTRY_TYPE)
HDassert(entry->size == entry_sizes[type]);
@@ -1124,18 +1053,15 @@ notify_image_len(const void *thing, size_t *image_length)
*-------------------------------------------------------------------------
*/
herr_t
-pre_serialize(H5F_t *f,
+pre_serialize(H5F_t H5_ATTR_NDEBUG_UNUSED *f,
void *thing,
- haddr_t addr,
- size_t len,
+ haddr_t H5_ATTR_NDEBUG_UNUSED addr,
+ size_t H5_ATTR_NDEBUG_UNUSED len,
haddr_t *new_addr_ptr,
size_t *new_len_ptr,
unsigned *flags_ptr)
{
test_entry_t *entry;
- test_entry_t *base_addr;
- int32_t type;
- int32_t idx;
int32_t i;
HDassert(f);
@@ -1155,16 +1081,9 @@ pre_serialize(H5F_t *f,
/* shouldn't serialize the entry unless it is dirty */
HDassert(entry->is_dirty);
-
- type = entry->type;
- idx = entry->index;
-
- HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
- HDassert((idx >= 0) && (idx <= max_indices[type]));
-
- base_addr = entries[type];
-
- HDassert(entry == &(base_addr[idx]));
+ HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES));
+ HDassert((entry->index >= 0) && (entry->index <= max_indices[entry->type]));
+ HDassert(entry == &(entries[entry->type][entry->index]));
HDassert(entry->num_flush_ops >= 0);
HDassert(entry->num_flush_ops < MAX_FLUSH_OPS);
@@ -1376,9 +1295,7 @@ herr_t
serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thing)
{
test_entry_t *entry;
- test_entry_t *base_addr;
int32_t type;
- int32_t idx;
HDassert(image_ptr);
HDassert(thing);
@@ -1392,14 +1309,11 @@ serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len, void *thin
HDassert(entry->is_dirty);
type = entry->type;
- idx = entry->index;
HDassert((type >= 0) && (type < NUMBER_OF_ENTRY_TYPES));
- HDassert((idx >= 0) && (idx <= max_indices[type]));
-
- base_addr = entries[type];
+ HDassert((entry->index >= 0) && (entry->index <= max_indices[type]));
- HDassert(entry == &(base_addr[idx]));
+ HDassert(entry == &(entries[type][entry->index]));
HDassert(entry->num_flush_ops >= 0);
HDassert(entry->num_flush_ops < MAX_FLUSH_OPS);
@@ -1530,21 +1444,19 @@ notify_serialize(const H5F_t H5_ATTR_UNUSED *f, void *image_ptr, size_t len,
*-------------------------------------------------------------------------
*/
static herr_t
-notify(H5C_notify_action_t action, void *thing, int32_t entry_type)
+notify(H5C_notify_action_t action, void *thing, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
test_entry_t *entry;
- test_entry_t *base_addr;
HDassert(thing);
entry = (test_entry_t *)thing;
- base_addr = entries[entry->type];
HDassert(entry->index >= 0);
HDassert(entry->index <= max_indices[entry->type]);
HDassert((entry->type >= 0) && (entry->type < NUMBER_OF_ENTRY_TYPES));
HDassert(entry->type == entry_type);
- HDassert(entry == &(base_addr[entry->index]));
+ HDassert(entry == &(entries[entry->type][entry->index]));
HDassert(entry == entry->self);
if(!(action == H5C_NOTIFY_ACTION_ENTRY_DIRTIED && entry->action == TEST_ENTRY_ACTION_MOVE))
HDassert(entry->header.addr == entry->addr);
@@ -1609,18 +1521,14 @@ notify_notify(H5C_notify_action_t action, void *thing)
*-------------------------------------------------------------------------
*/
herr_t
-free_icr(test_entry_t *entry, int32_t entry_type)
+free_icr(test_entry_t *entry, int32_t H5_ATTR_NDEBUG_UNUSED entry_type)
{
- test_entry_t *base_addr;
-
HDassert(entry);
- base_addr = entries[entry->type];
-
HDassert(entry->type == entry_type);
HDassert(entry->index >= 0);
HDassert(entry->index <= max_indices[entry->type]);
- HDassert(entry == &(base_addr[entry->index]));
+ HDassert(entry == &(entries[entry->type][entry->index]));
HDassert(entry == entry->self);
HDassert(entry->cache_ptr != NULL);
HDassert(entry->cache_ptr->magic == H5C__H5C_T_MAGIC);
@@ -3130,404 +3038,6 @@ verify_unprotected(void)
} /* verify_unprotected() */
-/*****************************************************************************
- *
- * Function: setup_cache()
- *
- * Purpose: Open an HDF file. This will allocate an instance and
- * initialize an associated instance of H5C_t. However,
- * we want to test an instance of H5C_t, so allocate and
- * initialize one with the file ID returned by the call to
- * H5Fcreate(). Return a pointer to this instance of H5C_t.
- *
- * Observe that we open a HDF file because the cache now
- * writes directly to file, and we need the file I/O facilities
- * associated with the file.
- *
- * To avoid tripping on error check code, must allocate enough
- * space in the file to hold all the test entries and their
- * alternates. This is a little sticky, as the addresses of
- * all the test entries are determined at compile time.
- *
- * Deal with this by choosing BASE_ADDR large enough that
- * the base address of the allocate space will be less than
- * or equal to BASE_ADDR, and then requesting an extra BASE_ADDR
- * bytes, so we don't have to wory about exceeding the allocation.
- *
- * Return: Success: Ptr to H5C_t
- *
- * Failure: NULL
- *
- * Programmer: JRM -- 9/13/07
- *
- *****************************************************************************/
-
-H5F_t *
-setup_cache(size_t max_cache_size,
- size_t min_clean_size,
- unsigned paged)
-{
- char filename[512];
- hbool_t show_progress = FALSE;
- hbool_t verbose = TRUE;
- int mile_stone = 1;
- hid_t fid = -1;
- H5F_t * file_ptr = NULL;
- H5C_t * cache_ptr = NULL;
- H5F_t * ret_val = NULL;
- haddr_t actual_base_addr;
- hid_t fapl_id = H5P_DEFAULT;
- hid_t fcpl_id = H5P_DEFAULT;
-
- if(show_progress) /* 1 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- saved_fid = -1;
-
- if(pass) {
- if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) == FAIL) {
- pass = FALSE;
- failure_mssg = "H5Pcreate(H5P_FILE_CREATE) failed.\n";
- }
- }
-
- if(pass && paged) {
- /* Set up paged aggregation strategy */
- if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, 1, (hsize_t)1) == FAIL) {
- pass = FALSE;
- failure_mssg = "H5Pset_file_space_strategy() failed.\n";
- H5Pclose(fcpl_id);
- fcpl_id = H5P_DEFAULT;
- }
- }
-
- if(pass && paged) {
- /* Set up file space page size to BASE_ADDR */
- if(H5Pset_file_space_page_size(fcpl_id, (hsize_t)BASE_ADDR) == FAIL) {
- pass = FALSE;
- failure_mssg = "H5Pset_file_space_page_size() failed.\n";
- H5Pclose(fcpl_id);
- fcpl_id = H5P_DEFAULT;
- }
- }
-
- if(pass)
- saved_fcpl_id = fcpl_id;
-
- /* setup the file name */
- if(pass) {
- if(NULL == h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))) {
- pass = FALSE;
- failure_mssg = "h5_fixname() failed.\n";
- }
- }
-
- if(show_progress) /* 2 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- if(pass && try_core_file_driver) {
- if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == FAIL) {
- pass = FALSE;
- failure_mssg = "H5Pcreate(H5P_FILE_ACCESS) failed.\n";
- }
- else if(H5Pset_fapl_core(fapl_id, MAX_ADDR, FALSE) < 0) {
- H5Pclose(fapl_id);
- fapl_id = H5P_DEFAULT;
- pass = FALSE;
- failure_mssg = "H5P_set_fapl_core() failed.\n";
- }
- else if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) {
- core_file_driver_failed = TRUE;
-
- if(verbose)
- HDfprintf(stdout, "%s: H5Fcreate() with CFD failed.\n", FUNC);
- } else {
- saved_fapl_id = fapl_id;
- }
- }
-
- if(show_progress) /* 3 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- /* if we either aren't using the core file driver, or a create
- * with the core file driver failed, try again with a regular file.
- * If this fails, we are cooked.
- */
- if(pass && fid < 0) {
- fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- saved_fid = fid;
-
- if(fid < 0) {
- pass = FALSE;
- failure_mssg = "H5Fcreate() failed.";
-
- if(verbose)
- HDfprintf(stdout, "%s: H5Fcreate() failed.\n", FUNC);
- } /* end if */
- } /* end if */
-
- /* Push API context */
- H5CX_push();
-
- if(show_progress) /* 4 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- if(pass) {
- HDassert(fid >= 0);
- saved_fid = fid;
- if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
- pass = FALSE;
- failure_mssg = "H5Fflush() failed.";
-
- if(verbose)
- HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
- }
- else {
- file_ptr = (H5F_t *)H5VL_object_verify(fid, H5I_FILE);
- if(file_ptr == NULL) {
- pass = FALSE;
- failure_mssg = "Can't get file_ptr.";
-
- if(verbose)
- HDfprintf(stdout, "%s: H5Fflush() failed.\n", FUNC);
- }
- }
- }
-
- if(show_progress) /* 5 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- if(pass) {
-
- /* A bit of fancy footwork here:
- *
- * The call to H5Fcreate() allocates an instance of H5C_t,
- * initializes it, and stores its address in f->shared->cache.
- *
- * We don't want to use this cache, as it has a bunch of extra
- * initialization that may change over time, and in any case
- * it will not in general be configured the way we want it.
- *
- * We used to deal with this problem by storing the file pointer
- * in another instance of H5C_t, and then ignoring the original
- * version. However, this strategy doesn't work any more, as
- * we can't store the file pointer in the instance of H5C_t,
- * and we have modified many cache routines to use a file
- * pointer to look up the target cache.
- *
- * Thus we now make note of the address of the instance of
- * H5C_t created by the call to H5Fcreate(), set
- * file_ptr->shared->cache to NULL, call H5C_create()
- * to allocate a new instance of H5C_t for test purposes,
- * and store than new instance's address in
- * file_ptr->shared->cache.
- *
- * On shut down, we call H5C_dest on our instance of H5C_t,
- * set file_ptr->shared->cache to point to the original
- * instance, and then close the file normally.
- */
-
- HDassert(saved_cache == NULL);
- saved_cache = file_ptr->shared->cache;
- file_ptr->shared->cache = NULL;
-
- cache_ptr = H5C_create(max_cache_size,
- min_clean_size,
- (NUMBER_OF_ENTRY_TYPES - 1),
- types,
- check_write_permitted,
- TRUE,
- NULL,
- NULL);
-
- file_ptr->shared->cache = cache_ptr;
- }
-
- if(show_progress) /* 6 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- if(pass) {
- if(cache_ptr == NULL) {
- pass = FALSE;
- failure_mssg = "H5C_create() failed.";
-
- if(verbose)
- HDfprintf(stdout, "%s: H5C_create() failed.\n", FUNC);
- }
- else if(cache_ptr->magic != H5C__H5C_T_MAGIC) {
- pass = FALSE;
- failure_mssg = "Bad cache_ptr magic.";
-
- if(verbose)
- HDfprintf(stdout, "%s: Bad cache_ptr magic.\n", FUNC);
- }
- }
-
- if(show_progress) /* 7 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- if(pass) { /* allocate space for test entries */
- actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
-
- if(actual_base_addr == HADDR_UNDEF) {
- pass = FALSE;
- failure_mssg = "H5MF_alloc() failed.";
-
- if(verbose)
- HDfprintf(stdout, "%s: H5MF_alloc() failed.\n", FUNC);
- } else if(actual_base_addr > BASE_ADDR) {
- /* If this happens, must increase BASE_ADDR so that the
- * actual_base_addr is <= BASE_ADDR. This should only happen
- * if the size of the superblock is increase.
- */
- pass = FALSE;
- failure_mssg = "actual_base_addr > BASE_ADDR";
-
- if(verbose)
- HDfprintf(stdout, "%s: actual_base_addr > BASE_ADDR.\n", FUNC);
- }
-
- saved_actual_base_addr = actual_base_addr;
- }
-
- if(show_progress) /* 8 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- if(pass) {
- /* Need to set this else all cache tests will fail */
- cache_ptr->ignore_tags = TRUE;
-
- H5C_stats__reset(cache_ptr);
- ret_val = file_ptr;
- }
-
- if(show_progress) /* 9 */
- HDfprintf(stdout, "%s() - %0d -- pass = %d\n",
- FUNC, mile_stone++, (int)pass);
-
- return(ret_val);
-} /* setup_cache() */
-
-
-/*-------------------------------------------------------------------------
- * Function: takedown_cache()
- *
- * Purpose: Flush the specified cache and destroy it. If requested,
- * dump stats first. Then close and delete the associate
- * file.
- *
- * If pass is FALSE, do nothing.
- *
- * Return: void
- *
- * Programmer: John Mainzer
- * 9/14/07
- *
- *-------------------------------------------------------------------------
- */
-
-void
-takedown_cache(H5F_t * file_ptr,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats)
-{
- char filename[512];
-
- if ( file_ptr != NULL ) {
- H5C_t * cache_ptr = file_ptr->shared->cache;
-
- if ( dump_stats ) {
-
- H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
- }
-
- if ( H5C_prep_for_file_close(file_ptr) < 0 ) {
-
- pass = FALSE;
- failure_mssg = "unexpected failure of prep for file close.\n";
- }
-
- flush_cache(file_ptr, TRUE, FALSE, FALSE);
-
- H5C_dest(file_ptr);
-
- if ( saved_cache != NULL ) {
-
- file_ptr->shared->cache = saved_cache;
- saved_cache = NULL;
- }
-
- }
-
- if ( saved_fapl_id != H5P_DEFAULT ) {
-
- H5Pclose(saved_fapl_id);
- saved_fapl_id = H5P_DEFAULT;
- }
-
- if ( saved_fcpl_id != H5P_DEFAULT ) {
- H5Pclose(saved_fcpl_id);
- saved_fcpl_id = H5P_DEFAULT;
- }
-
- if ( saved_fid != -1 ) {
-
- if ( H5F_addr_defined(saved_actual_base_addr) ) {
-
- if ( NULL == file_ptr ) {
- file_ptr = (H5F_t *)H5VL_object_verify(saved_fid, H5I_FILE);
- HDassert ( file_ptr );
- }
-
- H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, saved_actual_base_addr,
- (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR));
- saved_actual_base_addr = HADDR_UNDEF;
- }
-
- if ( H5Fclose(saved_fid) < 0 ) {
-
- pass = FALSE;
- failure_mssg = "couldn't close test file.";
-
- } else {
-
- saved_fid = -1;
-
- }
-
- /* Pop API context */
- H5CX_pop();
-
- if ( ( ! try_core_file_driver ) || ( core_file_driver_failed ) ) {
-
- if ( h5_fixname(FILENAME[0], H5P_DEFAULT, filename, sizeof(filename))
- == NULL ) {
-
- pass = FALSE;
- failure_mssg = "h5_fixname() failed.\n";
- }
-
- if ( HDremove(filename) < 0 ) {
-
- pass = FALSE;
- failure_mssg = "couldn't delete test file.";
-
- }
- }
- }
-
- return;
-
-} /* takedown_cache() */
-
/*-------------------------------------------------------------------------
* Function: expunge_entry()
diff --git a/test/cache_common.h b/test/cache_common.h
index 2604567..785dc21 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -14,17 +14,18 @@
/* Programmer: John Mainzer
* 10/27/05
*
- * This file contains common #defines, type definitions, and
- * externs for tests of the cache implemented in H5C.c
+ * This file contains common #defines, type definitions, and
+ * externs for tests of the cache implemented in H5C.c
*/
#ifndef _CACHE_COMMON_H
#define _CACHE_COMMON_H
-#define H5C_FRIEND /*suppress error about including H5Cpkg */
-#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5C_FRIEND /*suppress error about including H5Cpkg */
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
/* Include library header files */
#include "H5ACprivate.h"
+#include "H5MFprivate.h"
#include "H5Cpkg.h"
#include "H5Fpkg.h"
#include "H5Iprivate.h"
@@ -36,174 +37,174 @@
/* Macro to make error reporting easier */
#define CACHE_ERROR(s) {failure_mssg = "Line #" H5_TOSTRING(__LINE__) ": " s ; pass = FALSE; goto done;}
-#define NO_CHANGE -1
+#define NO_CHANGE -1
/* with apologies for the abuse of terminology... */
-#define PICO_ENTRY_TYPE 0
-#define NANO_ENTRY_TYPE 1
-#define MICRO_ENTRY_TYPE 2
-#define TINY_ENTRY_TYPE 3
-#define SMALL_ENTRY_TYPE 4
-#define MEDIUM_ENTRY_TYPE 5
-#define LARGE_ENTRY_TYPE 6
-#define HUGE_ENTRY_TYPE 7
-#define MONSTER_ENTRY_TYPE 8
-#define VARIABLE_ENTRY_TYPE 9
-#define NOTIFY_ENTRY_TYPE 10
+#define PICO_ENTRY_TYPE 0
+#define NANO_ENTRY_TYPE 1
+#define MICRO_ENTRY_TYPE 2
+#define TINY_ENTRY_TYPE 3
+#define SMALL_ENTRY_TYPE 4
+#define MEDIUM_ENTRY_TYPE 5
+#define LARGE_ENTRY_TYPE 6
+#define HUGE_ENTRY_TYPE 7
+#define MONSTER_ENTRY_TYPE 8
+#define VARIABLE_ENTRY_TYPE 9
+#define NOTIFY_ENTRY_TYPE 10
#define NUMBER_OF_ENTRY_TYPES 11
-#define PICO_ENTRY_SIZE (size_t)1
-#define NANO_ENTRY_SIZE (size_t)4
-#define MICRO_ENTRY_SIZE (size_t)16
-#define TINY_ENTRY_SIZE (size_t)64
-#define SMALL_ENTRY_SIZE (size_t)256
-#define MEDIUM_ENTRY_SIZE (size_t)1024
-#define LARGE_ENTRY_SIZE (size_t)(4 * 1024)
-#define HUGE_ENTRY_SIZE (size_t)(16 * 1024)
-#define MONSTER_ENTRY_SIZE (size_t)(64 * 1024)
-#define VARIABLE_ENTRY_SIZE (size_t)(10 * 1024)
-#define NOTIFY_ENTRY_SIZE (size_t)1
-
-#define NUM_PICO_ENTRIES (10 * 1024)
-#define NUM_NANO_ENTRIES (10 * 1024)
-#define NUM_MICRO_ENTRIES (10 * 1024)
-#define NUM_TINY_ENTRIES (10 * 1024)
-#define NUM_SMALL_ENTRIES (10 * 1024)
-#define NUM_MEDIUM_ENTRIES (10 * 1024)
-#define NUM_LARGE_ENTRIES (10 * 1024)
-#define NUM_HUGE_ENTRIES (10 * 1024)
-#define NUM_MONSTER_ENTRIES (10 * 1024)
-#define NUM_VARIABLE_ENTRIES (10 * 1024)
-#define NUM_NOTIFY_ENTRIES (10 * 1024)
-
-#define MAX_ENTRIES (10 * 1024)
+#define PICO_ENTRY_SIZE (size_t)1
+#define NANO_ENTRY_SIZE (size_t)4
+#define MICRO_ENTRY_SIZE (size_t)16
+#define TINY_ENTRY_SIZE (size_t)64
+#define SMALL_ENTRY_SIZE (size_t)256
+#define MEDIUM_ENTRY_SIZE (size_t)1024
+#define LARGE_ENTRY_SIZE (size_t)(4 * 1024)
+#define HUGE_ENTRY_SIZE (size_t)(16 * 1024)
+#define MONSTER_ENTRY_SIZE (size_t)(64 * 1024)
+#define VARIABLE_ENTRY_SIZE (size_t)(10 * 1024)
+#define NOTIFY_ENTRY_SIZE (size_t)1
+
+#define NUM_PICO_ENTRIES (10 * 1024)
+#define NUM_NANO_ENTRIES (10 * 1024)
+#define NUM_MICRO_ENTRIES (10 * 1024)
+#define NUM_TINY_ENTRIES (10 * 1024)
+#define NUM_SMALL_ENTRIES (10 * 1024)
+#define NUM_MEDIUM_ENTRIES (10 * 1024)
+#define NUM_LARGE_ENTRIES (10 * 1024)
+#define NUM_HUGE_ENTRIES (10 * 1024)
+#define NUM_MONSTER_ENTRIES (10 * 1024)
+#define NUM_VARIABLE_ENTRIES (10 * 1024)
+#define NUM_NOTIFY_ENTRIES (10 * 1024)
+
+#define MAX_ENTRIES (10 * 1024)
/* The choice of the BASE_ADDR below is arbitrary -- it just has to be
* larger than the superblock.
*/
-#define BASE_ADDR (haddr_t)1024
-#define PICO_BASE_ADDR BASE_ADDR
-#define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + \
+#define BASE_ADDR (haddr_t)1024
+#define PICO_BASE_ADDR BASE_ADDR
+#define NANO_BASE_ADDR (haddr_t)(PICO_BASE_ADDR + \
(PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
-#define MICRO_BASE_ADDR (haddr_t)(NANO_BASE_ADDR + \
+#define MICRO_BASE_ADDR (haddr_t)(NANO_BASE_ADDR + \
(NANO_ENTRY_SIZE * NUM_NANO_ENTRIES))
-#define TINY_BASE_ADDR (haddr_t)(MICRO_BASE_ADDR + \
- (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
-#define SMALL_BASE_ADDR (haddr_t)(TINY_BASE_ADDR + \
+#define TINY_BASE_ADDR (haddr_t)(MICRO_BASE_ADDR + \
+ (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
+#define SMALL_BASE_ADDR (haddr_t)(TINY_BASE_ADDR + \
(TINY_ENTRY_SIZE * NUM_TINY_ENTRIES))
-#define MEDIUM_BASE_ADDR (haddr_t)(SMALL_BASE_ADDR + \
+#define MEDIUM_BASE_ADDR (haddr_t)(SMALL_BASE_ADDR + \
(SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES))
-#define LARGE_BASE_ADDR (haddr_t)(MEDIUM_BASE_ADDR + \
+#define LARGE_BASE_ADDR (haddr_t)(MEDIUM_BASE_ADDR + \
(MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES))
-#define HUGE_BASE_ADDR (haddr_t)(LARGE_BASE_ADDR + \
+#define HUGE_BASE_ADDR (haddr_t)(LARGE_BASE_ADDR + \
(LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES))
-#define MONSTER_BASE_ADDR (haddr_t)(HUGE_BASE_ADDR + \
+#define MONSTER_BASE_ADDR (haddr_t)(HUGE_BASE_ADDR + \
(HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
-#define VARIABLE_BASE_ADDR (haddr_t)(MONSTER_BASE_ADDR + \
- (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
-#define NOTIFY_BASE_ADDR (haddr_t)(VARIABLE_BASE_ADDR + \
- (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
-
-#define PICO_ALT_BASE_ADDR (haddr_t)(NOTIFY_BASE_ADDR + \
- (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
-#define NANO_ALT_BASE_ADDR (haddr_t)(PICO_ALT_BASE_ADDR + \
+#define VARIABLE_BASE_ADDR (haddr_t)(MONSTER_BASE_ADDR + \
+ (MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
+#define NOTIFY_BASE_ADDR (haddr_t)(VARIABLE_BASE_ADDR + \
+ (VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
+
+#define PICO_ALT_BASE_ADDR (haddr_t)(NOTIFY_BASE_ADDR + \
+ (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
+#define NANO_ALT_BASE_ADDR (haddr_t)(PICO_ALT_BASE_ADDR + \
(PICO_ENTRY_SIZE * NUM_PICO_ENTRIES))
-#define MICRO_ALT_BASE_ADDR (haddr_t)(NANO_ALT_BASE_ADDR + \
+#define MICRO_ALT_BASE_ADDR (haddr_t)(NANO_ALT_BASE_ADDR + \
(NANO_ENTRY_SIZE * NUM_NANO_ENTRIES))
-#define TINY_ALT_BASE_ADDR (haddr_t)(MICRO_ALT_BASE_ADDR + \
- (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
-#define SMALL_ALT_BASE_ADDR (haddr_t)(TINY_ALT_BASE_ADDR + \
+#define TINY_ALT_BASE_ADDR (haddr_t)(MICRO_ALT_BASE_ADDR + \
+ (MICRO_ENTRY_SIZE * NUM_MICRO_ENTRIES))
+#define SMALL_ALT_BASE_ADDR (haddr_t)(TINY_ALT_BASE_ADDR + \
(TINY_ENTRY_SIZE * NUM_TINY_ENTRIES))
-#define MEDIUM_ALT_BASE_ADDR (haddr_t)(SMALL_ALT_BASE_ADDR + \
+#define MEDIUM_ALT_BASE_ADDR (haddr_t)(SMALL_ALT_BASE_ADDR + \
(SMALL_ENTRY_SIZE * NUM_SMALL_ENTRIES))
-#define LARGE_ALT_BASE_ADDR (haddr_t)(MEDIUM_ALT_BASE_ADDR + \
+#define LARGE_ALT_BASE_ADDR (haddr_t)(MEDIUM_ALT_BASE_ADDR + \
(MEDIUM_ENTRY_SIZE * NUM_MEDIUM_ENTRIES))
-#define HUGE_ALT_BASE_ADDR (haddr_t)(LARGE_ALT_BASE_ADDR + \
+#define HUGE_ALT_BASE_ADDR (haddr_t)(LARGE_ALT_BASE_ADDR + \
(LARGE_ENTRY_SIZE * NUM_LARGE_ENTRIES))
-#define MONSTER_ALT_BASE_ADDR (haddr_t)(HUGE_ALT_BASE_ADDR + \
+#define MONSTER_ALT_BASE_ADDR (haddr_t)(HUGE_ALT_BASE_ADDR + \
(HUGE_ENTRY_SIZE * NUM_HUGE_ENTRIES))
-#define VARIABLE_ALT_BASE_ADDR (haddr_t)(MONSTER_ALT_BASE_ADDR + \
+#define VARIABLE_ALT_BASE_ADDR (haddr_t)(MONSTER_ALT_BASE_ADDR + \
(MONSTER_ENTRY_SIZE * NUM_MONSTER_ENTRIES))
-#define NOTIFY_ALT_BASE_ADDR (haddr_t)(VARIABLE_ALT_BASE_ADDR + \
+#define NOTIFY_ALT_BASE_ADDR (haddr_t)(VARIABLE_ALT_BASE_ADDR + \
(VARIABLE_ENTRY_SIZE * NUM_VARIABLE_ENTRIES))
-#define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + \
- (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
-#define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR)
-
-#define MAX_PINS 8 /* Maximum number of entries that can be
- * directly pinned by a single entry.
- */
-
-#define FLUSH_OP__NO_OP 0
-#define FLUSH_OP__DIRTY 1
-#define FLUSH_OP__RESIZE 2
-#define FLUSH_OP__MOVE 3
-#define FLUSH_OP__ORDER 4
-#define FLUSH_OP__EXPUNGE 5
-#define FLUSH_OP__DEST_FLUSH_DEP 6
-#define FLUSH_OP__MAX_OP 6
-
-#define MAX_FLUSH_OPS 10 /* Maximum number of flush operations
- * that can be associated with a
- * cache entry.
- */
+#define MAX_ADDR (haddr_t)(NOTIFY_ALT_BASE_ADDR + \
+ (NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
+#define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR)
+
+#define MAX_PINS 8 /* Maximum number of entries that can be
+ * directly pinned by a single entry.
+ */
+
+#define FLUSH_OP__NO_OP 0
+#define FLUSH_OP__DIRTY 1
+#define FLUSH_OP__RESIZE 2
+#define FLUSH_OP__MOVE 3
+#define FLUSH_OP__ORDER 4
+#define FLUSH_OP__EXPUNGE 5
+#define FLUSH_OP__DEST_FLUSH_DEP 6
+#define FLUSH_OP__MAX_OP 6
+
+#define MAX_FLUSH_OPS 10 /* Maximum number of flush operations
+ * that can be associated with a
+ * cache entry.
+ */
#define MAX_FLUSH_DEP_PARS 8 /* Maximum number of flush dependency
* parents in the test */
typedef struct flush_op
{
- int op_code; /* integer op code indicating the
- * operation to be performed. At
- * present it must be one of:
- *
- * FLUSH_OP__NO_OP
- * FLUSH_OP__DIRTY
- * FLUSH_OP__RESIZE
- * FLUSH_OP__MOVE
- * FLUSH_OP__ORDER
- */
- int type; /* type code of the cache entry that
- * is the target of the operation.
- * This value is passed into the
- * function implementing the flush
- * operation.
- */
- int idx; /* index of the cache entry that
- * is the target of the operation.
- * This value is passed into the
+ int op_code; /* integer op code indicating the
+ * operation to be performed. At
+ * present it must be one of:
+ *
+ * FLUSH_OP__NO_OP
+ * FLUSH_OP__DIRTY
+ * FLUSH_OP__RESIZE
+ * FLUSH_OP__MOVE
+ * FLUSH_OP__ORDER
+ */
+ int type; /* type code of the cache entry that
+ * is the target of the operation.
+ * This value is passed into the
+ * function implementing the flush
+ * operation.
+ */
+ int idx; /* index of the cache entry that
+ * is the target of the operation.
+ * This value is passed into the
* function implementing the flush
* operation.
- */
- hbool_t flag; /* boolean flag passed into the
- * function implementing the flush
- * operation. The meaning of the
- * flag is dependent upon the flush
- * operation:
- *
- * FLUSH_OP__DIRTY: TRUE iff the
- * target is pinned, and is to
- * be dirtied via the
- * H5C_mark_entry_dirty()
- * call.
- *
- * FLUSH_OP__RESIZE: TRUE iff the
- * target is pinned, and is to
- * be resized via the
- * H5C_resize_entry()
- * call.
- *
- * FLUSH_OP__MOVE: TRUE iff the
- * target is to be moved to
- * its main address.
- */
- size_t size; /* New target size in the
- * FLUSH_OP__MOVE operation.
- * Unused elsewhere.
- */
+ */
+ hbool_t flag; /* boolean flag passed into the
+ * function implementing the flush
+ * operation. The meaning of the
+ * flag is dependent upon the flush
+ * operation:
+ *
+ * FLUSH_OP__DIRTY: TRUE iff the
+ * target is pinned, and is to
+ * be dirtied via the
+ * H5C_mark_entry_dirty()
+ * call.
+ *
+ * FLUSH_OP__RESIZE: TRUE iff the
+ * target is pinned, and is to
+ * be resized via the
+ * H5C_resize_entry()
+ * call.
+ *
+ * FLUSH_OP__MOVE: TRUE iff the
+ * target is to be moved to
+ * its main address.
+ */
+ size_t size; /* New target size in the
+ * FLUSH_OP__MOVE operation.
+ * Unused elsewhere.
+ */
unsigned * order_ptr; /* Pointer to outside counter for
* recording the order of entries
* flushed.
@@ -217,135 +218,135 @@ typedef enum test_entry_action_t {
typedef struct test_entry_t
{
- H5C_cache_entry_t header; /* entry data used by the cache
- * -- must be first
- */
- struct test_entry_t * self; /* pointer to this entry -- used for
- * sanity checking.
+ H5C_cache_entry_t header; /* entry data used by the cache
+ * -- must be first
+ */
+ struct test_entry_t * self; /* pointer to this entry -- used for
+ * sanity checking.
*/
test_entry_action_t action; /* Action being performed on a test entry */
H5F_t * file_ptr; /* pointer to the file in which the
* entry resides, or NULL if the entry
* is not in a file.
*/
- H5C_t * cache_ptr; /* pointer to the cache in which
- * the entry resides, or NULL if the
- * entry is not in cache.
- */
- hbool_t written_to_main_addr;
- /* Flag indicating whether an image
- * of the entry has been written to
- * its main address. Since we no
- * longer have a flush callback, we
- * set this field to true whenever the
- * entry is serialized while at its
- * main address.
- */
- hbool_t written_to_alt_addr;
+ H5C_t * cache_ptr; /* pointer to the cache in which
+ * the entry resides, or NULL if the
+ * entry is not in cache.
+ */
+ hbool_t written_to_main_addr;
+ /* Flag indicating whether an image
+ * of the entry has been written to
+ * its main address. Since we no
+ * longer have a flush callback, we
+ * set this field to true whenever the
+ * entry is serialized while at its
+ * main address.
+ */
+ hbool_t written_to_alt_addr;
/* Flag indicating whether an image
- * of the entry has been written to
- * its alternate address. Since we no
- * longer have a flush callback, we
- * set this field to true whenever the
- * entry is serialized while at its
- * alternate address.
- */
- haddr_t addr; /* where the cache thinks this entry
+ * of the entry has been written to
+ * its alternate address. Since we no
+ * longer have a flush callback, we
+ * set this field to true whenever the
+ * entry is serialized while at its
+ * alternate address.
+ */
+ haddr_t addr; /* where the cache thinks this entry
* is located
*/
- hbool_t at_main_addr; /* boolean flag indicating whether
- * the entry is supposed to be at
- * either its main or alternate
- * address.
- */
- haddr_t main_addr; /* initial location of the entry
+ hbool_t at_main_addr; /* boolean flag indicating whether
+ * the entry is supposed to be at
+ * either its main or alternate
+ * address.
+ */
+ haddr_t main_addr; /* initial location of the entry
*/
- haddr_t alt_addr; /* location to which the entry
- * can be relocated or "moved"
+ haddr_t alt_addr; /* location to which the entry
+ * can be relocated or "moved"
*/
- size_t size; /* how big the cache thinks this
+ size_t size; /* how big the cache thinks this
* entry is
*/
- int32_t type; /* indicates which entry array this
- * entry is in
+ int32_t type; /* indicates which entry array this
+ * entry is in
*/
- int32_t index; /* index in its entry array
+ int32_t index; /* index in its entry array
*/
- int32_t serializes; /* number of times this entry has
- * been serialized.
+ int32_t serializes; /* number of times this entry has
+ * been serialized.
*/
- int32_t deserializes; /* number of times this entry has
+ int32_t deserializes; /* number of times this entry has
* been deserialized
*/
- hbool_t is_dirty; /* entry has been modified since
+ hbool_t is_dirty; /* entry has been modified since
* last write
*/
- hbool_t is_protected; /* entry should currently be on
- * the cache's protected list.
+ hbool_t is_protected; /* entry should currently be on
+ * the cache's protected list.
*/
- hbool_t is_read_only; /* TRUE iff the entry should be
- * protected read only.
- */
- int ro_ref_count; /* Number of outstanding read only
- * protects on the entry.
- */
- hbool_t is_pinned; /* entry is currently pinned in
- * the cache.
+ hbool_t is_read_only; /* TRUE iff the entry should be
+ * protected read only.
+ */
+ int ro_ref_count; /* Number of outstanding read only
+ * protects on the entry.
+ */
+ hbool_t is_pinned; /* entry is currently pinned in
+ * the cache.
*/
- haddr_t tag; /* the base_addr as tag for corking entries */
- hbool_t is_corked; /* entry is currently corked or not */
- int pinning_ref_count; /* Number of entries that
- * pin this entry in the cache.
- * When this count drops to zero,
- * this entry should be unpinned.
- */
- int num_pins; /* Number of entries that this
- * entry pins in the cache. This
- * value must be in the range
- * [0, MAX_PINS].
- */
- int pin_type[MAX_PINS]; /* array of the types of entries
- * pinned by this entry.
- */
- int pin_idx[MAX_PINS]; /* array of the indicies of
- * entries pinned by this entry.
- */
- int num_flush_ops; /* integer field containing the
- * number of flush operations to
- * be executed when the entry is
- * flushed. This value must lie in
- * the closed interval
- * [0, MAX_FLUSH_OPS].
- */
- struct flush_op flush_ops[MAX_FLUSH_OPS]; /* Array of instances
- * of struct flush_op detailing the
- * flush operations (if any) that
- * are to be executed when the entry
- * is flushed from the cache.
- *
- * num_flush_ops contains the number
- * of valid entries in this array.
- */
- hbool_t flush_op_self_resize_in_progress; /* Boolean flag
- * that is set to TRUE iff this
- * entry is being flushed, it has
- * been resized by a resize flush
- * op, and the flush function has
- * not yet returned, This field is
- * used to turn off overactive santity
- * checking code that would otherwise
- * cause a false test failure.
- */
- hbool_t deserialized; /* entry has been deserialized since
- * the last time it was reset.
+ haddr_t tag; /* the base_addr as tag for corking entries */
+ hbool_t is_corked; /* entry is currently corked or not */
+ int pinning_ref_count; /* Number of entries that
+ * pin this entry in the cache.
+ * When this count drops to zero,
+ * this entry should be unpinned.
+ */
+ int num_pins; /* Number of entries that this
+ * entry pins in the cache. This
+ * value must be in the range
+ * [0, MAX_PINS].
+ */
+ int pin_type[MAX_PINS]; /* array of the types of entries
+ * pinned by this entry.
+ */
+ int pin_idx[MAX_PINS]; /* array of the indicies of
+ * entries pinned by this entry.
+ */
+ int num_flush_ops; /* integer field containing the
+ * number of flush operations to
+ * be executed when the entry is
+ * flushed. This value must lie in
+ * the closed interval
+ * [0, MAX_FLUSH_OPS].
+ */
+ struct flush_op flush_ops[MAX_FLUSH_OPS]; /* Array of instances
+ * of struct flush_op detailing the
+ * flush operations (if any) that
+ * are to be executed when the entry
+ * is flushed from the cache.
+ *
+ * num_flush_ops contains the number
+ * of valid entries in this array.
+ */
+ hbool_t flush_op_self_resize_in_progress; /* Boolean flag
+ * that is set to TRUE iff this
+ * entry is being flushed, it has
+ * been resized by a resize flush
+ * op, and the flush function has
+ * not yet returned, This field is
+ * used to turn off overactive santity
+ * checking code that would otherwise
+ * cause a false test failure.
+ */
+ hbool_t deserialized; /* entry has been deserialized since
+ * the last time it was reset.
*/
- hbool_t serialized; /* entry has been serialized since the
+ hbool_t serialized; /* entry has been serialized since the
* last time it was reset.
*/
hbool_t destroyed; /* entry has been destroyed since the
* last time it was reset.
*/
- hbool_t expunged; /* entry has been expunged since the
+ hbool_t expunged; /* entry has been expunged since the
* last time it was reset.
*/
int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */
@@ -353,15 +354,15 @@ typedef struct test_entry_t
unsigned flush_dep_npar; /* Number of flush dependency parents */
unsigned flush_dep_nchd; /* Number of flush dependency children */
unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children (including granchildren, etc.) */
- hbool_t pinned_from_client; /* entry was pinned by client call */
- hbool_t pinned_from_cache; /* entry was pinned by cache internally */
+ hbool_t pinned_from_client; /* entry was pinned by client call */
+ hbool_t pinned_from_cache; /* entry was pinned by cache internally */
unsigned flush_order; /* Order that entry was flushed in */
unsigned notify_after_insert_count; /* Count of times that entry was inserted in cache */
unsigned notify_before_evict_count; /* Count of times that entry was removed in cache */
- size_t actual_len; /* Simulate the entry's actual size for a speculative load */
- unsigned max_verify_ct; /* Maximum # of times to verify an entry's checksum */
- unsigned verify_ct; /* Count the # of checksum verification for an entry */
+ size_t actual_len; /* Simulate the entry's actual size for a speculative load */
+ unsigned max_verify_ct; /* Maximum # of times to verify an entry's checksum */
+ unsigned verify_ct; /* Count the # of checksum verification for an entry */
} test_entry_t;
/* The following are cut down test versions of the hash table manipulation
@@ -509,41 +510,35 @@ if ( ( (cache_ptr) == NULL ) || \
(i).empty_reserve = (e).empty_reserve; \
}
-
+
/* misc type definitions */
struct expected_entry_status
{
- int entry_type;
+ int entry_type;
int entry_index;
size_t size;
- hbool_t in_cache;
+ hbool_t in_cache;
hbool_t at_main_addr;
- hbool_t is_dirty;
- hbool_t is_protected;
- hbool_t is_pinned;
- hbool_t deserialized;
- hbool_t serialized;
- hbool_t destroyed;
+ hbool_t is_dirty;
+ hbool_t is_protected;
+ hbool_t is_pinned;
+ hbool_t deserialized;
+ hbool_t serialized;
+ hbool_t destroyed;
int flush_dep_par_type[MAX_FLUSH_DEP_PARS]; /* Entry types of flush dependency parents */
int flush_dep_par_idx[MAX_FLUSH_DEP_PARS]; /* Indices of flush dependency parents */
unsigned flush_dep_npar; /* Number of flush dependency parents */
unsigned flush_dep_nchd; /* Number of flush dependency children */
unsigned flush_dep_ndirty_chd; /* Number of dirty flush dependency children */
int flush_order; /* flush order of entry */
- unsigned char is_corked; /* cork status of entry */
+ unsigned char is_corked; /* cork status of entry */
};
-
-/* global variable externs: */
-H5TEST_DLLVAR H5C_t * saved_cache;
-
-H5TEST_DLLVAR const char *FILENAME[];
-H5TEST_DLLVAR haddr_t saved_actual_base_addr;
-H5TEST_DLLVAR hbool_t write_permitted;
+/* global variable externs: */
H5TEST_DLLVAR hbool_t pass; /* set to false on error */
H5TEST_DLLVAR const char *failure_mssg;
@@ -557,7 +552,7 @@ H5TEST_DLLVAR const haddr_t alt_base_addrs[NUMBER_OF_ENTRY_TYPES];
H5TEST_DLLVAR const H5C_class_t *types[NUMBER_OF_ENTRY_TYPES];
-
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -642,8 +637,6 @@ H5TEST_DLL void resize_entry(H5F_t * file_ptr,
size_t new_size,
hbool_t in_cache);
-H5TEST_DLL H5F_t *setup_cache(size_t max_cache_size, size_t min_clean_size, unsigned paged);
-
H5TEST_DLL void row_major_scan_forward(H5F_t * file_ptr,
int32_t max_index,
int32_t lag,
@@ -728,10 +721,6 @@ H5TEST_DLL void hl_col_major_scan_backward(H5F_t * file_ptr,
hbool_t do_inserts,
int dirty_unprotects);
-H5TEST_DLL void takedown_cache(H5F_t * file_ptr,
- hbool_t dump_stats,
- hbool_t dump_detailed_stats);
-
H5TEST_DLL void flush_cache(H5F_t * file_ptr,
hbool_t destroy_entries,
hbool_t dump_stats,
@@ -748,7 +737,7 @@ H5TEST_DLL void unprotect_entry(H5F_t * file_ptr,
H5TEST_DLL void verify_clean(void);
H5TEST_DLL void verify_entry_status(H5C_t * cache_ptr,
- int tag,
+ int tag,
int num_entries,
struct expected_entry_status expected[]);
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index 7ce4e88..cf0cd8d 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -24,6 +24,7 @@
#include "H5CXprivate.h" /* API Contexts */
#include "H5HLprivate.h"
+#include "H5VLnative_private.h" /* Native VOL connector */
/* ============ */
/* Test Defines */
@@ -374,14 +375,15 @@ error:
static int
get_object_header_tag(hid_t loc_id, haddr_t *tag)
{
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
/* Retrieve the info for the object */
- if(H5Oget_info2(loc_id, &oinfo, H5O_INFO_ALL) < 0)
+ if(H5Oget_info3(loc_id, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR;
/* Set the tag to return */
- *tag = oinfo.addr;
+ if(H5VLnative_token_to_addr(loc_id, oinfo.token, tag) < 0)
+ TEST_ERROR;
return 0;
@@ -439,7 +441,9 @@ check_file_creation_tags(hid_t fcpl_id, int type)
{
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose test outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0;
haddr_t sbe_tag = 0;
@@ -526,7 +530,9 @@ check_file_open_tags(hid_t fcpl, int type)
{
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag; /* Root Group Tag */
haddr_t sbe_tag; /* Sblock Extension Tag */
@@ -639,7 +645,9 @@ check_group_creation_tags(void)
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */
haddr_t g_tag; /* Group Tag */
@@ -740,7 +748,9 @@ check_multi_group_creation_tags(void)
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
char gname[16]; /* group name buffer */
int i = 0; /* iterator */
hid_t fapl = -1; /* File access prop list */
@@ -869,7 +879,9 @@ check_link_iteration_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t sid = -1; /* Group Identifier */
hid_t did = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
int i = 0; /* iterator */
haddr_t root_tag = 0; /* Root Group Tag Value */
char dsetname[500]; /* Name of dataset */
@@ -989,7 +1001,9 @@ check_dense_attribute_tags(void)
hid_t sid = -1; /* Group Identifier */
hid_t did = -1; /* Group Identifier */
hid_t dcpl = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
int i = 0; /* iterator */
hid_t fapl = -1; /* File access property list */
haddr_t d_tag = 0; /* Dataset tag value */
@@ -1171,7 +1185,9 @@ check_group_open_tags(void)
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file output */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = HADDR_UNDEF;
haddr_t g_tag;
@@ -1280,7 +1296,9 @@ check_attribute_creation_tags(hid_t fcpl, int type)
hid_t aid = -1; /* Attribute Identifier */
hid_t gid = -1; /* Group Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0; /* Root group tag */
haddr_t g_tag = 0;
@@ -1414,7 +1432,9 @@ check_attribute_open_tags(hid_t fcpl, int type)
hid_t aid = -1; /* Attribute Identifier */
hid_t gid = -1; /* Group Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0;
haddr_t g_tag = 0;
@@ -1551,7 +1571,9 @@ check_attribute_rename_tags(hid_t fcpl, int type)
hid_t gid = -1; /* Group Identifier */
hid_t aid = -1; /* Attribute Identifier */
hid_t sid = -1; /* Dataset Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
int *data = NULL; /* data buffer */
int i,j,k = 0; /* iterators */
hid_t fapl = -1; /* File access prop list */
@@ -1726,7 +1748,9 @@ check_attribute_delete_tags(hid_t fcpl, int type)
hid_t gid = -1; /* Group Identifier */
hid_t aid = -1; /* Attribute Identifier */
hid_t sid = -1; /* Dataset Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
int *data = NULL; /* data buffer */
int i,j,k = 0; /* iterators */
hid_t fapl = -1; /* File access prop list */
@@ -1892,7 +1916,9 @@ check_dataset_creation_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2025,7 +2051,9 @@ check_dataset_creation_earlyalloc_tags(hid_t fcpl, int type)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2162,7 +2190,9 @@ check_dataset_open_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2288,7 +2318,9 @@ check_dataset_write_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2430,7 +2462,9 @@ check_attribute_write_tags(hid_t fcpl, int type)
hid_t gid = -1; /* Group Identifier */
hid_t aid = -1; /* Attribute Identifier */
hid_t sid = -1; /* Dataset Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
int *data = NULL; /* data buffer */
int i,j,k = 0; /* iterators */
hid_t fapl = -1; /* File access prop list */
@@ -2583,7 +2617,9 @@ check_dataset_read_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2720,7 +2756,9 @@ check_dataset_size_retrieval(void)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2859,7 +2897,9 @@ check_dataset_extend_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -2996,11 +3036,13 @@ check_object_info_tags(void)
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file output */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = HADDR_UNDEF;
haddr_t g_tag;
- H5O_info_t oinfo; /* Object info struct */
+ H5O_native_info_t ninfo; /* Native object info struct */
/* Testing Macro */
TESTING("tag application during object info retrieval");
@@ -3040,7 +3082,10 @@ check_object_info_tags(void)
/* Get information on an object by name */
/* ===================================== */
- if ( H5Oget_info_by_name2(fid, GROUPNAME, &oinfo, H5O_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR;
+ /* Even though we do nothing with this, touching the internal
+ * data structures is needed for the test to pass.
+ */
+ if ( H5Oget_native_info_by_name(fid, GROUPNAME, &ninfo, H5O_NATIVE_INFO_ALL, H5P_DEFAULT) < 0 ) TEST_ERROR;
/* =================================== */
/* Verification of Metadata Tag Values */
@@ -3105,7 +3150,9 @@ check_object_copy_tags(void)
/* Variable Declarations */
hid_t fid = -1; /* File Identifier */
hid_t gid = -1; /* Group Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file output */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = HADDR_UNDEF;
haddr_t g_tag;
@@ -3226,7 +3273,9 @@ check_link_removal_tags(hid_t fcpl, int type)
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
hid_t gid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -3385,7 +3434,9 @@ check_link_getname_tags(void)
hid_t did = -1; /* Dataset Identifier */
hid_t sid = -1; /* Dataspace Identifier */
hid_t gid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t dcpl = -1; /* dataset creation pl */
hsize_t cdims[2] = {1,1}; /* chunk dimensions */
int fillval = 0;
@@ -3534,7 +3585,9 @@ check_external_link_creation_tags(void)
hid_t fid = -1; /* File Identifier */
hid_t fid2 = -1; /* File Identifier */
hid_t gid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0;
@@ -3640,7 +3693,10 @@ check_external_link_open_tags(void)
hid_t fid2 = -1; /* File Identifier */
hid_t gid = -1; /* Dataspace Identifier */
hid_t xid = -1; /* Dataspace Identifier */
+#ifndef NDEBUG
int verbose = FALSE; /* verbose file outout */
+#endif /* NDEBUG */ /* end debugging functions */
+ H5O_native_info_t ninfo; /* Native object info struct */
hid_t fapl = -1; /* File access prop list */
haddr_t root_tag = 0;
haddr_t root2_tag = 0;
@@ -3694,6 +3750,11 @@ check_external_link_open_tags(void)
if ( (fid2 = H5Iget_file_id(xid)) < 0) TEST_ERROR;
if ( get_object_header_tag(xid, &link_tag) < 0 ) TEST_ERROR;
+ /* Even though we do nothing with this, touching the internal
+ * data structures is needed for the test to pass.
+ */
+ if ( H5Oget_native_info(xid, &ninfo, H5O_NATIVE_INFO_ALL) < 0 ) TEST_ERROR;
+
/* =================================== */
/* Verification of Metadata Tag Values */
/* =================================== */
@@ -3836,12 +3897,13 @@ check_invalid_tag_application(void)
return 0;
-error:
#if H5C_DO_TAGGING_SANITY_CHECKS
+error:
if(api_ctx_pushed) H5CX_pop();
-#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
return 1;
+#endif /* H5C_DO_TAGGING_SANITY_CHECKS */
+
} /* check_invalid_tag_application */
diff --git a/test/chunk_info.c b/test/chunk_info.c
index 057991c..0afff66 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -119,7 +119,7 @@ const char *FILENAME[] = {
#define INVALID_CHK_INDEX 5
/* For compressed data */
-#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12)
+#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001)+12.0)
/* For use in error reporting */
#define MSG_CHK_ADDR "Chunk address should not be HADDR_UNDEF because of H5D_ALLOC_TIME_EARLY."
diff --git a/test/cork.c b/test/cork.c
index 06a520d..125c53e 100644
--- a/test/cork.c
+++ b/test/cork.c
@@ -99,9 +99,10 @@ verify_old_dset_cork(void)
hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
- int buf[100][20]; /* Data buffer */
- int i = 0, j = 0; /* Local index variable */
- H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */
+ int **buf = NULL; /* Data bufer (pointers to fake 2D array) */
+ int *buf_data = NULL; /* Data buffer (actual data) */
+ int i = 0, j = 0; /* Local index variables */
+ H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
hsize_t dims2[2] = {8, 16}; /* Dataset dimension sizes */
/* Testing Macro */
@@ -126,7 +127,7 @@ verify_old_dset_cork(void)
TEST_ERROR
/* Get dataset object header address: DSET_BT1 */
- if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_BT1 */
@@ -134,20 +135,28 @@ verify_old_dset_cork(void)
TEST_ERROR
/* Verify cork status */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < 100; i++)
+ buf[i] = buf_data + (i * 20);
+
/* Initialize data buffer */
for(i = 0; i < (int)dims[0]; i++)
for(j = 0; j < (int)dims[1]; j++)
buf[i][j] = (i + 1) * (j + 1);
/* Write to the dataset: DSET_BT1 */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT1 */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Create compact dataset: DSET_COMPACT */
@@ -163,7 +172,7 @@ verify_old_dset_cork(void)
FAIL_STACK_ERROR
/* Get dataset object address */
- if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_COMPACT */
@@ -171,7 +180,7 @@ verify_old_dset_cork(void)
TEST_ERROR
/* Verify cork status */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Closing */
@@ -196,11 +205,6 @@ verify_old_dset_cork(void)
if((fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
TEST_ERROR
- /* Initialize data buffer */
- for(i = 0; i < (int)dims[0]; i++)
- for(j = 0; j < (int)dims[1]; j++)
- buf[i][j] = (i + 1) * (j + 1);
-
/* Open and write to the dataset: DSET_BT1 */
if((did = H5Dopen2(fid, DSET_BT1, H5P_DEFAULT)) < 0)
TEST_ERROR
@@ -216,7 +220,7 @@ verify_old_dset_cork(void)
FAIL_STACK_ERROR
/* Get dataset object address: DSET_CONTIG */
- if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_CONTIG */
@@ -224,11 +228,11 @@ verify_old_dset_cork(void)
TEST_ERROR
/* Verify the cork status for DSET_CONTIG */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT1 */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Un-cork the dataset: DSET_CONTIG */
@@ -236,7 +240,7 @@ verify_old_dset_cork(void)
TEST_ERROR
/* Verify the cork status for DSET_CONTIG */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Closing */
@@ -249,6 +253,9 @@ verify_old_dset_cork(void)
if(H5Fclose(fid) < 0)
TEST_ERROR
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return 0;
@@ -265,6 +272,10 @@ error:
H5Pclose(dcpl3);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(buf);
+ HDfree(buf_data);
+
return 1;
} /* verify_old_dset_cork */
@@ -296,7 +307,7 @@ verify_obj_dset_cork(hbool_t swmr)
int i = 0; /* Local index variable */
hsize_t dim[1] = {100}; /* Dataset dimension size */
hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */
- H5O_info_t oinfo, oinfo2; /* Object metadata information */
+ H5O_info2_t oinfo, oinfo2; /* Object metadata information */
char attrname[500]; /* Name of attribute */
unsigned flags; /* File access flags */
@@ -329,11 +340,11 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Get dataset object header address */
- if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Cork the dataset: DSET */
@@ -345,7 +356,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Close the attribute */
@@ -353,7 +364,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Create dcpl */
@@ -372,7 +383,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Get dataset object header address */
- if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_NONE */
@@ -391,7 +402,7 @@ verify_obj_dset_cork(hbool_t swmr)
} /* end for */
/* Verify cork status of the dataset: DSET_NONE */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Closing */
@@ -420,7 +431,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Open the attribute attached to the dataset object: DSET_NONE */
@@ -432,7 +443,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: DSET_NONE */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Close the attribute */
@@ -440,7 +451,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Closing */
@@ -496,9 +507,11 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
hsize_t dims[2] = {100, 20}; /* Dataset dimension sizes */
hsize_t max_dims[2] = {100, H5S_UNLIMITED}; /* Dataset maximum dimension sizes */
hsize_t chunk_dims[2] = {2, 5}; /* Dataset chunked dimension sizes */
- int buf[100][20]; int i = 0, j = 0; /* Data buffer */
- H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */
- unsigned flags; /* File access flags */
+ int **buf = NULL; /* Data bufer (pointers to fake 2D array) */
+ int *buf_data = NULL; /* Data buffer (actual data) */
+ int i = 0, j = 0; /* Local index variables */
+ H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
+ unsigned flags; /* File access flags */
/* Testing Macro */
if(swmr) {
@@ -546,7 +559,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Get dataset object header address: DSET_EA */
- if(H5Oget_info2(did, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_EA */
@@ -554,7 +567,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Verify cork status */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Create chunked dataset with fixed array indexing: DSET_FA */
@@ -564,7 +577,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Get dataset object header address: DSET_FA */
- if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_FA */
@@ -576,11 +589,11 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Verify the cork status for DSET_FA */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Verify the cork status for DSET_EA */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Create chunked dataset with v2-Btree indexing */
@@ -591,7 +604,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Get dataset object header address: DSET_BT2 */
- if(H5Oget_info2(did3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET_BT2 */
@@ -599,7 +612,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Closing */
@@ -630,6 +643,14 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
if((fid = H5Fopen(FILENAME, flags, fapl)) < 0)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(100 * 20, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(100, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < 100; i++)
+ buf[i] = buf_data + (i * 20);
+
/* Initialize data buffer */
for(i = 0; i < (int)dims[0]; i++)
for(j = 0; j < (int)dims[1]; j++)
@@ -638,17 +659,17 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
/* Open and write to the dataset: DSET_EA */
if((did = H5Dopen2(fid, DSET_EA, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_EA */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Open and write to the dataset: DSET_FA */
if((did2 = H5Dopen2(fid, DSET_FA, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Cork the dataset: DSET_FA */
@@ -656,17 +677,17 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Verify the cork status for DSET_FA */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Open and write to the dataset: DSET_BT2 */
if((did3 = H5Dopen2(fid, DSET_BT2, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(did3, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Cork the dataset: DSET_BT2 */
@@ -674,7 +695,7 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Verify the cork status for DSET_BT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Closing */
@@ -689,6 +710,9 @@ verify_dset_cork(hbool_t swmr, hbool_t new_format)
if(H5Fclose(fid) < 0)
TEST_ERROR
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return 0;
@@ -704,6 +728,10 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(buf);
+ HDfree(buf_data);
+
return 1;
} /* verify_dset_cork */
@@ -729,11 +757,11 @@ verify_group_cork(hbool_t swmr)
hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t gid = -1, gid2 = -1, gid3 = -1; /* Group IDs */
- H5O_info_t oinfo, oinfo2, oinfo3; /* Object metadata information */
- hid_t aid; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
+ H5O_info2_t oinfo, oinfo2, oinfo3; /* Object metadata information */
+ hid_t aid; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
char attrname[500]; /* Name of attribute */
- unsigned flags; /* File access flags */
+ unsigned flags; /* File access flags */
int i = 0; /* Local index variable */
/* Testing Macro */
@@ -770,19 +798,19 @@ verify_group_cork(hbool_t swmr)
TEST_ERROR
/* Get group object header addresses */
- if(H5Oget_info2(gid, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gid, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info2(gid3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gid3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Verify cork status of the groups */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Close the second group: GRP2 */
@@ -794,7 +822,7 @@ verify_group_cork(hbool_t swmr)
FAIL_STACK_ERROR
/* Verify cork status of the second group: GRP2 */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Closing */
@@ -835,7 +863,7 @@ verify_group_cork(hbool_t swmr)
if(i == 3) {
if(H5Odisable_mdc_flushes(gid3) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
}
if(H5Aclose(aid) < 0)
@@ -843,7 +871,7 @@ verify_group_cork(hbool_t swmr)
} /* end for */
/* Verify cork status of the third group: GRP3 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Closing */
@@ -897,12 +925,12 @@ verify_named_cork(hbool_t swmr)
hid_t fapl = -1; /* File access property list */
hid_t tid = -1, tid2 = -1, tid3 = -1; /* Datatype IDs */
hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5O_info_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */
- hid_t aid = -1; /* Attribute ID */
- hid_t sid; /* Dataspace ID */
- hid_t did; /* Dataset ID */
+ H5O_info2_t oinfo, oinfo2, oinfo3, oinfo4; /* Object metadata information */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t did; /* Dataset ID */
char attrname[500]; /* Name of attribute */
- unsigned flags; /* File access flags */
+ unsigned flags; /* File access flags */
int i = 0; /* Local index variable */
/* Testing Macro */
@@ -959,19 +987,19 @@ verify_named_cork(hbool_t swmr)
TEST_ERROR
/* Get named datatype object header addresses */
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info2(tid3, &oinfo3, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(tid3, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Verify cork status of the named datatypes */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Close the datatypes */
@@ -991,11 +1019,11 @@ verify_named_cork(hbool_t swmr)
FAIL_STACK_ERROR
/* Verify cork status of the named datatypes */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, FALSE) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Closing */
@@ -1051,7 +1079,7 @@ verify_named_cork(hbool_t swmr)
if(i == 3) {
if(H5Odisable_mdc_flushes(tid3) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
}
if(H5Aclose(aid) < 0)
@@ -1063,7 +1091,7 @@ verify_named_cork(hbool_t swmr)
FAIL_STACK_ERROR
/* Get dataset object header address */
- if(H5Oget_info2(did, &oinfo4, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did, &oinfo4, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Cork the dataset: DSET */
@@ -1071,20 +1099,20 @@ verify_named_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the datatype: DT */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, FALSE) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT3 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Un-cork the datatype: DT3 */
if(H5Oenable_mdc_flushes(tid3) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT3 */
- if(H5C__verify_cork_tag_test(fid, oinfo3.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo3.token, FALSE) < 0)
TEST_ERROR
/* Cork the datatype: DT */
@@ -1092,14 +1120,14 @@ verify_named_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the datatype: DT */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the datatype: DT2 */
- if(H5C__verify_cork_tag_test(fid, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo4.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo4.token, TRUE) < 0)
TEST_ERROR
/* Close the dataset */
@@ -1107,11 +1135,11 @@ verify_named_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the datatype: DT */
- if(H5C__verify_cork_tag_test(fid, oinfo.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo.token, TRUE) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
- if(H5C__verify_cork_tag_test(fid, oinfo4.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid, oinfo4.token, FALSE) < 0)
TEST_ERROR
/* Closing */
@@ -1178,10 +1206,10 @@ verify_multiple_cork(hbool_t swmr)
hid_t aidd1 = -1, aidd2 = -1; /* Attribute ID */
hid_t aidt1 = -1, aidt2 = -1; /* Attribute ID */
hid_t sid = -1; /* Dataspace ID */
- H5O_info_t oinfo1, oinfo2, oinfo3; /* Object metadata information */
- hsize_t dim[1] = {5}; /* Dimension sizes */
- unsigned flags; /* File access flags */
- hbool_t corked; /* Cork status */
+ H5O_info2_t oinfo1, oinfo2, oinfo3; /* Object metadata information */
+ hsize_t dim[1] = {5}; /* Dimension sizes */
+ unsigned flags; /* File access flags */
+ hbool_t corked; /* Cork status */
herr_t ret; /* Return value */
/* Testing Macro */
@@ -1277,9 +1305,9 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the group: gid2 */
- if(H5Oget_info2(gid2, &oinfo1, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gid2, &oinfo1, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid2, oinfo1.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid2, oinfo1.token, TRUE) < 0)
TEST_ERROR
/* Check cork status of the group: gid1 */
@@ -1305,9 +1333,9 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: did1 */
- if(H5Oget_info2(did1, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did1, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid1, oinfo2.token, TRUE) < 0)
TEST_ERROR
/* Check cork status of the dataset: did2 */
@@ -1333,9 +1361,9 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the datatype: tid2 */
- if(H5Oget_info2(tid2, &oinfo3, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(tid2, &oinfo3, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid2, oinfo3.addr, TRUE) < 0)
+ if(H5C__verify_cork_tag_test(fid2, oinfo3.token, TRUE) < 0)
TEST_ERROR
/* Check cork status of the datatype: tid1 */
@@ -1349,9 +1377,9 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the group: gid1 */
- if(H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0)
TEST_ERROR
/* Check cork status of the group: gid2 */
@@ -1371,7 +1399,7 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the group: gid1 */
- if(H5C__verify_cork_tag_test(fid1, oinfo1.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid1, oinfo1.token, FALSE) < 0)
TEST_ERROR
/* Close the group: gid1 */
@@ -1383,9 +1411,9 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: did2 */
- if(H5Oget_info2(did2, &oinfo2, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(did2, &oinfo2, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5C__verify_cork_tag_test(fid2, oinfo2.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid2, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Check cork status of the dataset: did1 */
@@ -1405,7 +1433,7 @@ verify_multiple_cork(hbool_t swmr)
TEST_ERROR
/* Verify cork status of the dataset: did1 */
- if(H5C__verify_cork_tag_test(fid1, oinfo2.addr, FALSE) < 0)
+ if(H5C__verify_cork_tag_test(fid1, oinfo2.token, FALSE) < 0)
TEST_ERROR
/* Close the dataset: did1 */
@@ -1826,8 +1854,9 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
hsize_t cdims[RANK] = {2,2}; /* Chunk dimensions */
int fillval = 0; /* Fill value */
int i, j, k = 0; /* Local index variables */
- int data[DIMS0][DIMS1]; /* Data buffer */
- int rbuf[DIMS0][DIMS1]; /* Data buffer */
+ int **wbuf = NULL; /* Data buffer for writes (pointers to fake 2D array) */
+ int *wbuf_data = NULL; /* Data buffer for writes (real data) */
+ int *rbuf_data = NULL; /* Data buffer for reads (real data) */
hbool_t corked; /* Cork status of an object */
unsigned flags; /* File access flags */
@@ -1923,13 +1952,21 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
if(corked)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (wbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (wbuf = (int **)HDcalloc(DIMS0, sizeof(wbuf_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIMS0; i++)
+ wbuf[i] = wbuf_data + (i * DIMS1);
+
/* Initialize the buffer */
for(i = 0; i < DIMS0;i++)
for(j = 0;j < DIMS1;j++)
- data[i][j] = k++;
+ wbuf[i][j] = k++;
/* Write to the dataset */
- if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
TEST_ERROR
/* Flush the dataset */
@@ -1962,8 +1999,12 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
if(corked)
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (rbuf_data = (int *)HDcalloc(DIMS0 * DIMS1, sizeof(int))))
+ TEST_ERROR;
+
/* Read from the dataset */
- if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0)
+ if(H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_data) < 0)
TEST_ERROR
/* Cork the dataset */
@@ -1993,7 +2034,7 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
TEST_ERROR
/* Write to the dataset */
- if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did1, tid1, sid, sid, H5P_DEFAULT, wbuf_data) < 0)
TEST_ERROR
/* Refresh the dataset */
@@ -2106,6 +2147,10 @@ test_dset_cork(hbool_t swmr, hbool_t new_format)
if(H5Pclose(dcpl) < 0)
TEST_ERROR
+ HDfree(wbuf);
+ HDfree(wbuf_data);
+ HDfree(rbuf_data);
+
PASSED();
return 0;
@@ -2121,6 +2166,11 @@ error:
H5Pclose(fapl);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(wbuf);
+ HDfree(wbuf_data);
+ HDfree(rbuf_data);
+
return 1;
} /* test_dset_cork() */
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 7b17043..2e6cc68 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -43,7 +43,7 @@
#define CHUNK_NX 4
#define CHUNK_NY 4
-#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0))
+#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*1.001)+12.0)
/* Temporary filter IDs used for testing */
#define H5Z_FILTER_BOGUS1 305
@@ -661,20 +661,20 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
size_t *buf_size, void **buf)
{
int *int_ptr=(int *)*buf; /* Pointer to the data values */
- ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */
+ size_t buf_left=*buf_size; /* Amount of data buffer left to process */
if(flags & H5Z_FLAG_REVERSE) { /* read */
/* Substract the "add on" value to all the data values */
while(buf_left>0) {
*int_ptr++ -= (int)ADD_ON;
- buf_left -= (ssize_t)sizeof(int);
+ buf_left -= sizeof(int);
} /* end while */
} /* end if */
else { /* write */
/* Add the "add on" value to all the data values */
while(buf_left>0) {
*int_ptr++ += (int)ADD_ON;
- buf_left -= (ssize_t)sizeof(int);
+ buf_left -= sizeof(int);
} /* end while */
} /* end else */
@@ -698,20 +698,20 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
size_t *buf_size, void **buf)
{
int *int_ptr=(int *)*buf; /* Pointer to the data values */
- ssize_t buf_left=(ssize_t)*buf_size; /* Amount of data buffer left to process */
+ size_t buf_left=*buf_size; /* Amount of data buffer left to process */
if(flags & H5Z_FLAG_REVERSE) { /* read */
/* Substract the "add on" value to all the data values */
while(buf_left>0) {
*int_ptr++ /= (int)FACTOR;
- buf_left -= (ssize_t)sizeof(int);
+ buf_left -= sizeof(int);
} /* end while */
} /* end if */
else { /* write */
/* Add the "add on" value to all the data values */
while(buf_left>0) {
*int_ptr++ *= (int)FACTOR;
- buf_left -= (ssize_t)sizeof(int);
+ buf_left -= sizeof(int);
} /* end while */
} /* end else */
diff --git a/test/dsets.c b/test/dsets.c
index 649e001..2201d89 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -147,10 +147,12 @@ const char *FILENAME[] = {
#define DSET_COPY_DCPL_NAME_1 "copy_dcpl_1"
#define DSET_COPY_DCPL_NAME_2 "copy_dcpl_2"
#define COPY_DCPL_EXTFILE_NAME "ext_file"
+#ifndef H5_NO_DEPRECATED_SYMBOLS
#define DSET_DEPREC_NAME "deprecated"
#define DSET_DEPREC_NAME_CHUNKED "deprecated_chunked"
#define DSET_DEPREC_NAME_COMPACT "deprecated_compact"
#define DSET_DEPREC_NAME_FILTER "deprecated_filter"
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Dataset names for testing Fixed Array Indexing */
#define DSET_FIXED_MAX "DSET_FIXED_MAX"
@@ -176,7 +178,9 @@ const char *FILENAME[] = {
#define H5Z_FILTER_CORRUPT 306
#define H5Z_FILTER_CAN_APPLY_TEST 307
#define H5Z_FILTER_SET_LOCAL_TEST 308
+#ifndef H5_NO_DEPRECATED_SYMBOLS
#define H5Z_FILTER_DEPREC 309
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
#define H5Z_FILTER_EXPAND 310
#define H5Z_FILTER_CAN_APPLY_TEST2 311
#define H5Z_FILTER_COUNT 312
@@ -272,10 +276,16 @@ const char *FILENAME[] = {
/* Shared global arrays */
#define DSET_DIM1 100
#define DSET_DIM2 200
-int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
-double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2];
-size_t count_nbytes_read = 0;
-size_t count_nbytes_written = 0;
+int **points = NULL;
+int *points_data = NULL;
+double **points_dbl = NULL;
+double *points_dbl_data = NULL;
+int **check = NULL;
+int *check_data = NULL;
+double **check_dbl = NULL;
+double *check_dbl_data = NULL;
+size_t count_nbytes_read = 0;
+size_t count_nbytes_written = 0;
/* Temporary buffer dimensions */
#define DSET_TMP_DIM1 50
@@ -511,7 +521,8 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
void *tconv_buf = NULL;
int f = -1;
haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
+ int **rdata = NULL;
+ int *rdata_bytes = NULL;
TESTING("simple I/O");
@@ -519,6 +530,14 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
+ /* Set up data array */
+ if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ rdata[i] = rdata_bytes + (i * DSET_DIM2);
+
/* Initialize the dataset */
for(i = n = 0; i < DSET_DIM1; i++)
for(j = 0; j < DSET_DIM2; j++)
@@ -548,7 +567,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if(H5Dget_offset(dataset) != HADDR_UNDEF) goto error;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, points_data) < 0)
goto error;
/* Test dataset address in file. Open the same file as a C file, seek
@@ -557,7 +576,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
if((offset=H5Dget_offset(dataset))==HADDR_UNDEF) goto error;
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer, check_data) < 0)
goto error;
/* Check that the values read are the same as the values written */
@@ -581,7 +600,7 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
f = HDopen(filename, O_RDONLY);
HDlseek(f, (off_t)offset, SEEK_SET);
- if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
goto error;
/* Check that the values read are the same as the values written */
@@ -600,6 +619,9 @@ test_simple_io(const char *env_h5_drvr, hid_t fapl)
f = -1;
HDfree(tconv_buf);
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
PASSED();
} /* end if */
else {
@@ -620,8 +642,11 @@ error:
if(H5Fclose(file) < 0) TEST_ERROR
if(f > 0)
HDclose(f);
- if(tconv_buf)
- HDfree(tconv_buf);
+
+ HDfree(tconv_buf);
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
return FAIL;
} /* end test_simple_io() */
@@ -644,7 +669,8 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
hsize_t dims[2];
int f = -1;
haddr_t offset;
- int rdata[DSET_DIM1][DSET_DIM2];
+ int **rdata = NULL;
+ int *rdata_bytes = NULL;
TESTING("dataset offset with user block");
@@ -652,6 +678,14 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
if(HDstrcmp(env_h5_drvr, "split") && HDstrcmp(env_h5_drvr, "multi") && HDstrcmp(env_h5_drvr, "family")) {
h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ /* Set up data array */
+ if(NULL == (rdata_bytes = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata = (int **)HDcalloc(DSET_DIM1, sizeof(rdata_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ rdata[i] = rdata_bytes + (i * DSET_DIM2);
+
if((fcpl=H5Pcreate(H5P_FILE_CREATE)) < 0) goto error;
if(H5Pset_userblock(fcpl, (hsize_t)USER_BLOCK) < 0) goto error;
if(new_format)
@@ -675,7 +709,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
space = -1;
/* Write the data to the dataset */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0)
goto error;
/* Test dataset address in file. Open the same file as a C file, seek
@@ -690,7 +724,7 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
f = HDopen(filename, O_RDONLY);
HDlseek(f, (off_t)offset, SEEK_SET);
- if(HDread(f, rdata, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
+ if(HDread(f, rdata_bytes, sizeof(int)*DSET_DIM1*DSET_DIM2) < 0)
goto error;
/* Check that the values read are the same as the values written */
@@ -708,6 +742,9 @@ test_userblock_offset(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
HDclose(f);
f = -1;
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
PASSED();
} /* end if */
else {
@@ -728,6 +765,10 @@ error:
if(H5Fclose(file) < 0) TEST_ERROR
if(f > 0)
HDclose(f);
+
+ HDfree(rdata_bytes);
+ HDfree(rdata);
+
return FAIL;
} /* end test_userblock_offset() */
@@ -834,8 +875,8 @@ test_compact_io(hid_t fapl)
skipping invalid combinations.
- Create a file, create and write a compact dataset, and verify its data
- Verify the dataset's layout and fill message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -1786,7 +1827,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
*/
TESTING(" filters (uninitialized read)");
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
for(i=0; i<(size_t)size[0]; i++) {
@@ -1815,7 +1856,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
}
}
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
TEST_ERROR;
if((*dset_size=H5Dget_storage_size(dataset))==0) TEST_ERROR;
@@ -1833,25 +1874,25 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -1885,33 +1926,33 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
points[i][j] = (int)HDrandom ();
}
}
- if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
+ if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points_data) < 0)
TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
else {
/* Read the dataset back and check it */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -1946,13 +1987,13 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status >= 0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
@@ -1960,12 +2001,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status >= 0) TEST_ERROR;
} /* end if */
else {
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -1999,32 +2040,32 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
NULL) < 0) TEST_ERROR;
/* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
- if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0)
+ if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points_data) < 0)
TEST_ERROR;
if(corrupted) {
/* Default behavior is failure when data is corrupted. */
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
/* Callback decides to continue inspite data is corrupted. */
if(H5Pset_filter_callback(dxpl, filter_cb_cont, NULL) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check_data) < 0)
TEST_ERROR;
/* Callback decides to fail when data is corrupted. */
if(H5Pset_filter_callback(write_dxpl, filter_cb_fail, NULL) < 0) TEST_ERROR;
/* (Use the "write" DXPL in order to make certain corruption is seen) */
H5E_BEGIN_TRY {
- status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check);
+ status=H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
else {
- if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0)
+ if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check_data) < 0)
TEST_ERROR;
/* Check that the values read are the same as the values written */
@@ -2290,9 +2331,9 @@ H5_ATTR_UNUSED
hsize_t shuffle_size; /* Size of dataset with shuffle filter */
-#if(defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP)
+#if defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP)
hsize_t combo_size; /* Size of dataset with multiple filters */
-#endif /* defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP */
+#endif /* defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP) */
/* test the H5Zget_filter_info function */
if(test_get_filter_info() < 0) goto error;
@@ -2629,7 +2670,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -2658,7 +2699,7 @@ test_missing_filter(hid_t file)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
@@ -2719,7 +2760,7 @@ test_missing_filter(hid_t file)
/* Read data (should fail, since deflate filter is missing) */
H5E_BEGIN_TRY {
- ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check);
+ ret = H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data);
} H5E_END_TRY;
if(ret>=0) {
H5_FAILED();
@@ -3127,18 +3168,18 @@ test_nbit_double(hid_t file)
*/
double orig_data[2][5] = {
{
- H5_DOUBLE(1.6081706885101836e+60),
- H5_DOUBLE(-255.32099170994480),
- H5_DOUBLE(1.2677579992621376e-61),
- H5_DOUBLE(64568.289448797700),
- H5_DOUBLE(-1.0619721778839084e-75)
+ 1.6081706885101836e+60,
+ -255.32099170994480,
+ 1.2677579992621376e-61,
+ 64568.289448797700,
+ -1.0619721778839084e-75
},
{
- H5_DOUBLE(2.1499497833454840e+56),
- H5_DOUBLE(6.6562295504670740e-3),
- H5_DOUBLE(-1.5747263393432150),
- H5_DOUBLE(1.0711093225222612),
- H5_DOUBLE(-9.8971679387636870e-1)
+ 2.1499497833454840e+56,
+ 6.6562295504670740e-3,
+ -1.5747263393432150,
+ 1.0711093225222612,
+ -9.8971679387636870e-1
}};
double new_data[2][5];
size_t precision, offset;
@@ -4085,8 +4126,8 @@ test_nbit_compound_3(hid_t file)
* Cleanup
*----------------------------------------------------------------------
*/
- if(H5Dvlen_reclaim(cmpd_tid, space, H5P_DEFAULT, new_data) < 0) goto error;
- if(H5Dvlen_reclaim(cmpd_tid, space, H5P_DEFAULT, orig_data) < 0) goto error;
+ if(H5Treclaim(cmpd_tid, space, H5P_DEFAULT, new_data) < 0) goto error;
+ if(H5Treclaim(cmpd_tid, space, H5P_DEFAULT, orig_data) < 0) goto error;
if(H5Tclose(i_tid) < 0) goto error;
if(H5Tclose(str_tid) < 0) goto error;
if(H5Tclose(vl_str_tid) < 0) goto error;
@@ -4127,149 +4168,164 @@ test_nbit_int_size(hid_t file)
hid_t dataspace, dataset, datatype, mem_datatype, dset_create_props;
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
- int orig_data[DSET_DIM1][DSET_DIM2];
+ int **orig = NULL;
+ int *orig_data = NULL;
double power;
int i, j;
size_t precision, offset;
TESTING(" nbit integer dataset size");
- /* Define dataset datatype (integer), and set precision, offset */
- if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Set up data array */
+ if(NULL == (orig_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (orig = (int **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ orig[i] = orig_data + (i * DSET_DIM2);
- precision = 16; /* precision includes sign bit */
- if(H5Tset_precision(datatype,precision)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_precision failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Define dataset datatype (integer), and set precision, offset */
+ if((datatype = H5Tcopy(H5T_NATIVE_INT)) < 0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ }
- offset = 8;
- if(H5Tset_offset(datatype,offset)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
- goto error;
- } /* end if */
+ precision = 16; /* precision includes sign bit */
+ if(H5Tset_precision(datatype,precision)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_precision failed\n",__LINE__);
+ goto error;
+ }
- /* Copy to memory datatype */
- if((mem_datatype = H5Tcopy(datatype)) < 0) {
- H5_FAILED();
- HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
- goto error;
- } /* end if */
+ offset = 8;
+ if(H5Tset_offset(datatype,offset)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Tset_offset failed\n",__LINE__);
+ goto error;
+ }
- /* Set order of dataset datatype */
- if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ /* Copy to memory datatype */
+ if((mem_datatype = H5Tcopy(datatype)) < 0) {
H5_FAILED();
- HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
- goto error;
- } /* end if */
+ HDprintf(" line %d: H5Tcopy failed\n",__LINE__);
+ goto error;
+ }
- if(H5Tset_size(datatype, 4)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Set order of dataset datatype */
+ if(H5Tset_order(datatype, H5T_ORDER_BE)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_order failed\n",__LINE__);
+ goto error;
+ }
- /* Initiliaze data buffer with random data within correct range
- * corresponding to the memory datatype's precision and offset.
- */
- for (i=0; i < DSET_DIM1; i++)
- for (j=0; j < DSET_DIM2; j++) {
- power = HDpow(2.0F, (double)(precision-1));
- orig_data[i][j] = HDrandom() % (int)power << offset;
- } /* end for */
+ if(H5Tset_size(datatype, 4)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_size failed\n",__LINE__);
+ goto error;
+ }
+ /* Initiliaze data buffer with random data within correct range
+ * corresponding to the memory datatype's precision and offset.
+ */
+ for (i=0; i < DSET_DIM1; i++)
+ for (j=0; j < DSET_DIM2; j++) {
+ power = HDpow(2.0F, (double)(precision-1));
+ orig[i][j] = HDrandom() % (int)power << offset;
+ }
- /* Describe the dataspace. */
- dims[0] = DSET_DIM1;
- dims[1] = DSET_DIM2;
- if((dataspace = H5Screate_simple (2, dims, NULL))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
- goto error;
- } /* end if */
- /*
- * Set the dataset creation property list to specify the chunks
- */
- chunk_size[0] = DSET_DIM1/10;
- chunk_size[1] = DSET_DIM2/10;
- if((dset_create_props = H5Pcreate (H5P_DATASET_CREATE))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
- goto error;
- } /* end if */
+ /* Describe the dataspace. */
+ dims[0] = DSET_DIM1;
+ dims[1] = DSET_DIM2;
+ if((dataspace = H5Screate_simple(2, dims, NULL))<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ }
- if(H5Pset_chunk (dset_create_props, 2, chunk_size)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
- goto error;
- } /* end if */
+ /*
+ * Set the dataset creation property list to specify the chunks
+ */
+ chunk_size[0] = DSET_DIM1/10;
+ chunk_size[1] = DSET_DIM2/10;
+ if((dset_create_props = H5Pcreate(H5P_DATASET_CREATE))<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pcreate failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Set for n-bit compression
- */
- if(H5Pset_nbit (dset_create_props)<0) {
- H5_FAILED();
- HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
- goto error;
- } /* end if */
+ if(H5Pset_chunk(dset_create_props, 2, chunk_size)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_chunk failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Create a new dataset within the file.
- */
- if((dataset = H5Dcreate2 (file, DSET_NBIT_INT_SIZE_NAME, datatype,
+ /*
+ * Set for n-bit compression
+ */
+ if(H5Pset_nbit(dset_create_props)<0) {
+ H5_FAILED();
+ HDprintf(" line %d: H5Pset_nbit failed\n",__LINE__);
+ goto error;
+ }
+
+ /*
+ * Create a new dataset within the file.
+ */
+ if((dataset = H5Dcreate2(file, DSET_NBIT_INT_SIZE_NAME, datatype,
dataspace, H5P_DEFAULT,
dset_create_props, H5P_DEFAULT))<0) {
- H5_FAILED();
- HDprintf(" line %d: H5dwrite failed\n",__LINE__);
- goto error;
- } /* end if */
+ H5_FAILED();
+ HDprintf(" line %d: H5dwrite failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Write the array to the file.
- */
- if(H5Dwrite (dataset, mem_datatype, H5S_ALL, H5S_ALL,
- H5P_DEFAULT, orig_data)<0) {
- H5_FAILED();
- HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
- goto error;
- } /* end if */
+ /*
+ * Write the array to the file.
+ */
+ if(H5Dwrite(dataset, mem_datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig_data)<0) {
+ H5_FAILED();
+ HDprintf(" Line %d: H5Dwrite failed\n",__LINE__);
+ goto error;
+ }
- /*
- * Get the precision of the data type
- */
- if((precision = H5Tget_precision(datatype)) == 0) {
- H5_FAILED();
- HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
- goto error;
- } /* end if */
+ /*
+ * Get the precision of the data type
+ */
+ if((precision = H5Tget_precision(datatype)) == 0) {
+ H5_FAILED();
+ HDprintf(" Line %d: wrong precision size: %zu\n",__LINE__, precision);
+ goto error;
+ }
- /*
- * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
- */
- if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
- dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
- H5_FAILED();
- HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size);
- goto error;
- } /* end if */
+ /*
+ * The size of the dataset after compression should around 2 * DSET_DIM1 * DSET_DIM2
+ */
+ if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) ||
+ dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) {
+ H5_FAILED();
+ HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size);
+ goto error;
+ }
- H5Tclose (datatype);
- H5Tclose (mem_datatype);
- H5Dclose (dataset);
- H5Sclose (dataspace);
- H5Pclose (dset_create_props);
+ H5Tclose(datatype);
+ H5Tclose(mem_datatype);
+ H5Dclose(dataset);
+ H5Sclose(dataspace);
+ H5Pclose(dset_create_props);
+
+ HDfree(orig);
+ HDfree(orig_data);
PASSED();
- return SUCCEED;
+ return SUCCEED;
+
error:
+ HDfree(orig);
+ HDfree(orig_data);
+
return FAIL;
} /* end test_nbit_int_size() */
@@ -4295,13 +4351,22 @@ test_nbit_flt_size(hid_t file)
hid_t dataspace, dataset, datatype, dset_create_props;
hsize_t dims[2], chunk_size[2];
hsize_t dset_size = 0;
- float orig_data[DSET_DIM1][DSET_DIM2];
+ float **orig = NULL;
+ float *orig_data = NULL;
int i, j;
size_t precision, offset;
size_t spos, epos, esize, mpos, msize;
TESTING(" nbit floating-number dataset size");
+ /* Set up data array */
+ if(NULL == (orig_data = (float *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(float))))
+ TEST_ERROR;
+ if(NULL == (orig = (float **)HDcalloc(DSET_DIM1, sizeof(orig_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ orig[i] = orig_data + (i * DSET_DIM2);
+
/* Define floating-point type for dataset
*-------------------------------------------------------------------
* size=4 byte, precision=16 bits, offset=8 bits,
@@ -4380,7 +4445,7 @@ test_nbit_flt_size(hid_t file)
*/
for (i=0; i < DSET_DIM1; i++)
for (j=0; j < DSET_DIM2; j++)
- orig_data[i][j] = (float)(HDrandom() % 1234567) / 2;
+ orig[i][j] = (float)(HDrandom() % 1234567) / 2;
/* Describe the dataspace. */
@@ -4465,8 +4530,14 @@ test_nbit_flt_size(hid_t file)
PASSED();
+ HDfree(orig);
+ HDfree(orig_data);
+
return SUCCEED;
error:
+ HDfree(orig);
+ HDfree(orig_data);
+
return FAIL;
} /* end test_nbit_flt_size() */
@@ -5293,7 +5364,7 @@ test_types(hid_t file)
(space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
(dset=H5Dcreate2(grp, "bitfield_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
@@ -5307,7 +5378,7 @@ test_types(hid_t file)
(space=H5Screate_simple(1, &nelmts, NULL)) < 0 ||
(dset=H5Dcreate2(grp, "bitfield_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
- for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ for(i=0; i<sizeof buf; i++) buf[i] = (unsigned char)(0xff ^ i);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
goto error;
if(H5Sclose(space) < 0) goto error;
@@ -5322,7 +5393,7 @@ test_types(hid_t file)
(dset = H5Dcreate2(grp, "opaque_1", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
for(i = 0; i < sizeof buf; i++)
- buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ buf[i] = (unsigned char)(0xff ^ i);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Tclose(type) < 0) goto error;
@@ -5336,7 +5407,7 @@ test_types(hid_t file)
(dset = H5Dcreate2(grp, "opaque_2", type, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto error;
for(i = 0; i < sizeof buf; i++)
- buf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ buf[i] = (unsigned char)(0xff ^ i);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) goto error;
if(H5Sclose(space) < 0) goto error;
if(H5Tclose(type) < 0) goto error;
@@ -5460,7 +5531,7 @@ test_can_apply(hid_t file)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -5488,7 +5559,7 @@ test_can_apply(hid_t file)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
@@ -5619,7 +5690,7 @@ test_can_apply2(hid_t file)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -5647,7 +5718,7 @@ test_can_apply2(hid_t file)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n",__LINE__);
goto error;
@@ -5988,7 +6059,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -6010,7 +6081,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Write data */
- if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl) < 0) {
+ if(H5Dwrite(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_dbl_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error writing dataset data\n",__LINE__);
goto error;
@@ -6073,7 +6144,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
@@ -6123,7 +6194,7 @@ test_set_local(hid_t fapl)
} /* end if */
/* Read data */
- if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl) < 0) {
+ if(H5Dread(dsid, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, check_dbl_data) < 0) {
H5_FAILED();
HDprintf(" Line %d: Error reading dataset data\n", __LINE__);
goto error;
@@ -6856,10 +6927,12 @@ test_missing_chunk(hid_t file)
hsize_t hs_start2[2], hs_stride2[2], hs_count2[2], hs_block2[2];/* Hyperslab setting */
/* Buffers for reading/writing dataset */
- int wdata[MISSING_CHUNK_DIM],
- rdata[MISSING_CHUNK_DIM];
- int wdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM],
- rdata2[MISSING_CHUNK_DIM][MISSING_CHUNK_DIM];
+ int *wdata = NULL;
+ int *rdata = NULL;
+ int **wdata2 = NULL;
+ int **rdata2 = NULL;
+ int *wdata2_bytes = NULL;
+ int *rdata2_bytes = NULL;
/* Setting for 1-D dataset */
hsize_t dsize=100, dmax=H5S_UNLIMITED;
@@ -6876,6 +6949,26 @@ test_missing_chunk(hid_t file)
TESTING("Read dataset with unwritten chunk & undefined fill value");
+ /* Set up data arrays */
+ if(NULL == (wdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata = (int *)HDcalloc(MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+
+ if(NULL == (wdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (wdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(wdata2_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < MISSING_CHUNK_DIM; i++)
+ wdata2[i] = wdata2_bytes + (i * MISSING_CHUNK_DIM);
+
+ if(NULL == (rdata2_bytes = (int *)HDcalloc(MISSING_CHUNK_DIM * MISSING_CHUNK_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (rdata2 = (int **)HDcalloc(MISSING_CHUNK_DIM, sizeof(rdata2_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < MISSING_CHUNK_DIM; i++)
+ rdata2[i] = rdata2_bytes + (i * MISSING_CHUNK_DIM);
+
/* Get the file's file access property list */
if((fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR;
@@ -6893,10 +6986,10 @@ test_missing_chunk(hid_t file)
/* Initialize data for 2-D dataset */
for(i = 0; i < MISSING_CHUNK_DIM; i++) {
- for(j = 0; j < MISSING_CHUNK_DIM; j++) {
- wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
- rdata2[i][j] = 911;
- }
+ for(j = 0; j < MISSING_CHUNK_DIM; j++) {
+ wdata2[i][j] = (int)(j + (i * MISSING_CHUNK_DIM));
+ rdata2[i][j] = 911;
+ }
} /* end for */
/* Create dataspace */
@@ -6954,11 +7047,11 @@ test_missing_chunk(hid_t file)
/* Write selected data to the datasets */
if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
- if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2) < 0) TEST_ERROR;
+ if(H5Dwrite(did2, H5T_NATIVE_INT, sid2, sid2, H5P_DEFAULT, wdata2_bytes) < 0) TEST_ERROR;
/* Read all data from the datasets */
if(H5Dread(d, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
- if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2) < 0) TEST_ERROR;
+ if(H5Dread(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata2_bytes) < 0) TEST_ERROR;
/* Validata values read for the 1-D dataset */
for(u=0; u<MISSING_CHUNK_DIM; u++) {
@@ -7005,6 +7098,13 @@ test_missing_chunk(hid_t file)
if(H5Dclose(d) < 0) TEST_ERROR;
if(H5Dclose(did2) < 0) TEST_ERROR;
+ HDfree(rdata);
+ HDfree(wdata);
+ HDfree(rdata2);
+ HDfree(wdata2);
+ HDfree(rdata2_bytes);
+ HDfree(wdata2_bytes);
+
PASSED();
return SUCCEED;
@@ -7019,9 +7119,82 @@ error:
H5Sclose(s);
H5Sclose(sid2);
} H5E_END_TRY;
+
+ HDfree(rdata);
+ HDfree(wdata);
+ HDfree(rdata2);
+ HDfree(wdata2);
+ HDfree(rdata2_bytes);
+ HDfree(wdata2_bytes);
+
return FAIL;
} /* end test_missing_chunk() */
+/* Using Euclid's algorithm, find the greatest common divisor (GCD) of
+ * the two arguments and return it.
+ *
+ * The GCD is negative if the arguments have opposite sign. Otherwise,
+ * it is positive.
+ *
+ * If either argument is zero, then the result is undefined.
+ */
+static long
+gcd(const long l0, const long r0)
+{
+ long magnitude, remainder;
+ bool negative = ((l0 < 0) != (r0 < 0));
+ long l = labs(l0), r = labs(r0);
+
+ do {
+ if (l < r) {
+ r = r % l;
+ remainder = r;
+ } else /* r <= l */ {
+ l = l % r;
+ remainder = l;
+ }
+ } while (remainder != 0);
+
+ magnitude = (l == 0) ? r : l;
+ return negative ? -magnitude : magnitude;
+}
+
+/* Choose a random offset into an array `nelts` elements long, and store
+ * it at `offsetp`. The offset will be in the range [0, nelts - 1].
+ * Also choose a random increment, `inc`, that "generates" all
+ * indices in [0, nelts - 1] when it is added to itself repeatedly.
+ * That is, the range of the discrete function `f(i) = (i * inc)
+ * mod nelts` on the domain [0, nelts - 1] is [0, nelts - 1]. Store
+ * `inc` at `incp`.
+ *
+ * If `nelts <= 0`, results are undefined.
+ */
+static void
+make_random_offset_and_increment(long nelts, long *offsetp, long *incp)
+{
+ long inc;
+ long maxinc;
+
+ HDassert(0 < nelts);
+
+ *offsetp = HDrandom() % nelts;
+
+ /* `maxinc` is chosen so that for any `x` in [0, nelts - 1],
+ * `x + maxinc` does not overflow a long.
+ */
+ maxinc = MIN(nelts - 1, LONG_MAX - nelts);
+
+ /* Choose a random number in [1, nelts - 1]. If its greatest divisor
+ * in common with `nelts` is 1, then it will "generate" the additive ring
+ * [0, nelts - 1], so let it be our increment. Otherwise, choose a new
+ * number.
+ */
+ do {
+ inc = 1 + HDrandom() % maxinc;
+ } while (gcd(inc, nelts) != 1);
+
+ *incp = inc;
+}
/*-------------------------------------------------------------------------
* Function: test_random_chunks_real
@@ -7046,7 +7219,7 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
rbuf[NPOINTS],
check2[20][20];
hsize_t coord[NPOINTS][2];
- hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200};
+ const hsize_t dsize[2]={100,100}, dmax[2]={H5S_UNLIMITED, H5S_UNLIMITED}, csize[2]={10,10}, nsize[2]={200,200};
hsize_t fixed_dmax[2] = {1000, 1000};
hsize_t msize[1]={NPOINTS};
const char dname[]="dataset";
@@ -7054,7 +7227,9 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
size_t i, j;
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
H5F_libver_t low; /* File format low bound */
-
+ long ofs, inc;
+ long rows;
+ long cols;
TESTING(testname);
@@ -7088,12 +7263,16 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
for(j=0; j<dsize[1]/csize[1]; j++)
check2[i][j] = 0;
+ rows = (long)(dsize[0]/csize[0]);
+ cols = (long)(dsize[1]/csize[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i=0; i<NPOINTS; i++){
- do {
- chunk_row = (int)HDrandom () % (int)(dsize[0]/csize[0]);
- chunk_col = (int)HDrandom () % (int)(dsize[1]/csize[1]);
- } while (check2[chunk_row][chunk_col]);
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row+chunk_col+1;
coord[i][0] = (hsize_t)chunk_row * csize[0];
@@ -7211,12 +7390,16 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
for(j = 0; j < nsize[1] / csize[1]; j++)
check2[i][j] = 0;
+ H5_CHECKED_ASSIGN(rows, int, nsize[0] / csize[0], long);
+ H5_CHECKED_ASSIGN(cols, int, nsize[1] / csize[1], long);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < NPOINTS; i++){
- do {
- chunk_row = (int)HDrandom() % (int)(nsize[0] / csize[0]);
- chunk_col = (int)HDrandom() % (int)(nsize[1] / csize[1]);
- } while (check2[chunk_row][chunk_col]);
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
coord[i][0] = (hsize_t)chunk_row * csize[0];
@@ -7317,12 +7500,16 @@ test_random_chunks_real(const char *testname, hbool_t early_alloc, hid_t fapl)
for(j = 0; j < nsize[1] / csize[1]; j++)
check2[i][j] = 0;
+ rows = (long)(nsize[0] / csize[0]);
+ cols = (long)(nsize[1] / csize[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < NPOINTS; i++){
- do {
- chunk_row = (int)HDrandom() % (int)(nsize[0] / csize[0]);
- chunk_col = (int)HDrandom() % (int)(nsize[1] / csize[1]);
- } while (check2[chunk_row][chunk_col]);
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!check2[chunk_row][chunk_col]);
wbuf[i] = check2[chunk_row][chunk_col] = chunk_row + chunk_col + 1;
coord[i][0] = (hsize_t)chunk_row * csize[0];
@@ -7468,10 +7655,10 @@ static herr_t
test_deprec(hid_t file)
{
hid_t dataset, space, small_space, create_parms, dcpl;
- hsize_t dims[2], small_dims[2];
- hsize_t deprec_size;
- herr_t status;
- hsize_t csize[2];
+ hsize_t dims[2], small_dims[2];
+ hsize_t deprec_size;
+ herr_t H5_ATTR_NDEBUG_UNUSED status;
+ hsize_t csize[2];
TESTING("deprecated API routines");
@@ -7998,9 +8185,13 @@ test_big_chunks_bypass_cache(hid_t fapl)
hsize_t t_count[2], t_stride[2], t_offset[2], t_block[2]; /* Setting for hyperslab (2-D) */
/* Buffers for reading and writing data (1-D) */
int *wdata = NULL, *rdata1 = NULL, *rdata2 = NULL;
- /* Buffer for reading and writing data (2-D) */
- static int t_wdata[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2], t_rdata1[BYPASS_DIM][BYPASS_DIM],
- t_rdata2[BYPASS_CHUNK_DIM/2][BYPASS_CHUNK_DIM/2];
+ /* Buffers for reading and writing data (2-D) */
+ int **t_wdata = NULL;
+ int **t_rdata1 = NULL;
+ int **t_rdata2 = NULL;
+ int *t_wdata_bytes = NULL;
+ int *t_rdata1_bytes = NULL;
+ int *t_rdata2_bytes = NULL;
int i, j; /* Local index variables */
H5F_libver_t low; /* File format low bound */
H5D_chunk_index_t idx_type, t_idx_type; /* Dataset chunk index types */
@@ -8010,6 +8201,29 @@ test_big_chunks_bypass_cache(hid_t fapl)
h5_fixname(FILENAME[9], fapl, filename, sizeof filename);
+ /* Set up data arrays */
+ if(NULL == (t_wdata_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (t_wdata = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_wdata_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++)
+ t_wdata[i] = t_wdata_bytes + (i * (BYPASS_CHUNK_DIM/2));
+
+ if(NULL == (t_rdata1_bytes = (int *)HDcalloc(BYPASS_DIM * BYPASS_DIM, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (t_rdata1 = (int **)HDcalloc(BYPASS_DIM, sizeof(t_rdata1_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < BYPASS_DIM; i++)
+ t_rdata1[i] = t_rdata1_bytes + (i * BYPASS_DIM);
+
+ if(NULL == (t_rdata2_bytes = (int *)HDcalloc((BYPASS_CHUNK_DIM/2) * (BYPASS_CHUNK_DIM/2), sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (t_rdata2 = (int **)HDcalloc((BYPASS_CHUNK_DIM/2), sizeof(t_rdata2_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < (BYPASS_CHUNK_DIM/2); i++)
+ t_rdata2[i] = t_rdata2_bytes + (i * (BYPASS_CHUNK_DIM/2));
+
+
/* Check if we are using the latest version of the format */
if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR
@@ -8098,8 +8312,8 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Initialize data to write for 2-D dataset */
for(i = 0; i < BYPASS_CHUNK_DIM / 2; i++)
- for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
- t_wdata[i][j] = j;
+ for(j = 0; j < BYPASS_CHUNK_DIM / 2; j++)
+ t_wdata[i][j] = j;
/* Set up memory space for the 2-D dataset */
mid = H5Screate_simple(2, t_block, NULL);
@@ -8108,7 +8322,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* This write should go through the cache because fill value is used. */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0)
+ if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
FAIL_STACK_ERROR
/* Close the first 1-D & 2-D datasets */
@@ -8123,7 +8337,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
* chunk is bigger than the cache size and it isn't allocated on disk. */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata1) < 0)
FAIL_STACK_ERROR
- if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1) < 0)
+ if(H5Dread(t_dsid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, t_rdata1_bytes) < 0)
FAIL_STACK_ERROR
/* Verify data for the first 1-D dataset */
@@ -8154,8 +8368,8 @@ test_big_chunks_bypass_cache(hid_t fapl)
for(i = BYPASS_CHUNK_DIM / 2; i < BYPASS_DIM; i++)
for(j = BYPASS_CHUNK_DIM / 2; j < BYPASS_DIM; j++)
if(t_rdata1[i][j] != fvalue) {
- HDprintf(" Read different values than written in the 2nd chunk.\n");
- HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n",
+ HDprintf(" Read different values than written in the 2nd chunk.\n");
+ HDprintf(" At line %d and index (%d, %d), t_rdata1 = %d. It should be %d.\n",
__LINE__, i, j, t_rdata1[i][j], fvalue);
TEST_ERROR
} /* end if */
@@ -8179,7 +8393,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
/* Write to the second 1-D & 2-D dataset */
if(H5Dwrite(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, wdata) < 0)
FAIL_STACK_ERROR
- if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata) < 0)
+ if(H5Dwrite(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_wdata_bytes) < 0)
FAIL_STACK_ERROR
/* Close the second 1-D & 2-D dataset */
@@ -8195,7 +8409,7 @@ test_big_chunks_bypass_cache(hid_t fapl)
* the cache size. */
if(H5Dread(dsid, H5T_NATIVE_INT, H5S_ALL, sid, H5P_DEFAULT, rdata2) < 0)
FAIL_STACK_ERROR
- if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2) < 0)
+ if(H5Dread(t_dsid, H5T_NATIVE_INT, mid, t_sid, H5P_DEFAULT, t_rdata2_bytes) < 0)
FAIL_STACK_ERROR
/* Verify data for the second 1-D dataset */
@@ -8230,6 +8444,12 @@ test_big_chunks_bypass_cache(hid_t fapl)
HDfree(wdata);
HDfree(rdata1);
HDfree(rdata2);
+ HDfree(t_wdata);
+ HDfree(t_rdata1);
+ HDfree(t_rdata2);
+ HDfree(t_wdata_bytes);
+ HDfree(t_rdata1_bytes);
+ HDfree(t_rdata2_bytes);
PASSED();
return SUCCEED;
@@ -8245,12 +8465,17 @@ error:
H5Sclose(t_sid);
H5Fclose(fid);
} H5E_END_TRY;
- if(wdata)
- HDfree(wdata);
- if(rdata1)
- HDfree(rdata1);
- if(rdata2)
- HDfree(rdata2);
+
+ HDfree(wdata);
+ HDfree(rdata1);
+ HDfree(rdata2);
+ HDfree(t_wdata);
+ HDfree(t_rdata1);
+ HDfree(t_rdata2);
+ HDfree(t_wdata_bytes);
+ HDfree(t_rdata1_bytes);
+ HDfree(t_rdata2_bytes);
+
return FAIL;
} /* end test_big_chunks_bypass_cache() */
@@ -8341,7 +8566,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl)
H5D_alloc_time_t alloc_time; /* Storage allocation time */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
unsigned ndims; /* Current # of dims to test */
/* Loop over dataspace ranks to test */
@@ -8641,7 +8866,7 @@ test_reopen_chunk_fast(hid_t fapl)
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -8752,13 +8977,33 @@ test_chunk_fast_bug1(hid_t fapl)
hid_t dsid = -1; /* Dataset ID */
hsize_t dim[2], max_dim[2], chunk_dim[2]; /* Dataset and chunk dimensions */
H5D_alloc_time_t alloc_time; /* Storage allocation time */
- static unsigned wbuf[40][20], rbuf[40][20]; /* Element written/read */
+
+ unsigned **wbuf = NULL;
+ unsigned **rbuf = NULL;
+ unsigned *wbuf_bytes = NULL;
+ unsigned *rbuf_bytes = NULL;
+
unsigned i, j; /* Local index variables */
TESTING("datasets w/extensible array chunk indexing bug");
h5_fixname(FILENAME[10], fapl, filename, sizeof filename);
+ /* Set up data array */
+ if(NULL == (wbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
+ TEST_ERROR;
+ if(NULL == (wbuf = (unsigned **)HDcalloc(40, sizeof(wbuf_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 40; i++)
+ wbuf[i] = wbuf_bytes + (i * 20);
+
+ if(NULL == (rbuf_bytes = (unsigned *)HDcalloc(40 * 20, sizeof(unsigned))))
+ TEST_ERROR;
+ if(NULL == (rbuf = (unsigned **)HDcalloc(40, sizeof(rbuf_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 40; i++)
+ rbuf[i] = rbuf_bytes + (i * 20);
+
/* Initialize write buffer */
for(i=0; i<40; i++)
for(j=0; j<20; j++)
@@ -8772,7 +9017,7 @@ test_chunk_fast_bug1(hid_t fapl)
if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -8792,7 +9037,7 @@ test_chunk_fast_bug1(hid_t fapl)
FAIL_STACK_ERROR
/* Write buffer to dataset */
- if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &wbuf) < 0)
+ if(H5Dwrite(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, wbuf_bytes) < 0)
FAIL_STACK_ERROR
/* Close everything */
@@ -8802,7 +9047,7 @@ test_chunk_fast_bug1(hid_t fapl)
if((dsid = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
/* Read from dataset */
- if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, &rbuf) < 0)
+ if(H5Dread(dsid, H5T_NATIVE_UINT, sid, sid, H5P_DEFAULT, rbuf_bytes) < 0)
FAIL_STACK_ERROR
/* Verify read data */
@@ -8819,6 +9064,11 @@ test_chunk_fast_bug1(hid_t fapl)
if(H5Sclose(sid) < 0) FAIL_STACK_ERROR
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(wbuf_bytes);
+ HDfree(rbuf_bytes);
+
PASSED();
return SUCCEED;
@@ -8829,6 +9079,12 @@ error:
H5Sclose(sid);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(wbuf_bytes);
+ HDfree(rbuf_bytes);
+
return FAIL;
} /* end test_chunk_fast_bug1() */
@@ -8950,7 +9206,7 @@ test_chunk_expand(hid_t fapl)
if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9338,7 +9594,7 @@ test_fixed_array(hid_t fapl)
hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */
hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */
- hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */
+ const hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */
hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */
hid_t mem_id; /* Memory space ID */
@@ -9352,14 +9608,20 @@ test_fixed_array(hid_t fapl)
int rbuf[POINTS]; /* read buffer */
int *rbuf_big = NULL; /* read buffer for big dataset */
- hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
- int chunks[12][6]; /* # of chunks for dataset dimensions */
- int chunks_big[125][20]; /* # of chunks for big dataset dimensions */
+ const hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */
+
+ int **chunks = NULL; /* # of chunks for dataset dimensions */
+ int **chunks_big = NULL; /* # of chunks for big dataset dimensions */
+ int *chunks_bytes = NULL;
+ int *chunks_big_bytes = NULL;
+
int chunk_row; /* chunk row index */
int chunk_col; /* chunk column index */
- hsize_t coord[POINTS][2]; /* datdaset coordinates */
- hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */
+ hsize_t **coord = NULL; /* datdaset coordinates */
+ hsize_t **coord_big = NULL; /* big datdaset coordinates */
+ hsize_t *coord_bytes = NULL;
+ hsize_t *coord_big_bytes = NULL;
H5D_chunk_index_t idx_type; /* Dataset chunk index type */
H5F_libver_t low, high; /* File format bounds */
@@ -9374,11 +9636,43 @@ test_fixed_array(hid_t fapl)
size_t i, j; /* local index variables */
herr_t ret; /* Generic return value */
+ long ofs, inc;
+ long rows;
+ long cols;
TESTING("datasets w/fixed array as chunk index");
h5_fixname(FILENAME[12], fapl, filename, sizeof filename);
+ /* Set up 2D data arrays */
+ if(NULL == (chunks_bytes = (int *)HDcalloc(12 * 6, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (chunks = (int **)HDcalloc(12, sizeof(chunks_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 12; i++)
+ chunks[i] = chunks_bytes + (i * 6);
+
+ if(NULL == (chunks_big_bytes = (int *)HDcalloc(125 * 20, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (chunks_big = (int **)HDcalloc(125, sizeof(chunks_big_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < 125; i++)
+ chunks_big[i] = chunks_big_bytes + (i * 20);
+
+ if(NULL == (coord_bytes = (hsize_t *)HDcalloc(POINTS * 2, sizeof(hsize_t))))
+ TEST_ERROR;
+ if(NULL == (coord = (hsize_t **)HDcalloc(POINTS, sizeof(coord_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < POINTS; i++)
+ coord[i] = coord_bytes + (i * 2);
+
+ if(NULL == (coord_big_bytes = (hsize_t *)HDcalloc(POINTS_BIG * 2, sizeof(hsize_t))))
+ TEST_ERROR;
+ if(NULL == (coord_big = (hsize_t **)HDcalloc(POINTS_BIG, sizeof(coord_big_bytes))))
+ TEST_ERROR;
+ for (i = 0; i < POINTS_BIG; i++)
+ coord_big[i] = coord_big_bytes + (i * 2);
+
/* Check if we are using the latest version of the format */
if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR
@@ -9404,7 +9698,7 @@ test_fixed_array(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -9432,16 +9726,20 @@ test_fixed_array(hid_t fapl)
for(j = 0; j < dim2[1]/chunk_dim2[1]; j++)
chunks[i][j] = 0;
+ rows = (long)(dim2[0]/chunk_dim2[0]);
+ cols = (long)(dim2[1]/chunk_dim2[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < POINTS; i++){
- do {
- chunk_row = (int)HDrandom () % (int)(dim2[0]/chunk_dim2[0]);
- chunk_col = (int)HDrandom () % (int)(dim2[1]/chunk_dim2[1]);
- } while (chunks[chunk_row][chunk_col]);
-
- wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
- coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!chunks[chunk_row][chunk_col]);
+
+ wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1;
+ coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
+ coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
} /* end for */
/* Create first dataset with cur and max dimensions */
@@ -9474,7 +9772,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0)
+ if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
TEST_ERROR;
/* Write into dataset */
@@ -9515,7 +9813,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0)
+ if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0)
TEST_ERROR;
/* Write into dataset */
@@ -9557,23 +9855,27 @@ test_fixed_array(hid_t fapl)
for(j = 0; j < dim2_big[1]/chunk_dim2[1]; j++)
chunks_big[i][j] = 0;
+ rows = (long)(dim2_big[0]/chunk_dim2[0]);
+ cols = (long)(dim2_big[1]/chunk_dim2[1]);
+ make_random_offset_and_increment(rows * cols, &ofs, &inc);
+
/* Generate random point coordinates. Only one point is selected per chunk */
for(i = 0; i < POINTS_BIG; i++){
- do {
- chunk_row = (int)HDrandom () % (int)(dim2_big[0]/chunk_dim2[0]);
- chunk_col = (int)HDrandom () % (int)(dim2_big[1]/chunk_dim2[1]);
- } while (chunks_big[chunk_row][chunk_col]);
-
- wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1;
- coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
- coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
+ H5_CHECKED_ASSIGN(chunk_row, int, ofs / cols, long);
+ H5_CHECKED_ASSIGN(chunk_col, int, ofs % cols, long);
+ ofs = (ofs + inc) % (rows * cols);
+ HDassert(!chunks_big[chunk_row][chunk_col]);
+
+ wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1;
+ coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0];
+ coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1];
} /* end for */
/* Create dataspace for write buffer */
if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR;
/* Select the random points for writing */
- if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0)
+ if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0)
TEST_ERROR;
/* Write into dataset */
@@ -9595,7 +9897,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -9623,7 +9925,7 @@ test_fixed_array(hid_t fapl)
if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR;
+ if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord_bytes) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR;
@@ -9650,7 +9952,7 @@ test_fixed_array(hid_t fapl)
if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR;
/* Select the random points for reading */
- if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR;
+ if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big_bytes) < 0) TEST_ERROR;
/* Read from dataset */
if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR;
@@ -9692,6 +9994,15 @@ test_fixed_array(hid_t fapl)
HDfree(wbuf_big);
HDfree(rbuf_big);
+ HDfree(chunks);
+ HDfree(chunks_big);
+ HDfree(coord);
+ HDfree(coord_big);
+ HDfree(chunks_bytes);
+ HDfree(chunks_big_bytes);
+ HDfree(coord_bytes);
+ HDfree(coord_big_bytes);
+
PASSED();
return SUCCEED;
@@ -9703,10 +10014,18 @@ error:
H5Sclose(mem_id);
H5Fclose(fid);
} H5E_END_TRY;
- if(wbuf_big)
- HDfree(wbuf_big);
- if(rbuf_big)
- HDfree(rbuf_big);
+
+ HDfree(wbuf_big);
+ HDfree(rbuf_big);
+ HDfree(chunks);
+ HDfree(chunks_big);
+ HDfree(coord);
+ HDfree(coord_big);
+ HDfree(chunks_bytes);
+ HDfree(chunks_big_bytes);
+ HDfree(coord_bytes);
+ HDfree(coord_big_bytes);
+
return FAIL;
} /* end test_fixed_array() */
@@ -9805,7 +10124,7 @@ test_single_chunk(hid_t fapl)
#endif /* H5_HAVE_FILTER_DEFLATE */
/* Loop over storage allocation time */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR
@@ -10335,8 +10654,8 @@ test_zero_dim_dset(hid_t fapl)
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combination, and verify support for reading a 1D
chunked dataset with dimension size = 0 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds before opening the file */
H5E_BEGIN_TRY {
@@ -10673,7 +10992,7 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl)
const hsize_t maxshape[1] = { H5S_UNLIMITED };
const hsize_t chunk[1] = { 8 };
const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- H5O_info_t info;
+ H5O_info2_t info;
TESTING("Extensible array chunk index header flush dependencies handled correctly");
@@ -10738,9 +11057,9 @@ test_earray_hdr_fd(const char *env_h5_driver, hid_t fapl)
FAIL_STACK_ERROR;
/* The second call triggered a bug in the library (JIRA issue: SWMR-95) */
- if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Oget_info_by_name2(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(fid, DSET_EARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
if(H5Pclose(fapl) < 0)
@@ -10793,7 +11112,7 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl)
const hsize_t maxshape[1] = { 64 };
const hsize_t chunk[1] = { 8 };
const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- H5O_info_t info;
+ H5O_info2_t info;
TESTING("Fixed array chunk index header flush dependencies handled correctly");
@@ -10858,9 +11177,9 @@ test_farray_hdr_fd(const char *env_h5_driver, hid_t fapl)
FAIL_STACK_ERROR;
/* The second call triggered a bug in the library (JIRA issue: SWMR-95) */
- if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Oget_info_by_name2(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(fid, DSET_FARRAY_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
if(H5Pclose(fapl) < 0)
@@ -10913,7 +11232,7 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
const hsize_t maxshape[2] = { H5S_UNLIMITED, H5S_UNLIMITED };
const hsize_t chunk[2] = { 8, 8 };
const int buffer[8] = {0, 1, 2, 3, 4, 5, 6, 7};
- H5O_info_t info;
+ H5O_info2_t info;
TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly");
@@ -10978,9 +11297,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
FAIL_STACK_ERROR;
/* The second call triggered a bug in the library (JIRA issue: SWMR-95) */
- if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
- if(H5Oget_info_by_name2(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(fid, DSET_BT2_HDR_FD, &info, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR;
if(H5Pclose(fapl) < 0)
@@ -12686,20 +13005,23 @@ error:
} /* end dls_01_write_data() */
static herr_t
-dls_01_read_stuff( hid_t fid )
+dls_01_read_stuff(hid_t fid)
{
int status = 0;
hid_t did = 0;
- H5O_info_t info;
+ H5O_info2_t info;
- did = H5Dopen2( fid, DLS_01_DATASET, H5P_DEFAULT );
- if ( did <= 0 ) TEST_ERROR
+ did = H5Dopen2(fid, DLS_01_DATASET, H5P_DEFAULT);
+ if(did <= 0)
+ TEST_ERROR
- status = H5Oget_info2( did, &info, H5O_INFO_BASIC );
- if ( status != 0 ) TEST_ERROR
+ status = H5Oget_info3(did, &info, H5O_INFO_BASIC);
+ if(status != 0)
+ TEST_ERROR
- status = H5Dclose( did );
- if ( status != 0 ) TEST_ERROR
+ status = H5Dclose(did);
+ if(status != 0)
+ TEST_ERROR
return SUCCEED;
@@ -12964,8 +13286,8 @@ test_versionbounds(void)
/* Create a source file and a dataset in it. Create a virtual file and
virtual dataset. Creation of virtual dataset should only succeed in
H5F_LIBVER_V110 */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds, skip for invalid low/high combination */
H5E_BEGIN_TRY {
@@ -13043,7 +13365,7 @@ test_versionbounds(void)
return FAIL;
} /* end test_versionbounds() */
-
+
/*-----------------------------------------------------------------------------
* Function: test_object_header_minimization_dcpl
*
@@ -13190,6 +13512,7 @@ main(void)
int nerrors = 0;
const char *envval;
hbool_t contig_addr_vfd; /* Whether VFD used has a contigous address space */
+ int i;
/* Don't run this test using certain file drivers */
envval = HDgetenv("HDF5_DRIVER");
@@ -13202,6 +13525,39 @@ main(void)
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
+ /* Initialize global arrays */
+ /* points */
+ if(NULL == (points_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (points = (int **)HDcalloc(DSET_DIM1, sizeof(points_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ points[i] = points_data + (i * DSET_DIM2);
+
+ /* check */
+ if(NULL == (check_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (check = (int **)HDcalloc(DSET_DIM1, sizeof(check_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ check[i] = check_data + (i * DSET_DIM2);
+
+ /* points_dbl */
+ if(NULL == (points_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
+ TEST_ERROR;
+ if(NULL == (points_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(points_dbl_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ points_dbl[i] = points_dbl_data + (i * DSET_DIM2);
+
+ /* check_dbl */
+ if(NULL == (check_dbl_data = (double *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(double))))
+ TEST_ERROR;
+ if(NULL == (check_dbl = (double **)HDcalloc(DSET_DIM1, sizeof(check_dbl_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ check_dbl[i] = check_dbl_data + (i * DSET_DIM2);
+
/* Testing setup */
h5_reset();
fapl = h5_fileaccess();
@@ -13387,9 +13743,29 @@ main(void)
#endif /* H5_HAVE_FILTER_SZIP */
h5_cleanup(FILENAME, fapl);
+ HDfree(points);
+ HDfree(check);
+ HDfree(points_dbl);
+ HDfree(check_dbl);
+
+ HDfree(points_data);
+ HDfree(check_data);
+ HDfree(points_dbl_data);
+ HDfree(check_dbl_data);
+
HDexit(EXIT_SUCCESS);
error:
+ HDfree(points);
+ HDfree(check);
+ HDfree(points_dbl);
+ HDfree(check_dbl);
+
+ HDfree(points_data);
+ HDfree(check_data);
+ HDfree(points_dbl_data);
+ HDfree(check_dbl_data);
+
nerrors = MAX(1, nerrors);
HDprintf("***** %d DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 7e1adf5..8d04770 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -770,7 +770,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_c != SCHAR_MAX) {
- double x;
+ double x = 0.;
signed char y;
if(0 == fails_this_test++)
@@ -814,7 +814,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_i != fill_value) {
- float x;
+ float x = 0.;
int y;
if(0 == fails_this_test++)
@@ -2723,16 +2723,16 @@ my_isnan(dtype_t type, void *val)
char s[256];
if (FLT_FLOAT==type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, val, sizeof(float));
retval = (x!=x);
} else if (FLT_DOUBLE==type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, val, sizeof(double));
retval = (x!=x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, val, sizeof(long double));
retval = (x!=x);
#endif
@@ -2746,18 +2746,18 @@ my_isnan(dtype_t type, void *val)
*/
if (!retval) {
if (FLT_FLOAT==type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, val, sizeof(float));
HDsnprintf(s, sizeof(s), "%g", (double)x);
} else if (FLT_DOUBLE==type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, val, sizeof(double));
HDsnprintf(s, sizeof(s), "%g", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, val, sizeof(long double));
HDsnprintf(s, sizeof(s), "%Lg", x);
@@ -3197,7 +3197,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
int check_expo[2];
if (FLT_FLOAT==dst_type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
if (underflow &&
HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
@@ -3208,7 +3208,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
check_mant[0] = HDfrexpf(x, check_expo+0);
check_mant[1] = HDfrexpf(hw_f, check_expo+1);
} else if (FLT_DOUBLE==dst_type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
if (underflow &&
HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
@@ -3220,7 +3220,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
check_mant[1] = HDfrexp(hw_d, check_expo+1);
#if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE)
} else {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
check_mant[0] = (double)HDfrexpl(x, check_expo+0);
@@ -3265,16 +3265,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
if (FLT_FLOAT==src_type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==src_type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(double));
HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(long double));
HDfprintf(stdout," %29.20Le\n", x);
#endif
@@ -3285,16 +3285,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type) {
- float x;
+ float x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==dst_type) {
- double x;
+ double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
- long double x;
+ long double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
HDfprintf(stdout," %29.20Le\n", x);
#endif
diff --git a/test/dtypes.c b/test/dtypes.c
index 98a3f87..0f95830 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -1216,8 +1216,8 @@ test_compound_6(void)
orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->b = (i*8+1) & 0x7fff;
- s_ptr->d = (i*8+6) & 0x7fff;
+ s_ptr->b = (int16_t)((i*8+1) & 0x7fff);
+ s_ptr->d = (int16_t)((i*8+6) & 0x7fff);
}
HDmemcpy(buf, orig, nelmts*sizeof(struct st));
@@ -1809,7 +1809,7 @@ test_compound_9(void)
goto error;
} /* end if */
- if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ if(H5Treclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
@@ -1875,7 +1875,7 @@ test_compound_9(void)
goto error;
} /* end if */
- if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ if(H5Treclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
HDprintf("Can't read data\n");
goto error;
@@ -2063,12 +2063,12 @@ test_compound_10(void)
goto error;
}
} /* end for */
- if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
+ if(H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
- if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
+ if(H5Treclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
@@ -2226,7 +2226,7 @@ test_compound_11(void)
TEST_ERROR
} /* end if */
} /* end for */
- if(H5Dvlen_reclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) {
+ if(H5Treclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim data\n");
goto error;
@@ -2270,7 +2270,7 @@ test_compound_11(void)
TEST_ERROR
} /* end if */
} /* end for */
- if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ if(H5Treclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim data\n");
goto error;
@@ -2308,7 +2308,7 @@ test_compound_11(void)
TEST_ERROR
} /* end if */
} /* end for */
- if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
+ if(H5Treclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim data\n");
goto error;
@@ -2811,13 +2811,13 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ if(H5Treclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata1.str = NULL;
- if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ if(H5Treclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
@@ -2898,13 +2898,13 @@ test_compound_14(void)
goto error;
} /* end if */
- if(H5Dvlen_reclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
+ if(H5Treclaim(cmpd_m1_tid, space_id, H5P_DEFAULT, &rdata1) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
} /* end if */
rdata1.str = NULL;
- if(H5Dvlen_reclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
+ if(H5Treclaim(cmpd_m2_tid, space_id, H5P_DEFAULT, &rdata2) < 0) {
H5_FAILED(); AT();
HDprintf("Can't reclaim read data\n");
goto error;
@@ -5884,7 +5884,7 @@ test_latest(void)
hid_t file = (-1); /* File ID */
hid_t tid1 = (-1), tid2 = (-1); /* Datatype ID */
hid_t fapl = (-1); /* File access property list */
- H5O_info_t oi; /* Stat buffer for committed datatype */
+ H5O_native_info_t oi; /* Stat buffer for committed datatype */
hsize_t old_dtype_oh_size; /* Size of object header with "old" format */
hsize_t new_dtype_oh_size; /* Size of object header with "new" format */
char filename[1024]; /* Buffer for filename */
@@ -5918,7 +5918,7 @@ test_latest(void)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0)
+ if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
old_dtype_oh_size = oi.hdr.space.total;
@@ -5943,7 +5943,7 @@ test_latest(void)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0)
+ if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Check that the object header info is still the same */
@@ -5979,7 +5979,7 @@ test_latest(void)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0)
+ if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
new_dtype_oh_size = oi.hdr.space.total;
@@ -6008,7 +6008,7 @@ test_latest(void)
FAIL_STACK_ERROR
/* Get information about datatype on disk */
- if(H5Oget_info_by_name2(file, compnd_type, &oi, H5O_INFO_HDR, H5P_DEFAULT) < 0)
+ if(H5Oget_native_info_by_name(file, compnd_type, &oi, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Check that the object header info is still the same */
@@ -6732,7 +6732,7 @@ static void create_del_obj_named_test_file(const char *filename, hid_t fapl,
hid_t my_fapl; /* Copy of file access property list ID */
hid_t dcpl; /* Dataset creation property list ID */
unsigned use_at_least_v18;/* Whether to use old or new format */
- herr_t status; /* Generic return value */
+ herr_t H5_ATTR_NDEBUG_UNUSED status; /* Generic return value */
/* Make copy of FAPL */
my_fapl = H5Pcopy(fapl);
@@ -6858,8 +6858,8 @@ test_delete_obj_named(hid_t fapl)
/* Loop through all valid the combinations of low/high library format bounds,
to test delete objects that use named datatypes through different file IDs */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -6959,8 +6959,8 @@ test_delete_obj_named_fileid(hid_t fapl)
h5_fixname(FILENAME[9], fapl2, filename2, sizeof filename2);
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Skip invalid low/high combination */
if ((high == H5F_LIBVER_EARLIEST) || (low > high))
@@ -7292,7 +7292,7 @@ test_utf_ascii_conv(void)
/* Test conversion in memory */
H5E_BEGIN_TRY {
- status = H5Tconvert(utf8_vtid, ascii_vtid, 1, (void *)utf8_w, NULL, H5P_DEFAULT);
+ status = H5Tconvert(utf8_vtid, ascii_vtid, 1, &utf8_w, NULL, H5P_DEFAULT);
} H5E_END_TRY
if(status >= 0)
FAIL_STACK_ERROR
@@ -7325,7 +7325,7 @@ test_utf_ascii_conv(void)
************************************************/
/* Test conversion in memory */
H5E_BEGIN_TRY {
- status = H5Tconvert(ascii_vtid, utf8_vtid, 1, (void *)ascii_w, NULL, H5P_DEFAULT);
+ status = H5Tconvert(ascii_vtid, utf8_vtid, 1, &ascii_w, NULL, H5P_DEFAULT);
} H5E_END_TRY
if(status >= 0)
FAIL_STACK_ERROR
diff --git a/test/earray.c b/test/earray.c
index 71dd8b5..3c0212d 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -2471,7 +2471,7 @@ main(void)
init_cparam(&cparam);
/* Iterate over the testing parameters */
- for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; H5_INC_ENUM(earray_test_type_t, curr_test)) {
+ for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) {
/* Initialize the testing parameters */
init_tparam(&tparam, &cparam);
@@ -2503,7 +2503,7 @@ main(void)
nerrors += test_delete_open(fapl, &cparam, &tparam);
/* Iterate over the type of capacity tests */
- for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) {
+ for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) {
hsize_t sblk; /* Super block index */
hsize_t dblk; /* Data block index */
hsize_t nelmts; /* # of elements to test */
diff --git a/test/efc.c b/test/efc.c
index b427884..b818fb4 100644
--- a/test/efc.c
+++ b/test/efc.c
@@ -32,8 +32,14 @@ const char *FILENAME[] = {
NULL
};
+/* Windows doesn't have PATH_MAX */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif /* !PATH_MAX */
+
/* Global patched filename buffer */
-static char filename[6][1024];
+#define N_FILENAMES 6
+static char *filename[N_FILENAMES];
/* Global property lists - just copies of the defaults (necessary to use
* internal functions */
@@ -2896,10 +2902,11 @@ error:
int
main(void)
{
- unsigned nerrors = 0; /* track errors */
- H5P_genplist_t *plist; /* Property list pointer for FAPL */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ unsigned nerrors = 0; /* track errors */
+ H5P_genplist_t *plist; /* Property list pointer for FAPL */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
+ int i; /* iterator */
/* Test Setup */
HDputs("Testing the external file cache");
@@ -2908,13 +2915,18 @@ main(void)
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
fapl_id = h5_fileaccess();
+ /* Allocate memory for filenames */
+ for(i = 0; i < N_FILENAMES; i++) {
+ filename[i] = (char *)HDcalloc(PATH_MAX, sizeof(char));
+ }
+
/* Patch filenames */
- h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0]));
- h5_fixname(FILENAME[1], fapl_id, filename[1], sizeof(filename[1]));
- h5_fixname(FILENAME[2], fapl_id, filename[2], sizeof(filename[2]));
- h5_fixname(FILENAME[3], fapl_id, filename[3], sizeof(filename[3]));
- h5_fixname(FILENAME[4], fapl_id, filename[4], sizeof(filename[4]));
- h5_fixname(FILENAME[5], fapl_id, filename[5], sizeof(filename[5]));
+ h5_fixname(FILENAME[0], fapl_id, filename[0], PATH_MAX);
+ h5_fixname(FILENAME[1], fapl_id, filename[1], PATH_MAX);
+ h5_fixname(FILENAME[2], fapl_id, filename[2], PATH_MAX);
+ h5_fixname(FILENAME[3], fapl_id, filename[3], PATH_MAX);
+ h5_fixname(FILENAME[4], fapl_id, filename[4], PATH_MAX);
+ h5_fixname(FILENAME[5], fapl_id, filename[5], PATH_MAX);
/* Push API context */
if(H5CX_push() < 0) FAIL_STACK_ERROR
@@ -2942,7 +2954,8 @@ main(void)
nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0);
/* Pop API context */
- if(api_ctx_pushed && H5CX_pop() < 0) FAIL_STACK_ERROR
+ if(api_ctx_pushed && H5CX_pop() < 0)
+ FAIL_STACK_ERROR
api_ctx_pushed = FALSE;
if(nerrors)
@@ -2952,6 +2965,10 @@ main(void)
h5_clean_files(FILENAME, fapl_id);
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
+
return EXIT_SUCCESS;
error:
@@ -2961,7 +2978,12 @@ error:
H5Pclose(fapl_id);
} H5E_END_TRY
- if(api_ctx_pushed) H5CX_pop();
+ if(api_ctx_pushed)
+ H5CX_pop();
+
+ for(i = 0; i < N_FILENAMES; i++) {
+ HDfree(filename[i]);
+ }
return EXIT_FAILURE;
} /* end main() */
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index fa0a15e..54f3fb0 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -187,8 +187,8 @@ main(void)
-1 };
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
char msg[80]; /* Message for file version bounds */
const char *low_string; /* The low bound string */
const char *high_string; /* The high bound string */
diff --git a/test/err_compat.c b/test/err_compat.c
index d2d039a..eb86760 100644
--- a/test/err_compat.c
+++ b/test/err_compat.c
@@ -35,7 +35,10 @@ const char *FILENAME[] = {
#define DIM0 100
#define DIM1 200
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+int **ipoints2 = NULL;
+int **icheck2 = NULL;
+int *ipoints2_data = NULL;
+int *icheck2_data = NULL;
#define DSET_NAME "a_dataset"
#define FAKE_ID (hid_t)-1
@@ -465,13 +468,29 @@ dump_error(void)
int
main(void)
{
- hid_t file, fapl;
+ hid_t file, fapl;
char filename[1024];
- const char *FUNC_main="main";
+ const char *FUNC_main="main";
+ int i;
HDfprintf(stderr, " This program tests the Error API compatible with HDF5 v1.6. There are supposed to be some error messages\n");
fapl = h5_fileaccess();
+ /* Set up data arrays */
+ if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIM0; i++)
+ ipoints2[i] = ipoints2_data + (i * DIM1);
+
+ if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIM0; i++)
+ icheck2[i] = icheck2_data + (i * DIM1);
+
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR ;
@@ -500,10 +519,20 @@ main(void)
if(H5Fclose(file) < 0) TEST_ERROR ;
h5_clean_files(FILENAME, fapl);
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDprintf("All error API tests passed.\n");
return 0;
error:
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDprintf("***** ERROR TEST FAILED! *****\n");
return 1;
}
diff --git a/test/error_test.c b/test/error_test.c
index 1de9065..7c6cf9f 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -38,7 +38,10 @@ const char *FILENAME[] = {
#define DIM0 100
#define DIM1 200
-int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1];
+int **ipoints2 = NULL;
+int **icheck2 = NULL;
+int *ipoints2_data = NULL;
+int *icheck2_data = NULL;
hid_t ERR_CLS;
hid_t ERR_CLS2;
@@ -326,8 +329,7 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie
* 'full_desc' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static herr_t
test_long_desc(void)
{
@@ -382,7 +384,7 @@ error:
return -1;
} /* end test_long_desc() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -679,6 +681,7 @@ main(void)
hid_t estack_id = -1;
char filename[1024];
const char *FUNC_main = "main";
+ int i;
HDfprintf(stderr, " This program tests the Error API. There're supposed to be some error messages\n");
@@ -689,6 +692,21 @@ main(void)
if ((fapl = h5_fileaccess()) < 0)
TEST_ERROR;
+ /* Set up data arrays */
+ if(NULL == (ipoints2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (ipoints2 = (int **)HDcalloc(DIM0, sizeof(ipoints2_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIM0; i++)
+ ipoints2[i] = ipoints2_data + (i * DIM1);
+
+ if(NULL == (icheck2_data = (int *)HDcalloc(DIM0 * DIM1, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (icheck2 = (int **)HDcalloc(DIM0, sizeof(icheck2_data))))
+ TEST_ERROR;
+ for (i = 0; i < DIM0; i++)
+ icheck2[i] = icheck2_data + (i * DIM1);
+
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
@@ -755,10 +773,20 @@ main(void)
h5_clean_files(FILENAME, fapl);
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDfprintf(stderr, "\nAll error API tests passed.\n");
return 0;
error:
+ HDfree(ipoints2);
+ HDfree(ipoints2_data);
+ HDfree(icheck2);
+ HDfree(icheck2_data);
+
HDfprintf(stderr, "\n***** ERROR TEST FAILED (real problem)! *****\n");
return 1;
}
diff --git a/test/extend.c b/test/extend.c
index a31ac0e..1e2b5b5 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -25,11 +25,16 @@ const char *FILENAME[] = {
NULL
};
-#define NX 100 /* USE AN EVEN NUMBER!*/
-#define NY 100 /* USE AN EVEN NUMBER!*/
+#define N1X 100 /* USE AN EVEN NUMBER! */
+#define N1Y 100 /* USE AN EVEN NUMBER! */
+#define N2X (N1X / 2)
+#define N2Y (N1Y / 2)
/* Data buffers */
-static int buf1[NY][NX], buf2[NX / 2][NY / 2];
+static int **buf1 = NULL;
+static int *buf1_data = NULL;
+static int **buf2 = NULL;
+static int *buf2_data = NULL;
/*-------------------------------------------------------------------------
@@ -49,8 +54,8 @@ static int
write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space)
{
hid_t dataset, file_space, half_space;
- static const hsize_t dims[2] = {NX, NY};
- static const hsize_t half_dims[2] = {NX / 2, NY / 2};
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t half_dims[2] = {N2X, N2Y};
hsize_t size[2];
hsize_t max_size[2] = {0, 0};
hsize_t offset[2];
@@ -63,13 +68,13 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me
/* Write the data */
for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++) {
+ for(j = 0; j < 5; j++) {
- /* Extend the dataset */
- offset[0] = (hsize_t)(i * NX);
- offset[1] = (hsize_t)(j * NY);
- size[0] = offset[0] + NX;
- size[1] = offset[1] + NY;
+ /* Extend the dataset */
+ offset[0] = (hsize_t)(i * N1X);
+ offset[1] = (hsize_t)(j * N1Y);
+ size[0] = offset[0] + N1X;
+ size[1] = offset[1] + N1Y;
if(size[0] > max_size[0] || size[1] > max_size[1]) {
if(size[0] > max_size[0])
max_size[0] = size[0];
@@ -78,42 +83,41 @@ write_data(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t me
if(H5Dset_extent(dataset, max_size) < 0) TEST_ERROR;
} /* end if */
- /* Select a hyperslab */
+ /* Select a hyperslab */
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
- /* Write to the hyperslab */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR;
+ /* Write to the hyperslab */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR;
if(H5Sclose(file_space) < 0) TEST_ERROR;
- } /* end for */
+ } /* end for */
/* Read the data */
if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR;
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
-
- /* Select a hyperslab */
- offset[0] = (hsize_t)(i * (NX / 2));
- offset[1] = (hsize_t)(j * (NY / 2));
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
-
- /* Read */
- if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR;
-
- /* Compare */
- for(k = 0; k < (NX / 2); k++)
- for(m = 0; m < (NY / 2); m++)
- if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) {
- HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
- HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
- HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]);
- TEST_ERROR;
- } /* end if */
- } /* end for */
+ for(j = 0; j < 10; j++) {
+
+ /* Select a hyperslab */
+ offset[0] = (hsize_t)(i * N2X);
+ offset[1] = (hsize_t)(j * N2Y);
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
+
+ /* Read */
+ if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR;
+
+ /* Compare */
+ for(k = 0; k < N2X; k++)
+ for(m = 0; m < N2Y; m++)
+ if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
+ HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
+ HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
+ HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
+ TEST_ERROR;
+ } /* end if */
+ } /* end for */
} /* end for */
-
/* Cleanup */
if(H5Dclose(dataset) < 0) TEST_ERROR;
if(H5Sclose(file_space) < 0) TEST_ERROR;
@@ -146,8 +150,8 @@ static int
write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, hid_t mem_space)
{
hid_t dataset, file_space, half_space;
- static const hsize_t dims[2] = {NX, NY};
- static const hsize_t half_dims[2] = {NX / 2, NY / 2};
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t half_dims[2] = {N2X, N2Y};
static hsize_t size[2];
hsize_t offset[2];
int i, j, k, m;
@@ -159,48 +163,48 @@ write_data_deprec(const char *msg, hid_t file, const char *name, hid_t cparms, h
/* Write the data */
for(i = 0; i < 5; i++)
- for(j = 0; j < 5; j++) {
+ for(j = 0; j < 5; j++) {
- /* Extend the dataset */
- offset[0] = (hsize_t)(i * NX);
- offset[1] = (hsize_t)(j * NY);
- size[0] = offset[0] + NX;
- size[1] = offset[1] + NY;
- if(H5Dextend(dataset, size) < 0) TEST_ERROR;
+ /* Extend the dataset */
+ offset[0] = (hsize_t)(i * N1X);
+ offset[1] = (hsize_t)(j * N1Y);
+ size[0] = offset[0] + N1X;
+ size[1] = offset[1] + N1Y;
+ if(H5Dextend(dataset, size) < 0) TEST_ERROR;
- /* Select a hyperslab */
+ /* Select a hyperslab */
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, dims, NULL) < 0) TEST_ERROR;
- /* Write to the hyperslab */
- if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1) < 0) TEST_ERROR;
+ /* Write to the hyperslab */
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, mem_space, file_space, H5P_DEFAULT, buf1_data) < 0) TEST_ERROR;
if(H5Sclose(file_space) < 0) TEST_ERROR;
- } /* end for */
+ } /* end for */
/* Read the data */
if((half_space = H5Screate_simple(2, half_dims, NULL)) < 0) TEST_ERROR;
if((file_space = H5Dget_space(dataset)) < 0) TEST_ERROR;
for(i = 0; i < 10; i++) {
- for(j = 0; j < 10; j++) {
-
- /* Select a hyperslab */
- offset[0] = (hsize_t)(i * (NX / 2));
- offset[1] = (hsize_t)(j * (NY / 2));
- if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
-
- /* Read */
- if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2) < 0) TEST_ERROR;
-
- /* Compare */
- for(k = 0; k < (NX / 2); k++)
- for(m = 0; m < (NY / 2); m++)
- if(buf2[k][m] != buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]) {
- HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
- HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
- HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * (NX / 2) + k, (j % 2) * (NY / 2) + m, buf1[(i % 2) * (NX / 2) + k][(j % 2) * (NY / 2) + m]);
- TEST_ERROR;
- } /* end if */
- } /* end for */
+ for(j = 0; j < 10; j++) {
+
+ /* Select a hyperslab */
+ offset[0] = (hsize_t)(i * N2X);
+ offset[1] = (hsize_t)(j * N2Y);
+ if(H5Sselect_hyperslab(file_space, H5S_SELECT_SET, offset, NULL, half_dims, NULL) < 0) TEST_ERROR;
+
+ /* Read */
+ if(H5Dread(dataset, H5T_NATIVE_INT, half_space, file_space, H5P_DEFAULT, buf2_data) < 0) TEST_ERROR;
+
+ /* Compare */
+ for(k = 0; k < N2X; k++)
+ for(m = 0; m < N2Y; m++)
+ if(buf2[k][m] != buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]) {
+ HDprintf(" i=%d, j=%d, k=%d, m=%d\n", i, j, k, m);
+ HDprintf(" buf2[%d][%d]=%d\n", k, m, buf2[k][m]);
+ HDprintf(" buf1[%d][%d]=%d\n", (i % 2) * N2X + k, (j % 2) * N2Y + m, buf1[(i % 2) * N2X + k][(j % 2) * N2Y + m]);
+ TEST_ERROR;
+ } /* end if */
+ } /* end for */
} /* end for */
@@ -236,8 +240,8 @@ main (void)
hid_t file, mem_space, cparms;
hid_t fapl;
int nerrors = 0;
- static const hsize_t dims[2] = {NX, NY};
- static const hsize_t chunk_dims[2] = {NX/2, NY/2};
+ static const hsize_t dims[2] = {N1X, N1Y};
+ static const hsize_t chunk_dims[2] = {N2X, N2Y};
static hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
char filename[1024];
int i, j;
@@ -246,9 +250,23 @@ main (void)
fapl = h5_fileaccess();
/* Initialize buffer and space */
- for(i = 0; i < NX; i++)
- for(j = 0; j < NY; j++)
- buf1[i][j] = i * NY + j;
+ if(NULL == (buf1_data = (int *)HDcalloc(N1X * N1Y, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf1 = (int **)HDcalloc(N1X, sizeof(buf1_data))))
+ TEST_ERROR;
+ for (i = 0; i < N1X; i++)
+ buf1[i] = buf1_data + (i * N1Y);
+
+ if(NULL == (buf2_data = (int *)HDcalloc(N2X * N2Y, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf2 = (int **)HDcalloc(N2X, sizeof(buf2_data))))
+ TEST_ERROR;
+ for (i = 0; i < N2X; i++)
+ buf2[i] = buf2_data + (i * N2Y);
+
+ for(i = 0; i < N1X; i++)
+ for(j = 0; j < N1Y; j++)
+ buf1[i][j] = i * N1Y + j;
if((mem_space = H5Screate_simple(2, dims, maxdims)) < 0) TEST_ERROR;
@@ -288,9 +306,20 @@ main (void)
HDprintf("All extend tests passed.\n");
h5_cleanup(FILENAME, fapl);
+ HDfree(buf1);
+ HDfree(buf1_data);
+ HDfree(buf2);
+ HDfree(buf2_data);
+
HDexit(EXIT_SUCCESS);
error:
+
+ HDfree(buf1);
+ HDfree(buf1_data);
+ HDfree(buf2);
+ HDfree(buf2_data);
+
HDprintf("*** One or more extend tests failed ***\n");
HDexit(EXIT_FAILURE);
} /* end main() */
diff --git a/test/external_env.c b/test/external_env.c
index 01f2cba..e9c7635 100644
--- a/test/external_env.c
+++ b/test/external_env.c
@@ -15,7 +15,6 @@
* Purpose: Tests datasets stored in external raw files.
*/
#include "external_common.h"
-#include "external_fname.h"
static const char *EXT_ENV_FNAME[] = {
"extern_env_dir/env_file_1",
@@ -189,7 +188,7 @@ main(void)
HDputs("All external storage tests passed.");
/* Clean up files used by file set tests */
- if(h5_cleanup(EXT_FNAME, fapl_id_old)) {
+ if(h5_cleanup(EXT_ENV_FNAME, fapl_id_old)) {
HDremove("extern_env_1r.raw");
HDremove("extern_env_2r.raw");
HDremove("extern_env_3r.raw");
diff --git a/test/farray.c b/test/farray.c
index c9584b8..d6610f2 100644
--- a/test/farray.c
+++ b/test/farray.c
@@ -1687,7 +1687,7 @@ main(void)
}
/* Iterate over the testing parameters */
- for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; H5_INC_ENUM(farray_test_type_t, curr_test)) {
+ for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) {
/* Initialize the testing parameters */
HDmemset(&tparam, 0, sizeof(tparam));
@@ -1723,7 +1723,7 @@ main(void)
nerrors += test_delete_open(fapl, &cparam, &tparam);
/* Iterate over the type of capacity tests */
- for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; H5_INC_ENUM(farray_iter_type_t, curr_iter)) {
+ for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) {
/* Set appropriate parameters for each type of iteration */
switch(curr_iter) {
diff --git a/test/fheap.c b/test/fheap.c
index ef47d94..7772ff7 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -545,8 +545,7 @@ get_fill_size(const fheap_test_param_t *tparam)
* test_desc in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static int
begin_test(fheap_test_param_t *tparam, const char *base_desc,
fheap_heap_ids_t *keep_ids, size_t *fill_size)
@@ -575,7 +574,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc,
/* Success */
return(0);
} /* end begin_test() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -7617,7 +7616,8 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
H5F_t *f = NULL; /* Internal file object pointer */
H5HF_t *fh = NULL; /* Fractal heap wrapper */
haddr_t fh_addr; /* Address of fractal heap */
- unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */
+ unsigned char **heap_id = NULL;
+ unsigned char *heap_id_data = NULL;
struct a_type_t1 {
char a[10];
char b[40];
@@ -7629,6 +7629,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+ /* Set up data array */
+ if(NULL == (heap_id_data = (unsigned char *)HDcalloc(100 * MAX_HEAP_ID_LEN, sizeof(unsigned char))))
+ TEST_ERROR;
+ if(NULL == (heap_id = (unsigned char **)HDcalloc(100, sizeof(heap_id_data))))
+ TEST_ERROR;
+ for (i = 0; i < 100; i++)
+ heap_id[i] = heap_id_data + (i * MAX_HEAP_ID_LEN);
+
/* Create the file to work on */
if((file = H5Fcreate(filename, H5F_ACC_TRUNC, tparam->my_fcpl, fapl)) < 0)
FAIL_STACK_ERROR
@@ -7695,7 +7703,10 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
/* All tests passed */
PASSED()
- return(0);
+ HDfree(heap_id);
+ HDfree(heap_id_data);
+
+ return 0;
error:
H5E_BEGIN_TRY {
@@ -7703,7 +7714,11 @@ error:
H5HF_close(fh);
H5Fclose(file);
} H5E_END_TRY;
- return(1);
+
+ HDfree(heap_id);
+ HDfree(heap_id_data);
+
+ return 1;
} /* test_man_incr_insert_remove() */
#endif /* QAK */
@@ -16458,7 +16473,7 @@ main(void)
}
/* Iterate over the testing parameters */
- for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) {
+ for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) {
/* Clear the testing parameters */
HDmemset(&tparam, 0, sizeof(fheap_test_param_t));
tparam.actual_id_len = HEAP_ID_LEN;
@@ -16500,7 +16515,7 @@ main(void)
fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */
/* Filling with different sized objects */
- for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) {
+ for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) {
tparam.fill = fill;
/* Set appropriate testing parameters for each test */
@@ -16593,9 +16608,9 @@ main(void)
fheap_test_del_drain_t drain_half; /* Deletion draining */
/* More complex removal patterns */
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
+ for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
tparam.del_dir = del_dir;
- for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) {
+ for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; drain_half++) {
tparam.drain_half = drain_half;
/* Don't need to test deletion directions when deleting entire heap */
if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL)
@@ -16703,7 +16718,7 @@ main(void)
} /* end switch */
/* Try several different methods of deleting objects */
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
+ for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
tparam.del_dir = del_dir;
/* Test 'huge' object insert & delete */
@@ -16731,7 +16746,7 @@ main(void)
{
fheap_test_del_dir_t del_dir; /* Deletion direction */
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
+ for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) {
tparam.del_dir = del_dir;
/* Controlled tests */
diff --git a/test/file_image.c b/test/file_image.c
index ddbec80..dfb3ae8 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -678,8 +678,7 @@ error:
* 'member_file_name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static int
test_get_file_image(const char * test_banner,
const int file_name_num,
@@ -946,7 +945,7 @@ test_get_file_image(const char * test_banner,
error:
return 1;
} /* end test_get_file_image() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/******************************************************************************
diff --git a/test/fillval.c b/test/fillval.c
index 0454bde..019744a 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -758,10 +758,15 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
int fillval=(-1), val_rd, should_be;
int i, j, *buf=NULL, odd;
unsigned u;
- comp_datatype rd_c, fill_c, should_be_c;
+ comp_datatype rd_c, fill_c, should_be_c;
comp_datatype *buf_c=NULL;
H5D_space_status_t allocation;
+ fill_c.a = 0;
+ fill_c.x = 0;
+ fill_c.y = 0;
+ fill_c.z = 0;
+
if(datatype == H5T_INTEGER) {
fillval = *(int*)_fillval;
}
@@ -822,7 +827,7 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
hs_offset[0], hs_offset[1],
hs_offset[2], hs_offset[3],
hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z,
- (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
+ (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
goto error;
}
}
@@ -1516,7 +1521,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1572,7 +1577,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1613,7 +1618,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1652,7 +1657,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1693,7 +1698,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1739,7 +1744,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, fillval) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1758,7 +1763,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
@@ -1786,7 +1791,7 @@ test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name,
if(verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0) TEST_ERROR
/* Release any VL components */
- if(H5Dvlen_reclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
+ if(H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0) TEST_ERROR
/* Clear the read buffer */
HDmemset(val_rd, 0, val_size);
diff --git a/test/flushrefresh.c b/test/flushrefresh.c
index 92c9f87..20a4ba4 100644
--- a/test/flushrefresh.c
+++ b/test/flushrefresh.c
@@ -843,13 +843,13 @@ herr_t flush_verification(const char * obj_pathname, const char * expected)
/* Variables */
hid_t oid = -1, fid = -1;
herr_t status = 0;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
/* Try to open the testfile and then obj_pathname within the file */
H5E_BEGIN_TRY {
fid = H5Fopen(FILENAME, H5F_ACC_SWMR_READ, H5P_DEFAULT);
oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT);
- status = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC);
+ status = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC);
} H5E_END_TRY;
/* Compare to expected result */
@@ -978,9 +978,12 @@ herr_t refresh_verification(const char * obj_pathname)
{
/* Variables */
hid_t oid,fid,status = 0;
- H5O_info_t flushed_oinfo;
- H5O_info_t refreshed_oinfo;
+ H5O_info2_t flushed_oinfo;
+ H5O_info2_t refreshed_oinfo;
+ H5O_native_info_t flushed_ninfo;
+ H5O_native_info_t refreshed_ninfo;
int tries = 800, sleep_tries = 400;
+ int token_cmp;
hbool_t ok = FALSE;
HDremove(SIGNAL_BETWEEN_PROCESSES_2);
@@ -990,8 +993,9 @@ herr_t refresh_verification(const char * obj_pathname)
if((oid = H5Oopen(fid, obj_pathname, H5P_DEFAULT)) < 0) PROCESS_ERROR;
/* Get Object info */
- if((status = H5Oget_info2(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR;
-
+ if((status = H5Oget_info3(oid, &flushed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR;
+ if((status = H5Oget_native_info(oid, &flushed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR;
+
/* Make sure there are no attributes on the object. This is just a sanity
check to ensure we didn't erroneously flush the attribute before
starting the verification. */
@@ -1009,18 +1013,20 @@ herr_t refresh_verification(const char * obj_pathname)
/* Get object info again. This will NOT reflect what's on disk, only what's
in the cache. Thus, all values will be unchanged from above, despite
newer information being on disk. */
- if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0) PROCESS_ERROR;
+ if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR;
+ if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR;
/* Verify that before doing a refresh, getting the object info returns stale
information. (i.e., unchanged from above, despite new info on disk). */
- if(flushed_oinfo.addr != refreshed_oinfo.addr) PROCESS_ERROR;
- if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR;
- if(flushed_oinfo.hdr.version != refreshed_oinfo.hdr.version) PROCESS_ERROR;
- if(flushed_oinfo.hdr.flags != refreshed_oinfo.hdr.flags) PROCESS_ERROR;
- if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR;
- if(flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) PROCESS_ERROR;
- if(flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) PROCESS_ERROR;
- if(flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) PROCESS_ERROR;
+ if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR;
+ if(token_cmp) PROCESS_ERROR;
+ if(flushed_oinfo.type != refreshed_oinfo.type) PROCESS_ERROR;
+ if(flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) PROCESS_ERROR;
+ if(flushed_ninfo.hdr.version != refreshed_ninfo.hdr.version) PROCESS_ERROR;
+ if(flushed_ninfo.hdr.flags != refreshed_ninfo.hdr.flags) PROCESS_ERROR;
+ if(flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) PROCESS_ERROR;
+ if(flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) PROCESS_ERROR;
+ if(flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) PROCESS_ERROR;
/* Refresh object */
/* The H5*refresh function called depends on which object we are trying
@@ -1047,19 +1053,20 @@ herr_t refresh_verification(const char * obj_pathname)
} /* end else */
/* Get object info. This should now accurately reflect the refreshed object on disk. */
- if((status = H5Oget_info2(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR)) < 0)
- PROCESS_ERROR;
+ if((status = H5Oget_info3(oid, &refreshed_oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS)) < 0) PROCESS_ERROR;
+ if((status = H5Oget_native_info(oid, &refreshed_ninfo, H5O_NATIVE_INFO_HDR)) < 0) PROCESS_ERROR;
+ if(H5Otoken_cmp(oid, &flushed_oinfo.token, &refreshed_oinfo.token, &token_cmp) < 0) PROCESS_ERROR;
/* Confirm following (first 4) attributes are the same: */
/* Confirm following (last 4) attributes are different */
- if( (flushed_oinfo.addr == refreshed_oinfo.addr) &&
- (flushed_oinfo.type == refreshed_oinfo.type) &&
- (flushed_oinfo.hdr.version == refreshed_oinfo.hdr.version) &&
- (flushed_oinfo.hdr.flags == refreshed_oinfo.hdr.flags) &&
- (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) &&
- (flushed_oinfo.hdr.nmesgs != refreshed_oinfo.hdr.nmesgs) &&
- (flushed_oinfo.hdr.nchunks != refreshed_oinfo.hdr.nchunks) &&
- (flushed_oinfo.hdr.space.total != refreshed_oinfo.hdr.space.total) ) {
+ if( (!token_cmp) &&
+ (flushed_oinfo.type == refreshed_oinfo.type) &&
+ (flushed_oinfo.num_attrs != refreshed_oinfo.num_attrs) &&
+ (flushed_ninfo.hdr.version == refreshed_ninfo.hdr.version) &&
+ (flushed_ninfo.hdr.flags == refreshed_ninfo.hdr.flags) &&
+ (flushed_ninfo.hdr.nmesgs != refreshed_ninfo.hdr.nmesgs) &&
+ (flushed_ninfo.hdr.nchunks != refreshed_ninfo.hdr.nchunks) &&
+ (flushed_ninfo.hdr.space.total != refreshed_ninfo.hdr.space.total) ) {
ok = TRUE;
break;
}
@@ -1071,11 +1078,11 @@ herr_t refresh_verification(const char * obj_pathname)
if(!ok) {
HDprintf("FLUSHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n",
- (int)flushed_oinfo.num_attrs, (int)flushed_oinfo.hdr.nmesgs,
- (int)flushed_oinfo.hdr.nchunks, (int)flushed_oinfo.hdr.space.total);
+ (int)flushed_oinfo.num_attrs, (int)flushed_ninfo.hdr.nmesgs,
+ (int)flushed_ninfo.hdr.nchunks, (int)flushed_ninfo.hdr.space.total);
HDprintf("REFRESHED: num_attrs=%d, nmesgs=%d, nchunks=%d, total=%d\n",
- (int)refreshed_oinfo.num_attrs, (int)refreshed_oinfo.hdr.nmesgs,
- (int)refreshed_oinfo.hdr.nchunks, (int)refreshed_oinfo.hdr.space.total);
+ (int)refreshed_oinfo.num_attrs, (int)refreshed_ninfo.hdr.nmesgs,
+ (int)refreshed_ninfo.hdr.nchunks, (int)refreshed_ninfo.hdr.space.total);
PROCESS_ERROR;
}
diff --git a/test/gen_filespace.c b/test/gen_filespace.c
index 4397836..f4a4f3f 100644
--- a/test/gen_filespace.c
+++ b/test/gen_filespace.c
@@ -29,7 +29,6 @@ const char *FILENAMES[] = {
#define NUM_ELMTS 100
#define FALSE 0
#define TRUE 1
-#define INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1))
/*
* Compile and run this program in the trunk to generate
@@ -58,7 +57,7 @@ int main(void)
unsigned fs_persist; /* Persisting free-space or not */
j = 0;
- for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) {
+ for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) {
for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
if(fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR)
diff --git a/test/gen_new_super.c b/test/gen_new_super.c
index f6ce589..ed43a39 100644
--- a/test/gen_new_super.c
+++ b/test/gen_new_super.c
@@ -24,7 +24,7 @@
*/
#include <assert.h>
-#include "hdf5.h"
+#include "testhdf5.h"
#define TESTFILE "tsupern.h5"
#define ISTORE_IK 64
@@ -50,7 +50,7 @@ main(void)
{
hid_t file; /* File IDs for old & new files */
hid_t fcpl; /* File creation property list */
- herr_t ret; /* Generic return value */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret;
/* Create a file creation property list */
fcpl = H5Pcreate(H5P_FILE_CREATE);
diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c
index 9d76deb..e4e75ac 100644
--- a/test/gen_nullspace.c
+++ b/test/gen_nullspace.c
@@ -24,8 +24,8 @@
* put into the 'test' directory in the 1.6.x branch of the library.
*/
-#include "hdf5.h"
#include <assert.h>
+#include "testhdf5.h"
#define NULLFILE "tnullspace.h5"
#define NULLDATASET "null_dataset"
@@ -39,7 +39,7 @@ main(void)
hid_t sid; /* Dataspace ID */
hid_t did; /* Dataset ID */
hid_t attr; /* Attribute ID */
- herr_t ret; /* Generic return value */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret; /* Generic return value */
/* Create the file */
fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/gen_plist.c b/test/gen_plist.c
index 8f38b1a..8fc8a05 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -458,7 +458,7 @@ encode_plist(hid_t plist_id, int little_endian, int word_length, const char *fil
herr_t ret = 0;
void *temp_buf = NULL;
size_t temp_size = 0;
- ssize_t write_size;
+ ssize_t H5_ATTR_NDEBUG_UNUSED write_size;
char filename[1024];
/* Generate filename */
diff --git a/test/gen_specmetaread.c b/test/gen_specmetaread.c
index d06bd59..fd484d1 100644
--- a/test/gen_specmetaread.c
+++ b/test/gen_specmetaread.c
@@ -23,9 +23,10 @@
* the library on the trunk as of when this file is checked in.
*/
-#include "hdf5.h"
#include <assert.h>
+#include "testhdf5.h"
+
#define FILENAME "specmetaread.h5"
#define DIM 10
@@ -39,7 +40,7 @@ main(void)
hsize_t dim[1] = {DIM};
unsigned data[DIM];
unsigned u;
- herr_t ret; /* Generic return value */
+ herr_t H5_ATTR_NDEBUG_UNUSED ret;
/* Initialize the data */
for(u = 0; u < DIM; u++)
diff --git a/test/genall5.c b/test/genall5.c
index 4cc0a2d..3f55930 100644
--- a/test/genall5.c
+++ b/test/genall5.c
@@ -479,7 +479,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
u = 0;
while ((pass) && (u < nlinks)) {
- H5L_info_t lnk_info;
+ H5L_info2_t lnk_info;
char linkname[16];
htri_t link_exists;
@@ -493,7 +493,7 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
HDassert(link_exists >= 0);
HDmemset(&lnk_info, 0, sizeof(grp_info));
- ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT);
+ ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT);
if (ret < 0) {
pass = FALSE;
@@ -554,7 +554,8 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
HDfree(slinkval);
} /* end if */
else if (1 == (u % 3)) {
- H5O_info_t root_oinfo;
+ H5O_info2_t root_oinfo;
+ int token_cmp = 0;
if (H5L_TYPE_HARD != lnk_info.type) {
pass = FALSE;
@@ -563,18 +564,25 @@ vrfy_ns_grp_c(hid_t fid, const char *group_name, unsigned nlinks) {
HDassert(H5L_TYPE_HARD == lnk_info.type);
HDmemset(&root_oinfo, 0, sizeof(root_oinfo));
- ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC);
if (ret < 0) {
pass = FALSE;
failure_mssg = "vrfy_ns_grp_c: H5Oget_info() failed.";
}
- else if (root_oinfo.addr != lnk_info.u.address) {
- pass = FALSE;
- failure_mssg = "vrfy_ns_grp_c: root_oinfo.addr != lnk_info.u.address";
+ else {
+ if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_c: H5Otoken_cmp() failed.";
+ }
+
+ if (token_cmp) {
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_c: root_oinfo.token != lnk_info.u.token";
+ }
}
HDassert(ret >= 0);
- HDassert(root_oinfo.addr == lnk_info.u.address);
+ HDassert(!token_cmp);
} /* end else-if */
else {
void *elinkval;
@@ -888,7 +896,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
u = 0;
while ((pass) && (u < nlinks)) {
- H5L_info_t lnk_info;
+ H5L_info2_t lnk_info;
char linkname[16];
htri_t link_exists;
@@ -902,7 +910,7 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
HDassert(link_exists >= 0);
HDmemset(&lnk_info, 0, sizeof(grp_info));
- ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT);
+ ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT);
if (ret < 0) {
pass = FALSE;
@@ -963,7 +971,8 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
HDfree(slinkval);
} /* end if */
else if (1 == (u % 3)) {
- H5O_info_t root_oinfo;
+ H5O_info2_t root_oinfo;
+ int token_cmp = 0;
if (H5L_TYPE_HARD != lnk_info.type) {
pass = FALSE;
@@ -972,17 +981,24 @@ vrfy_ns_grp_d(hid_t fid, const char *group_name, unsigned nlinks) {
HDassert(H5L_TYPE_HARD == lnk_info.type);
HDmemset(&root_oinfo, 0, sizeof(root_oinfo));
- ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC);
if (ret < 0) {
pass = FALSE;
failure_mssg = "vrfy_ns_grp_d: H5Oget_info() failed.";
}
- else if (root_oinfo.addr != lnk_info.u.address) {
- pass = FALSE;
- failure_mssg = "vrfy_ns_grp_d: root_oinfo.addr != lnk_info.u.address";
+ else {
+ if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_d: H5Otoken_cmp() failed.";
+ }
+
+ if (token_cmp) {
+ pass = FALSE;
+ failure_mssg = "vrfy_ns_grp_d: root_oinfo.token != lnk_info.u.token";
+ }
}
HDassert(ret >= 0);
- HDassert(root_oinfo.addr == lnk_info.u.address);
+ HDassert(!token_cmp);
} /* end else-if */
else {
void *elinkval;
@@ -1486,7 +1502,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
u = 0;
while ((pass) && (u < nlinks)) {
- H5L_info_t lnk_info;
+ H5L_info2_t lnk_info;
char linkname[32];
htri_t link_exists;
@@ -1500,7 +1516,7 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
HDassert(link_exists >= 0);
HDmemset(&lnk_info, 0, sizeof(grp_info));
- ret = H5Lget_info(gid, linkname, &lnk_info, H5P_DEFAULT);
+ ret = H5Lget_info2(gid, linkname, &lnk_info, H5P_DEFAULT);
if (ret < 0) {
pass = FALSE;
@@ -1557,7 +1573,8 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
HDfree(slinkval);
} /* end if */
else {
- H5O_info_t root_oinfo;
+ H5O_info2_t root_oinfo;
+ int token_cmp = 0;
HDassert(1 == (u % 2));
@@ -1568,18 +1585,25 @@ vrfy_os_grp_n(hid_t fid, const char *group_name, int proc_num,
HDassert(H5L_TYPE_HARD == lnk_info.type);
HDmemset(&root_oinfo, 0, sizeof(root_oinfo));
- ret = H5Oget_info2(fid, &root_oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(fid, &root_oinfo, H5O_INFO_BASIC);
if (ret < 0) {
pass = FALSE;
failure_mssg = "vrfy_os_grp_n: H5Oget_info() failed.";
}
- else if (root_oinfo.addr != lnk_info.u.address) {
- pass = FALSE;
- failure_mssg = "vrfy_os_grp_n: root_oinfo.addr != lnk_info.u.address";
+ else {
+ if(H5Otoken_cmp(fid, &root_oinfo.token, &lnk_info.u.token, &token_cmp) < 0) {
+ pass = FALSE;
+ failure_mssg = "vrfy_os_grp_n: H5Otoken_cmp() failed.";
+ }
+
+ if (token_cmp) {
+ pass = FALSE;
+ failure_mssg = "vrfy_os_grp_n: root_oinfo.token != lnk_info.u.token";
+ }
}
HDassert(ret >= 0);
- HDassert(root_oinfo.addr == lnk_info.u.address);
+ HDassert(!token_cmp);
} /* end else */
u++;
@@ -2735,11 +2759,11 @@ ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
}
if ((pass) && (write_data)) {
- ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, wdata);
+ ret = H5Treclaim(tid, sid, H5P_DEFAULT, wdata);
if (ret < 0) {
pass = FALSE;
- failure_mssg = "ds_ctg_v: H5Dvlen_reclaim() failed.";
+ failure_mssg = "ds_ctg_v: H5Treclaim() failed.";
}
HDassert(ret >= 0);
@@ -3003,11 +3027,11 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data) {
}
if ((pass) && (write_data)) {
- ret = H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata);
+ ret = H5Treclaim(tid, sid, H5P_DEFAULT, rdata);
if (ret < 0) {
pass = FALSE;
- failure_mssg = "vrfy_ds_ctg_v: H5Dvlen_reclaim() failed.";
+ failure_mssg = "vrfy_ds_ctg_v: H5Treclaim() failed.";
}
HDassert(ret >= 0);
diff --git a/test/getname.c b/test/getname.c
index 873ceb9..f677d78 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -101,8 +101,8 @@ test_main(hid_t file_id, hid_t fapl)
hid_t space_id;
hid_t type_id, type2_id;
hsize_t dims[1] = { 5 };
- size_t name_len; /* Name length */
- H5O_info_t oinfo; /* Object info structs */
+ size_t name_len; /* Name length */
+ H5O_info2_t oinfo; /* Object info structs */
hid_t dtype; /* Object identifier for testing */
hid_t dtype_anon; /* Object identifier for testing anonymous */
ssize_t size; /* Size returned by H5Iget_name */
@@ -2380,7 +2380,7 @@ test_main(hid_t file_id, hid_t fapl)
if((size = H5Iget_name(dtype, NULL, 0)) != 0) TEST_ERROR
/* Create a link to the object */
- if( H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Olink(dtype, file2_id, "datatype", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Commit a second datatype with no links to it and commit it */
if((dtype_anon = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
@@ -2390,7 +2390,7 @@ test_main(hid_t file_id, hid_t fapl)
if((size = H5Iget_name(dtype_anon, NULL,0)) != 0) TEST_ERROR
/* Store the address of the datatype for later use */
- if(H5Oget_info2(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(dtype_anon, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
/* Update the reference count to dtype_anon to preserve the datatype */
if(H5Oincr_refcount(dtype_anon) < 0) TEST_ERROR
@@ -2400,22 +2400,22 @@ test_main(hid_t file_id, hid_t fapl)
if(H5Fclose(file2_id) < 0) TEST_ERROR
/* Re-open the file and check that the anonymous datatypes persist */
- if( (file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+ if((file2_id = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Check the H5Iget_name does not return an error for anon committed datatypes */
- if((dtype_anon = H5Oopen_by_addr(file2_id, oinfo.addr)) < 0) TEST_ERROR
+ if((dtype_anon = H5Oopen_by_token(file2_id, oinfo.token)) < 0) TEST_ERROR
- if((size = H5Iget_name(dtype_anon,NULL,0)) != 0) TEST_ERROR
+ if((size = H5Iget_name(dtype_anon, NULL, 0)) != 0) TEST_ERROR
if(H5Tclose(dtype_anon) < 0) TEST_ERROR
if(H5Fclose(file2_id) < 0) TEST_ERROR
PASSED();
- return(0);
+ return 0;
error:
- return(1);
+ return 1;
}
static int
diff --git a/test/h5test.c b/test/h5test.c
index c8f4132..03731c6 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -23,6 +23,7 @@
#include "h5test.h"
#include "H5srcdir.h"
+#include "H5srcdir_str.h"
/* Necessary for h5_verify_cached_stabs() */
#define H5G_FRIEND /*suppress error about including H5Gpkg */
@@ -100,6 +101,12 @@ static const char *multi_letters = "msbrglo";
/* The # of seconds to wait for the message file--used by h5_wait_message() */
#define MESSAGE_TIMEOUT 300 /* Timeout in seconds */
+/* Buffer to construct path in and return pointer to */
+static char srcdir_path[1024] = "";
+
+/* Buffer to construct file in and return pointer to */
+static char srcdir_testpath[1024] = "";
+
/* The strings that correspond to library version bounds H5F_libver_t in H5Fpublic.h */
/* This is used by h5_get_version_string() */
const char *LIBVER_NAMES[] = {
@@ -196,8 +203,7 @@ h5_clean_files(const char *base_name[], hid_t fapl)
* sub_filename in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
void
h5_delete_test_file(const char *base_name, hid_t fapl)
{
@@ -237,7 +243,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl)
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]);
HDremove(sub_filename);
}
@@ -247,7 +253,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl)
return;
} /* end h5_delete_test_file() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -990,7 +996,7 @@ h5_get_vfd_fapl(hid_t fapl)
HDmemset(memb_addr, 0, sizeof(memb_addr));
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN);
HDassert(sv[mt]);
@@ -1002,7 +1008,7 @@ h5_get_vfd_fapl(hid_t fapl)
if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0)
goto error;
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
HDfree(sv[mt]);
} else if(!HDstrcmp(tok, "family")) {
/* Family of files, each 1MB and using the default driver */
@@ -1166,10 +1172,8 @@ h5_show_hostname(void)
else
HDprintf("thread 0.");
}
-#elif defined(H5_HAVE_THREADSAFE)
- HDprintf("thread %lu.", HDpthread_self_ulong());
#else
- HDprintf("thread 0.");
+ HDprintf("thread %" PRIu64 ".", H5TS_thread_id());
#endif
#ifdef H5_HAVE_WIN32_API
@@ -1321,8 +1325,7 @@ h5_dump_info_object(MPI_Info info)
int flag;
int i, nkeys;
- HDprintf("Dumping MPI Info Object(%d) (up to %d bytes per item):\n", (int)info,
- MPI_MAX_INFO_VAL);
+ HDprintf("Dumping MPI Info Object (up to %d bytes per item):\n", MPI_MAX_INFO_VAL);
if (info==MPI_INFO_NULL){
HDprintf("object is MPI_INFO_NULL\n");
}
@@ -1359,8 +1362,7 @@ h5_dump_info_object(MPI_Info info)
* temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
h5_stat_size_t
h5_get_file_size(const char *filename, hid_t fapl)
{
@@ -1398,7 +1400,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
h5_stat_size_t tot_size = 0;
HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
/* Create the filename to query */
HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]);
@@ -1462,7 +1464,7 @@ h5_get_file_size(const char *filename, hid_t fapl)
return(-1);
} /* end get_file_size() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*
* This routine is designed to provide equivalent functionality to 'printf'
@@ -1698,7 +1700,7 @@ error:
*/
static herr_t
h5_verify_cached_stabs_cb(hid_t oid, const char H5_ATTR_UNUSED *name,
- const H5O_info_t *oinfo, void H5_ATTR_UNUSED *udata)
+ const H5O_info2_t *oinfo, void H5_ATTR_UNUSED *udata)
{
if(oinfo->type == H5O_TYPE_GROUP)
return H5G__verify_cached_stabs_test(oid);
@@ -1746,7 +1748,7 @@ h5_verify_cached_stabs(const char *base_name[], hid_t fapl)
continue;
} /* end if */
- if(H5Ovisit2(file, H5_INDEX_NAME, H5_ITER_NATIVE,
+ if(H5Ovisit3(file, H5_INDEX_NAME, H5_ITER_NATIVE,
h5_verify_cached_stabs_cb, NULL, H5O_INFO_BASIC) < 0)
goto error;
@@ -2039,3 +2041,56 @@ h5_get_version_string(H5F_libver_t libver)
{
return(LIBVER_NAMES[libver]);
} /* end of h5_get_version_string */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_get_srcdir_filename
+ *
+ * Purpose: Append the test file name to the srcdir path and return the whole string
+ *
+ * Return: The string
+ *
+ *-------------------------------------------------------------------------
+ */
+const char *H5_get_srcdir_filename(const char *filename)
+{
+ const char *srcdir = H5_get_srcdir();
+
+ /* Check for error */
+ if(NULL == srcdir)
+ return(NULL);
+ else {
+ /* Build path to test file */
+ if((HDstrlen(srcdir) + HDstrlen(filename) + 1) < sizeof(srcdir_testpath)) {
+ HDsnprintf(srcdir_testpath, sizeof(srcdir_testpath), "%s%s", srcdir, filename);
+ return(srcdir_testpath);
+ } /* end if */
+ else
+ return(NULL);
+ } /* end else */
+} /* end H5_get_srcdir_filename() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5_get_srcdir
+ *
+ * Purpose: Just return the srcdir path
+ *
+ * Return: The string
+ *
+ *-------------------------------------------------------------------------
+ */
+const char *H5_get_srcdir(void)
+{
+ const char *srcdir = HDgetenv("srcdir");
+
+ /* Check for using the srcdir from configure time */
+ if(NULL == srcdir)
+ srcdir = config_srcdir;
+
+ /* Build path to all test files */
+ if((HDstrlen(srcdir) + 2) < sizeof(srcdir_path)) {
+ HDsnprintf(srcdir_path, sizeof(srcdir_path), "%s/", srcdir);
+ return(srcdir_path);
+ } /* end if */
+ else
+ return(NULL);
+} /* end H5_get_srcdir() */
diff --git a/test/links.c b/test/links.c
index 916ad88..60d3152 100644
--- a/test/links.c
+++ b/test/links.c
@@ -31,10 +31,11 @@
#include "h5test.h"
#include "H5srcdir.h"
-#include "H5FDpkg.h" /* File drivers */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Lprivate.h" /* Links */
+#include "H5FDpkg.h" /* File drivers */
+#include "H5Gpkg.h" /* Groups */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Lprivate.h" /* Links */
+#include "H5VLnative_private.h" /* Native VOL connector */
/* File for external link test. Created with gen_udlinks.c */
#define LINKED_FILE "be_extlink2.h5"
@@ -314,7 +315,119 @@ typedef struct {
static hid_t dcpl_g; /* for [un]minimized dataset object headers */
+static herr_t
+UD_hard_create(const char *link_name, hid_t loc_group, const void *udata,
+ size_t udata_size, hid_t lcpl_id);
+static hid_t
+UD_hard_traverse(const char *link_name, hid_t cur_group,
+ const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id);
+static herr_t
+UD_hard_delete(const char *link_name, hid_t file, const void *udata,
+ size_t udata_size);
+
+/* User-defined link class */
+const H5L_class_t UD_hard_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
+ "UD_hard_link", /* Link class name for debugging */
+ UD_hard_create, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_hard_traverse, /* The actual traversal function */
+ UD_hard_delete, /* Deletion callback */
+ NULL /* Query callback */
+}};
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+static herr_t
+UD_hard_create_deprec(const char *link_name, hid_t loc_group, const void *udata,
+ size_t udata_size, hid_t lcpl_id);
+static hid_t
+UD_hard_traverse_deprec(const char *link_name, hid_t cur_group,
+ const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id);
+static herr_t
+UD_hard_delete_deprec(const char *link_name, hid_t file, const void *udata,
+ size_t udata_size);
+
+/* User-defined link class */
+const H5L_class_t UD_hard_class_deprec[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
+ "UD_hard_link_deprec", /* Link class name for debugging */
+ UD_hard_create_deprec, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_hard_traverse_deprec, /* The actual traversal function */
+ UD_hard_delete_deprec, /* Deletion callback */
+ NULL /* Query callback */
+}};
+#endif
+
+static hid_t
+UD_rereg_traverse(const char *link_name, hid_t cur_group,
+ const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id);
+
+/* This link class has the same ID number as the UD hard links but
+ * has a very different traversal function */
+const H5L_class_t UD_rereg_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
+ "UD_reregistered_type", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_rereg_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
+}};
+
+static herr_t
+UD_cb_create(const char * link_name, hid_t loc_group, const void *udata,
+ size_t udata_size, hid_t lcpl_id);
+static herr_t
+UD_cb_move(const char *new_name, hid_t new_loc, const void *udata,
+ size_t udata_size);
+static hid_t
+UD_cb_traverse(const char * link_name, hid_t cur_group, const void *udata,
+ size_t udata_size, hid_t lapl_id, hid_t dxpl_id);
+static herr_t
+UD_cb_delete(const char *link_name, hid_t file, const void *udata,
+ size_t udata_size);
+static ssize_t
+UD_cb_query(const char * link_name, const void *udata, size_t udata_size,
+ void *buf, size_t buf_size);
+
+const H5L_class_t UD_cb_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_CB_TYPE, /* Link type id number */
+ NULL, /* NULL name (to make sure this doesn't break anything */
+ UD_cb_create, /* Creation callback */
+ UD_cb_move, /* Move/rename callback */
+ UD_cb_move, /* Copy callback */
+ UD_cb_traverse, /* The actual traversal function */
+ UD_cb_delete, /* Deletion callback */
+ UD_cb_query /* Query callback */
+}};
+static hid_t
+UD_plist_traverse(const char *link_name, hid_t cur_group,
+ const void *udata, size_t udata_size, hid_t lapl_id,
+ hid_t dxpl_id);
+
+const H5L_class_t UD_plist_class[1] = {{
+ H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
+ (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */
+ "UD_plist_link", /* Link class name for debugging */
+ NULL, /* Creation callback */
+ NULL, /* Move/rename callback */
+ NULL, /* Copy callback */
+ UD_plist_traverse, /* The actual traversal function */
+ NULL, /* Deletion callback */
+ NULL /* Query callback */
+}};
/*-------------------------------------------------------------------------
* Function: fix_ext_filename
@@ -499,10 +612,11 @@ static int
cklinks(hid_t fapl, hbool_t new_format)
{
hid_t file;
- H5O_info_t oinfo1, oinfo2;
- H5L_info_t linfo2;
+ H5O_info2_t oinfo1, oinfo2;
+ H5L_info2_t linfo;
char linkval[LINK_BUF_SIZE];
char filename[NAME_BUF_SIZE];
+ int token_cmp;
herr_t status;
if(new_format)
@@ -515,14 +629,15 @@ cklinks(hid_t fapl, hbool_t new_format)
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
/* Hard link */
- if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
+ if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR
+ if(token_cmp) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
@@ -537,9 +652,9 @@ cklinks(hid_t fapl, hbool_t new_format)
status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
- H5_FAILED();
- HDputs(" H5Lexists() should have failed for a path with missing components.");
- TEST_ERROR
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
@@ -551,13 +666,14 @@ cklinks(hid_t fapl, hbool_t new_format)
} /* end if */
/* Symbolic link */
- if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
- if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
+ if(H5Otoken_cmp(file, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) FAIL_STACK_ERROR
+ if(token_cmp) {
H5_FAILED();
HDputs(" Soft link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
@@ -573,15 +689,15 @@ cklinks(hid_t fapl, hbool_t new_format)
/* Dangling link */
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ status = H5Oget_info_by_name3(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
HDputs(" H5Oget_info_by_name() should have failed for a dangling link.");
TEST_ERROR
} /* end if */
- if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5L_TYPE_SOFT != linfo2.type) {
+ if(H5Lget_info2(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5L_TYPE_SOFT != linfo.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
@@ -600,15 +716,15 @@ cklinks(hid_t fapl, hbool_t new_format)
/* Recursive link */
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ status = H5Oget_info_by_name3(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
HDputs(" H5Oget_info_by_name() should have failed for a recursive link.");
TEST_ERROR
} /* end if */
- if(H5Lget_info(file, "grp1/recursive", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5L_TYPE_SOFT != linfo2.type) {
+ if(H5Lget_info2(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5L_TYPE_SOFT != linfo.type) {
H5_FAILED();
HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
@@ -635,7 +751,7 @@ cklinks(hid_t fapl, hbool_t new_format)
error:
return FAIL;
-}
+} /* end cklinks() */
/*-------------------------------------------------------------------------
@@ -652,8 +768,9 @@ static int
ck_new_links(hid_t fapl, hbool_t new_format)
{
hid_t file;
- H5O_info_t oi_dset, oi_hard1, oi_hard2;
+ H5O_info2_t oi_dset, oi_hard1, oi_hard2;
char filename[NAME_BUF_SIZE];
+ int token_cmp1, token_cmp2;
if(new_format)
TESTING("new link queries (w/new group format)")
@@ -665,9 +782,9 @@ ck_new_links(hid_t fapl, hbool_t new_format)
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Get hard link info */
- if(H5Oget_info_by_name2(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file, "/grp1/dataset2", &oi_dset, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file, "/grp1/hard1", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file, "/grp2/hard2", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
/* Check hard links */
if(H5O_TYPE_DATASET != oi_hard1.type || H5O_TYPE_DATASET != oi_hard2.type) {
@@ -675,7 +792,10 @@ ck_new_links(hid_t fapl, hbool_t new_format)
HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
}
- if(H5F_addr_ne(oi_dset.addr, oi_hard1.addr) || H5F_addr_ne(oi_dset.addr, oi_hard2.addr)) {
+
+ if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard1.token, &token_cmp1) < 0) TEST_ERROR
+ if(H5Otoken_cmp(file, &oi_dset.token, &oi_hard2.token, &token_cmp2) < 0) TEST_ERROR
+ if(token_cmp1 || token_cmp2) {
H5_FAILED();
HDputs(" Hard link test failed. Link seems not to point to the ");
HDputs(" expected file location.");
@@ -686,11 +806,11 @@ ck_new_links(hid_t fapl, hbool_t new_format)
if(H5Fclose(file) < 0) TEST_ERROR
PASSED();
- return SUCCEED;
+ return 0;
error:
- return FAIL;
-}
+ return -1;
+} /* end ck_new_links() */
/*-------------------------------------------------------------------------
@@ -920,7 +1040,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
hid_t dset_id = -1;
hid_t type_id = -1;
hid_t lcpl_id = -1;
- H5L_info_t linfo;
+ H5L_info2_t linfo;
char filename[1024];
hsize_t dims[2];
@@ -942,7 +1062,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Gclose(group_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
/* Create and commit a datatype with the default LCPL */
@@ -951,7 +1071,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Tclose(type_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
/* Create a dataspace */
@@ -964,7 +1084,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
- if(H5Lget_info(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
/* Create a link creation property list with the UTF-8 character encoding */
@@ -976,7 +1096,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Gclose(group_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create and commit a datatype with the new LCPL */
@@ -985,7 +1105,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Tclose(type_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create a dataset using the new LCPL */
@@ -993,7 +1113,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
- if(H5Lget_info(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create a new link to the dataset with a different character encoding. */
@@ -1004,35 +1124,35 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
/* Check that its character encoding is ASCII */
- if(H5Lget_info(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
/* Check that the first link's encoding hasn't changed */
- if(H5Lget_info(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Make sure that LCPLs work properly for other API calls: */
/* H5Lcreate_soft */
if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* H5Lmove */
if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
/* H5Lcopy */
if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* H5Lcreate_external */
if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Close open IDs */
@@ -1328,8 +1448,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
hid_t fcpl_id=-1; /* Group creation property list ID */
hid_t lcpl_id=-1;
hid_t lcpl2_id=-1;
- H5O_info_t oinfo;
- H5L_info_t linfo;
+ H5O_info2_t oinfo;
+ H5L_info2_t linfo;
H5T_cset_t old_cset;
int64_t old_corder; /* Creation order value of link */
time_t old_modification_time;
@@ -1366,8 +1486,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
if(H5Gclose(group_id) < 0) TEST_ERROR
/* Get the group's link's information */
- if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
old_cset = linfo.cset;
if(old_cset != H5T_CSET_UTF8) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
@@ -1385,8 +1505,8 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
/* Get the link's character set & modification time . They should be unchanged */
- if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
if(old_cset != linfo.cset) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
@@ -1394,9 +1514,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
/* Create a new link to the group. It should have a different creation order value but the same modification time */
if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(old_corder == linfo.corder) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
if(linfo.corder != 1) TEST_ERROR
@@ -1407,9 +1527,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
* should not change.
*/
if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
if(linfo.corder != 2) TEST_ERROR
@@ -1418,9 +1538,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
/* Move the link with the default property list. */
if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
if(linfo.corder != 3) TEST_ERROR
@@ -1428,9 +1548,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
/* Check that the original link is unchanged */
- if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
if(old_corder != linfo.corder) TEST_ERROR
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
@@ -1439,9 +1559,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
* Its creation order value will change, but modification time should not
* change. */
if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
if(linfo.corder != 4) TEST_ERROR
@@ -1450,9 +1570,9 @@ test_move_preserves(hid_t fapl_id, hbool_t new_format)
/* Move the link again using the default property list. */
if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
if(old_modification_time != oinfo.mtime) TEST_ERROR
- if(H5Lget_info(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder_valid != TRUE) TEST_ERROR
if(linfo.corder != 5) TEST_ERROR
@@ -1625,6 +1745,3910 @@ error:
} H5E_END_TRY;
return 1;
} /* end test_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: cklinks_deprec
+ *
+ * Purpose: Open the file created in the first step and check that the
+ * links look correct.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+cklinks_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t file;
+ H5O_info1_t oinfo1, oinfo2;
+ H5L_info1_t linfo;
+ char linkval[LINK_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+ herr_t status;
+
+ if(new_format)
+ TESTING("link queries using deprecated routines (w/new group format)")
+ else
+ TESTING("link queries using deprecated routines")
+
+ /* Open the file */
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) FAIL_STACK_ERROR
+
+ /* Hard link */
+ if(H5Oget_info_by_name2(file, "d1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5O_TYPE_DATASET != oinfo2.type) {
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ TEST_ERROR
+ } /* end if */
+ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
+ H5_FAILED();
+ HDputs(" Hard link test failed. Link seems not to point to the ");
+ HDputs(" expected file location.");
+ TEST_ERROR
+ } /* end if */
+ if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
+ H5E_BEGIN_TRY {
+ status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Lexists() should have failed for a path with missing components.");
+ TEST_ERROR
+ } /* end if */
+
+ /* Symbolic link */
+ if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5O_TYPE_DATASET != oinfo2.type) {
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ TEST_ERROR
+ } /* end if */
+ if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
+ H5_FAILED();
+ HDputs(" Soft link test failed. Link seems not to point to the ");
+ HDputs(" expected file location.");
+ TEST_ERROR
+ } /* end if */
+ if(H5Lget_val(file, "grp1/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(HDstrcmp(linkval, "/d1")) {
+ H5_FAILED();
+ HDputs(" Soft link test failed. Wrong link value");
+ TEST_ERROR
+ } /* end if */
+ if(H5Lexists(file, "grp1/soft", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+
+ /* Dangling link */
+ H5E_BEGIN_TRY {
+ status = H5Oget_info_by_name2(file, "grp1/dangle", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Oget_info_by_name() should have failed for a dangling link.");
+ TEST_ERROR
+ } /* end if */
+ if(H5Lget_info1(file, "grp1/dangle", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5L_TYPE_SOFT != linfo.type) {
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
+ TEST_ERROR
+ } /* end if */
+ if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
+ H5_FAILED();
+ HDprintf(" %d: Can't retrieve link value\n", __LINE__);
+ TEST_ERROR
+ } /* end if */
+ if(HDstrcmp(linkval, "foobar")) {
+ H5_FAILED();
+ HDputs(" Dangling link test failed. Wrong link value");
+ TEST_ERROR
+ } /* end if */
+ if(H5Lexists(file, "grp1/dangle", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR
+
+ /* Recursive link */
+ H5E_BEGIN_TRY {
+ status = H5Oget_info_by_name2(file, "grp1/recursive", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(status >= 0) {
+ H5_FAILED();
+ HDputs(" H5Oget_info_by_name() should have failed for a recursive link.");
+ TEST_ERROR
+ } /* end if */
+ if(H5Lget_info1(file, "grp1/recursive", &linfo, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5L_TYPE_SOFT != linfo.type) {
+ H5_FAILED();
+ HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
+ TEST_ERROR
+ } /* end if */
+ if(H5Lget_val(file, "grp1/recursive", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
+ H5_FAILED();
+ HDprintf(" %d: Can't retrieve link value\n", __LINE__);
+ TEST_ERROR
+ } /* end if */
+ if(HDstrcmp(linkval, "/grp1/recursive")) {
+ H5_FAILED();
+ HDputs(" Recursive link test failed. Wrong link value");
+ TEST_ERROR
+ } /* end if */
+
+ /* Non-existent link */
+ if(H5Lexists(file, "foobar", H5P_DEFAULT) == TRUE) FAIL_STACK_ERROR
+
+ /* Cleanup */
+ if(H5Fclose(file) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ return FAIL;
+} /* end chklinks_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_lcpl_deprec
+ *
+ * Purpose: Tests Link Creation Property Lists
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *-------------------------------------------------------------------------
+ */
+static int
+test_lcpl_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t file_id = -1;
+ hid_t group_id = -1;
+ hid_t space_id = -1;
+ hid_t dset_id = -1;
+ hid_t type_id = -1;
+ hid_t lcpl_id = -1;
+ H5L_info1_t linfo;
+ char filename[1024];
+ hsize_t dims[2];
+
+ if(new_format)
+ TESTING("link creation property lists using deprecated routines (w/new group format)")
+ else
+ TESTING("link creation property lists using deprecated routines")
+
+ /* Actually, intermediate group creation is tested elsewhere (tmisc).
+ * Here we only need to test the character encoding property */
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create and link a group with the default LCPL */
+ if((group_id = H5Gcreate2(file_id, "/group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Check that its character encoding is the default */
+ if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+
+ /* Create and commit a datatype with the default LCPL */
+ if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit2(file_id, "/type", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tclose(type_id) < 0) TEST_ERROR
+
+ /* Check that its character encoding is the default */
+ if(H5Lget_info1(file_id, "type", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+
+ /* Create a dataspace */
+ dims[0] = H5L_DIM1;
+ dims[1] = H5L_DIM2;
+ if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
+
+ /* Create a dataset using the default LCPL */
+ if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
+
+ /* Check that its character encoding is the default */
+ if(H5Lget_info1(file_id, "dataset", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5F_DEFAULT_CSET) TEST_ERROR
+
+ /* Create a link creation property list with the UTF-8 character encoding */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+
+ /* Create and link a group with the new LCPL */
+ if((group_id = H5Gcreate2(file_id, "/group2", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Check that its character encoding is UTF-8 */
+ if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Create and commit a datatype with the new LCPL */
+ if((type_id = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit2(file_id, "/type2", type_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tclose(type_id) < 0) TEST_ERROR
+
+ /* Check that its character encoding is UTF-8 */
+ if(H5Lget_info1(file_id, "type2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Create a dataset using the new LCPL */
+ if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
+
+ /* Check that its character encoding is UTF-8 */
+ if(H5Lget_info1(file_id, "dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Create a new link to the dataset with a different character encoding. */
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
+
+ if(H5Lcreate_hard(file_id, "/dataset2", file_id, "/dataset2_link", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check that its character encoding is ASCII */
+ if(H5Lget_info1(file_id, "/dataset2_link", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+
+ /* Check that the first link's encoding hasn't changed */
+ if(H5Lget_info1(file_id, "/dataset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Make sure that LCPLs work properly for other API calls: */
+ /* H5Lcreate_soft */
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+ if(H5Lcreate_soft("dataset2", file_id, "slink_to_dset2", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info1(file_id, "slink_to_dset2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* H5Lmove */
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_ASCII) < 0) TEST_ERROR
+ if(H5Lmove(file_id, "slink_to_dset2", file_id, "moved_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info1(file_id, "moved_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+
+ /* H5Lcopy */
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+ if(H5Lcopy(file_id, "moved_slink", file_id, "copied_slink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info1(file_id, "copied_slink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* H5Lcreate_external */
+ if(H5Lcreate_external("filename", "path", file_id, "extlink", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info1(file_id, "extlink", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Close open IDs */
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if(H5Sclose(space_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(group_id);
+ H5Dclose(dset_id);
+ H5Tclose(type_id);
+ H5Pclose(lcpl_id);
+ H5Sclose(space_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_lcpl_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_move_preserves_deprec
+ *
+ * Purpose: Tests that moving and renaming links preserves their
+ * properties.
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *-------------------------------------------------------------------------
+ */
+static int
+test_move_preserves_deprec(hid_t fapl_id, hbool_t new_format)
+{
+ hid_t file_id=-1;
+ hid_t group_id=-1;
+ hid_t fcpl_id=-1; /* Group creation property list ID */
+ hid_t lcpl_id=-1;
+ hid_t lcpl2_id=-1;
+ H5O_info1_t oinfo;
+ H5L_info1_t linfo;
+ H5T_cset_t old_cset;
+ int64_t old_corder; /* Creation order value of link */
+ time_t old_modification_time;
+ time_t curr_time;
+ unsigned crt_order_flags; /* Status of creation order info for GCPL */
+ char filename[1024];
+
+ if(new_format)
+ TESTING("moving and copying links using deprecated routines preserves their properties (w/new group format)")
+ else
+ TESTING("moving and copying links using deprecated routines preserves their properties")
+
+ /* Create a file creation property list with creation order stored for links
+ * in the root group
+ */
+ if((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR
+ if(crt_order_flags != 0) TEST_ERROR
+ if(H5Pset_link_creation_order(fcpl_id, H5P_CRT_ORDER_TRACKED) < 0) TEST_ERROR
+ if(H5Pget_link_creation_order(fcpl_id, &crt_order_flags) < 0) TEST_ERROR
+ if(crt_order_flags != H5P_CRT_ORDER_TRACKED) TEST_ERROR
+
+ /* Create file */
+ /* (with creation order tracking for the root group) */
+ h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) TEST_ERROR
+
+ /* Create a link creation property list with the UTF-8 character encoding */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_char_encoding(lcpl_id, H5T_CSET_UTF8) < 0) TEST_ERROR
+
+ /* Create a group with that lcpl */
+ if((group_id = H5Gcreate2(file_id, "group", lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Get the group's link's information */
+ if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ old_cset = linfo.cset;
+ if(old_cset != H5T_CSET_UTF8) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ old_corder = linfo.corder;
+ if(old_corder != 0) TEST_ERROR
+ old_modification_time = oinfo.mtime;
+
+ /* If this test happens too quickly, the times will all be the same. Make sure the time changes. */
+ curr_time = HDtime(NULL);
+ while(HDtime(NULL) <= curr_time)
+ ;
+
+ /* Close the file and reopen it */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+ if((file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) TEST_ERROR
+
+ /* Get the link's character set & modification time . They should be unchanged */
+ if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(old_cset != linfo.cset) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(old_corder != linfo.corder) TEST_ERROR
+
+ /* Create a new link to the group. It should have a different creation order value but the same modification time */
+ if(H5Lcreate_hard(file_id, "group", file_id, "group2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(H5Lget_info1(file_id, "group2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_corder == linfo.corder) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 1) TEST_ERROR
+ if(linfo.cset != H5T_CSET_ASCII) TEST_ERROR
+
+ /* Copy the first link to a UTF-8 name.
+ * Its creation order value should be different, but modification time
+ * should not change.
+ */
+ if(H5Lcopy(file_id, "group", file_id, "group_copied", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group_copied", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(H5Lget_info1(file_id, "group_copied", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 2) TEST_ERROR
+
+ /* Check that its character encoding is UTF-8 */
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Move the link with the default property list. */
+ if(H5Lmove(file_id, "group_copied", file_id, "group_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group_copied2", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(H5Lget_info1(file_id, "group_copied2", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 3) TEST_ERROR
+
+ /* Check that its character encoding is not UTF-8 */
+ if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
+
+ /* Check that the original link is unchanged */
+ if(H5Oget_info_by_name2(file_id, "group", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(H5Lget_info1(file_id, "group", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(old_corder != linfo.corder) TEST_ERROR
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Move the first link to a UTF-8 name.
+ * Its creation order value will change, but modification time should not
+ * change. */
+ if(H5Lmove(file_id, "group", file_id, "group_moved", lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group_moved", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(H5Lget_info1(file_id, "group_moved", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 4) TEST_ERROR
+
+ /* Check that its character encoding is UTF-8 */
+ if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Move the link again using the default property list. */
+ if(H5Lmove(file_id, "group_moved", file_id, "group_moved_again", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(file_id, "group_moved_again", &oinfo, H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR
+ if(old_modification_time != oinfo.mtime) TEST_ERROR
+ if(H5Lget_info1(file_id, "group_moved_again", &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != 5) TEST_ERROR
+
+ /* Check that its character encoding is not UTF-8 */
+ if(linfo.cset == H5T_CSET_UTF8) TEST_ERROR
+
+ /* Close open IDs */
+ if(H5Pclose(fcpl_id) < 0) TEST_ERROR
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fcpl_id);
+ H5Pclose(lcpl_id);
+ H5Pclose(lcpl2_id);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_move_preserves_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: external_link_root_deprec
+ *
+ * Purpose: Build a file with external link to root group in external file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+external_link_root_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info1_t linfo; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename1[NAME_BUF_SIZE];
+ char filename2[NAME_BUF_SIZE];
+ const char *file; /* File from external link */
+ const char *path; /* Path from external link */
+
+ if(new_format)
+ TESTING("external link to root using deprecated routines (w/new group format)")
+ else
+ TESTING("external link to root using deprecated routines")
+
+ /* Set up filenames */
+ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
+
+ /* Create file to point to */
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Check that external links are registered with the library */
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+
+ /* Create file with link to first file */
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create external link to object in first file */
+ if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check information for external link */
+ if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
+ if(H5L_TYPE_EXTERNAL != linfo.type) {
+ H5_FAILED();
+ HDputs(" Unexpected object type - should have been an external link");
+ goto error;
+ }
+ if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
+ if(HDstrcmp(file, filename1)) {
+ H5_FAILED();
+ HDputs(" External link file name incorrect");
+ goto error;
+ }
+ if(HDstrcmp(path, "/")) {
+ H5_FAILED();
+ HDputs(" External link path incorrect");
+ goto error;
+ }
+
+ /* Create external link to object in first file */
+ /* (add a few extra '/'s to make certain library normalizes external link object names) */
+ if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check information for external link */
+ if(H5Lget_info1(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
+ if(H5L_TYPE_EXTERNAL != linfo.type) {
+ H5_FAILED();
+ HDputs(" Unexpected object type - should have been an external link");
+ goto error;
+ }
+ if(H5Lget_val(fid, "ext_link", objname, sizeof(objname), H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lunpack_elink_val(objname, linfo.u.val_size, NULL, &file, &path) < 0) TEST_ERROR
+ if(HDstrcmp(file, filename1)) {
+ H5_FAILED();
+ HDputs(" External link file name incorrect");
+ goto error;
+ }
+ if(HDstrcmp(path, "/")) {
+ H5_FAILED();
+ HDputs(" External link path incorrect");
+ goto error;
+ }
+
+ /* Close and re-open file to ensure that data is written to disk */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+
+ /* Open object through external link */
+ if((gid = H5Gopen2(fid, "ext_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/")) TEST_ERROR
+
+ /* Create object in external file */
+ if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close group in external file */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+
+ /* Close external object (lets first file close) */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create a new object using H5Gcreate2 through the external link
+ * directly
+ */
+ if((gid = H5Gcreate2(fid, "ext_link/newer_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close file and group */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Check that all file IDs have been closed */
+ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
+
+ /* Open first file again with read-only access and check on objects created */
+ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* Open objects created through external link */
+ if((gid = H5Gopen2(fid, "new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((gid2 = H5Gopen2(fid, "newer_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Check names */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/new_group")) TEST_ERROR
+ if(H5Iget_name(gid2, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/newer_group")) TEST_ERROR
+
+ /* Close opened objects */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+
+ /* Close first file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Check that all file IDs have been closed */
+ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
+
+ /* Verify that new objects can't be created through a read-only external
+ * link.
+ */
+ if((fid = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ gid = H5Gcreate2(fid, "ext_link/readonly_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ } H5E_END_TRY
+ if(gid >= 0) TEST_ERROR
+
+ /* Close second file again */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Check that all file IDs have been closed */
+ if(H5I_nmembers(H5I_FILE) != 0) TEST_ERROR
+ H5F_sfile_assert_num(0);
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose (gid2);
+ H5Gclose (gid);
+ H5Fclose (fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end external_link_root_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: external_link_query_deprec
+ *
+ * Purpose: Query file & object names for external links, as well as
+ * information from H5Gget_obj_info
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+external_link_query_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ const char *file_name; /* Name of the file the external link points to */
+ const char *object_name; /* Name of the object the external link points to */
+ H5O_info1_t oi; /* Object information */
+ H5L_info1_t li; /* Link information */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
+ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
+
+ if(new_format)
+ TESTING("query aspects of external link using deprecated routines (w/new group format)")
+ else
+ TESTING("query aspects of external link using deprecated routines")
+
+ /* Set up filenames */
+ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
+
+ /* Create first file, with external link to object in second file */
+ if((fid = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create external link */
+ /* (add a few extra '/'s to make certain library normalizes external link object names) */
+ if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Get size of buffer for external link */
+ if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
+ if (H5L_TYPE_EXTERNAL != li.type) {
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been an external link");
+ goto error;
+ }
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Create second file to point to */
+ if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create object to link to */
+ if((gid = H5Gcreate2(fid, "dst", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Open first file */
+ if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* Get size of buffer for external link */
+ if(H5Lget_info1(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
+ if(H5L_TYPE_EXTERNAL != li.type) {
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been an external link");
+ goto error;
+ }
+
+ /* Get information for external link. It should be two strings right after each other */
+ if(H5Lget_val(fid, "src", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Extract the file and object names from the buffer */
+ if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, &file_name, &object_name) < 0) TEST_ERROR
+
+ /* Compare the file and object names */
+ if(HDstrcmp(file_name, filename2)) TEST_ERROR
+ if(HDstrcmp(object_name, "/dst")) TEST_ERROR
+
+ /* Query information about object that external link points to */
+ if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5O_TYPE_GROUP != oi.type) {
+ H5_FAILED();
+ HDputs(" Unexpected object type - should have been a group");
+ goto error;
+ }
+
+ /* Close first file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Make sure that passing in NULLs to H5Lunpack_elink_val works */
+ if(H5Lunpack_elink_val(query_buf, li.u.val_size, NULL, NULL, NULL) < 0) TEST_ERROR
+
+ /* Make sure that bogus cases trigger errors in H5Lunpack_elink_val */
+ H5E_BEGIN_TRY {
+ if(H5Lunpack_elink_val(query_buf, li.u.val_size - 1, NULL, NULL, NULL) >= 0) TEST_ERROR
+ } H5E_END_TRY
+ H5E_BEGIN_TRY {
+ if(H5Lunpack_elink_val(query_buf, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
+ } H5E_END_TRY
+ H5E_BEGIN_TRY {
+ if(H5Lunpack_elink_val(NULL, (size_t)0, NULL, NULL, NULL) >= 0) TEST_ERROR
+ } H5E_END_TRY
+ H5E_BEGIN_TRY {
+ if(H5Lunpack_elink_val(NULL, (size_t)1000, NULL, NULL, NULL) >= 0) TEST_ERROR
+ } H5E_END_TRY
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end external_link_query_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: external_link_closing_deprec
+ *
+ * Purpose: Test that files are closed correctly when traversing
+ * external links.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+external_link_closing_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid1 = (-1), fid2 = (-1), fid3 = (-1), fid4=(-1);
+ hid_t gid=(-1), tid=(-1), tid2=(-1), sid=(-1), did=(-1);
+ hid_t lcpl_id=(-1);
+ hsize_t dims[2];
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE],
+ filename3[NAME_BUF_SIZE],
+ filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
+ buf[NAME_BUF_SIZE]; /* misc. buffer */
+ H5L_info1_t li;
+ H5O_info1_t oi;
+ hobj_ref_t obj_ref;
+
+ if(new_format)
+ TESTING("that external files are closed during traversal (w/new group format)")
+ else
+ TESTING("that external files are closed during traversal")
+
+ /* In this test, external links will go from file1 to file2 and from
+ * file2 to file3.
+ * Test that all functions that can traverse external files close
+ * the files they open.
+ * Test that providing unusual paths containing external links can't
+ * make HDF5 forget to close a file it opened.
+ */
+
+ /* Set up filenames */
+ h5_fixname(FILENAME[3], fapl, filename1, sizeof filename1);
+ h5_fixname(FILENAME[4], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[5], fapl, filename3, sizeof filename3);
+ h5_fixname(FILENAME[6], fapl, filename4, sizeof filename4);
+
+ /* Create four files */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create a dataspace and a datatype so we can create/commit a dataset/datatype in the files */
+ dims[0] = 2;
+ dims[1] = 2;
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if((tid2 = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+
+ /* Create external links from each file to the next */
+ if(H5Lcreate_external(filename2, "/", fid1, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/", fid2, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename4, "/", fid3, "elink", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close all files but the first */
+ if(H5Fclose(fid4) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+
+ /* Test creating each kind of object */
+ if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close objects */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Test that getting info works */
+ if(H5Lget_info1(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info1(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Test move */
+ if(H5Lmove(fid1, "elink/elink/elink/group1", fid1,
+ "elink/elink/elink/group1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Open file 4 so we can do some fancy things */
+ if((fid4 = H5Fopen(filename4, H5F_ACC_RDWR, fapl)) < 0) FAIL_STACK_ERROR
+ if(H5Lmove(fid1, "elink/elink/elink/type1", fid4,
+ "type1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lmove(fid4, "dataset1", fid1,
+ "elink/elink/elink/dataset1_moved", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Close file 4 again */
+ if(H5Fclose(fid4) < 0) FAIL_STACK_ERROR
+
+ /* Test copy (as of this test, it uses the same code as move) */
+ if(H5Lcopy(fid1, "elink/elink/elink", fid1,
+ "elink/elink/elink_copied", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcopy(fid1, "elink/elink/elink", fid1,
+ "elink/elink/elink/elink_copied2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Test H5Gset and get comment */
+ if(H5Oset_comment_by_name(fid1, "elink/elink/elink/group1_moved", "comment", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_comment_by_name(fid1, "elink/elink/elink/group1_moved", buf, sizeof(buf), H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(HDstrcmp(buf, "comment")) TEST_ERROR
+
+ /* Test H5*open */
+ if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Close objects */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+
+ /* Test H5*open2 */
+ if((gid = H5Gopen2(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((tid = H5Topen2(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((did = H5Dopen2(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ /* Close objects */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ if(H5Tclose(tid) < 0) FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0) FAIL_STACK_ERROR
+
+ /* Test H5Oopen */
+ if((did = H5Oopen(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Test H5Fmount */
+ if((gid = H5Gcreate2(fid1, "elink/elink/elink/mnt", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ if(H5Fmount(fid1, "elink/elink/elink/mnt", fid1, H5P_DEFAULT) >= 0) TEST_ERROR
+ if(H5Funmount(fid1, "elink/elink/elink/mnt") >= 0) TEST_ERROR
+ } H5E_END_TRY
+
+ /* Test H5Rcreate */
+ if(H5Rcreate(&obj_ref, fid1, "elink/elink/elink/type1_moved", H5R_OBJECT, (hid_t)(-1)) < 0) TEST_ERROR
+
+ /* Test unlink */
+ if(H5Ldelete(fid1, "elink/elink/elink/group1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/type1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/dataset1_moved", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink_copied", H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Ldelete(fid1, "elink/elink/elink/elink_copied2", H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* We've tested that the various functions above don't leave files open.
+ * Now test that we can't confuse HDF5 by giving unusual paths with external links
+ */
+ /* Create an external link that points to another external link */
+ if((fid2 = H5Fopen(filename2, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ if(H5Lcreate_external(filename3, "/elink", fid2, "elink2",
+ H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+
+ /* Do an external link traversal that recursively calls another external link. */
+ if((gid = H5Gcreate2(fid1, "elink/elink2/group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create two more groups so that the last three elements in the path are
+ * all within the same external file
+ */
+ if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Add a few regular groups and a soft link in file2 using intermediate group creation */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/elink2", fid1, "elink/file2group1/file2group2/slink",
+ lcpl_id, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Try to traverse this path. There are three soft traversals in a row;
+ * slink points to (file2)/elink2, which points to (file3)/elink, which
+ * points to file 4.
+ */
+ if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Lget_info1(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Some simpler tests */
+ if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Lget_info1(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info1(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+
+
+ /* Close file1, the only file that should still be open */
+ if(H5Fclose(fid1) < 0) TEST_ERROR
+
+ /* Re-create each file. If they are hanging open, these creates will fail */
+ if((fid1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid2 = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid3 = H5Fcreate(filename3, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if((fid4 = H5Fcreate(filename4, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Cleanup */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+ if(H5Fclose(fid4) < 0) TEST_ERROR
+ if(H5Fclose(fid3) < 0) TEST_ERROR
+ if(H5Fclose(fid2) < 0) TEST_ERROR
+ if(H5Fclose(fid1) < 0) TEST_ERROR
+
+ PASSED();
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Tclose(tid);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(tid2);
+ H5Fclose(fid4);
+ H5Fclose(fid3);
+ H5Fclose(fid2);
+ H5Fclose(fid1);
+ } H5E_END_TRY;
+ return FAIL;
+} /* external_link_closing_deprec() */
+
+/* Callback functions for UD hard links. */
+/* UD_hard_create increments the object's reference count */
+static herr_t
+UD_hard_create_deprec(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata,
+ size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
+{
+ haddr_t addr;
+ hid_t target_obj = -1;
+ herr_t ret_value = 0;
+
+ if(udata_size != sizeof(haddr_t)) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+ addr = *((const haddr_t *)udata);
+
+ /* Open the object this link points to */
+ target_obj= H5Oopen_by_addr(loc_group, addr);
+ if(target_obj < 0) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+ /* Increment the reference count of the target object */
+ if(H5Oincr_refcount(target_obj) < 0) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+done:
+ /* Close the target object if we opened it */
+ if(target_obj >= 0) {
+ switch(H5Iget_type(target_obj)) {
+ case H5I_GROUP:
+ if(H5Gclose(target_obj) < 0)
+ ret_value = -1;
+ break;
+
+ case H5I_DATASET:
+ if(H5Dclose(target_obj) < 0)
+ ret_value = -1;
+ break;
+
+ case H5I_DATATYPE:
+ if(H5Tclose(target_obj) < 0)
+ ret_value = -1;
+ break;
+
+ case H5I_MAP:
+ /* TODO: Not supported in native file format yet */
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
+ case H5I_NTYPES:
+ default:
+ return FAIL;
+ } /* end switch */
+ } /* end if */
+
+ return ret_value;
+} /* end UD_hard_create() */
+
+/* Traverse a hard link by opening the object */
+static hid_t
+UD_hard_traverse_deprec(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
+ const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id,
+ hid_t H5_ATTR_UNUSED dxpl_id)
+{
+ haddr_t addr;
+ hid_t ret_value = -1;
+
+ if(udata_size != sizeof(haddr_t))
+ return FAIL;
+
+ addr = *((const haddr_t *) udata);
+
+ ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */
+
+ return ret_value;
+} /* end UD_hard_traverse() */
+
+/* UD_hard_delete decrements the object's reference count */
+static herr_t
+UD_hard_delete_deprec(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata,
+ size_t udata_size)
+{
+ haddr_t addr;
+ hid_t target_obj = -1;
+ herr_t ret_value = 0;
+
+ if(udata_size != sizeof(haddr_t)) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+ addr = *((const haddr_t *) udata);
+
+ /* Open the object this link points to */
+ target_obj= H5Oopen_by_addr(file, addr);
+ if(target_obj < 0) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+ /* Decrement the reference count of the target object */
+ if(H5Odecr_refcount(target_obj) < 0) {
+ ret_value = -1;
+ goto done;
+ } /* end if */
+
+done:
+ /* Close the target object if we opened it */
+ if(target_obj >= 0) {
+ switch(H5Iget_type(target_obj)) {
+ case H5I_GROUP:
+ if(H5Gclose(target_obj) < 0)
+ ret_value = -1;
+ break;
+
+ case H5I_DATASET:
+ if(H5Dclose(target_obj) < 0)
+ ret_value = -1;
+ break;
+
+ case H5I_DATATYPE:
+ if(H5Tclose(target_obj) < 0)
+ ret_value = -1;
+ break;
+
+ case H5I_MAP:
+ /* TODO: Not supported in native file format yet */
+
+ case H5I_UNINIT:
+ case H5I_BADID:
+ case H5I_FILE:
+ case H5I_DATASPACE:
+ case H5I_ATTR:
+ case H5I_VFL:
+ case H5I_VOL:
+ case H5I_GENPROP_CLS:
+ case H5I_GENPROP_LST:
+ case H5I_ERROR_CLASS:
+ case H5I_ERROR_MSG:
+ case H5I_ERROR_STACK:
+ case H5I_SPACE_SEL_ITER:
+ case H5I_NTYPES:
+ default:
+ return FAIL;
+ } /* end switch */
+ } /* end if */
+
+ return ret_value;
+} /* end UD_hard_delete() */
+
+static int
+ud_hard_links_deprec(hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info1_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ h5_stat_size_t empty_size; /* Size of an empty file */
+ char filename[NAME_BUF_SIZE];
+
+ TESTING("user-defined hard link using deprecated routines (w/new group format)")
+
+ /* Set up filename and create file*/
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Get the size of the empty file for reference */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
+
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Check that external links are registered and UD hard links are not */
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+
+ /* Register "user-defined hard links" with the library */
+ if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR
+
+ /* Check that UD hard links are now registered */
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+
+ /* Create a group for the UD hard link to point to */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Get address for the group to give to the hard link */
+ if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create a user-defined "hard link" to the group using the address we got
+ * from H5Lget_info1 */
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close and re-open file to ensure that data is written to disk */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+
+ /* Open group through UD link */
+ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/group")) TEST_ERROR
+
+ /* Create object in group */
+ if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close groups*/
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Re-open group without using ud link to check that it was created properly */
+ if((gid = H5Gopen2(fid, "group/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/group/new_group")) TEST_ERROR
+
+ /* Close opened object */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Check that H5Lget_objinfo works on the hard link */
+ if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ /* UD hard links have no query function, thus return a "link length" of 0 */
+ if(li.u.val_size != 0) TEST_ERROR
+ if(UD_HARD_TYPE != li.type) {
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been a UD hard link");
+ goto error;
+ } /* end if */
+
+ /* Unlink the group pointed to by the UD link. It shouldn't be
+ * deleted because of the UD link. */
+ if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Ensure we can open the group through the UD link */
+ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Unlink the group contained within it. */
+ if(H5Ldelete(gid, "new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Now delete the UD link. This should cause the group to be
+ * deleted, too. */
+ if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ /* The file should be empty again. */
+ if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR
+
+ if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end ud_hard_links_deprec() */
+
+static int
+ud_link_reregister_deprec(hid_t fapl)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ H5L_info1_t li; /* Link information */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ h5_stat_size_t empty_size; /* Size of an empty file */
+
+ TESTING("registering a new class for existing UD links using deprecated routines (w/new group format)")
+
+ /* Set up filename and create file*/
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Get the size of the empty file for reference */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+ if((empty_size = h5_get_file_size(filename, fapl))<0) TEST_ERROR
+
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Check that UD hard links are not registered */
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+
+ /* Register "user-defined hard links" with the library */
+ if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR
+
+ /* Check that UD hard links are registered */
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+
+ /* Point a UD defined hard link to a group in the same way as the previous test */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
+ sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0)
+ TEST_ERROR
+
+ /* Create a group named REREG_TARGET_NAME in the same group as the ud link */
+ if((gid = H5Gcreate2(fid, REREG_TARGET_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Now unregister UD hard links */
+ if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR
+
+ /* Check that UD hard links are no longer registered */
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+
+ /* Verify that we can't traverse the ud link anymore */
+ H5E_BEGIN_TRY {
+ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) >= 0) TEST_ERROR
+ } H5E_END_TRY
+
+ /* Verify that we can't create any new links of this type */
+ H5E_BEGIN_TRY {
+ if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
+ sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ TEST_ERROR
+ } H5E_END_TRY
+
+ /* Register a new kind of link with the same ID number */
+ if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
+
+ /* Check that UD hard links are registered again */
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+
+ /* Open a group through the ud link (now a different class of link).
+ * It should be a different group
+ * than the UD hard link pointed to */
+ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/" REREG_TARGET_NAME)) TEST_ERROR
+
+ /* Create object in group */
+ if((gid2 = H5Gcreate2(gid, "new_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close groups*/
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Re-open group without using ud link to check that it was created properly */
+ if((gid = H5Gopen2(fid, "rereg_target/new_group", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/rereg_target/new_group")) TEST_ERROR
+
+ /* Close opened object */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Unlink the group pointed to by the UD hard link. It shouldn't be
+ * deleted because the UD link incremented its reference count. */
+ if(H5Ldelete(fid, "/group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* What a mess! Re-register user-defined links to clean up the
+ * reference counts. We shouldn't actually need to unregister the
+ * other link type */
+ if(H5Lregister(UD_hard_class_deprec) < 0) FAIL_STACK_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) FAIL_STACK_ERROR
+
+ /* Ensure we can open the group through the UD link (now that UD hard
+ * links have been registered) */
+ if((gid = H5Gopen2(fid, "ud_link", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Delete the UD hard link. This should cause the group to be
+ * deleted, too. */
+ if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Unlink the other two groups so that we can make sure the file is empty */
+ if(H5Ldelete(fid, "/rereg_target/new_group", H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ldelete(fid, REREG_TARGET_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ /* The file should be empty again. */
+ if(empty_size != h5_get_file_size(filename, fapl)) TEST_ERROR
+
+ if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) FAIL_STACK_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end ud_link_reregister_deprec() */
+
+static int
+ud_callbacks_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t lcpl = -1; /* Link Creation PL */
+ H5L_info1_t li; /* Link information */
+ char ud_target_name[] = UD_CB_TARGET; /* Link target name */
+ char filename[NAME_BUF_SIZE];
+ char query_buf[NAME_BUF_SIZE];
+
+ if(new_format)
+ TESTING("user-defined link callbacks using deprecated routines (w/new group format)")
+ else
+ TESTING("user-defined link callbacks using deprecated routines")
+
+ /* Set up filename and create file*/
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((fid=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Check that registered link classes are, and unregistered ones aren't */
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != FALSE) TEST_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != FALSE) TEST_ERROR
+
+ /* Hit two birds with one stone: register UD hard links from previous
+ * test to check that having two UD links registered at once presents
+ * no problems. */
+ if(H5Lregister(UD_hard_class_deprec) < 0) TEST_ERROR
+
+ /* Register user-defined link class. This is the one we'll actually be using. */
+ if(H5Lregister(UD_cb_class) < 0) TEST_ERROR
+
+ /* Check that registered link classes are, and unregistered ones aren't */
+ if(H5Lis_registered(H5L_TYPE_EXTERNAL) != TRUE) TEST_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_HARD_TYPE) != TRUE) TEST_ERROR
+ if(H5Lis_registered((H5L_type_t)UD_CB_TYPE) != TRUE) TEST_ERROR
+
+ /* Create a group for the UD link to point to */
+ if((gid = H5Gcreate2(fid, UD_CB_TARGET, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Create a user-defined link to the group. These UD links behave like soft links. */
+ if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Try opening group through UD link */
+ if((gid = H5Gopen2(fid, UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Query the link to test its query callback */
+ if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.u.val_size != 16) TEST_ERROR
+ if (UD_CB_TYPE != li.type) {
+ H5_FAILED();
+ HDputs(" Unexpected link class - should have been a UD hard link");
+ goto error;
+ }
+
+ /* Fill the query buffer */
+ if(H5Lget_val(fid, UD_CB_LINK_NAME, query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(HDstrcmp(query_buf, "query succeeded") != 0) TEST_ERROR
+
+ /* Move the link */
+ if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Re-open group to ensure that move worked */
+ if((gid = H5Gopen2(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Remove UD link */
+ if(H5Ldelete(fid, NEW_UD_CB_LINK_NAME, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Test that the callbacks don't work if the link class is not registered */
+
+ /* Create a new link. Just for fun, give it a non-default character
+ * encoding (to test that LAPLs work) */
+ if((lcpl = H5Pcreate(H5P_LINK_CREATE)) < 0) FAIL_STACK_ERROR
+ if(H5Pset_char_encoding(lcpl, H5T_CSET_UTF8) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_ud(fid, UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, lcpl, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR
+
+ /* Check its character encoding */
+ if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(li.cset != H5T_CSET_UTF8) TEST_ERROR
+
+ /* Unregister the link class so the library forgets what its callbacks do */
+ if(H5Lunregister((H5L_type_t)UD_CB_TYPE) < 0) FAIL_STACK_ERROR
+
+ /* Now test that each of the callbacks fails */
+ H5E_BEGIN_TRY {
+ if(H5Lcreate_ud(fid, NEW_UD_CB_LINK_NAME, (H5L_type_t)UD_CB_TYPE, ud_target_name, (size_t)UD_CB_TARGET_LEN, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
+ if(H5Lmove(fid, UD_CB_LINK_NAME, H5L_SAME_LOC, NEW_UD_CB_LINK_NAME, H5P_DEFAULT, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
+ if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
+ if((gid = H5Gopen2(gid, UD_CB_LINK_NAME, H5P_DEFAULT)) >= 0) FAIL_STACK_ERROR
+ if(H5Ldelete(fid, UD_CB_LINK_NAME, H5P_DEFAULT) >= 0) FAIL_STACK_ERROR
+ } H5E_END_TRY
+
+ /* The query callback should NOT fail, but should be unable to give a linklen */
+ if(H5Lget_info1(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(li.u.val_size != 0) TEST_ERROR
+ if(li.type != UD_CB_TYPE) TEST_ERROR
+
+ /* Unregister the UD hard links */
+ if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) FAIL_STACK_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) FAIL_STACK_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose (lcpl);
+ H5Gclose (gid);
+ H5Fclose (fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end ud_callbacks_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: lapl_nlinks_deprec
+ *
+ * Purpose: Check that the maximum number of soft links can be adjusted
+ * by the user using the Link Access Property List.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+lapl_nlinks_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t plist = -1; /* lapl ID */
+ hid_t tid = -1, sid = -1, did = -1; /* Other IDs */
+ hid_t gapl = -1, dapl = -1, tapl = -1; /* Other property lists */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];
+ size_t nlinks; /* nlinks for H5Pset_nlinks */
+ hsize_t dims[2];
+
+ if(new_format)
+ TESTING("adjusting nlinks with LAPL using deprecated routines (w/new group format)")
+ else
+ TESTING("adjusting nlinks with LAPL using deprecated routines")
+
+ /* Make certain test is valid */
+ /* XXX: should probably make a "generic" test that creates the proper
+ * # of links based on this value - QAK
+ */
+ HDassert(H5L_NUM_LINKS == 16);
+
+ /* Create file */
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group with short name in file (used as target for links) */
+ if((gid = H5Gcreate2(fid, "final", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Create chain of soft links to existing object (limited) */
+ if(H5Lcreate_soft("final", fid, "soft1", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft1", fid, "soft2", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft2", fid, "soft3", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft3", fid, "soft4", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft4", fid, "soft5", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft5", fid, "soft6", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft6", fid, "soft7", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft7", fid, "soft8", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft8", fid, "soft9", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft9", fid, "soft10", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft10", fid, "soft11", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft11", fid, "soft12", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft12", fid, "soft13", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft13", fid, "soft14", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft14", fid, "soft15", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft15", fid, "soft16", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("soft16", fid, "soft17", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* Close objects */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ /* Open file */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+
+ /* Create LAPL with higher-than-usual nlinks value */
+ /* Create a non-default lapl with udata set to point to the first group */
+ if((plist = H5Pcreate(H5P_LINK_ACCESS)) < 0) TEST_ERROR
+ nlinks = 20;
+ if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+
+ /* Ensure that nlinks was set successfully */
+ nlinks = 0;
+ if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
+ if(nlinks != 20) TEST_ERROR
+
+ /* Open object through what is normally too many soft links using
+ * new property list */
+ if((gid = H5Oopen(fid, "soft17", plist)) < 0) TEST_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/soft17")) TEST_ERROR
+
+ /* Create group using soft link */
+ if((gid2 = H5Gcreate2(gid, "new_soft", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Close groups */
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Set nlinks to a smaller number */
+ nlinks = 4;
+ if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+
+ /* Ensure that nlinks was set successfully */
+ nlinks = 0;
+ if(H5Pget_nlinks(plist, &nlinks) < 0) TEST_ERROR
+ if(nlinks != 4) TEST_ERROR
+
+ /* Try opening through what is now too many soft links */
+ H5E_BEGIN_TRY {
+ gid = H5Oopen(fid, "soft5", plist);
+ } H5E_END_TRY;
+ if (gid >= 0) {
+ H5_FAILED();
+ HDputs(" Should have failed for sequence of too many nested links.");
+ goto error;
+ }
+
+ /* Open object through lesser soft link */
+ if((gid = H5Oopen(fid, "soft4", plist)) < 0) TEST_ERROR
+
+ /* Check name */
+ if(H5Iget_name(gid, objname, (size_t)NAME_BUF_SIZE) < 0) TEST_ERROR
+ if(HDstrcmp(objname, "/soft4")) TEST_ERROR
+
+ /* Test other functions that should use a LAPL */
+ nlinks = 20;
+ if(H5Pset_nlinks(plist, nlinks) < 0) TEST_ERROR
+
+ /* Try copying and moving when both src and dst contain many soft links
+ * using a non-default LAPL
+ */
+ if(H5Lcopy(fid, "soft17", fid, "soft17/newer_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if(H5Lmove(fid, "soft17/newer_soft", fid, "soft17/newest_soft", H5P_DEFAULT, plist) < 0) TEST_ERROR
+
+ /* H5Olink */
+ if(H5Olink(gid, fid, "soft17/link_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
+
+ /* H5Lcreate_hard and H5Lcreate_soft */
+ if(H5Lcreate_hard(fid, "soft17", fid, "soft17/link2_to_group", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if(H5Lcreate_soft("/soft4", fid, "soft17/soft_link", H5P_DEFAULT, plist) < 0) TEST_ERROR
+
+ /* H5Ldelete */
+ if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
+
+ /* H5Lget_val and H5Lget_info1 */
+ if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR
+ if(H5Lget_info1(fid, "soft17", NULL, plist) < 0) TEST_ERROR
+
+ /* H5Lcreate_external and H5Lcreate_ud */
+ if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR
+ if(H5Lregister(UD_rereg_class) < 0) TEST_ERROR
+ if(H5Lcreate_ud(fid, "soft17/udlink", (H5L_type_t)UD_HARD_TYPE, NULL, (size_t)0, H5P_DEFAULT, plist) < 0) TEST_ERROR
+
+ /* Close plist */
+ if(H5Pclose(plist) < 0) TEST_ERROR
+
+ /* Create a datatype and dataset as targets inside the group */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit2(gid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+
+ dims[0] = 2;
+ dims[1] = 2;
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Close group */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Try to open the objects using too many symlinks with default *APLs */
+ H5E_BEGIN_TRY {
+ if((gid = H5Gopen2(fid, "soft17", H5P_DEFAULT)) >= 0)
+ FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
+ if((tid = H5Topen2(fid, "soft17/datatype", H5P_DEFAULT)) >= 0)
+ FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
+ if((did = H5Dopen2(fid, "soft17/dataset", H5P_DEFAULT)) >= 0)
+ FAIL_PUTS_ERROR(" Should have failed for too many nested links.")
+ } H5E_END_TRY
+
+ /* Create property lists with nlinks set */
+ if((gapl = H5Pcreate(H5P_GROUP_ACCESS)) < 0) TEST_ERROR
+ if((tapl = H5Pcreate(H5P_DATATYPE_ACCESS)) < 0) TEST_ERROR
+ if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) TEST_ERROR
+
+ nlinks = 20;
+ if(H5Pset_nlinks(gapl, nlinks) < 0) TEST_ERROR
+ if(H5Pset_nlinks(tapl, nlinks) < 0) TEST_ERROR
+ if(H5Pset_nlinks(dapl, nlinks) < 0) TEST_ERROR
+
+ /* We should now be able to use these property lists to open each kind
+ * of object.
+ */
+ if((gid = H5Gopen2(fid, "soft17", gapl)) < 0) FAIL_STACK_ERROR
+ if((tid = H5Topen2(fid, "soft17/datatype", tapl)) < 0) TEST_ERROR
+ if((did = H5Dopen2(fid, "soft17/dataset", dapl)) < 0) TEST_ERROR
+
+ /* Close objects */
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Close plists */
+ if(H5Pclose(gapl) < 0) TEST_ERROR
+ if(H5Pclose(tapl) < 0) TEST_ERROR
+ if(H5Pclose(dapl) < 0) TEST_ERROR
+
+ /* Unregister UD hard link class */
+ if(H5Lunregister((H5L_type_t)UD_HARD_TYPE) < 0) TEST_ERROR
+
+ /* Close file */
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(gapl);
+ H5Pclose(dapl);
+ H5Pclose(tapl);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Pclose(plist);
+ H5Fclose(fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end lapl_nlinks_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: linkinfo_deprec
+ *
+ * Purpose: Check that the link class is returned correctly when queried.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+linkinfo_deprec(hid_t fapl, hbool_t new_format)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t tid = -1; /* Type ID */
+ hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
+ H5L_info1_t li; /* Link information */
+ char filename[NAME_BUF_SIZE];
+
+ if(new_format)
+ TESTING("link type field in H5Lget_info using deprecated routines (w/new group format)")
+ else
+ TESTING("link type field in H5Lget_info using deprecated routines")
+
+ /* Set up filename and create file*/
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Register a couple of user-defined link classes with the library */
+ if(H5Lregister(UD_plist_class) < 0) TEST_ERROR
+
+ /* Create an object of each type */
+ if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0) TEST_ERROR
+ if(H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Close all objects */
+ if(H5Tclose(tid) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* Make sure that link type is correct when objects are queried */
+ if(H5Lget_info1(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_HARD) TEST_ERROR
+ if(H5Lget_info1(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_HARD) TEST_ERROR
+ if(H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_HARD) TEST_ERROR
+
+ if(H5Lget_info1(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR
+ if(H5Lget_info1(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != H5L_TYPE_SOFT) TEST_ERROR
+ if(H5Lget_info1(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(li.type != UD_PLIST_TYPE) TEST_ERROR
+
+ /* Ensure that passing a NULL pointer doesn't cause an error */
+ if(H5Lget_info1(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR
+
+ if(H5Fclose(fid) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Tclose (tid);
+ H5Dclose (did);
+ H5Gclose (gid);
+ H5Fclose (fid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end linkinfo_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: corder_create_compact_deprec
+ *
+ * Purpose: Create a group with creation order indices and insert links
+ * in it when in compact form
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+corder_create_compact_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ unsigned u; /* Local index variable */
+
+ TESTING("creating compact group with creation order indexing using deprecated routines")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Set creation order tracking & indexing on group */
+ if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+
+ /* Create group with creation order indexing & tracking on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check on group's initial status */
+ if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+
+ /* Query the group creation properties */
+ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+
+ /* Create several links, but keep group in compact form */
+ for(u = 0; u < max_compact; u++) {
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
+ if(nlinks != (u + 1)) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ } /* end for */
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ /* Re-open the file */
+ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* Open group created */
+ if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
+ if(nlinks != max_compact) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+
+ /* Loop through links, checking their creation order values */
+ /* (the name index is used, but the creation order value is in the same order) */
+ for(u = 0; u < max_compact; u++) {
+ H5L_info1_t linfo; /* Link information */
+
+ /* Retrieve information for link */
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
+ if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify creation order of link */
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != u) TEST_ERROR
+ } /* end for */
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(gcpl_id);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end corder_create_compact_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: corder_create_dense_deprec
+ *
+ * Purpose: Create a group with creation order indices and insert links
+ * in it until it's in dense form
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+corder_create_dense_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ unsigned nlinks; /* Number of link messages in group's header */
+ hsize_t name_count; /* # of records in name index */
+ hsize_t corder_count; /* # of records in creation order index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ unsigned u; /* Local index variable */
+
+ TESTING("creating dense group with creation order indexing using deprecated routines")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Set creation order tracking & indexing on group */
+ if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) TEST_ERROR
+
+ /* Create group with creation order indexing & tracking on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check on group's initial status */
+ if(H5G__is_empty_test(group_id) != TRUE) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+
+ /* Query the group creation properties */
+ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+
+ /* Create several links, up to limit of compact form */
+ for(u = 0; u < max_compact; u++) {
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_links_test(group_id, &nlinks) != TRUE) TEST_ERROR
+ if(nlinks != (u + 1)) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+ } /* end for */
+
+ /* Create another link, to push group into dense form */
+ HDsnprintf(objname, sizeof(objname), "filler %u", max_compact);
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Retrieve & verify # of records in the name & creation order indices */
+ if(H5G__new_dense_info_test(group_id, &name_count, &corder_count) < 0) TEST_ERROR
+ if(name_count != corder_count) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ /* Re-open the file */
+ if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
+
+ /* Open group created */
+ if((group_id = H5Gopen2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+ if(H5G__has_stab_test(group_id) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Loop through links, checking their creation order values */
+ /* (the name index is used, but the creation order value is in the same order) */
+ for(u = 0; u < (max_compact + 1); u++) {
+ H5L_info1_t linfo; /* Link information */
+
+ /* Retrieve information for link */
+ HDsnprintf(objname, sizeof(objname), "filler %u", u);
+ if(H5Lget_info1(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify creation order of link */
+ if(linfo.corder_valid != TRUE) TEST_ERROR
+ if(linfo.corder != u) TEST_ERROR
+ } /* end for */
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(gcpl_id);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end corder_create_dense_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_info_by_idx_check_deprec
+ *
+ * Purpose: Support routine for link_info_by_idx, to verify the link
+ * info is correct for a link
+ *
+ * Note: This routine assumes that the links have been inserted in the
+ * group in alphabetical order.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_info_by_idx_check_deprec(hid_t group_id, const char *linkname, hsize_t n,
+ hbool_t hard_link, hbool_t use_index)
+{
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ H5L_info1_t linfo; /* Link info struct */
+
+ /* Make link value for increasing/native order queries */
+ HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n);
+
+ /* Verify the link information for first link, in increasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != 0) TEST_ERROR
+
+ /* Verify the link information for new link, in increasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != (int64_t)n) TEST_ERROR
+
+ /* Verify value for new soft link, in increasing creation order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the name for new link, in increasing creation order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+
+ /* Don't test "native" order if there is no creation order index, since
+ * there's not a good way to easily predict the link's order in the name
+ * index.
+ */
+ if(use_index) {
+ /* Verify the link information for first link, in native creation order (which is increasing) */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != 0) TEST_ERROR
+
+ /* Verify the link information for new link, in native creation order (which is increasing) */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != (int64_t)n) TEST_ERROR
+
+ /* Verify value for new soft link, in native creation order (which is increasing) */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the name for new link, in native creation order (which is increasing) */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the link information for first link, in decreasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != 0) TEST_ERROR
+
+ /* Verify the link information for new link, in decreasing creation order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != (int64_t)n) TEST_ERROR
+
+ /* Verify value for new soft link, in decreasing creation order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the name for new link, in decreasing creation order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+
+
+ /* Verify the link information for first link, in increasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != 0) TEST_ERROR
+
+ /* Verify the link information for new link, in increasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != (int64_t)n) TEST_ERROR
+
+ /* Verify value for new soft link, in increasing link name order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the name for new link, in increasing link name order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+
+ /* Don't test "native" order queries on link name order, since there's not
+ * a good way to easily predict the order of the links in the name index.
+ */
+
+ /* Verify the link information for first link, in decreasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != 0) TEST_ERROR
+
+ /* Verify the link information for new link, in decreasing link name order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.corder != (int64_t)n) TEST_ERROR
+
+ /* Verify value for new soft link, in decreasing link name order */
+ if(!hard_link) {
+ HDmemset(tmpval, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end if */
+
+ /* Verify the name for new link, in decreasing link name order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(linkname, tmpname)) TEST_ERROR
+
+ /* Success */
+ return(0);
+
+error:
+ /* Failure */
+ return(-1);
+} /* end link_info_by_idx_check_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_info_by_idx_deprec
+ *
+ * Purpose: Create a group with creation order indices and test querying
+ * info by index.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_info_by_idx_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ unsigned hard_link; /* Create hard or soft link? */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5L_info1_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ herr_t ret; /* Generic return value */
+
+ /* Loop over creating hard or soft links */
+ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ /* Loop over using index for creation order value */
+ for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ if(hard_link) {
+ if(use_index)
+ TESTING("querying info by index w/creation order index, using hard links and deprecated routines")
+ else
+ TESTING("querying info by index w/o creation order index, using hard links and deprecated routines")
+ } /* end if */
+ else {
+ if(use_index)
+ TESTING("querying info by index w/creation order index, using soft links and deprecated routines")
+ else
+ TESTING("querying info by index w/o creation order index, using soft links and deprecated routines")
+ } /* end else */
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Set creation order tracking & indexing on group */
+ if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+
+ /* Create group with creation order indexing & tracking on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Query the group creation properties */
+ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+
+ /* Check for query on empty group */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(name_len >= 0) TEST_ERROR
+
+ /* Create several links, up to limit of compact form */
+ for(u = 0; u < max_compact; u++) {
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Check for creating hard or soft link */
+ if(hard_link) {
+ hid_t group_id2; /* Group ID */
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Make value for link */
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
+
+ /* Create soft link */
+ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ } /* end else */
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Verify state of group */
+ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+
+ /* Check for out of bound offset queries */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(name_len >= 0) TEST_ERROR
+
+ /* Create more links, to push group into dense form */
+ for(; u < (max_compact * 2); u++) {
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Check for creating hard or soft link */
+ if(hard_link) {
+ hid_t group_id2; /* Group ID */
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Make value for link */
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
+
+ /* Create soft link */
+ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ } /* end else */
+
+ /* Verify state of group */
+ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, hard_link, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Check for out of bound offset queries */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(name_len >= 0) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
+ } /* end for */
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(gcpl_id);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end link_info_by_idx_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_info_by_idx_old_deprec
+ *
+ * Purpose: Create a old-format group and test querying
+ * info by index.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_info_by_idx_old_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ unsigned hard_link; /* Create hard or soft link? */
+ H5L_info1_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ herr_t ret; /* Generic return value */
+
+ /* Loop over creating hard or soft links */
+ for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
+ if(hard_link)
+ TESTING("querying info by index in old-style group, using hard links and deprecated routines")
+ else
+ TESTING("querying info by index in old-style group, using soft links and deprecated routines")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group to operate on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Create several links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Check for creating hard or soft link */
+ if(hard_link) {
+ H5O_info1_t oi; /* Buffer for querying object's info */
+
+ /* Create group */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Retrieve group's address on disk */
+ if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oi.addr;
+
+ /* Close group */
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Make value for link */
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
+
+ /* Create soft link */
+ if(H5Lcreate_soft(valname, group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ } /* end else */
+ } /* end for */
+
+ /* Verify link information for created links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 1); /* Decreasing mapped index */
+
+ /* Make link name for increasing/native order queries */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Make link value for increasing/native order queries */
+ HDsnprintf(valname, sizeof(valname), "value %02u", u);
+
+ /* Verify link information (in increasing order) */
+ if(hard_link) {
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end else */
+
+ /* Verify link name (in increasing order) */
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+
+
+ /* Verify link information (in native order - native is increasing) */
+ if(hard_link) {
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end else */
+
+ /* Verify link name (in native order - native is increasing) */
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+
+
+ /* Make link name for decreasing order queries */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
+
+ /* Make link value for decreasing order queries */
+ HDsnprintf(valname, sizeof(valname), "value %02u", dec_u);
+
+ /* Verify link information (in decreasing order) */
+ if(hard_link) {
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(valname, tmpval)) TEST_ERROR
+ } /* end else */
+
+ /* Verify link name (in decreasing order) */
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Check for creation order index queries */
+ H5E_BEGIN_TRY {
+ ret = H5Lget_info_by_idx1(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+ H5E_BEGIN_TRY {
+ name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(name_len >= 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end link_info_by_idx_old_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: delete_by_idx_deprec
+ *
+ * Purpose: Create a group with creation order indices and test deleting
+ * links by index.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+delete_by_idx_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ hid_t gcpl_id = -1; /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ H5L_info1_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ /* Loop over operating on different indices on link fields */
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ /* Loop over operating in different orders */
+ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ /* Loop over using index for creation order value */
+ for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ /* Print appropriate test message */
+ if(idx_type == H5_INDEX_CRT_ORDER) {
+ if(order == H5_ITER_INC) {
+ if(use_index)
+ TESTING("deleting links by creation order index in increasing order w/creation order index using deprecated routines")
+ else
+ TESTING("deleting links by creation order index in increasing order w/o creation order index using deprecated routines")
+ } /* end if */
+ else {
+ if(use_index)
+ TESTING("deleting links by creation order index in decreasing order w/creation order index using deprecated routines")
+ else
+ TESTING("deleting links by creation order index in decreasing order w/o creation order index using deprecated routines")
+ } /* end else */
+ } /* end if */
+ else {
+ if(order == H5_ITER_INC) {
+ if(use_index)
+ TESTING("deleting links by name index in increasing order w/creation order index using deprecated routines")
+ else
+ TESTING("deleting links by name index in increasing order w/o creation order index using deprecated routines")
+ } /* end if */
+ else {
+ if(use_index)
+ TESTING("deleting links by name index in decreasing order w/creation order index using deprecated routines")
+ else
+ TESTING("deleting links by name index in decreasing order w/o creation order index using deprecated routines")
+ } /* end else */
+ } /* end else */
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Set creation order tracking & indexing on group */
+ if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+
+ /* Create group with creation order tracking on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Query the group creation properties */
+ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+
+ /* Delete links from one end */
+
+ /* Check for deletion on empty group */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Check for deletion on non-existing group */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, "None", idx_type, order, (hsize_t)0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Create several links, up to limit of compact form */
+ for(u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Verify state of group (compact) */
+ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+
+ /* Check for out of bound deletion */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Delete links from compact group */
+ for(u = 0; u < (max_compact - 1); u++) {
+ /* Delete first link in appropriate order */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for first link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(linfo.corder != (u + 1)) TEST_ERROR
+ } /* end if */
+ else {
+ if(linfo.corder != (max_compact - (u + 2))) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for first link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (max_compact - (u + 2)));
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete last link */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify state of group (empty) */
+ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+
+ /* Create more links, to push group into dense form */
+ for(u = 0; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+
+ /* Verify state of group (dense) */
+ if(u >= max_compact)
+ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Check for out of bound deletion again */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Delete links from dense group, in appropriate order */
+ for(u = 0; u < ((max_compact * 2) - 1); u++) {
+ /* Delete first link in appropriate order */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for first link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(linfo.corder != (u + 1)) TEST_ERROR
+ } /* end if */
+ else {
+ if(linfo.corder != ((max_compact * 2) - (u + 2))) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for first link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - (u + 2)));
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete last link */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify state of group (empty) */
+ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+
+ /* Check for deletion on empty group again */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Delete links in middle */
+
+ /* Create more links, to push group into dense form */
+ for(u = 0; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+
+ /* Verify state of group (dense) */
+ if(u >= max_compact)
+ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Verify link information for new link */
+ if(link_info_by_idx_check_deprec(group_id, objname, (hsize_t)u, TRUE, use_index) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Delete every other link from dense group, in appropriate order */
+ for(u = 0; u < max_compact; u++) {
+ /* Delete link */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for current link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(linfo.corder != ((u * 2) + 1)) TEST_ERROR
+ } /* end if */
+ else {
+ if(linfo.corder != ((max_compact * 2) - ((u * 2) + 2))) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for current link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 2)));
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete remaining links from dense group, in appropriate order */
+ for(u = 0; u < (max_compact - 1); u++) {
+ /* Delete link */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for first link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(linfo.corder != ((u * 2) + 3)) TEST_ERROR
+ } /* end if */
+ else {
+ if(linfo.corder != ((max_compact * 2) - ((u * 2) + 4))) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for first link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", idx_type, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((max_compact * 2) - ((u * 2) + 4)));
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete last link */
+ if(H5Ldelete_by_idx(group_id, ".", idx_type, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify state of group (empty) */
+ if(H5G__has_links_test(group_id, NULL) == TRUE) TEST_ERROR
+ if(H5G__is_new_dense_test(group_id) == TRUE) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
+ } /* end for */
+ } /* end for */
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(gcpl_id);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end delete_by_idx_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: delete_by_idx_old_deprec
+ *
+ * Purpose: Create a old-format group and test deleting
+ * links by index.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+delete_by_idx_old_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ H5L_info1_t linfo; /* Link info struct */
+ H5_iter_order_t order; /* Order within in the index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ /* Loop over operating in different orders */
+ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
+ /* Print test banner */
+ if(order == H5_ITER_INC)
+ TESTING("deleting links by index in increasing order in old-style group using deprecated routines")
+ else
+ TESTING("deleting links by index in decreasing order in old-style group using deprecated routines")
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group to operate on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Delete links from one end */
+
+ /* Check for deletion in empty group */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Create several links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ H5O_info1_t oi; /* Buffer for querying object's info */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create group */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Retrieve group's address on disk */
+ if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oi.addr;
+
+ /* Close group */
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Check for bad index type deletion */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Check for out of bounds deletion */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Delete links, in appropriate order */
+ for(u = 0; u < (CORDER_NLINKS - 1); u++) {
+ unsigned dec_u = CORDER_NLINKS - (u + 2); /* Decreasing mapped index */
+
+ /* Delete first link in appropriate order */
+ if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for first link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for first link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (u + 1));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete last link */
+ if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check for deletion in empty group (again) */
+ H5E_BEGIN_TRY {
+ ret = H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+
+ /* Delete links in middle */
+
+ /* Create several links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ H5O_info1_t oi; /* Buffer for querying object's info */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create group */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Retrieve group's address on disk */
+ if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oi.addr;
+
+ /* Close group */
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Delete every other link from group, in appropriate order */
+ for(u = 0; u < (CORDER_NLINKS / 2); u++) {
+ unsigned dec_u = CORDER_NLINKS - ((u * 2) + 2); /* Decreasing mapped index */
+
+ /* Delete link */
+ if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for current link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for current link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 1));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete remaining links from group, in appropriate order */
+ for(u = 0; u < ((CORDER_NLINKS / 2) - 1); u++) {
+ unsigned dec_u = CORDER_NLINKS - ((u * 2) + 4); /* Decreasing mapped index */
+
+ /* Delete link */
+ if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify the link information for first link in appropriate order */
+ HDmemset(&linfo, 0, sizeof(linfo));
+ if(H5Lget_info_by_idx1(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR
+ } /* end if */
+ else {
+ if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ } /* end else */
+
+ /* Verify the name for first link in appropriate order */
+ HDmemset(tmpname, 0, (size_t)NAME_BUF_SIZE);
+ if(H5Lget_name_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(order == H5_ITER_INC)
+ HDsnprintf(objname, sizeof(objname), "filler %02u", ((u * 2) + 3));
+ else
+ HDsnprintf(objname, sizeof(objname), "filler %02u", dec_u);
+ if(HDstrcmp(objname, tmpname)) TEST_ERROR
+ } /* end for */
+
+ /* Delete last link */
+ if(H5Ldelete_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Verify state of group */
+ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
+
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+
+ return FAIL;
+} /* end delete_by_idx_old_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_deprec_cb
+ *
+ * Purpose: Callback routine for iterating over links in group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info,
+ void *_op_data)
+{
+ link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ H5L_info1_t my_info; /* Local link info */
+
+ /* Increment # of times the callback was called */
+ op_data->ncalled++;
+
+ /* Get the link information directly to compare */
+ if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ return H5_ITER_ERROR;
+
+ /* Check more things for link iteration (vs. group iteration) */
+ if(info) {
+ /* Check for correct order of iteration */
+ /* (if we are operating in increasing or decreasing order) */
+ if(op_data->order != H5_ITER_NATIVE)
+ if(info->corder != op_data->curr)
+ return H5_ITER_ERROR;
+
+ /* Compare link info structs */
+ if(info->type != my_info.type)
+ return H5_ITER_ERROR;
+ if(info->corder_valid != my_info.corder_valid)
+ return H5_ITER_ERROR;
+ if(info->corder != my_info.corder)
+ return H5_ITER_ERROR;
+ if(info->cset != my_info.cset)
+ return H5_ITER_ERROR;
+ if(H5F_addr_ne(info->u.address, my_info.u.address))
+ return H5_ITER_ERROR;
+ } /* end if */
+
+ /* Verify name of link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (unsigned)my_info.corder);
+ if(HDstrcmp(link_name, objname))
+ return H5_ITER_ERROR;
+
+ /* Check if we've visited this link before */
+ if((size_t)op_data->curr >= op_data->max_visit)
+ return H5_ITER_ERROR;
+ if(op_data->visited[op_data->curr])
+ return H5_ITER_ERROR;
+ op_data->visited[op_data->curr] = TRUE;
+
+ /* Advance to next value, in correct direction */
+ if(op_data->order != H5_ITER_DEC)
+ op_data->curr++;
+ else
+ op_data->curr--;
+
+ /* Check for stopping in the middle of iterating */
+ if(op_data->stop > 0)
+ if(--op_data->stop == 0)
+ return CORDER_ITER_STOP;
+
+ return H5_ITER_CONT;
+} /* end link_iterate_deprec_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: group_iterate_deprec_cb
+ *
+ * Purpose: Callback routine for iterating over links in group with
+ * H5Giterate()
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+group_iterate_deprec_cb(hid_t group_id, const char *link_name, void *_op_data)
+{
+ return link_iterate_deprec_cb(group_id, link_name, NULL, _op_data);
+} /* end group_iterate_deprec_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_fail_deprec_cb
+ *
+ * Purpose: Callback routine for iterating over links in group that
+ * always returns failure
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_fail_deprec_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name,
+ const H5L_info1_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+{
+ return H5_ITER_ERROR;
+} /* end link_iterate_fail_deprec_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_check_deprec
+ *
+ * Purpose: Check iteration over links in a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_check_deprec(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
+ unsigned max_links, link_iter_info_t *iter_info)
+{
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of links to skip in group */
+ int gskip; /* # of links to skip in group, with H5Giterate */
+ herr_t ret; /* Generic return value */
+
+ /* Iterate over links in group */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(skip != max_links) TEST_ERROR
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+
+ /* Iterate over links in group, with H5Giterate */
+ iter_info->nskipped = (unsigned)(gskip = 0);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(gskip != (int)max_links) TEST_ERROR
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+
+ /* Skip over some links in group */
+ iter_info->nskipped = (unsigned)(skip = max_links / 2);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(skip != max_links) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+ } /* end if */
+ else {
+ unsigned nvisit = 0; /* # of links visited */
+
+ HDassert(order == H5_ITER_NATIVE);
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == TRUE)
+ nvisit++;
+
+ if(nvisit != (max_links / 2)) TEST_ERROR
+ } /* end else */
+
+ /* Skip over some links in group, with H5Giterate */
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(gskip != (int)max_links) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+ } /* end if */
+ else {
+ unsigned nvisit = 0; /* # of links visited */
+
+ HDassert(order == H5_ITER_NATIVE);
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == TRUE)
+ nvisit++;
+
+ if(nvisit != (max_links / 2)) TEST_ERROR
+ } /* end else */
+
+ /* Iterate over links in group, stopping in the middle */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if((ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR
+ if(ret != CORDER_ITER_STOP) TEST_ERROR
+ if(iter_info->ncalled != 3) TEST_ERROR
+
+ /* Iterate over links in group, stopping in the middle, with H5Giterate() */
+ iter_info->nskipped = (unsigned)(gskip = 0);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_deprec_cb, iter_info)) < 0) TEST_ERROR
+ if(ret != CORDER_ITER_STOP) TEST_ERROR
+ if(iter_info->ncalled != 3) TEST_ERROR
+
+ /* Check for iteration routine indicating failure */
+ skip = 0;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_fail_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Success */
+ return SUCCEED;
+
+error:
+ return FAIL;
+} /* end link_iterate_check_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_deprec
+ *
+ * Purpose: Create a group with creation order indices and test iterating over
+ * links by index.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, November 14, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_deprec(hid_t fapl)
+{
+ hid_t file_id = (-1); /* File ID */
+ hid_t group_id = (-1); /* Group ID */
+ hid_t gcpl_id = (-1); /* Group creation property list ID */
+ H5_index_t idx_type; /* Type of index to operate on */
+ H5_iter_order_t order; /* Order within in the index */
+ unsigned use_index; /* Use index on creation order values */
+ unsigned max_compact; /* Maximum # of links to store in group compactly */
+ unsigned min_dense; /* Minimum # of links to store in group "densely" */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ link_iter_info_t iter_info; /* Iterator info */
+ hbool_t *visited = NULL; /* Array of flags for visiting links */
+ hsize_t skip; /* # of links to skip in group */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ /* Create group creation property list */
+ if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) TEST_ERROR
+
+ /* Query the group creation properties */
+ if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
+
+ /* Allocate the "visited link" array */
+ iter_info.max_visit = max_compact * 2;
+ if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR
+ iter_info.visited = visited;
+
+ /* Loop over operating on different indices on link fields */
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
+ /* Loop over operating in different orders */
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ /* Loop over using index for creation order value */
+ for(use_index = FALSE; use_index <= TRUE; use_index++) {
+ /* Print appropriate test message */
+ if(idx_type == H5_INDEX_CRT_ORDER) {
+ if(order == H5_ITER_INC) {
+ if(use_index)
+ TESTING("iterating over links by creation order index in increasing order w/creation order index using deprecated routines")
+ else
+ TESTING("iterating over links by creation order index in increasing order w/o creation order index using deprecated routines")
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ if(use_index)
+ TESTING("iterating over links by creation order index in decreasing order w/creation order index using deprecated routines")
+ else
+ TESTING("iterating over links by creation order index in decreasing order w/o creation order index using deprecated routines")
+ } /* end else */
+ else {
+ HDassert(order == H5_ITER_NATIVE);
+ if(use_index)
+ TESTING("iterating over links by creation order index in native order w/creation order index using deprecated routines")
+ else
+ TESTING("iterating over links by creation order index in native order w/o creation order index using deprecated routines")
+ } /* end else */
+ } /* end if */
+ else {
+ if(order == H5_ITER_INC) {
+ if(use_index)
+ TESTING("iterating over links by name index in increasing order w/creation order index using deprecated routines")
+ else
+ TESTING("iterating over links by name index in increasing order w/o creation order index using deprecated routines")
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ if(use_index)
+ TESTING("iterating over links by name index in decreasing order w/creation order index using deprecated routines")
+ else
+ TESTING("iterating over links by name index in decreasing order w/o creation order index using deprecated routines")
+ } /* end else */
+ else {
+ HDassert(order == H5_ITER_NATIVE);
+ if(use_index)
+ TESTING("iterating over links by name index in native order w/creation order index using deprecated routines")
+ else
+ TESTING("iterating over links by name index in native order w/o creation order index using deprecated routines")
+ } /* end else */
+ } /* end else */
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Set creation order tracking & indexing on group */
+ if(H5Pset_link_creation_order(gcpl_id, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0))) < 0) TEST_ERROR
+
+ /* Create group with creation order tracking on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, gcpl_id, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check for iteration on empty group */
+ /* (should be OK) */
+ if(H5Literate1(group_id, idx_type, order, NULL, link_iterate_deprec_cb, NULL) < 0) TEST_ERROR
+
+ /* Create several links, up to limit of compact form */
+ for(u = 0; u < max_compact; u++) {
+ hid_t group_id2; /* Group ID */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Verify state of group (compact) */
+ if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
+
+ /* Check for out of bound iteration on compact group */
+ skip = (hsize_t)u;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Test iteration over links in compact group */
+ if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
+
+ /* Create more links, to push group into dense form */
+ for(; u < (max_compact * 2); u++) {
+ hid_t group_id2; /* Group ID */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Verify state of group (dense) */
+ if(H5G__is_new_dense_test(group_id) != TRUE) TEST_ERROR
+
+ /* Check for out of bound iteration on dense group */
+ skip = (hsize_t)u;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1(group_id, idx_type, order, &skip, link_iterate_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Test iteration over links in dense group */
+ if(link_iterate_check_deprec(group_id, idx_type, order, u, &iter_info) < 0) TEST_ERROR
+
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
+ } /* end for */
+ } /* end for */
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl_id) < 0) TEST_ERROR
+
+ /* Free resources */
+ if(visited)
+ HDfree(visited);
+
+ return SUCCEED;
+
+error:
+ /* Free resources */
+ H5E_BEGIN_TRY {
+ H5Pclose(gcpl_id);
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+
+ if(visited)
+ HDfree(visited);
+
+ return FAIL;
+} /* end link_iterate_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_old_deprec_cb
+ *
+ * Purpose: Callback routine for iterating over [old] links in group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_old_deprec_cb(hid_t group_id, const char *link_name, const H5L_info1_t *info, void *_op_data)
+{
+ link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ H5L_info1_t my_info; /* Local link info */
+
+ /* Increment # of times the callback was called */
+ op_data->ncalled++;
+
+ /* Get the link information directly to compare */
+ if(H5Lget_info1(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ return H5_ITER_ERROR;
+
+ /* Check more things for link iteration (vs. group iteration) */
+ if(info) {
+ /* Compare link info structs */
+ if(info->type != my_info.type)
+ return H5_ITER_ERROR;
+ if(info->corder_valid != my_info.corder_valid)
+ return H5_ITER_ERROR;
+ if(info->corder != my_info.corder)
+ return H5_ITER_ERROR;
+ if(info->cset != my_info.cset)
+ return H5_ITER_ERROR;
+ if(H5F_addr_ne(info->u.address, my_info.u.address))
+ return H5_ITER_ERROR;
+ } /* end if */
+
+ /* Verify name of link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", (info ? (unsigned)op_data->curr : (unsigned)((op_data->ncalled - 1) + op_data->nskipped)));
+ if(HDstrcmp(link_name, objname))
+ return H5_ITER_ERROR;
+
+ /* Check if we've visited this link before */
+ if((size_t)op_data->curr >= op_data->max_visit)
+ return H5_ITER_ERROR;
+ if(op_data->visited[op_data->curr])
+ return H5_ITER_ERROR;
+ op_data->visited[op_data->curr] = TRUE;
+
+ /* Advance to next value, in correct direction */
+ if(op_data->order != H5_ITER_DEC)
+ op_data->curr++;
+ else
+ op_data->curr--;
+
+ /* Check for stopping in the middle of iterating */
+ if(op_data->stop > 0)
+ if(--op_data->stop == 0)
+ return CORDER_ITER_STOP;
+
+ return H5_ITER_CONT;
+} /* end link_iterate_old_deprec_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: group_iterate_old_deprec_cb
+ *
+ * Purpose: Callback routine for iterating over links in group with
+ * H5Giterate()
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+group_iterate_old_deprec_cb(hid_t group_id, const char *link_name, void *_op_data)
+{
+ return link_iterate_old_deprec_cb(group_id, link_name, NULL, _op_data);
+} /* end group_iterate_old_deprec_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_old_check_deprec
+ *
+ * Purpose: Check iteration over [old] links in a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_old_check_deprec(hid_t group_id, H5_iter_order_t order, unsigned max_links, link_iter_info_t *iter_info)
+{
+ unsigned v; /* Local index variable */
+ hsize_t skip; /* # of links to skip in group */
+ int gskip; /* # of links to skip in group, with H5Giterate */
+ herr_t ret; /* Generic return value */
+
+ /* Iterate over links in group */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(skip != max_links) TEST_ERROR
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+
+ /* Iterate over links in group, with H5Giterate */
+ iter_info->nskipped = (unsigned)(gskip = 0);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(gskip != (int)max_links) TEST_ERROR
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+
+ /* Skip over some links in group */
+ iter_info->nskipped = (unsigned)(skip = max_links / 2);
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(skip != max_links) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+ } /* end if */
+ else {
+ unsigned nvisit = 0; /* # of links visited */
+
+ HDassert(order == H5_ITER_NATIVE);
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == TRUE)
+ nvisit++;
+
+ if(nvisit != (max_links / 2)) TEST_ERROR
+ } /* end else */
+
+ /* Skip over some links in group, with H5Giterate */
+ iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2));
+ iter_info->order = order;
+ iter_info->stop = -1;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if(H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info) < 0) TEST_ERROR
+
+ /* Verify that we visited all the links */
+ if(gskip != (int)max_links) TEST_ERROR
+ if(order == H5_ITER_INC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v + (max_links / 2)] == FALSE) TEST_ERROR
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ for(v = 0; v < (max_links / 2); v++)
+ if(iter_info->visited[v] == FALSE) TEST_ERROR
+ } /* end if */
+ else {
+ unsigned nvisit = 0; /* # of links visited */
+
+ HDassert(order == H5_ITER_NATIVE);
+ for(v = 0; v < max_links; v++)
+ if(iter_info->visited[v] == TRUE)
+ nvisit++;
+
+ if(nvisit != (max_links / 2)) TEST_ERROR
+ } /* end else */
+
+ /* Iterate over links in group, stopping in the middle */
+ iter_info->nskipped = (unsigned)(skip = 0);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if((ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR
+ if(ret != CORDER_ITER_STOP) TEST_ERROR
+ if(iter_info->ncalled != 3) TEST_ERROR
+
+ /* Iterate over links in group, stopping in the middle, with H5Giterate() */
+ iter_info->nskipped = (unsigned)(gskip = 0);
+ iter_info->order = order;
+ iter_info->stop = 3;
+ iter_info->ncalled = 0;
+ iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
+ HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
+ if((ret = H5Giterate(group_id, ".", &gskip, group_iterate_old_deprec_cb, iter_info)) < 0) TEST_ERROR
+ if(ret != CORDER_ITER_STOP) TEST_ERROR
+ if(iter_info->ncalled != 3) TEST_ERROR
+
+ /* Check for iteration routine indicating failure */
+ skip = 0;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Check for iteration w/bad location ID */
+ skip = 0;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ ret = H5Giterate((hid_t)(-1), ".", &gskip, group_iterate_old_deprec_cb, iter_info);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Success */
+ return SUCCEED;
+
+error:
+ return FAIL;
+} /* end link_iterate_old_check_deprec() */
+
+/*-------------------------------------------------------------------------
+ * Function: link_iterate_old_deprec
+ *
+ * Purpose: Create a "old-style" group and test iterating over links by index.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+link_iterate_old_deprec(hid_t fapl)
+{
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1; /* Group ID */
+ H5_iter_order_t order; /* Order within in the index */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ link_iter_info_t iter_info; /* Iterator info */
+ hbool_t *visited = NULL; /* Array of flags for visiting links */
+ hsize_t skip; /* # of links to skip in group */
+ unsigned u; /* Local index variable */
+ herr_t ret; /* Generic return value */
+
+ /* Allocate the "visited link" array */
+ iter_info.max_visit = CORDER_NLINKS;
+ if(NULL == (visited = (hbool_t *)HDmalloc(sizeof(hbool_t) * iter_info.max_visit))) TEST_ERROR
+ iter_info.visited = visited;
+
+ /* Loop over operating in different orders */
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
+ /* Print appropriate test message */
+ if(order == H5_ITER_INC) {
+ TESTING("iterating over links by name index in increasing order in old-style group using deprecated routines")
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ TESTING("iterating over links by name index in decreasing order in old-style group using deprecated routines")
+ } /* end else */
+ else {
+ HDassert(order == H5_ITER_NATIVE);
+ TESTING("iterating over links by name index in native order in old-style group using deprecated routines")
+ } /* end else */
+
+ /* Create file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+
+ /* Create group with creation order tracking on */
+ if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check for iteration on empty group */
+ /* (should be OK) */
+ if(H5Literate1(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_deprec_cb, NULL) < 0) TEST_ERROR
+
+ /* Create several links */
+ for(u = 0; u < CORDER_NLINKS; u++) {
+ hid_t group_id2; /* Group ID */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Create hard link, with group object */
+ if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group_id2) < 0) TEST_ERROR
+ } /* end for */
+
+ /* Verify state of group (symbol table) */
+ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR
+
+ /* Check for out of bound iteration on old-style group */
+ skip = (hsize_t)u;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Check for iteration on creation order */
+ /* (should fail) */
+ skip = (hsize_t)0;
+ H5E_BEGIN_TRY {
+ ret = H5Literate1(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_deprec_cb, NULL);
+ } H5E_END_TRY;
+ if(ret >= 0) TEST_ERROR
+
+ /* Test iteration over links in group */
+ if(link_iterate_old_check_deprec(group_id, order, u, &iter_info) < 0) TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(group_id) < 0) TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED();
+ } /* end for */
+
+ /* Free resources */
+ if(visited)
+ HDfree(visited);
+
+ return SUCCEED;
+
+error:
+ /* Free resources */
+ H5E_BEGIN_TRY {
+ H5Gclose(group_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+
+ if(visited)
+ HDfree(visited);
+
+ return FAIL;
+} /* end link_iterate_old_deprec() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -1642,7 +5666,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
{
hid_t fid = -1; /* File ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info_t linfo; /* Link information */
+ H5L_info2_t linfo; /* Link information */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename1[NAME_BUF_SIZE];
char filename2[NAME_BUF_SIZE];
@@ -1674,7 +5698,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
if(H5Lcreate_external(filename1, "/", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Check information for external link */
- if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
+ if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
if(H5L_TYPE_EXTERNAL != linfo.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been an external link");
@@ -1698,7 +5722,7 @@ external_link_root(hid_t fapl, hbool_t new_format)
if(H5Lcreate_external(filename1, "///", fid, "ext_link2", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Check information for external link */
- if(H5Lget_info(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
+ if(H5Lget_info2(fid, "ext_link", &linfo, H5P_DEFAULT) < 0) goto error;
if(H5L_TYPE_EXTERNAL != linfo.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been an external link");
@@ -3310,7 +7334,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format)
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_map[mt] = H5FD_MEM_SUPER;
memb_fapl[mt] = H5P_DEFAULT;
} /* end for */
@@ -3456,33 +7480,58 @@ error:
static int
external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
{
- hid_t fid = (-1); /* File ID */
- hid_t gid = (-1); /* Group IDs */
- hid_t core_fapl = -1, space = -1, dset = -1, did = -1, dapl_id = -1, dcpl = -1;
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
- hsize_t dims[2];
- int points[NUM40][NUM40];
- int i, j, n;
- h5_stat_size_t filesize, new_filesize;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t core_fapl = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t dapl_id = H5I_INVALID_HID;
+ hid_t dcpl = H5I_INVALID_HID;
+ char *filename1 = NULL;
+ char *filename2 = NULL;
+ char *tmpname = NULL;
+ char *cwdpath = NULL;
+ hsize_t dims[2];
+ int **points = NULL;
+ int *points_data = NULL;
+ int i, j, n;
+ h5_stat_size_t filesize;
+ h5_stat_size_t new_filesize;
if(new_format)
TESTING("H5Pset/get_elink_fapl() with same physical layout (w/new group format)")
else
TESTING("H5Pset/get_elink_fapl() with same physical layout")
+ /* Set up file names and paths */
+ if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename2 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+
if((HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST) || (NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE)))
TEST_ERROR
+ /* Set up data array */
+ if(NULL == (points_data = (int *)HDcalloc(NUM40 * NUM40, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (points = (int **)HDcalloc(NUM40, sizeof(points_data))))
+ TEST_ERROR;
+ for (i = 0; i < NUM40; i++)
+ points[i] = points_data + (i * NUM40);
+
/*
* set up name for main file:
* Linux: "/CWD/tmp_links/extlinks0"
* Windows: "<cur drive>:/CWD/tmp_links/extlinks0"
*/
fix_ext_filename(tmpname, cwdpath, FILENAME[13]);
- h5_fixname(tmpname, fapl, filename1, sizeof filename1);
+ h5_fixname(tmpname, fapl, filename1, NAME_BUF_SIZE);
/* create fapl for the target file to be a "core" file */
core_fapl = h5_fileaccess();
@@ -3490,7 +7539,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
/* set up name for external linked target file: "extlinks17" */
/* set up name for target file: "extlinks17" */
- h5_fixname(FILENAME[39], core_fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[39], core_fapl, filename2, NAME_BUF_SIZE);
/* Create the target file to be a "core" file */
if((fid = H5Fcreate(filename2, H5F_ACC_TRUNC, H5P_DEFAULT, core_fapl)) < 0) TEST_ERROR
@@ -3505,7 +7554,8 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
dcpl = H5Pcreate(H5P_DATASET_CREATE);
else
dcpl = H5Pcopy(dcpl_g);
- if (0 > dcpl) TEST_ERROR;
+ if (0 > dcpl)
+ TEST_ERROR;
if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR;
/* create "Dataset" in group "A" of target file */
@@ -3548,7 +7598,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
points[i][j] = n++;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, points_data) < 0) TEST_ERROR
if(H5Pclose(dapl_id) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -3561,6 +7611,14 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if(H5Pclose(core_fapl) < 0) TEST_ERROR
+ HDfree(points);
+ HDfree(points_data);
+
+ HDfree(filename1);
+ HDfree(filename2);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
PASSED();
return SUCCEED;
@@ -3575,6 +7633,15 @@ error:
H5Gclose(gid);
H5Fclose(fid);
} H5E_END_TRY;
+
+ HDfree(points);
+ HDfree(points_data);
+
+ HDfree(filename1);
+ HDfree(filename2);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
return FAIL;
} /* end external_set_elink_fapl2() */
@@ -4970,15 +9037,15 @@ error:
static int
external_link_query(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- const char *file_name; /* Name of the file the external link points to */
- const char *object_name; /* Name of the object the external link points to */
- H5O_info_t oi; /* Object information */
- H5L_info_t li; /* Link information */
- char filename1[NAME_BUF_SIZE],
- filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
- query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ const char *file_name; /* Name of the file the external link points to */
+ const char *object_name; /* Name of the object the external link points to */
+ H5O_info2_t oi; /* Object information */
+ H5L_info2_t li; /* Link information */
+ char filename1[NAME_BUF_SIZE],
+ filename2[NAME_BUF_SIZE], /* Names of files to externally link across */
+ query_buf[NAME_BUF_SIZE]; /* Buffer to hold query result */
if(new_format)
TESTING("query aspects of external link (w/new group format)")
@@ -4997,7 +9064,7 @@ external_link_query(hid_t fapl, hbool_t new_format)
if(H5Lcreate_external(filename2, "///dst//", fid, "src", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Get size of buffer for external link */
- if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
if (H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
@@ -5022,7 +9089,7 @@ external_link_query(hid_t fapl, hbool_t new_format)
if((fid = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Get size of buffer for external link */
- if(H5Lget_info(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "src", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != (1 + (HDstrlen(filename2) + 1) + (HDstrlen("/dst") + 1))) TEST_ERROR
if(H5L_TYPE_EXTERNAL != li.type) {
H5_FAILED();
@@ -5041,7 +9108,7 @@ external_link_query(hid_t fapl, hbool_t new_format)
if(HDstrcmp(object_name, "/dst")) TEST_ERROR
/* Query information about object that external link points to */
- if(H5Oget_info_by_name2(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(fid, "src", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_GROUP != oi.type) {
H5_FAILED();
HDputs(" Unexpected object type - should have been a group");
@@ -5686,8 +9753,8 @@ external_link_closing(hid_t fapl, hbool_t new_format)
filename3[NAME_BUF_SIZE],
filename4[NAME_BUF_SIZE], /* Names of files to externally link across */
buf[NAME_BUF_SIZE]; /* misc. buffer */
- H5L_info_t li;
- H5O_info_t oi;
+ H5L_info2_t li;
+ H5O_info2_t oi;
hobj_ref_t obj_ref;
if(new_format)
@@ -5743,10 +9810,10 @@ external_link_closing(hid_t fapl, hbool_t new_format)
if(H5Dclose(did) < 0) TEST_ERROR
/* Test that getting info works */
- if(H5Lget_info(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid1, "elink/elink/elink/type1", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid1, "elink/elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(fid1, "elink/elink/elink/type1", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(fid1, "elink/elink/elink", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
/* Test move */
if(H5Lmove(fid1, "elink/elink/elink/group1", fid1,
@@ -5833,7 +9900,7 @@ external_link_closing(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
if((gid = H5Gcreate2(fid1, "elink/elink2/group2/group3/group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(fid1, "elink/elink2/group2/group3/group4", &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
/* Add a few regular groups and a soft link in file2 using intermediate group creation */
if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
@@ -5847,13 +9914,13 @@ external_link_closing(hid_t fapl, hbool_t new_format)
*/
if((gid = H5Gcreate2(fid1, "elink/file2group1/file2group2/slink/group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid1, "elink/file2group1/file2group2/slink/group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
/* Some simpler tests */
if((gid = H5Gcreate2(fid1, "elink/file2group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid1, "elink/file2group3", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid1, "elink/elink", &li, H5P_DEFAULT) < 0) TEST_ERROR
/* Close file1, the only file that should still be open */
@@ -6059,19 +10126,26 @@ static int
external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
{
#ifdef H5_HAVE_SYMLINK
- hid_t file1 = -1, file2 = -1, file3 = -1, file4 = -1, file5 = -1;
- hid_t group2 = -1, group3 = -1, group4 = -1, group5 = -1;
- char filename1[NAME_BUF_SIZE],
- filename2a[NAME_BUF_SIZE],
- filename2b[NAME_BUF_SIZE],
- filename3a[NAME_BUF_SIZE],
- filename3b[NAME_BUF_SIZE],
- filename4a[NAME_BUF_SIZE],
- filename4b[NAME_BUF_SIZE],
- filename5a[NAME_BUF_SIZE],
- filename5b[NAME_BUF_SIZE],
- tmpname[NAME_BUF_SIZE],
- cwdpath[NAME_BUF_SIZE];
+ hid_t file1 = H5I_INVALID_HID;
+ hid_t file2 = H5I_INVALID_HID;
+ hid_t file3 = H5I_INVALID_HID;
+ hid_t file4 = H5I_INVALID_HID;
+ hid_t file5 = H5I_INVALID_HID;
+ hid_t group2 = H5I_INVALID_HID;
+ hid_t group3 = H5I_INVALID_HID;
+ hid_t group4 = H5I_INVALID_HID;
+ hid_t group5 = H5I_INVALID_HID;
+ char *filename1 = NULL;
+ char *filename2a = NULL;
+ char *filename2b = NULL;
+ char *filename3a = NULL;
+ char *filename3b = NULL;
+ char *filename4a = NULL;
+ char *filename4b = NULL;
+ char *filename5a = NULL;
+ char *filename5b = NULL;
+ char *tmpname = NULL;
+ char *cwdpath = NULL;
hbool_t have_posix_compat_vfd; /* Whether VFD used is compatible w/POSIX I/O calls */
#endif /* H5_HAVE_SYMLINK */
@@ -6087,144 +10161,179 @@ external_symlink(const char *env_h5_drvr, hid_t fapl, hbool_t new_format)
have_posix_compat_vfd = (hbool_t)(!HDstrcmp(env_h5_drvr, "sec2")
|| !HDstrcmp(env_h5_drvr, "core")
|| !HDstrcmp(env_h5_drvr, "nomatch"));
- if(have_posix_compat_vfd) {
- /* set up name for main file: "extlinks21A" */
- h5_fixname(FILENAME[45], fapl, filename1, sizeof(filename1));
+ if(!have_posix_compat_vfd) {
+ SKIPPED();
+ HDputs(" Current VFD doesn't support POSIX I/O calls");
+ return SUCCEED;
+ }
- /* create tmp_links directory and get current working directory path */
- if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
- if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
- TEST_ERROR
- if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
- TEST_ERROR
+ if(NULL == (filename1 = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename2a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename2b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename3a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename3b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename4a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename4b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename5a = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (filename5b = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (tmpname = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+ if(NULL == (cwdpath = (char *)HDcalloc(NAME_BUF_SIZE, sizeof(char))))
+ TEST_ERROR;
+
+ /* set up name for main file: "extlinks21A" */
+ h5_fixname(FILENAME[45], fapl, filename1, NAME_BUF_SIZE);
- /* Set up names for files in the subdirectories */
+ /* create tmp_links directory and get current working directory path */
+ if(HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+ if(HDmkdir(TMPDIR2, (mode_t)0755) < 0 && errno != EEXIST)
+ TEST_ERROR
+ if(NULL == HDgetcwd(cwdpath, (size_t)NAME_BUF_SIZE))
+ TEST_ERROR
- /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */
- h5_fixname(FILENAME[46], fapl, filename2a, sizeof(filename2a));
- fix_ext_filename(tmpname, cwdpath, FILENAME[46]);
- h5_fixname(tmpname, fapl, filename2b, sizeof(filename2b));
+ /* Set up names for files in the subdirectories */
- /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
- /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
- if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
+ /* set up names for file #2 in temporary directory #2: "tmp2_links/extlinks21B" */
+ h5_fixname(FILENAME[46], fapl, filename2a, NAME_BUF_SIZE);
+ fix_ext_filename(tmpname, cwdpath, FILENAME[46]);
+ h5_fixname(tmpname, fapl, filename2b, NAME_BUF_SIZE);
- /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
- h5_fixname(FILENAME[47], fapl, filename3a, sizeof(filename3a));
- h5_fixname(FILENAME[48], fapl, filename3b, sizeof(filename3b));
+ /* Create symbolic link #1 in temporary directory #1 to file #2 in temporary directory #2 */
+ /* (i.e. tmp_links/sym1.h5 -> <full path to>/tmp2_links/extlinks21B.h5) */
+ if(HDsymlink(filename2b, SYMLINK1) < 0 && errno != EEXIST) TEST_ERROR
- /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */
- h5_fixname(FILENAME[49], fapl, filename4a, sizeof(filename4a));
- fix_ext_filename(tmpname, cwdpath, FILENAME[49]);
- h5_fixname(tmpname, fapl, filename4b, sizeof(filename4b));
+ /* set up name for file #3 in temporary directory #2: "tmp2_links/extlinks21C" */
+ h5_fixname(FILENAME[47], fapl, filename3a, NAME_BUF_SIZE);
+ h5_fixname(FILENAME[48], fapl, filename3b, NAME_BUF_SIZE);
- /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
- /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
- if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
+ /* set up name for file #4 in temporary directory #1: "tmp_links/extlinks21D" */
+ h5_fixname(FILENAME[49], fapl, filename4a, NAME_BUF_SIZE);
+ fix_ext_filename(tmpname, cwdpath, FILENAME[49]);
+ h5_fixname(tmpname, fapl, filename4b, NAME_BUF_SIZE);
- /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
- h5_fixname(FILENAME[50], fapl, filename5a, sizeof(filename5a));
- h5_fixname(FILENAME[51], fapl, filename5b, sizeof(filename5b));
+ /* Create symbolic link #2 in temporary directory #2 to file #4 in temporary directory #1 */
+ /* (i.e. tmp2_links/sym2.h5 -> <full path to>/tmp_links/extlinks21D.h5) */
+ if(HDsymlink(filename4b, SYMLINK2) < 0 && errno != EEXIST) TEST_ERROR
- /* Create file #1 in current directory */
- if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* set up name for file #5 in temporary directory #1: "tmp_links/extlinks21E" */
+ h5_fixname(FILENAME[50], fapl, filename5a, NAME_BUF_SIZE);
+ h5_fixname(FILENAME[51], fapl, filename5b, NAME_BUF_SIZE);
- /* Create external link to file & object in temporary directory #2, using symlink #1 name */
- if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create file #1 in current directory */
+ if((file1 = H5Fcreate(filename1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Close file #1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ /* Create external link to file & object in temporary directory #2, using symlink #1 name */
+ if(H5Lcreate_external(SYMLINK1, "group2", file1, "extlink2-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Create file #2 in tmp_links directory #2 */
- if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- if(H5Fclose(file2) < 0) TEST_ERROR
+ /* Close file #1 */
+ if(H5Fclose(file1) < 0) TEST_ERROR
- /* Re-open file #2 in tmp_links directory through symlink */
- if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Create file #2 in tmp_links directory #2 */
+ if((file2 = H5Fcreate(filename2a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ if(H5Fclose(file2) < 0) TEST_ERROR
- /* Create group in file #2 in temporary directory */
- if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Re-open file #2 in tmp_links directory through symlink */
+ if((file2 = H5Fopen(SYMLINK1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- /* Create external link to file #3 & object in temporary directory #2 */
- if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create group in file #2 in temporary directory */
+ if((group2 = H5Gcreate2(file2, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close group in file #2 */
- if(H5Gclose(group2) < 0) TEST_ERROR
+ /* Create external link to file #3 & object in temporary directory #2 */
+ if(H5Lcreate_external(filename3b, "group3", group2, "extlink3", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file #2 */
- if(H5Fclose(file2) < 0) TEST_ERROR
+ /* Close group in file #2 */
+ if(H5Gclose(group2) < 0) TEST_ERROR
- /* Create file #3 in temp. directory #2 */
- if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Close file #2 */
+ if(H5Fclose(file2) < 0) TEST_ERROR
- /* Create group in file #3 */
- if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create file #3 in temp. directory #2 */
+ if((file3 = H5Fcreate(filename3a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create external link to file & object in temporary directory #1, using symlink #2 name */
- if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create group in file #3 */
+ if((group3 = H5Gcreate2(file3, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close group in file #3 */
- if(H5Gclose(group3) < 0) TEST_ERROR
+ /* Create external link to file & object in temporary directory #1, using symlink #2 name */
+ if(H5Lcreate_external(SYMLINK2, "group4", group3, "extlink4-sym", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file #3 */
- if(H5Fclose(file3) < 0) TEST_ERROR
+ /* Close group in file #3 */
+ if(H5Gclose(group3) < 0) TEST_ERROR
- /* Create file #4 in temporary directory #1 */
- if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Close file #3 */
+ if(H5Fclose(file3) < 0) TEST_ERROR
- /* Create group in file #4 in 'temporary' directory */
- if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ /* Create file #4 in temporary directory #1 */
+ if((file4 = H5Fcreate(filename4b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Create external link to file #5 & object in temporary directory #1 */
- if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Create group in file #4 in 'temporary' directory */
+ if((group4 = H5Gcreate2(file4, "group4", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Close group in file #4 */
- if(H5Gclose(group4) < 0) TEST_ERROR
+ /* Create external link to file #5 & object in temporary directory #1 */
+ if(H5Lcreate_external(filename5b, "group5", group4, "extlink5", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- /* Close file #4 */
- if(H5Fclose(file4) < 0) TEST_ERROR
+ /* Close group in file #4 */
+ if(H5Gclose(group4) < 0) TEST_ERROR
- /* Create file #5 in temporary directory #1 */
- if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Close file #4 */
+ if(H5Fclose(file4) < 0) TEST_ERROR
- /* Create group in file #5 in 'temporary' directory #1 */
- if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Gclose(group5) < 0) TEST_ERROR
+ /* Create file #5 in temporary directory #1 */
+ if((file5 = H5Fcreate(filename5a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
- /* Close file #5 */
- if(H5Fclose(file5) < 0) TEST_ERROR
+ /* Create group in file #5 in 'temporary' directory #1 */
+ if((group5 = H5Gcreate2(file5, "group5", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Gclose(group5) < 0) TEST_ERROR
- /* Actual tests... */
+ /* Close file #5 */
+ if(H5Fclose(file5) < 0) TEST_ERROR
- /* Reopen file #1 */
- if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
+ /* Actual tests... */
- /* Open group in file #2, through external link w/symlink */
- if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group2) < 0) TEST_ERROR
+ /* Reopen file #1 */
+ if((file1 = H5Fopen(filename1, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
- /* Open group in file #3, through external link w/symlink to external link */
- if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group3) < 0) TEST_ERROR
+ /* Open group in file #2, through external link w/symlink */
+ if((group2 = H5Gopen2(file1, "extlink2-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group2) < 0) TEST_ERROR
- /* Open group in file #4, through external link w/symlink to external link w/symlink */
- if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group4) < 0) TEST_ERROR
+ /* Open group in file #3, through external link w/symlink to external link */
+ if((group3 = H5Gopen2(file1, "extlink2-sym/extlink3", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group3) < 0) TEST_ERROR
- /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */
- if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Gclose(group5) < 0) TEST_ERROR
+ /* Open group in file #4, through external link w/symlink to external link w/symlink */
+ if((group4 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group4) < 0) TEST_ERROR
- /* Close file #1 */
- if(H5Fclose(file1) < 0) TEST_ERROR
+ /* Open group in file #5, through external link w/symlink to external link w/symlink to external link */
+ if((group5 = H5Gopen2(file1, "extlink2-sym/extlink3/extlink4-sym/extlink5", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(group5) < 0) TEST_ERROR
- PASSED();
- } /* end if */
- else {
- SKIPPED();
- HDputs(" Current VFD doesn't support POSIX I/O calls");
- } /* end else */
+ /* Close file #1 */
+ if(H5Fclose(file1) < 0) TEST_ERROR
+
+ HDfree(filename1);
+ HDfree(filename2a);
+ HDfree(filename2b);
+ HDfree(filename3a);
+ HDfree(filename3b);
+ HDfree(filename4a);
+ HDfree(filename4b);
+ HDfree(filename5a);
+ HDfree(filename5b);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
+ PASSED();
return SUCCEED;
@@ -6240,7 +10349,21 @@ error:
H5Fclose(file2);
H5Fclose(file1);
} H5E_END_TRY;
+
+ HDfree(filename1);
+ HDfree(filename2a);
+ HDfree(filename2b);
+ HDfree(filename3a);
+ HDfree(filename3b);
+ HDfree(filename4a);
+ HDfree(filename4b);
+ HDfree(filename5a);
+ HDfree(filename5b);
+ HDfree(tmpname);
+ HDfree(cwdpath);
+
return FAIL;
+
#else /* H5_HAVE_SYMLINK */
SKIPPED();
HDputs(" Current file system or operating system doesn't support symbolic links");
@@ -7069,19 +11192,19 @@ static herr_t
UD_hard_create(const char H5_ATTR_UNUSED * link_name, hid_t loc_group, const void *udata,
size_t udata_size, hid_t H5_ATTR_UNUSED lcpl_id)
{
- haddr_t addr;
+ H5O_token_t token;
hid_t target_obj = -1;
herr_t ret_value = 0;
- if(udata_size != sizeof(haddr_t)) {
+ if(udata_size != sizeof(H5O_token_t)) {
ret_value = -1;
goto done;
} /* end if */
- addr = *((const haddr_t *)udata);
+ token = *(const H5O_token_t *)udata;
/* Open the object this link points to */
- target_obj= H5Oopen_by_addr(loc_group, addr);
+ target_obj = H5Oopen_by_token(loc_group, token);
if(target_obj < 0) {
ret_value = -1;
goto done;
@@ -7143,15 +11266,16 @@ UD_hard_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group,
const void *udata, size_t udata_size, hid_t H5_ATTR_UNUSED lapl_id,
hid_t H5_ATTR_UNUSED dxpl_id)
{
- haddr_t addr;
+ H5O_token_t token;
hid_t ret_value = -1;
- if(udata_size != sizeof(haddr_t))
+ if(udata_size != sizeof(H5O_token_t))
return FAIL;
- addr = *((const haddr_t *) udata);
+ token = *(const H5O_token_t *)udata;
- ret_value = H5Oopen_by_addr(cur_group, addr); /* If this fails, our return value will be negative. */
+ /* If this fails, our return value will be negative. */
+ ret_value = H5Oopen_by_token(cur_group, token);
return ret_value;
} /* end UD_hard_traverse() */
@@ -7161,19 +11285,19 @@ static herr_t
UD_hard_delete(const char H5_ATTR_UNUSED * link_name, hid_t file, const void *udata,
size_t udata_size)
{
- haddr_t addr;
+ H5O_token_t token;
hid_t target_obj = -1;
herr_t ret_value = 0;
- if(udata_size != sizeof(haddr_t)) {
+ if(udata_size != sizeof(H5O_token_t)) {
ret_value = -1;
goto done;
} /* end if */
- addr = *((const haddr_t *) udata);
+ token = *(const H5O_token_t *)udata;
/* Open the object this link points to */
- target_obj= H5Oopen_by_addr(file, addr);
+ target_obj = H5Oopen_by_token(file, token);
if(target_obj < 0) {
ret_value = -1;
goto done;
@@ -7229,24 +11353,12 @@ done:
return ret_value;
} /* end UD_hard_delete() */
-const H5L_class_t UD_hard_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
- "UD_hard_link", /* Link class name for debugging */
- UD_hard_create, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_hard_traverse, /* The actual traversal function */
- UD_hard_delete, /* Deletion callback */
- NULL /* Query callback */
-}};
-
static int
ud_hard_links(hid_t fapl)
{
hid_t fid = -1; /* File ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info_t li; /* Link information */
+ H5L_info2_t li; /* Link information */
char objname[NAME_BUF_SIZE]; /* Object name */
h5_stat_size_t empty_size; /* Size of an empty file */
char filename[NAME_BUF_SIZE];
@@ -7279,13 +11391,13 @@ ud_hard_links(hid_t fapl)
if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Get address for the group to give to the hard link */
- if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
/* Create a user-defined "hard link" to the group using the address we got
- * from H5Lget_info */
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address), (size_t)sizeof(haddr_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ * from H5Lget_info2 */
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token), sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
/* Close and re-open file to ensure that data is written to disk */
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -7316,7 +11428,7 @@ ud_hard_links(hid_t fapl)
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Check that H5Lget_objinfo works on the hard link */
- if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* UD hard links have no query function, thus return a "link length" of 0 */
if(li.u.val_size != 0) TEST_ERROR
if(UD_HARD_TYPE != li.type) {
@@ -7371,7 +11483,7 @@ error:
* Failure: -1
*-------------------------------------------------------------------------
*/
- /* A traversal function that ignores any udata and simply opens an object
+/* A traversal function that ignores any udata and simply opens an object
* in the current group named REREG_TARGET_NAME
*/
static hid_t
@@ -7389,26 +11501,12 @@ error:
return FAIL;
} /* end UD_rereg_traverse() */
-/* This link class has the same ID number as the UD hard links but
- * has a very different traversal function */
-const H5L_class_t UD_rereg_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_HARD_TYPE, /* Link type id number */
- "UD_reregistered_type", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_rereg_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
-}};
-
static int
ud_link_reregister(hid_t fapl)
{
hid_t fid = -1; /* File ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5L_info_t li; /* Link information */
+ H5L_info2_t li; /* Link information */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];
h5_stat_size_t empty_size; /* Size of an empty file */
@@ -7437,11 +11535,11 @@ ud_link_reregister(hid_t fapl)
/* Point a UD defined hard link to a group in the same way as the previous test */
if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if (H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Gclose(gid) < 0) TEST_ERROR
- if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
- sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) < 0)
+ if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_HARD_TYPE, &(li.u.token),
+ sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR
/* Create a group named REREG_TARGET_NAME in the same group as the ud link */
@@ -7461,8 +11559,8 @@ ud_link_reregister(hid_t fapl)
/* Verify that we can't create any new links of this type */
H5E_BEGIN_TRY {
- if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.address),
- sizeof(li.u.address), H5P_DEFAULT, H5P_DEFAULT) >= 0)
+ if(H5Lcreate_ud(fid, "ud_link2", (H5L_type_t)UD_HARD_TYPE, &(li.u.token),
+ sizeof(H5O_token_t), H5P_DEFAULT, H5P_DEFAULT) >= 0)
TEST_ERROR
} H5E_END_TRY
@@ -7544,7 +11642,7 @@ error:
/*-------------------------------------------------------------------------
- * Function: ud_callbacks
+ * Function: UD_cb_create
*
* Purpose: Check that all callbacks are called and are given the correct
* information.
@@ -7660,25 +11758,13 @@ error:
return FAIL;
} /* end UD_cb_query() */
-const H5L_class_t UD_cb_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_CB_TYPE, /* Link type id number */
- NULL, /* NULL name (to make sure this doesn't break anything */
- UD_cb_create, /* Creation callback */
- UD_cb_move, /* Move/rename callback */
- UD_cb_move, /* Copy callback */
- UD_cb_traverse, /* The actual traversal function */
- UD_cb_delete, /* Deletion callback */
- UD_cb_query /* Query callback */
-}};
-
static int
ud_callbacks(hid_t fapl, hbool_t new_format)
{
hid_t fid = -1; /* File ID */
hid_t gid = -1; /* Group ID */
hid_t lcpl = -1; /* Link Creation PL */
- H5L_info_t li; /* Link information */
+ H5L_info2_t li; /* Link information */
char ud_target_name[] = UD_CB_TARGET; /* Link target name */
char filename[NAME_BUF_SIZE];
char query_buf[NAME_BUF_SIZE];
@@ -7723,7 +11809,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Query the link to test its query callback */
- if (H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.u.val_size != 16) TEST_ERROR
if (UD_CB_TYPE != li.type) {
H5_FAILED();
@@ -7755,7 +11841,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
if(H5Pclose(lcpl) < 0) FAIL_STACK_ERROR
/* Check its character encoding */
- if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(li.cset != H5T_CSET_UTF8) TEST_ERROR
/* Unregister the link class so the library forgets what its callbacks do */
@@ -7771,7 +11857,7 @@ ud_callbacks(hid_t fapl, hbool_t new_format)
} H5E_END_TRY
/* The query callback should NOT fail, but should be unable to give a linklen */
- if(H5Lget_info(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lget_info2(fid, UD_CB_LINK_NAME, &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(li.u.val_size != 0) TEST_ERROR
if(li.type != UD_CB_TYPE) TEST_ERROR
@@ -7825,18 +11911,6 @@ error:
return FAIL;
} /* end UD_plist_traverse() */
-const H5L_class_t UD_plist_class[1] = {{
- H5L_LINK_CLASS_T_VERS, /* H5L_class_t version */
- (H5L_type_t)UD_PLIST_TYPE, /* Link type id number */
- "UD_plist_link", /* Link class name for debugging */
- NULL, /* Creation callback */
- NULL, /* Move/rename callback */
- NULL, /* Copy callback */
- UD_plist_traverse, /* The actual traversal function */
- NULL, /* Deletion callback */
- NULL /* Query callback */
-}};
-
static int
lapl_udata(hid_t fapl, hbool_t new_format)
{
@@ -8132,12 +12206,12 @@ const H5L_class_t UD_error4_class[1] = {{
static int
ud_link_errors(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group IDs */
- char group_name[NAME_BUF_SIZE];
- char filename[NAME_BUF_SIZE];
- char query_buf[NAME_BUF_SIZE];
- H5L_info_t li; /* Link information */
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group IDs */
+ char group_name[NAME_BUF_SIZE];
+ char filename[NAME_BUF_SIZE];
+ char query_buf[NAME_BUF_SIZE];
+ H5L_info2_t li; /* Link information */
if(new_format)
TESTING("user-defined link error conditions (w/new group format)")
@@ -8202,7 +12276,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
if(H5Ldelete(fid, "ud_link", H5P_DEFAULT) >= 0) TEST_ERROR
/* The query callback will fail */
- if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR
+ if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) >=0) TEST_ERROR
} H5E_END_TRY
/* Now use a class with different callback functions */
@@ -8215,7 +12289,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
if(H5Lcopy(fid, "ud_link", fid, "copy_succ", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* The query callback will succeed when we only want to get the size of the buffer... */
- if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(li.u.val_size != 0) TEST_ERROR
/* ...but fail when we try to write data to the buffer itself*/
H5E_BEGIN_TRY {
@@ -8226,7 +12300,7 @@ ud_link_errors(hid_t fapl, hbool_t new_format)
if(H5Lregister(UD_cbfail_class3) < 0) FAIL_STACK_ERROR
/* Now querying should succeed */
- if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(li.u.val_size != 8) TEST_ERROR
if(H5Lget_val(fid, "ud_link", query_buf, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(HDstrcmp(query_buf, "succeed") != 0) TEST_ERROR
@@ -8392,9 +12466,9 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
/* H5Ldelete */
if(H5Ldelete(fid, "soft17/soft_link", plist) < 0) TEST_ERROR
- /* H5Lget_val and H5Lget_info */
+ /* H5Lget_val and H5Lget_info2 */
if(H5Lget_val(fid, "soft17", NULL, (size_t)0, plist) < 0) TEST_ERROR
- if(H5Lget_info(fid, "soft17", NULL, plist) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "soft17", NULL, plist) < 0) TEST_ERROR
/* H5Lcreate_external and H5Lcreate_ud */
if(H5Lcreate_external("filename", "path", fid, "soft17/extlink", H5P_DEFAULT, plist) < 0) TEST_ERROR
@@ -8493,12 +12567,12 @@ error:
static int
linkinfo(hid_t fapl, hbool_t new_format)
{
- hid_t fid = -1; /* File ID */
- hid_t gid = -1; /* Group ID */
- hid_t tid = -1; /* Type ID */
- hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
- H5L_info_t li; /* Link information */
- char filename[NAME_BUF_SIZE];
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t tid = -1; /* Type ID */
+ hid_t sid = -1, did = -1; /* Dataspace and dataset IDs */
+ H5L_info2_t li; /* Link information */
+ char filename[NAME_BUF_SIZE];
if(new_format)
TESTING("link type field in H5Lget_info (w/new group format)")
@@ -8531,22 +12605,22 @@ linkinfo(hid_t fapl, hbool_t new_format)
if(H5Dclose(did) < 0) TEST_ERROR
/* Make sure that link type is correct when objects are queried */
- if(H5Lget_info(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "datatype", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "group", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.type != H5L_TYPE_HARD) TEST_ERROR
- if(H5Lget_info(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "ext_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.type != H5L_TYPE_EXTERNAL) TEST_ERROR
- if(H5Lget_info(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "softlink", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.type != H5L_TYPE_SOFT) TEST_ERROR
- if(H5Lget_info(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "ud_link", &li, H5P_DEFAULT) < 0) TEST_ERROR
if(li.type != UD_PLIST_TYPE) TEST_ERROR
/* Ensure that passing a NULL pointer doesn't cause an error */
- if(H5Lget_info(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid, "group", NULL, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Fclose(fid) < 0) TEST_ERROR
@@ -8716,7 +12790,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info_t *linfo, void *_op_data)
+visit_link_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5L_info2_t *linfo, void *_op_data)
{
lvisit_ud_t *op_data = (lvisit_ud_t *)_op_data;
@@ -8758,26 +12832,26 @@ link_visit(hid_t fapl, hbool_t new_format)
/* Visit all the links reachable from the root group (with file ID) */
udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
/* Visit all the links reachable from the root group (with group ID) */
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Visit all the links reachable from each internal group */
if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit1;
- if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit2;
- if(H5Lvisit(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Close file created */
@@ -8822,34 +12896,34 @@ link_visit_by_name(hid_t fapl, hbool_t new_format)
/* Visit all the links reachable from the root group (with file ID) */
udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit_by_name(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Visit all the links reachable from the root group (with group ID) */
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit0;
- if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Visit all the links reachable from each internal group */
udata.idx = 0;
udata.info = lvisit1;
- if(H5Lvisit_by_name(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit1;
- if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit2;
- if(H5Lvisit_by_name(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = lvisit2;
- if(H5Lvisit_by_name(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lvisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_link_cb, &udata, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Close file created */
@@ -8877,7 +12951,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info_t *oinfo, void *_op_data)
+visit_obj_cb(hid_t H5_ATTR_UNUSED group_id, const char *name, const H5O_info2_t *oinfo, void *_op_data)
{
ovisit_ud_t *op_data = (ovisit_ud_t *)_op_data;
@@ -8919,26 +12993,26 @@ obj_visit(hid_t fapl, hbool_t new_format)
/* Visit all the objects reachable from the root group (with file ID) */
udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
/* Visit all the objects reachable from the root group (with group ID) */
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Visit all the objects reachable from each internal group */
if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
- if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
- if(H5Ovisit2(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit3(gid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Close file created */
@@ -8983,34 +13057,34 @@ obj_visit_by_name(hid_t fapl, hbool_t new_format)
/* Visit all the objects reachable from the root group (with file ID) */
udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Visit all the objects reachable from the root group (with group ID) */
if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit0_new : ovisit0_old;
- if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Visit all the objects reachable from each internal group */
udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
- if(H5Ovisit_by_name2(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit_by_name3(fid, "/Group1", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if((gid = H5Gopen2(fid, "/Group1", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit1_new : ovisit1_old;
- if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
- if(H5Ovisit_by_name2(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit_by_name3(fid, "/Group1/Group2", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if((gid = H5Gopen2(fid, "/Group1/Group2", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
udata.idx = 0;
udata.info = new_format ? ovisit2_new : ovisit2_old;
- if(H5Ovisit_by_name2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Ovisit_by_name3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
/* Close file created */
@@ -9037,7 +13111,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info_t H5_ATTR_UNUSED *oinfo, void *_op_data)
+visit_obj_stop_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *name, const H5O_info2_t H5_ATTR_UNUSED *oinfo, void *_op_data)
{
unsigned *op_data = (unsigned *)_op_data;
@@ -9077,14 +13151,14 @@ obj_visit_stop(hid_t fapl, hbool_t new_format)
* returns H5_ITER_STOP
*/
nvisited = 0;
- if((ret = H5Ovisit2(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0)
+ if((ret = H5Ovisit3(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb, &nvisited, H5O_INFO_BASIC)) < 0)
FAIL_STACK_ERROR
if(ret != H5_ITER_STOP) TEST_ERROR
if(nvisited != 1) TEST_ERROR
/* Same test with H5Ovisit_by_name */
nvisited = 0;
- if((ret = H5Ovisit_by_name2(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb,
+ if((ret = H5Ovisit_by_name3(fid, "/", H5_INDEX_NAME, H5_ITER_INC, visit_obj_stop_cb,
&nvisited, H5O_INFO_BASIC, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
if(ret != H5_ITER_STOP) TEST_ERROR
if(nvisited != 1) TEST_ERROR
@@ -9878,11 +13952,11 @@ corder_create_compact(hid_t fapl)
/* Loop through links, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
for(u = 0; u < max_compact; u++) {
- H5L_info_t linfo; /* Link information */
+ H5L_info2_t linfo; /* Link information */
/* Retrieve information for link */
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify creation order of link */
if(linfo.corder_valid != TRUE) TEST_ERROR
@@ -10006,11 +14080,11 @@ corder_create_dense(hid_t fapl)
/* Loop through links, checking their creation order values */
/* (the name index is used, but the creation order value is in the same order) */
for(u = 0; u < (max_compact + 1); u++) {
- H5L_info_t linfo; /* Link information */
+ H5L_info2_t linfo; /* Link information */
/* Retrieve information for link */
HDsnprintf(objname, sizeof(objname), "filler %u", u);
- if(H5Lget_info(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(group_id, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
/* Verify creation order of link */
if(linfo.corder_valid != TRUE) TEST_ERROR
@@ -10404,19 +14478,19 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
char valname[NAME_BUF_SIZE]; /* Link value name */
char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
- H5L_info_t linfo; /* Link info struct */
+ H5L_info2_t linfo; /* Link info struct */
/* Make link value for increasing/native order queries */
HDsnprintf(valname, sizeof(valname), "value %02u", (unsigned)n);
/* Verify the link information for first link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in increasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
/* Verify value for new soft link, in increasing creation order */
@@ -10438,12 +14512,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
if(use_index) {
/* Verify the link information for first link, in native creation order (which is increasing) */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in native creation order (which is increasing) */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
/* Verify value for new soft link, in native creation order (which is increasing) */
@@ -10461,12 +14535,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
/* Verify the link information for first link, in decreasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in decreasing creation order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
/* Verify value for new soft link, in decreasing creation order */
@@ -10484,12 +14558,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
/* Verify the link information for first link, in increasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in increasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
/* Verify value for new soft link, in increasing link name order */
@@ -10510,12 +14584,12 @@ link_info_by_idx_check(hid_t group_id, const char *linkname, hsize_t n,
/* Verify the link information for first link, in decreasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, n, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != 0) TEST_ERROR
/* Verify the link information for new link, in decreasing link name order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.corder != (int64_t)n) TEST_ERROR
/* Verify value for new soft link, in decreasing link name order */
@@ -10559,7 +14633,7 @@ link_info_by_idx(hid_t fapl)
unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5L_info_t linfo; /* Link info struct */
+ H5L_info2_t linfo; /* Link info struct */
char objname[NAME_BUF_SIZE]; /* Object name */
char valname[NAME_BUF_SIZE]; /* Link value name */
char filename[NAME_BUF_SIZE];/* File name */
@@ -10603,7 +14677,7 @@ link_info_by_idx(hid_t fapl)
/* Check for query on empty group */
H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, &linfo, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
@@ -10641,11 +14715,11 @@ link_info_by_idx(hid_t fapl)
/* Check for out of bound offset queries */
H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
@@ -10683,11 +14757,11 @@ link_info_by_idx(hid_t fapl)
/* Check for out of bound offset queries */
H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
@@ -10733,19 +14807,22 @@ error:
static int
link_info_by_idx_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- unsigned hard_link; /* Create hard or soft link? */
- H5L_info_t linfo; /* Link info struct */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char valname[NAME_BUF_SIZE]; /* Link value name */
- char filename[NAME_BUF_SIZE];/* File name */
- haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
- unsigned u; /* Local index variable */
- ssize_t name_len; /* Length of name */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ H5F_t *f = NULL;
+ unsigned hard_link; /* Create hard or soft link? */
+ H5L_info2_t linfo; /* Link info struct */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char valname[NAME_BUF_SIZE]; /* Link value name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */
+ void *vol_obj_file = NULL; /* Object of file_id */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */
+ unsigned u; /* Local index variable */
+ ssize_t name_len; /* Length of name */
+ int token_cmp;
+ herr_t ret; /* Generic return value */
/* Loop over creating hard or soft links */
for(hard_link = FALSE; hard_link <= TRUE; hard_link++) {
@@ -10758,6 +14835,12 @@ link_info_by_idx_old(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Need the file struct to address encoding */
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR
+
/* Create group to operate on */
if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -10768,14 +14851,15 @@ link_info_by_idx_old(hid_t fapl)
/* Check for creating hard or soft link */
if(hard_link) {
- H5O_info_t oi; /* Buffer for querying object's info */
+ H5O_info2_t oi; /* Buffer for querying object's info */
/* Create group */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oi.addr;
+ /* Retrieve group's object token */
+ if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+
+ HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t));
/* Close group */
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -10801,8 +14885,9 @@ link_info_by_idx_old(hid_t fapl)
/* Verify link information (in increasing order) */
if(hard_link) {
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -10816,8 +14901,9 @@ link_info_by_idx_old(hid_t fapl)
/* Verify link information (in native order - native is increasing) */
if(hard_link) {
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[u])) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -10837,8 +14923,9 @@ link_info_by_idx_old(hid_t fapl)
/* Verify link information (in decreasing order) */
if(hard_link) {
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
if(H5Lget_val_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_DEC, (hsize_t)u, tmpval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
@@ -10852,7 +14939,7 @@ link_info_by_idx_old(hid_t fapl)
/* Check for creation order index queries */
H5E_BEGIN_TRY {
- ret = H5Lget_info_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
+ ret = H5Lget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, &linfo, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
H5E_BEGIN_TRY {
@@ -10904,7 +14991,7 @@ delete_by_idx(hid_t fapl)
unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5L_info_t linfo; /* Link info struct */
+ H5L_info2_t linfo; /* Link info struct */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];/* File name */
char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
@@ -10912,9 +14999,9 @@ delete_by_idx(hid_t fapl)
herr_t ret; /* Generic return value */
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -11008,7 +15095,7 @@ delete_by_idx(hid_t fapl)
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
if(linfo.corder != (u + 1)) TEST_ERROR
} /* end if */
@@ -11064,7 +15151,7 @@ delete_by_idx(hid_t fapl)
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
if(linfo.corder != (u + 1)) TEST_ERROR
} /* end if */
@@ -11123,7 +15210,7 @@ delete_by_idx(hid_t fapl)
/* Verify the link information for current link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
if(linfo.corder != ((u * 2) + 1)) TEST_ERROR
} /* end if */
@@ -11148,7 +15235,7 @@ delete_by_idx(hid_t fapl)
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
if(linfo.corder != ((u * 2) + 3)) TEST_ERROR
} /* end if */
@@ -11212,19 +15299,22 @@ error:
static int
delete_by_idx_old(hid_t fapl)
{
- hid_t file_id = -1; /* File ID */
- hid_t group_id = -1, group_id2 = -1; /* Group IDs */
- H5L_info_t linfo; /* Link info struct */
- H5_iter_order_t order; /* Order within in the index */
- char objname[NAME_BUF_SIZE]; /* Object name */
- char filename[NAME_BUF_SIZE];/* File name */
- haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
- char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
- unsigned u; /* Local index variable */
- herr_t ret; /* Generic return value */
+ hid_t file_id = -1; /* File ID */
+ hid_t group_id = -1, group_id2 = -1; /* Group IDs */
+ H5F_t *f = NULL;
+ H5L_info2_t linfo; /* Link info struct */
+ H5_iter_order_t order; /* Order within in the index */
+ void *vol_obj_file = NULL; /* Object of file_id */
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ char filename[NAME_BUF_SIZE];/* File name */
+ H5O_token_t objtoken[CORDER_NLINKS];/* Tokens (Addresses) of the objects created */
+ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */
+ unsigned u; /* Local index variable */
+ int token_cmp;
+ herr_t ret; /* Generic return value */
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) {
/* Print test banner */
if(order == H5_ITER_INC)
TESTING("deleting links by index in increasing order in old-style group")
@@ -11235,6 +15325,12 @@ delete_by_idx_old(hid_t fapl)
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
+ /* Need the file struct to address encoding */
+ /* Retrieve VOL object */
+ if(NULL == (vol_obj_file = H5VL_vol_object(file_id))) TEST_ERROR
+ /* Retrieve file from VOL object */
+ if(NULL == (f = (H5F_t *)H5VL_object_data((const H5VL_object_t *)vol_obj_file))) TEST_ERROR
+
/* Create group to operate on */
if((group_id = H5Gcreate2(file_id, CORDER_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -11248,7 +15344,7 @@ delete_by_idx_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- H5O_info_t oi; /* Buffer for querying object's info */
+ H5O_info2_t oi; /* Buffer for querying object's info */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -11256,9 +15352,10 @@ delete_by_idx_old(hid_t fapl)
/* Create group */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oi.addr;
+ /* Retrieve group's object token */
+ if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+
+ HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t));
/* Close group */
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -11285,12 +15382,14 @@ delete_by_idx_old(hid_t fapl)
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
- if(H5F_addr_ne(linfo.u.address, objno[u + 1])) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[u + 1], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
@@ -11319,7 +15418,7 @@ delete_by_idx_old(hid_t fapl)
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
- H5O_info_t oi; /* Buffer for querying object's info */
+ H5O_info2_t oi; /* Buffer for querying object's info */
/* Make name for link */
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
@@ -11327,9 +15426,10 @@ delete_by_idx_old(hid_t fapl)
/* Create group */
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oi.addr;
+ /* Retrieve group's object token */
+ if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+
+ HDmemcpy(&objtoken[u], &oi.token, sizeof(H5O_token_t));
/* Close group */
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -11344,12 +15444,14 @@ delete_by_idx_old(hid_t fapl)
/* Verify the link information for current link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
- if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 1])) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 1], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end else */
/* Verify the name for current link in appropriate order */
@@ -11371,12 +15473,14 @@ delete_by_idx_old(hid_t fapl)
/* Verify the link information for first link in appropriate order */
HDmemset(&linfo, 0, sizeof(linfo));
- if(H5Lget_info_by_idx(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(order == H5_ITER_INC) {
- if(H5F_addr_ne(linfo.u.address, objno[(u * 2) + 3])) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[(u * 2) + 3], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
- if(H5F_addr_ne(linfo.u.address, objno[dec_u])) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &linfo.u.token, &objtoken[dec_u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end else */
/* Verify the name for first link in appropriate order */
@@ -11426,22 +15530,24 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
+link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info,
void *_op_data)
{
link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info_t my_info; /* Local link info */
+ H5L_info2_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
- if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
if(info) {
+ int token_cmp;
+
/* Check for correct order of iteration */
/* (if we are operating in increasing or decreasing order) */
if(op_data->order != H5_ITER_NATIVE)
@@ -11457,7 +15563,9 @@ link_iterate_cb(hid_t group_id, const char *link_name, const H5L_info_t *info,
return H5_ITER_ERROR;
if(info->cset != my_info.cset)
return H5_ITER_ERROR;
- if(H5F_addr_ne(info->u.address, my_info.u.address))
+ if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0)
+ return H5_ITER_ERROR;
+ if(token_cmp)
return H5_ITER_ERROR;
} /* end if */
@@ -11519,7 +15627,7 @@ group_iterate_cb(hid_t group_id, const char *link_name, void *_op_data)
*/
static int
link_iterate_fail_cb(hid_t H5_ATTR_UNUSED group_id, const char H5_ATTR_UNUSED *link_name,
- const H5L_info_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
+ const H5L_info2_t H5_ATTR_UNUSED *info, void H5_ATTR_UNUSED *_op_data)
{
return H5_ITER_ERROR;
} /* end link_iterate_fail_cb() */
@@ -11552,7 +15660,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
+ if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
/* Verify that we visited all the links */
if(skip != max_links) TEST_ERROR
@@ -11582,7 +15690,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->ncalled = 0;
iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
+ if(H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR
/* Verify that we visited all the links */
if(skip != max_links) TEST_ERROR
@@ -11644,7 +15752,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR
+ if((ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, iter_info)) < 0) TEST_ERROR
if(ret != CORDER_ITER_STOP) TEST_ERROR
if(iter_info->ncalled != 3) TEST_ERROR
@@ -11664,7 +15772,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order,
/* Check for iteration routine indicating failure */
skip = 0;
H5E_BEGIN_TRY {
- ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL);
+ ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_fail_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -11721,9 +15829,9 @@ link_iterate(hid_t fapl)
iter_info.visited = visited;
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -11782,7 +15890,7 @@ link_iterate(hid_t fapl)
/* Check for iteration on empty group */
/* (should be OK) */
- if(H5Literate(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR
+ if(H5Literate2(group_id, idx_type, order, NULL, link_iterate_cb, NULL) < 0) TEST_ERROR
/* Create several links, up to limit of compact form */
for(u = 0; u < max_compact; u++) {
@@ -11802,7 +15910,7 @@ link_iterate(hid_t fapl)
/* Check for out of bound iteration on compact group */
skip = (hsize_t)u;
H5E_BEGIN_TRY {
- ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL);
+ ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -11827,7 +15935,7 @@ link_iterate(hid_t fapl)
/* Check for out of bound iteration on dense group */
skip = (hsize_t)u;
H5E_BEGIN_TRY {
- ret = H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, NULL);
+ ret = H5Literate2(group_id, idx_type, order, &skip, link_iterate_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -11880,21 +15988,23 @@ error:
*-------------------------------------------------------------------------
*/
static int
-link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *info, void *_op_data)
+link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info2_t *info, void *_op_data)
{
link_iter_info_t *op_data = (link_iter_info_t *)_op_data; /* User data */
char objname[NAME_BUF_SIZE]; /* Object name */
- H5L_info_t my_info; /* Local link info */
+ H5L_info2_t my_info; /* Local link info */
/* Increment # of times the callback was called */
op_data->ncalled++;
/* Get the link information directly to compare */
- if(H5Lget_info(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
+ if(H5Lget_info2(group_id, link_name, &my_info, H5P_DEFAULT) < 0)
return H5_ITER_ERROR;
/* Check more things for link iteration (vs. group iteration) */
if(info) {
+ int token_cmp;
+
/* Compare link info structs */
if(info->type != my_info.type)
return H5_ITER_ERROR;
@@ -11904,7 +16014,9 @@ link_iterate_old_cb(hid_t group_id, const char *link_name, const H5L_info_t *inf
return H5_ITER_ERROR;
if(info->cset != my_info.cset)
return H5_ITER_ERROR;
- if(H5F_addr_ne(info->u.address, my_info.u.address))
+ if(H5Otoken_cmp(group_id, &info->u.token, &my_info.u.token, &token_cmp) < 0)
+ return H5_ITER_ERROR;
+ if(token_cmp)
return H5_ITER_ERROR;
} /* end if */
@@ -11980,7 +16092,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
+ if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
/* Verify that we visited all the links */
if(skip != max_links) TEST_ERROR
@@ -12010,7 +16122,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links
iter_info->ncalled = 0;
iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip));
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
+ if(H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR
/* Verify that we visited all the links */
if(skip != max_links) TEST_ERROR
@@ -12072,7 +16184,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links
iter_info->ncalled = 0;
iter_info->curr = order != H5_ITER_DEC ? 0 : (max_links - 1);
HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit);
- if((ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR
+ if((ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info)) < 0) TEST_ERROR
if(ret != CORDER_ITER_STOP) TEST_ERROR
if(iter_info->ncalled != 3) TEST_ERROR
@@ -12092,14 +16204,14 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, unsigned max_links
/* Check for iteration routine indicating failure */
skip = 0;
H5E_BEGIN_TRY {
- ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL);
+ ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
/* Check for iteration w/bad location ID */
skip = 0;
H5E_BEGIN_TRY {
- ret = H5Literate((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL);
+ ret = H5Literate2((hid_t)(-1), H5_INDEX_NAME, order, &skip, link_iterate_fail_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -12147,7 +16259,7 @@ link_iterate_old(hid_t fapl)
iter_info.visited = visited;
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
/* Print appropriate test message */
if(order == H5_ITER_INC) {
TESTING("iterating over links by name index in increasing order in old-style group")
@@ -12169,7 +16281,7 @@ link_iterate_old(hid_t fapl)
/* Check for iteration on empty group */
/* (should be OK) */
- if(H5Literate(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR
+ if(H5Literate2(group_id, H5_INDEX_NAME, order, NULL, link_iterate_old_cb, NULL) < 0) TEST_ERROR
/* Create several links */
for(u = 0; u < CORDER_NLINKS; u++) {
@@ -12189,7 +16301,7 @@ link_iterate_old(hid_t fapl)
/* Check for out of bound iteration on old-style group */
skip = (hsize_t)u;
H5E_BEGIN_TRY {
- ret = H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL);
+ ret = H5Literate2(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -12197,7 +16309,7 @@ link_iterate_old(hid_t fapl)
/* (should fail) */
skip = (hsize_t)0;
H5E_BEGIN_TRY {
- ret = H5Literate(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL);
+ ret = H5Literate2(group_id, H5_INDEX_CRT_ORDER, order, &skip, link_iterate_old_cb, NULL);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -12244,15 +16356,16 @@ error:
*/
static int
open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
- H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, haddr_t *objno)
+ H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
{
char mntname[NAME_BUF_SIZE]; /* Link value */
hid_t group_id = -1; /* ID of group to test */
- H5O_info_t oi; /* Buffer for querying object's info */
- haddr_t mnt_root_addr; /* Address of root group in file to mount */
+ H5O_info2_t oi; /* Buffer for querying object's info */
+ H5O_token_t mnt_root_token; /* Token (address) of root group in file to mount */
hid_t obj_id; /* ID of object opened */
unsigned mnt_idx; /* Index to mount group on */
unsigned u, v; /* Local index variables */
+ int token_cmp;
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
@@ -12268,16 +16381,18 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR
/* Get the object's information */
- if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
/* Check that the object is the correct one */
if(order == H5_ITER_INC) {
- if(H5F_addr_ne(oi.addr, objno[u])) TEST_ERROR
+ if(H5Otoken_cmp(obj_id, &oi.token, &objno[u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else if(order == H5_ITER_DEC) {
unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
- if(H5F_addr_ne(oi.addr, objno[dec_u])) TEST_ERROR
+ if(H5Otoken_cmp(obj_id, &oi.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
} /* end if */
else {
/* XXX: What to do about native order? */
@@ -12291,8 +16406,9 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
/* Verify opening correct object by index when file mounting is present */
/* Get the address of the root group in the file to mount */
- if(H5Oget_info2(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- mnt_root_addr = oi.addr;
+ if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0)
+ TEST_ERROR
+ HDmemcpy(&mnt_root_token, &oi.token, sizeof(mnt_root_token));
/* Mount a file over a group in main group */
mnt_idx = 2;
@@ -12303,11 +16419,13 @@ open_by_idx_check(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR
/* Get the object's information */
- if(H5Oget_info2(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
/* Check that the object is the root of the mounted file and not in the previous file */
- if(H5F_addr_ne(oi.addr, mnt_root_addr)) TEST_ERROR
- if(H5F_addr_eq(oi.addr, objno[mnt_idx])) TEST_ERROR
+ if(H5Otoken_cmp(obj_id, &oi.token, &mnt_root_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
+ if(H5Otoken_cmp(obj_id, &oi.token, &objno[mnt_idx], &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
/* Close object */
if(H5Oclose(obj_id) < 0) TEST_ERROR
@@ -12346,11 +16464,11 @@ open_by_idx(hid_t fapl)
unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5O_info_t oi; /* Buffer for querying object's info */
+ H5O_info2_t oi; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
char valname[2 * NAME_BUF_SIZE]; /* Link value */
- haddr_t *objno = NULL; /* Addresses of the objects created */
+ H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */
unsigned u; /* Local index variable */
hid_t ret; /* Generic return value */
@@ -12360,17 +16478,17 @@ open_by_idx(hid_t fapl)
/* Query the group creation properties */
if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
- /* Allocate object address array */
- if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR
+ /* Allocate object token array */
+ if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR
/* Create file to mount */
h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -12447,8 +16565,8 @@ open_by_idx(hid_t fapl)
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oi.addr;
+ if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oi.token;
/* Close group created */
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -12456,7 +16574,7 @@ open_by_idx(hid_t fapl)
/* Create soft link in another group, to objects in main group */
HDsnprintf(valname, sizeof(valname), "/%s/%s", CORDER_GROUP_NAME, objname);
if(H5Lcreate_soft(valname, soft_group_id, objname, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- } /* end for */
+ }
/* Verify state of group (compact) */
if(H5G__has_links_test(group_id, NULL) != TRUE) TEST_ERROR
@@ -12481,8 +16599,8 @@ open_by_idx(hid_t fapl)
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oi.addr;
+ if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oi.token;
/* Close group created */
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -12546,6 +16664,100 @@ error:
/*-------------------------------------------------------------------------
+ * Function: open_by_idx_check_old
+ *
+ * Purpose: Check opening by index in a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+open_by_idx_check_old(hid_t main_group_id, hid_t soft_group_id, hid_t mount_file_id,
+ H5_index_t idx_type, H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
+{
+ char mntname[NAME_BUF_SIZE]; /* Link value */
+ hid_t group_id = -1; /* ID of group to test */
+ H5O_info2_t oi; /* Buffer for querying object's info */
+ H5O_token_t mnt_root_token; /* Token of root group in file to mount */
+ hid_t obj_id; /* ID of object opened */
+ unsigned mnt_idx; /* Index to mount group on */
+ unsigned u, v; /* Local index variables */
+ int cmp_value; /* Token comparison value */
+
+ /* Work through main & soft link groups */
+ for(v = 0; v < 2; v++) {
+ /* Choose appropriate group to open links within */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
+
+ /* Open each object in main group by index and check that it's the correct one */
+ for(u = 0; u < max_links; u++) {
+ /* Open the object */
+ if((obj_id = H5Oopen_by_idx(group_id, ".", idx_type, order, (hsize_t)u, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Get the object's information */
+ if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+
+ /* Check that the object is the correct one */
+ if(order == H5_ITER_INC) {
+ if(H5Otoken_cmp(group_id, &oi.token, &objno[u], &cmp_value) < 0) TEST_ERROR
+ if(0 != cmp_value) TEST_ERROR
+ } /* end if */
+ else if(order == H5_ITER_DEC) {
+ unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
+
+ if(H5Otoken_cmp(group_id, &oi.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR
+ if(0 != cmp_value) TEST_ERROR
+ } /* end if */
+ else {
+ /* XXX: What to do about native order? */
+ } /* end else */
+
+ /* Close object */
+ if(H5Oclose(obj_id) < 0) TEST_ERROR
+ } /* end for */
+ } /* end for */
+
+ /* Verify opening correct object by index when file mounting is present */
+
+ /* Get the address of the root group in the file to mount */
+ if(H5Oget_info3(mount_file_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ mnt_root_token = oi.token;
+
+ /* Mount a file over a group in main group */
+ mnt_idx = 2;
+ HDsnprintf(mntname, sizeof(mntname), "/%s/filler %02u", CORDER_GROUP_NAME, mnt_idx);
+ if(H5Fmount(main_group_id, mntname, mount_file_id, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Open the object that the file is mounted on */
+ if((obj_id = H5Oopen_by_idx(group_id, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)mnt_idx, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Get the object's information */
+ if(H5Oget_info3(obj_id, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+
+ /* Check that the object is the root of the mounted file and not in the previous file */
+ if(H5Otoken_cmp(group_id, &oi.token, &mnt_root_token, &cmp_value) < 0) TEST_ERROR
+ if(0 != cmp_value) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &oi.token, &objno[mnt_idx], &cmp_value) < 0) TEST_ERROR
+ if(0 == cmp_value) TEST_ERROR
+
+ /* Close object */
+ if(H5Oclose(obj_id) < 0) TEST_ERROR
+
+ /* Unmount the file */
+ if(H5Funmount(main_group_id, mntname) < 0) TEST_ERROR
+
+ /* Success */
+ return SUCCEED;
+
+error:
+ return FAIL;
+} /* end open_by_idx_check_old() */
+
+/*-------------------------------------------------------------------------
* Function: open_by_idx_old
*
* Purpose: Create an old-style group and test opening
@@ -12563,11 +16775,11 @@ open_by_idx_old(hid_t fapl)
hid_t group_id = -1; /* Group ID */
hid_t soft_group_id = -1; /* Group ID for soft links */
H5_iter_order_t order; /* Order within in the index */
- H5O_info_t oi; /* Buffer for querying object's info */
+ H5O_info2_t oi; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
char valname[2 * NAME_BUF_SIZE]; /* Link value */
- haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
+ H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */
unsigned u; /* Local index variable */
hid_t ret; /* Generic return value */
@@ -12576,7 +16788,7 @@ open_by_idx_old(hid_t fapl)
if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
/* Print appropriate test message */
if(order == H5_ITER_INC) {
TESTING("open object by name index in increasing order in old-style group")
@@ -12617,8 +16829,8 @@ open_by_idx_old(hid_t fapl)
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oi.addr;
+ if(H5Oget_info3(group_id2, &oi, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oi.token;
/* Close group created */
if(H5Gclose(group_id2) < 0) TEST_ERROR
@@ -12644,7 +16856,7 @@ open_by_idx_old(hid_t fapl)
if(ret >= 0) TEST_ERROR
/* Verify opening objects by index */
- if(open_by_idx_check(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
+ if(open_by_idx_check_old(group_id, soft_group_id, mount_file_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -12685,12 +16897,13 @@ error:
*/
static int
object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
- H5_iter_order_t order, unsigned max_links, haddr_t *objno)
+ H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
{
char objname[NAME_BUF_SIZE]; /* Object name */
hid_t group_id = -1; /* ID of group to test */
- H5O_info_t oinfo; /* Buffer for querying object's info */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
unsigned u, v; /* Local index variables */
+ int token_cmp;
/* Work through main & soft link groups */
for(v = 0; v < 2; v++) {
@@ -12706,25 +16919,28 @@ object_info_check(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
HDsnprintf(objname, sizeof(objname), "filler %02u", u);
/* Query the object's information, by name */
- if(H5Oget_info_by_name2(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
/* Check that the object is the correct one */
- if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR
- if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
+ if(oinfo.num_attrs != u) TEST_ERROR
/* Query the object's information, by index */
- if(H5Oget_info_by_idx2(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
/* Check that the object is the correct one */
if(order == H5_ITER_INC) {
- if(H5F_addr_ne(oinfo.addr, objno[u])) TEST_ERROR
- if(H5F_addr_ne(oinfo.num_attrs, u)) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
+ if(oinfo.num_attrs != u) TEST_ERROR
} /* end if */
else if(order == H5_ITER_DEC) {
unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
- if(H5F_addr_ne(oinfo.addr, objno[dec_u])) TEST_ERROR
- if(H5F_addr_ne(oinfo.num_attrs, dec_u)) TEST_ERROR
+ if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
+ if(oinfo.num_attrs != dec_u) TEST_ERROR
} /* end if */
else {
/* XXX: What to do about native order? */
@@ -12764,12 +16980,12 @@ object_info(hid_t fapl)
unsigned use_index; /* Use index on creation order values */
unsigned max_compact; /* Maximum # of links to store in group compactly */
unsigned min_dense; /* Minimum # of links to store in group "densely" */
- H5O_info_t oinfo; /* Buffer for querying object's info */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
char valname[2 * NAME_BUF_SIZE]; /* Link value */
char attrname[NAME_BUF_SIZE]; /* Attribute name */
- haddr_t *objno = NULL; /* Addresses of the objects created */
+ H5O_token_t *objno = NULL; /* Tokens (addresses) of the objects created */
herr_t ret; /* Generic return value */
unsigned u, v; /* Local index variables */
@@ -12779,16 +16995,16 @@ object_info(hid_t fapl)
/* Query the group creation properties */
if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
- /* Allocate object address array */
- if(NULL == (objno = (haddr_t *)HDmalloc(sizeof(haddr_t) * (max_compact * 2)))) TEST_ERROR
+ /* Allocate object token array */
+ if(NULL == (objno = (H5O_token_t *)HDmalloc(sizeof(H5O_token_t) * (max_compact * 2)))) TEST_ERROR
/* Create dataspace for attributes */
if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -12851,7 +17067,7 @@ object_info(hid_t fapl)
/* Check for out of bound query by index on empty group */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -12867,8 +17083,8 @@ object_info(hid_t fapl)
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oinfo.addr;
+ if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oinfo.token;
/* Create attributes on new object */
for(v = 0; v < u; v++) {
@@ -12895,7 +17111,7 @@ object_info(hid_t fapl)
/* Check for out of bound query by index */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -12915,8 +17131,8 @@ object_info(hid_t fapl)
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oinfo.addr;
+ if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oinfo.token;
/* Create attributes on new object */
for(v = 0; v < u; v++) {
@@ -12943,7 +17159,7 @@ object_info(hid_t fapl)
/* Check for out of bound query by index */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -12989,6 +17205,77 @@ error:
/*-------------------------------------------------------------------------
+ * Function: object_info_check_old
+ *
+ * Purpose: Check querying object info in a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *-------------------------------------------------------------------------
+ */
+static int
+object_info_check_old(hid_t main_group_id, hid_t soft_group_id, H5_index_t idx_type,
+ H5_iter_order_t order, unsigned max_links, H5O_token_t *objno)
+{
+ char objname[NAME_BUF_SIZE]; /* Object name */
+ hid_t group_id = -1; /* ID of group to test */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
+ unsigned u, v; /* Local index variables */
+
+ /* Work through main & soft link groups */
+ for(v = 0; v < 2; v++) {
+ /* Choose appropriate group to open links within */
+ if(0 == v)
+ group_id = main_group_id;
+ else
+ group_id = soft_group_id;
+
+ /* Open each object in group by name and check that it's the correct one */
+ for(u = 0; u < max_links; u++) {
+ int cmp_value; /* Token comparison value */
+
+ /* Make name for link */
+ HDsnprintf(objname, sizeof(objname), "filler %02u", u);
+
+ /* Query the object's information, by name */
+ if(H5Oget_info_by_name3(group_id, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check that the object is the correct one */
+ if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR
+ if(0 != cmp_value) TEST_ERROR
+ if(oinfo.num_attrs != u) TEST_ERROR
+
+ /* Query the object's information, by index */
+ if(H5Oget_info_by_idx3(group_id, ".", idx_type, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Check that the object is the correct one */
+ if(order == H5_ITER_INC) {
+ if(H5Otoken_cmp(group_id, &oinfo.token, &objno[u], &cmp_value) < 0) TEST_ERROR
+ if(0 != cmp_value) TEST_ERROR
+ if(oinfo.num_attrs != u) TEST_ERROR
+ }
+ else if(order == H5_ITER_DEC) {
+ unsigned dec_u = max_links - (u + 1); /* Decreasing mapped index */
+
+ if(H5Otoken_cmp(group_id, &oinfo.token, &objno[dec_u], &cmp_value) < 0) TEST_ERROR
+ if(0 != cmp_value) TEST_ERROR
+ if(oinfo.num_attrs != dec_u) TEST_ERROR
+ }
+ else {
+ /* XXX: What to do about native order? */
+ }
+
+ } /* end for */
+ } /* end for */
+
+ /* Success */
+ return SUCCEED;
+
+error:
+ return FAIL;
+} /* end object_info_check_old() */
+
+/*-------------------------------------------------------------------------
* Function: object_info_old
*
* Purpose: Create an old-style group test querying object info.
@@ -13005,12 +17292,12 @@ object_info_old(hid_t fapl)
hid_t soft_group_id = -1; /* Group ID for soft links */
hid_t space_id = -1; /* Dataspace ID (for attributes) */
H5_iter_order_t order; /* Order within in the index */
- H5O_info_t oinfo; /* Buffer for querying object's info */
+ H5O_info2_t oinfo; /* Buffer for querying object's info */
char filename[NAME_BUF_SIZE];/* File name */
char objname[NAME_BUF_SIZE]; /* Object name */
char valname[2 * NAME_BUF_SIZE]; /* Link value */
char attrname[NAME_BUF_SIZE]; /* Attribute name */
- haddr_t objno[CORDER_NLINKS]; /* Addresses of the objects created */
+ H5O_token_t objno[CORDER_NLINKS]; /* Tokens for the objects created */
herr_t ret; /* Generic return value */
unsigned u, v; /* Local index variables */
@@ -13018,7 +17305,8 @@ object_info_old(hid_t fapl)
if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) {
+
/* Print appropriate test message */
if(order == H5_ITER_INC) {
TESTING("query object info by name index in increasing order in old-style group")
@@ -13043,7 +17331,7 @@ object_info_old(hid_t fapl)
/* Check for out of bound query by index on empty group */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
@@ -13059,8 +17347,8 @@ object_info_old(hid_t fapl)
if((group_id2 = H5Gcreate2(group_id, objname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Retrieve group's address on disk */
- if(H5Oget_info2(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- objno[u] = oinfo.addr;
+ if(H5Oget_info3(group_id2, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ objno[u] = oinfo.token;
/* Create attributes on new object */
for(v = 0; v < u; v++) {
@@ -13087,18 +17375,18 @@ object_info_old(hid_t fapl)
/* Check for out of bound query by index */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_NAME, order, (hsize_t)u, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
/* Check for creation order index query */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_idx2(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(group_id, ".", H5_INDEX_CRT_ORDER, order, (hsize_t)(u - 1), &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(ret >= 0) TEST_ERROR
/* Verify querying objects by name */
- if(object_info_check(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
+ if(object_info_check_old(group_id, soft_group_id, H5_INDEX_NAME, order, u, objno) < 0) TEST_ERROR
/* Close the groups */
if(H5Gclose(group_id) < 0) TEST_ERROR
@@ -13165,9 +17453,9 @@ group_info(hid_t fapl)
if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -13557,7 +17845,7 @@ group_info_old(hid_t fapl)
unsigned u, v; /* Local index variables */
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) {
if(order == H5_ITER_INC) {
TESTING("query group info by name index in increasing order in old-style group")
} /* end if */
@@ -13767,7 +18055,8 @@ timestamps(hid_t fapl)
hid_t group_id2 = -1; /* Group ID */
hid_t gcpl_id = -1; /* Group creation property list ID */
hid_t gcpl_id2 = -1; /* Group creation property list ID */
- H5O_info_t oinfo, oinfo2; /* Object info for groups created */
+ H5O_info2_t oinfo, oinfo2; /* Object info for groups created */
+ H5O_native_info_t ninfo, ninfo2; /* Native info for groups created */
char filename[NAME_BUF_SIZE];/* File name */
hbool_t track_times; /* The object timestamp setting */
@@ -13816,10 +18105,15 @@ timestamps(hid_t fapl)
if(track_times != TRUE) TEST_ERROR
/* Query the object information for each group */
- if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR
- if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR
+ /* Generic info */
+ if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR
+ if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR
+ /* Native file format info */
+ if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
+ if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
/* Sanity check object information for each group */
+ /* Generic info */
if(oinfo.atime != 0) TEST_ERROR
if(oinfo.mtime != 0) TEST_ERROR
if(oinfo.ctime != 0) TEST_ERROR
@@ -13828,10 +18122,11 @@ timestamps(hid_t fapl)
if(oinfo.mtime == oinfo2.mtime) TEST_ERROR
if(oinfo.ctime == oinfo2.ctime) TEST_ERROR
if(oinfo.btime == oinfo2.btime) TEST_ERROR
- if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
- if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
- if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR
- if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR
+ /* Native file format info */
+ if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
+ if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
+ if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR
+ if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR
/* Close the property lists */
if(H5Pclose(gcpl_id) < 0) TEST_ERROR
@@ -13862,10 +18157,14 @@ timestamps(hid_t fapl)
if(track_times != TRUE) TEST_ERROR
/* Query the object information for each group */
- if(H5Oget_info2(group_id, &oinfo, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR
- if(H5Oget_info2(group_id2, &oinfo2, H5O_INFO_TIME|H5O_INFO_HDR) < 0) TEST_ERROR
+ if(H5Oget_info3(group_id, &oinfo, H5O_INFO_TIME) < 0) TEST_ERROR
+ if(H5Oget_info3(group_id2, &oinfo2, H5O_INFO_TIME) < 0) TEST_ERROR
+ /* Native file format info */
+ if(H5Oget_native_info(group_id, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
+ if(H5Oget_native_info(group_id2, &ninfo2, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
/* Sanity check object information for each group */
+ /* Generic info */
if(oinfo.atime != 0) TEST_ERROR
if(oinfo.mtime != 0) TEST_ERROR
if(oinfo.ctime != 0) TEST_ERROR
@@ -13874,10 +18173,11 @@ timestamps(hid_t fapl)
if(oinfo.mtime == oinfo2.mtime) TEST_ERROR
if(oinfo.ctime == oinfo2.ctime) TEST_ERROR
if(oinfo.btime == oinfo2.btime) TEST_ERROR
- if((oinfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
- if((oinfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
- if(oinfo.hdr.space.total >= oinfo2.hdr.space.total) TEST_ERROR
- if(oinfo.hdr.space.meta >= oinfo2.hdr.space.meta) TEST_ERROR
+ /* Native file format info */
+ if((ninfo.hdr.flags & H5O_HDR_STORE_TIMES) != 0) TEST_ERROR
+ if((ninfo2.hdr.flags & H5O_HDR_STORE_TIMES) == 0) TEST_ERROR
+ if(ninfo.hdr.space.total >= ninfo2.hdr.space.total) TEST_ERROR
+ if(ninfo.hdr.space.meta >= ninfo2.hdr.space.meta) TEST_ERROR
/* Close the property lists */
if(H5Pclose(gcpl_id) < 0) TEST_ERROR
@@ -13965,6 +18265,9 @@ main(void)
/* General tests... (on both old & new format groups */
nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += cklinks_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
@@ -13972,13 +18275,18 @@ main(void)
/* Test new H5L link creation routine */
nerrors += test_lcpl(my_fapl, new_format);
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += test_lcpl_deprec(my_fapl, new_format);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += test_move(my_fapl, new_format);
nerrors += test_copy(my_fapl, new_format);
nerrors += test_move_preserves(my_fapl, new_format);
#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += test_move_preserves_deprec(my_fapl, new_format);
nerrors += test_deprec(my_fapl, new_format);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
/* tests for external link */
/* Test external file cache first, so it sees the default efc setting on the fapl
*/
@@ -14006,6 +18314,9 @@ main(void)
} /* end else */
nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += external_link_root_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0;
@@ -14013,11 +18324,17 @@ main(void)
nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += external_link_query_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += external_link_closing_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
@@ -14056,14 +18373,29 @@ main(void)
* above has already been tested for UD links.
*/
if(new_format == TRUE) {
- nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
- nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += ud_hard_links_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += ud_link_reregister_deprec(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end if */
nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += ud_callbacks_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0;
nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += lapl_nlinks_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += linkinfo_deprec(my_fapl, new_format) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Misc. extra tests, useful for both new & old format files */
nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0;
@@ -14087,12 +18419,27 @@ main(void)
* correct.
*/
nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += corder_create_compact_deprec(fapl2) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += corder_create_dense_deprec(fapl2) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += link_info_by_idx_deprec(fapl2) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += delete_by_idx_deprec(fapl2) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += link_iterate(fapl2) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += link_iterate_deprec(fapl2) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += open_by_idx(fapl2) < 0 ? 1 : 0;
nerrors += object_info(fapl2) < 0 ? 1 : 0;
nerrors += group_info(fapl2) < 0 ? 1 : 0;
@@ -14100,8 +18447,17 @@ main(void)
/* Test new API calls on old-style groups */
nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += link_info_by_idx_old_deprec(fapl) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += delete_by_idx_old_deprec(fapl) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += link_iterate_old(fapl) < 0 ? 1 : 0;
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ nerrors += link_iterate_old_deprec(fapl) < 0 ? 1 : 0;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0;
nerrors += object_info_old(fapl) < 0 ? 1 : 0;
nerrors += group_info_old(fapl) < 0 ? 1 : 0;
diff --git a/test/mf.c b/test/mf.c
index ca2defe..141f5ec 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -6005,7 +6005,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
/* Populate memb_fapl_arr, patch memb_addr so member file addresses
* are aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl_arr[mt] = memb_fapl;
memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align;
} /* end for */
@@ -6015,7 +6015,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
} /* end else */
@@ -6378,7 +6378,7 @@ error:
HDmemset(memb_name, 0, sizeof memb_name); \
HDmemset(memb_addr, 0, sizeof memb_addr); \
HDmemset(sv, 0, sizeof sv); \
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { \
memb_map[mt] = H5FD_MEM_SUPER; \
memb_fapl[mt] = H5P_DEFAULT; \
} \
@@ -7128,7 +7128,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for
for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
/* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */
- for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) {
+ for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) {
if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
continue;
@@ -7296,7 +7296,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format
/* Test with TRUE or FALSE for persisting free-space */
for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) {
/* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */
- for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) {
+ for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) {
/* Skip for multi/split driver: persisting free-space or paged aggregation strategy */
if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE))
@@ -7528,7 +7528,7 @@ error:
*-------------------------------------------------------------------------
*/
static int
-set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
+set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t is_multi_or_split)
{
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
@@ -7537,7 +7537,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
hbool_t relax;
H5FD_mem_t mt;
- HDassert(multi || split);
+ HDassert(is_multi_or_split);
HDmemset(memb_name, 0, sizeof memb_name);
@@ -7545,13 +7545,13 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
if(H5Pget_fapl_multi(fapl, memb_map, memb_fapl_arr, memb_name, memb_addr, &relax) < 0)
TEST_ERROR
- if(split) {
+ if(is_multi_or_split) {
/* Set memb_addr aligned */
memb_addr[H5FD_MEM_SUPER] = ((memb_addr[H5FD_MEM_SUPER] + pagesize - 1) / pagesize) * pagesize;
memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
} else {
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
} /* end else */
@@ -7560,7 +7560,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
return 0;
@@ -7614,7 +7614,7 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
if((fapl_new = H5Pcopy(fapl)) < 0) TEST_ERROR
if(multi || split)
- if(set_multi_split(fapl_new, 4096, multi, split) < 0)
+ if(set_multi_split(fapl_new, 4096, split) < 0)
TEST_ERROR;
/* Test with TRUE or FALSE for persisting free-space */
@@ -8616,7 +8616,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
/* Populate memb_fapl_arr */
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) {
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) {
memb_fapl_arr[mt] = memb_fapl;
memb_addr[mt] = ((memb_addr[mt] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096;
}
@@ -8628,7 +8628,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl)
} /* end else */
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
/* Close memb_fapl */
@@ -8875,7 +8875,7 @@ main(void)
nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl);
/* For old library format--tests for alignment */
- for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) {
+ for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) {
switch(curr_test) {
case TEST_NORMAL: /* set alignment = 1024 */
diff --git a/test/mount.c b/test/mount.c
index b7d2858..3abe084 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -400,43 +400,60 @@ static int
test_hide(hid_t fapl)
{
hid_t file1 = -1, file2 = -1, grp = -1;
- H5O_info_t oi1, oi2;
+ H5O_info2_t oi1, oi2;
char filename1[1024], filename2[1024];
+ hbool_t same_obj;
TESTING("name hiding under mount point");
- h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
- h5_fixname(FILENAME[1], fapl, filename2, sizeof filename2);
+ h5_fixname(FILENAME[0], fapl, filename1, sizeof(filename1));
+ h5_fixname(FILENAME[1], fapl, filename2, sizeof(filename2));
if((file1 = H5Fopen(filename1, H5F_ACC_RDONLY, fapl)) < 0 ||
(file2 = H5Fopen(filename2, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get information about file1:/mnt1/file1 for later */
- if(H5Oget_info_by_name2(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt1/file1", &oi1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Build the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/* Original names under file1:/mnt1 should not be accessible */
H5E_BEGIN_TRY {
- grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
+ grp = H5Gopen2(file1, "/mnt1/file1", H5P_DEFAULT);
} H5E_END_TRY;
if(grp >= 0) {
- H5_FAILED();
- HDputs(" Name is still accessible under mount point.");
- TEST_ERROR
- } /* end if */
+ H5_FAILED();
+ HDputs(" Name is still accessible under mount point.");
+ TEST_ERROR
+ }
/*
* The original objects under file1:/mnt1 are still accessible by their
* other names. This is a rather stupid test but demonstrates a point.
*/
- if(H5Oget_info_by_name2(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
- H5_FAILED();
- HDputs(" Hard link failed for hidden object.");
- TEST_ERROR
- } /* end if */
+ if(H5Oget_info_by_name3(file1, "/file1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
+
+ same_obj = TRUE;
+ if(oi1.fileno == oi2.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
+ FAIL_STACK_ERROR
+ if(token_cmp)
+ same_obj = FALSE;
+ }
+ else
+ same_obj = FALSE;
+
+ if(!same_obj) {
+ H5_FAILED();
+ HDputs(" Hard link failed for hidden object.");
+ TEST_ERROR
+ }
/* Unmount and close objects */
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
@@ -448,9 +465,9 @@ test_hide(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Gclose(grp);
- H5Fclose(file1);
- H5Fclose(file2);
+ H5Gclose(grp);
+ H5Fclose(file1);
+ H5Fclose(file2);
} H5E_END_TRY;
return 1;
} /* end test_hide() */
@@ -477,8 +494,9 @@ static int
test_assoc(hid_t fapl)
{
hid_t file1 = -1, file2 = -1;
- H5O_info_t oi1, oi2;
+ H5O_info2_t oi1, oi2;
char filename1[1024], filename2[1024];
+ hbool_t same_obj;
TESTING("mount point open");
h5_fixname(FILENAME[0], fapl, filename1, sizeof filename1);
@@ -490,20 +508,35 @@ test_assoc(hid_t fapl)
FAIL_STACK_ERROR
/* Get information about the root of file2 */
- if(H5Oget_info2(file2, &oi1, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info3(file2, &oi1, H5O_INFO_BASIC) < 0)
+ FAIL_STACK_ERROR
/* Create the virtual file */
- if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
/*
* Get info about the mount point -- should be the same as the root group
* of file2.
*/
- if(H5Oget_info_by_name2(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt1", &oi2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ FAIL_STACK_ERROR
- if(oi1.fileno != oi2.fileno || H5F_addr_ne(oi1.addr, oi2.addr)) {
- H5_FAILED();
- HDputs(" Association failed.");
+ same_obj = TRUE;
+ if(oi1.fileno == oi2.fileno) {
+ int token_cmp;
+
+ if(H5Otoken_cmp(file1, &oi1.token, &oi2.token, &token_cmp) < 0)
+ FAIL_STACK_ERROR
+ if(token_cmp)
+ same_obj = FALSE;
+ }
+ else
+ same_obj = FALSE;
+
+ if(!same_obj) {
+ H5_FAILED();
+ HDputs(" Association failed.");
TEST_ERROR
} /* end if */
@@ -517,8 +550,8 @@ test_assoc(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Fclose(file2);
- H5Fclose(file1);
+ H5Fclose(file2);
+ H5Fclose(file1);
} H5E_END_TRY;
return 1;
} /* end test_assoc() */
@@ -670,7 +703,7 @@ static int
test_preopen(hid_t fapl)
{
hid_t file1 = -1, file2 = -1, grp = -1;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
TESTING("preopening objects under the mount point");
@@ -688,7 +721,7 @@ test_preopen(hid_t fapl)
if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Now access the thing we previously opened */
- if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
/* Shut down */
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
@@ -732,7 +765,7 @@ test_postopen(hid_t fapl)
{
hid_t file1 = -1, file2 = -1, grp = -1;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
TESTING("open object access after unmount");
@@ -752,10 +785,10 @@ test_postopen(hid_t fapl)
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
/* Now access the thing we previously opened */
- if(H5Oget_info2(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info3(grp, &oinfo, H5O_INFO_BASIC) < 0) FAIL_STACK_ERROR
/* Try accessing it from the file */
- if(H5Oget_info_by_name2(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file2, "/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Shut down */
if(H5Gclose(grp) < 0) FAIL_STACK_ERROR
@@ -797,7 +830,7 @@ static int
test_unlink(hid_t fapl)
{
hid_t file1 = -1, file2 = -1, mnt = -1, root = -1;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
herr_t status;
@@ -825,12 +858,12 @@ test_unlink(hid_t fapl)
* before the H5Fmount() and thus refers to the mount point itself rather
* than the group mounted there.
*/
- if(H5Oget_info_by_name2(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(mnt, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(root, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -845,9 +878,9 @@ test_unlink(hid_t fapl)
* We should still be able to get to "/file2" of file2 by starting at
* `root' which is still open, but not by name.
*/
- if(H5Oget_info_by_name2(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(root, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name2(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ status = H5Oget_info_by_name3(mnt, "file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -855,7 +888,7 @@ test_unlink(hid_t fapl)
TEST_ERROR
} /* end if */
H5E_BEGIN_TRY {
- status = H5Oget_info_by_name2(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ status = H5Oget_info_by_name3(file2, "/mnt_unlink/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
if(status >= 0) {
H5_FAILED();
@@ -926,7 +959,7 @@ static int
test_mvmpt(hid_t fapl)
{
hid_t file1 = -1, file2 = -1;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
TESTING("mount point renaming");
@@ -943,7 +976,7 @@ test_mvmpt(hid_t fapl)
if(H5Lmove(file1, "/mnt_move_a", H5L_SAME_LOC, "/mnt_move_b", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Access something under the new name */
- if(H5Oget_info_by_name2(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt_move_b/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Shut down */
if(H5Funmount(file1, "/mnt_move_b") < 0) FAIL_STACK_ERROR
@@ -1088,7 +1121,7 @@ static int
test_uniformity(hid_t fapl)
{
hid_t file1 = -1, file2 = -1;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
TESTING("file handle uniformity");
@@ -1102,18 +1135,18 @@ test_uniformity(hid_t fapl)
if(H5Fmount(file1, "/mnt1", file2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Access some things from the file1 handle */
- if(H5Oget_info_by_name2(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Access the same things from the file2 handle */
- if(H5Oget_info_by_name2(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file2, "/", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file2, "mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file2, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file2, "mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
/* Shut down */
if(H5Funmount(file1, "/mnt1") < 0) FAIL_STACK_ERROR
@@ -1152,7 +1185,7 @@ static int
test_close(hid_t fapl)
{
hid_t file1 = -1, file2 = -1;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024], filename2[1024];
TESTING("file handle close");
@@ -1170,7 +1203,7 @@ test_close(hid_t fapl)
* still accessible through the file2 handle.
*/
if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
+ if(H5Oget_info_by_name3(file2, "/mnt1", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) {
H5_FAILED();
HDputs(" File1 contents are not accessible!");
TEST_ERROR
@@ -1191,7 +1224,7 @@ test_close(hid_t fapl)
* Close file2. It is not actually closed because it's a child of file1.
*/
if(H5Fclose(file2) < 0) FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file1, "/mnt1/file2", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5Fclose(file1) < 0) FAIL_STACK_ERROR
/* Check that all file IDs have been closed */
@@ -2426,7 +2459,7 @@ test_fcdegree_strong(hid_t fapl)
hid_t fid1 = -1, fid2 = -1; /* File IDs */
hid_t gidA = -1, gidM = -1, gidAM = -1; /* Group IDs */
hid_t fapl_id = -1; /* FAPL IDs */
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
char filename1[1024],
filename2[1024]; /* Name of files to mount */
herr_t ret; /* Generic return value */
@@ -2495,9 +2528,9 @@ test_fcdegree_strong(hid_t fapl)
TEST_ERROR
/* Check that objects are still open */
- if(H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
- if(H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC) < 0)
+ if(H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC) < 0)
TEST_ERROR
/* Close file #2 (should close open objects also) */
@@ -2506,12 +2539,12 @@ test_fcdegree_strong(hid_t fapl)
/* Check that objects are closed */
H5E_BEGIN_TRY {
- ret = H5Oget_info2(gidA, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(gidA, &oinfo, H5O_INFO_BASIC);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
H5E_BEGIN_TRY {
- ret = H5Oget_info2(gidAM, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(gidAM, &oinfo, H5O_INFO_BASIC);
} H5E_END_TRY;
if(ret >= 0)
TEST_ERROR
diff --git a/test/mtime.c b/test/mtime.c
index f7a441d..81a20db 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -39,9 +39,7 @@ const char *FILENAME[] = {
*
* Purpose: H5O_mtime_decode() test.
*
- * Return: Success:
- *
- * Failure:
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Robb Matzke
* Thursday, July 30, 1998
@@ -62,9 +60,10 @@ main(void)
hsize_t size[1] = {2};
time_t now;
struct tm *tm;
- H5O_info_t oi1, oi2;
+ H5O_info2_t oi1, oi2;
signed char buf1[32], buf2[32];
char filename[1024];
+ int token_cmp;
h5_reset();
fapl = h5_fileaccess();
@@ -90,14 +89,15 @@ main(void)
*/
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR;
- if(H5Oget_info_by_name2(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR;
+ if(H5Oget_info_by_name3(file, "dset", &oi1, H5O_INFO_BASIC|H5O_INFO_TIME, H5P_DEFAULT) < 0) TEST_ERROR;
if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Oget_info2(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR;
+ if(H5Oget_info3(dset, &oi2, H5O_INFO_BASIC|H5O_INFO_TIME) < 0) TEST_ERROR;
+ if(H5Otoken_cmp(file, &oi1.token, &oi2.token, &token_cmp) < 0)TEST_ERROR;
if(H5Dclose(dset) < 0) TEST_ERROR;
if(H5Fclose(file) < 0) TEST_ERROR;
- /* Compare addresses & times from the two ways of calling H5Oget_info() */
- if(oi1.addr != oi2.addr || oi1.ctime != oi2.ctime) {
+ /* Compare object tokens & times from the two ways of calling H5Oget_info() */
+ if(token_cmp || oi1.ctime != oi2.ctime) {
H5_FAILED();
HDputs(" Calling H5Oget_info() with the dataset ID returned");
HDputs(" different values than calling it with a file and dataset");
@@ -134,7 +134,7 @@ main(void)
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
if(file >= 0){
- if(H5Oget_info_by_name2(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(file, "/Dataset1", &oi1, H5O_INFO_TIME, H5P_DEFAULT) < 0)
TEST_ERROR;
if(oi1.ctime != MTIME1) {
H5_FAILED();
@@ -164,7 +164,7 @@ main(void)
file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
if(file >= 0){
- if(H5Oget_info_by_name2(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(file, "/Dataset1", &oi2, H5O_INFO_TIME, H5P_DEFAULT) < 0)
TEST_ERROR;
if(oi2.ctime != MTIME2) {
H5_FAILED();
@@ -188,10 +188,10 @@ main(void)
/* All looks good */
HDputs("All modification time tests passed.");
h5_cleanup(FILENAME, fapl);
- return 0;
+ return EXIT_SUCCESS;
/* Something broke */
error:
- return 1;
-}
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/ntypes.c b/test/ntypes.c
index 83cdfd2..f1d2449 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -1779,10 +1779,10 @@ test_vl_dtype(hid_t file)
} /* end for */
/* Reclaim the read VL data */
- if(H5Dvlen_reclaim(native_type, space, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
+ if(H5Treclaim(native_type, space, H5P_DEFAULT, rdata) < 0) TEST_ERROR;
/* Reclaim the write VL data */
- if(H5Dvlen_reclaim(native_type, space, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
+ if(H5Treclaim(native_type, space, H5P_DEFAULT, wdata) < 0) TEST_ERROR;
/* Close Dataset */
if(H5Dclose(dataset) < 0) TEST_ERROR;
@@ -1808,8 +1808,8 @@ error:
H5E_BEGIN_TRY {
if(native_type > 0) {
- H5Dvlen_reclaim(native_type, space, H5P_DEFAULT, rdata);
- H5Dvlen_reclaim(native_type, space, H5P_DEFAULT, wdata);
+ H5Treclaim(native_type, space, H5P_DEFAULT, rdata);
+ H5Treclaim(native_type, space, H5P_DEFAULT, wdata);
} /* end if */
H5Sclose(space);
H5Dclose(dataset);
@@ -2484,7 +2484,7 @@ test_opaque_dtype(hid_t file)
TEST_ERROR;
for(i = 0; i < sizeof(wbuf); i++)
- wbuf[i] = (unsigned char)0xff ^ (unsigned char)i;
+ wbuf[i] = (unsigned char)(0xff ^ i);
if(H5Dwrite(dset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf) < 0) TEST_ERROR;
if(H5Sclose(space) < 0) TEST_ERROR;
diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c
index 5ed8545..ef76fe6 100644
--- a/test/null_vol_connector.c
+++ b/test/null_vol_connector.c
@@ -28,95 +28,110 @@
/* The VOL class struct */
static const H5VL_class_t null_vol_g = {
- 0, /* version */
- NULL_VOL_CONNECTOR_VALUE, /* value */
- NULL_VOL_CONNECTOR_NAME, /* name */
+ 0, /* version */
+ NULL_VOL_CONNECTOR_VALUE, /* value */
+ NULL_VOL_CONNECTOR_NAME, /* name */
0, /* capability flags */
- NULL, /* initialize */
- NULL, /* terminate */
+ NULL, /* initialize */
+ NULL, /* terminate */
{ /* info_cls */
- (size_t)0, /* size */
- NULL, /* copy */
- NULL, /* compare */
- NULL, /* free */
- NULL, /* to_str */
- NULL, /* from_str */
+ (size_t)0, /* size */
+ NULL, /* copy */
+ NULL, /* compare */
+ NULL, /* free */
+ NULL, /* to_str */
+ NULL, /* from_str */
},
{ /* wrap_cls */
- NULL, /* get_object */
- NULL, /* get_wrap_ctx */
- NULL, /* wrap_object */
- NULL, /* unwrap_object */
- NULL, /* free_wrap_ctx */
+ NULL, /* get_object */
+ NULL, /* get_wrap_ctx */
+ NULL, /* wrap_object */
+ NULL, /* unwrap_object */
+ NULL, /* free_wrap_ctx */
},
{ /* attribute_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* dataset_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* read */
- NULL, /* write */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* read */
+ NULL, /* write */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* datatype_cls */
- NULL, /* commit */
- NULL, /* open */
- NULL, /* get_size */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* commit */
+ NULL, /* open */
+ NULL, /* get_size */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* file_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* group_cls */
- NULL, /* create */
- NULL, /* open */
- NULL, /* get */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* close */
+ NULL, /* create */
+ NULL, /* open */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* close */
},
{ /* link_cls */
- NULL, /* create */
- NULL, /* copy */
- NULL, /* move */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ NULL, /* create */
+ NULL, /* copy */
+ NULL, /* move */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
},
{ /* object_cls */
- NULL, /* open */
- NULL, /* copy */
- NULL, /* get */
- NULL, /* specific */
- NULL /* optional */
+ NULL, /* open */
+ NULL, /* copy */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
+ { /* introspect_cls */
+ NULL, /* get_conn_cls */
+ NULL, /* opt_query */
},
{ /* request_cls */
- NULL, /* wait */
- NULL, /* notify */
- NULL, /* cancel */
- NULL, /* specific */
- NULL, /* optional */
- NULL /* free */
+ NULL, /* wait */
+ NULL, /* notify */
+ NULL, /* cancel */
+ NULL, /* specific */
+ NULL, /* optional */
+ NULL /* free */
+ },
+ { /* blob_cls */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
+ { /* token_cls */
+ NULL, /* cmp */
+ NULL, /* to_str */
+ NULL /* from_str */
},
- NULL /* optional */
+ NULL /* optional */
};
/* These two functions are necessary to load this plugin using
diff --git a/test/objcopy.c b/test/objcopy.c
index 05ddfa4..5174700 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -157,6 +157,7 @@ const char *FILENAME[] = {
#define NUM_SUB_GROUPS 20
#define NUM_WIDE_LOOP_GROUPS 10
#define NUM_DATASETS 10
+#define ATTR_CMPD_STRING "ThisIsAString"
char src_obj_full_name[215]; /* the full path + name of the object to be copied */
@@ -167,7 +168,7 @@ unsigned num_attributes_g; /* Number of attributes created */
static struct {
size_t nalloc; /* number of slots allocated */
size_t nobjs; /* number of objects */
- haddr_t *obj; /* Addresses of objects seen */
+ H5O_token_t *obj; /* Tokens of objects seen */
} idtab_g;
/* Local function prototypes */
@@ -190,19 +191,19 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2);
/*-------------------------------------------------------------------------
- * Function: addr_insert
+ * Function: token_insert
*
- * Purpose: Add an address to the table.
+ * Purpose: Add a token to the table.
*
- * Return: void
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
*/
static void
-addr_insert(H5O_info_t *oi)
+token_insert(H5O_info2_t *oi)
{
size_t n;
@@ -214,64 +215,67 @@ addr_insert(H5O_info_t *oi)
/* Extend the table */
if(idtab_g.nobjs >= idtab_g.nalloc) {
idtab_g.nalloc = MAX(256, 2*idtab_g.nalloc);
- idtab_g.obj = (haddr_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
+ idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
} /* end if */
/* Insert the entry */
n = idtab_g.nobjs++;
- idtab_g.obj[n] = oi->addr;
-} /* end addr_insert() */
+ idtab_g.obj[n] = oi->token;
+} /* end token_insert() */
/*-------------------------------------------------------------------------
- * Function: addr_lookup
- *
- * Purpose: Check if address has already been encountered
+ * Function: token_lookup
*
- * Return: Success: TRUE/FALSE
+ * Purpose: Check if a token has already been encountered
*
- * Failure: (can't fail)
+ * Return: Success: TRUE/FALSE
+ * Failure: (can't fail)
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
*/
static H5_ATTR_PURE hbool_t
-addr_lookup(H5O_info_t *oi)
+token_lookup(hid_t loc_id, H5O_info2_t *oi)
{
- size_t n;
+ size_t n;
+ int token_cmp;
if(oi->rc < 2) return FALSE; /*only one link possible*/
- for(n = 0; n < idtab_g.nobjs; n++)
- if(H5F_addr_eq(idtab_g.obj[n], oi->addr))
+ for(n = 0; n < idtab_g.nobjs; n++) {
+ if(H5Otoken_cmp(loc_id, &idtab_g.obj[n], &oi->token, &token_cmp) < 0)
+ return FALSE;
+ if(!token_cmp)
return TRUE;
+ }
return FALSE;
-} /* end addr_lookup() */
+} /* end token_lookup() */
/*-------------------------------------------------------------------------
- * Function: addr_reset
+ * Function: token_reset
*
- * Purpose: Reset the address tracking data structures
+ * Purpose: Reset the token tracking data structures
*
- * Return: void
+ * Return: void
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Saturday, November 5, 2005
*
*-------------------------------------------------------------------------
*/
static void
-addr_reset(void)
+token_reset(void)
{
if(idtab_g.obj)
HDfree(idtab_g.obj);
idtab_g.obj = NULL;
idtab_g.nalloc = idtab_g.nobjs = 0;
-} /* end addr_reset() */
+} /* end token_reset() */
/*-------------------------------------------------------------------------
@@ -547,7 +551,7 @@ done:
if(tid >0 && sid > 0) {
hid_t dxpl_id = H5Pcreate(H5P_DATASET_XFER);
H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL);
- H5Dvlen_reclaim(tid, sid, dxpl_id, buf);
+ H5Treclaim(tid, sid, dxpl_id, buf);
H5Pclose(dxpl_id);
}
if(sid > 0)
@@ -794,9 +798,9 @@ compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_
/* Reclaim vlen data, if necessary */
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE)
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE)
- if(H5Dvlen_reclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
/* Release raw data buffers */
HDfree(rbuf);
@@ -852,7 +856,7 @@ static int
compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
{
hid_t aid = -1, aid2 = -1; /* Attribute IDs */
- H5O_info_t oinfo1, oinfo2; /* Object info */
+ H5O_info2_t oinfo1, oinfo2; /* Object info */
unsigned cpy_flags; /* Object copy flags */
/* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
@@ -863,10 +867,10 @@ compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
cpy_flags = 0;
/* Check the number of attributes on source dataset */
- if(H5Oget_info2(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+ if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
/* Check the number of attributes on destination dataset */
- if(H5Oget_info2(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+ if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) {
/* Check that the destination has no attributes */
@@ -1055,11 +1059,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
/* break the infinite loop when the ref_object points to itself */
if(obj_owner > 0) {
- H5O_info_t oinfo1, oinfo2;
+ H5O_info2_t oinfo1, oinfo2;
+ int token_cmp;
- if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) {
+ if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) {
if(H5Oclose(obj1_id) < 0) TEST_ERROR
if(H5Oclose(obj2_id) < 0) TEST_ERROR
return TRUE;
@@ -1116,11 +1122,13 @@ compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
/* break the infinite loop when the ref_object points to itself */
if(obj_owner > 0) {
- H5O_info_t oinfo1, oinfo2;
+ H5O_info2_t oinfo1, oinfo2;
+ int token_cmp;
- if(H5Oget_info2(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info2(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5F_addr_eq(oinfo1.addr, oinfo2.addr)) {
+ if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) {
if(H5Oclose(obj1_id) < 0) TEST_ERROR
if(H5Oclose(obj2_id) < 0) TEST_ERROR
return TRUE;
@@ -1273,7 +1281,7 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Check that the space used is the same */
/* (Don't check if the dataset is filtered (i.e. compressed, etc.) and
- * the datatype is VLEN, since the addresses for the vlen
+ * the datatype is VLEN, since the tokens for the vlen
* data in each dataset will (probably) be different and the storage
* size will thus vary)
*/
@@ -1306,9 +1314,9 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
/* Reclaim vlen data, if necessary */
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE)
- if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE)
- if(H5Dvlen_reclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+ if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
/* Release raw data buffers */
HDfree(rbuf);
@@ -1394,8 +1402,8 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
if(ginfo2.nlinks > 0) {
char objname[NAME_BUF_SIZE]; /* Name of object in group */
char objname2[NAME_BUF_SIZE]; /* Name of object in group */
- H5L_info_t linfo; /* Link information */
- H5L_info_t linfo2; /* Link information */
+ H5L_info2_t linfo; /* Link information */
+ H5L_info2_t linfo2; /* Link information */
/* Loop over contents of groups */
for(idx = 0; idx < ginfo.nlinks; idx++) {
@@ -1405,18 +1413,24 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
if(HDstrcmp(objname, objname2)) TEST_ERROR
/* Get link info */
- if(H5Lget_info(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Lget_info(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.type != linfo2.type) TEST_ERROR
/* Extra checks for "real" objects */
if(linfo.type == H5L_TYPE_HARD) {
- hid_t oid, oid2; /* IDs of objects within group */
- H5O_info_t oinfo, oinfo2; /* Object info */
+ hid_t oid, oid2; /* IDs of objects within group */
+ H5O_info2_t oinfo, oinfo2; /* Data model object info */
+ H5O_native_info_t ninfo, ninfo2; /* Native file format object info */
/* Compare some pieces of the object info */
- if(H5Oget_info_by_name2(gid, objname, &oinfo, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
- if(H5Oget_info_by_name2(gid2, objname2, &oinfo2, H5O_INFO_BASIC|H5O_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
+ /* Get data model object info */
+ if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Get native object info */
+ if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
if(oinfo.type != oinfo2.type) TEST_ERROR
if(oinfo.rc != oinfo2.rc) TEST_ERROR
@@ -1427,17 +1441,17 @@ compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
* of messages hasn't increased.
*/
if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) {
- if(oinfo.hdr.nmesgs != oinfo2.hdr.nmesgs)
+ if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs)
;
else
- if(oinfo.hdr.nmesgs < oinfo2.hdr.nmesgs) TEST_ERROR
+ if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs) TEST_ERROR
}
/* Check for object already having been compared */
- if(addr_lookup(&oinfo))
+ if(token_lookup(gid, &oinfo))
continue;
else
- addr_insert(&oinfo);
+ token_insert(&oinfo);
/* Open objects */
if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
@@ -1580,8 +1594,8 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -1605,7 +1619,7 @@ test_copy_named_datatype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
@@ -1673,8 +1687,8 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -1698,7 +1712,7 @@ test_copy_named_datatype_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
@@ -1766,8 +1780,8 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -1797,7 +1811,7 @@ test_copy_named_datatype_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
@@ -1861,10 +1875,11 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
hid_t aid = -1; /* Attribute ID */
hid_t sid = -1; /* Dataspace ID */
hsize_t dims[2] = {3, 4}; /* Dataspace dimensions */
- H5O_info_t oinfo, oinfo2; /* Object info */
+ H5O_info2_t oinfo, oinfo2; /* Object info */
H5G_info_t ginfo; /* Group info */
- char src_filename[NAME_BUF_SIZE];
- char dst_filename[NAME_BUF_SIZE];
+ hbool_t same_type;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
TESTING("H5Ocopy(): named datatype with self-referential attribute");
@@ -1872,8 +1887,8 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -1912,7 +1927,7 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datatype from SRC to DST */
@@ -1939,10 +1954,20 @@ test_copy_named_datatype_attr_self(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* verify that the attribute's datatype is committed */
if(H5Tcommitted(tid) != TRUE) TEST_ERROR
- /* verify that the addresses of the datatypes are the same */
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(H5Oget_info2(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.fileno != oinfo2.fileno || oinfo.addr != oinfo2.addr)
+ /* verify that the tokens of the datatypes are the same */
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(tid2, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
+
+ same_type = TRUE;
+ if(oinfo.fileno == oinfo2.fileno) {
+ int token_cmp;
+ if(H5Otoken_cmp(tid2, &oinfo.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) same_type = FALSE;
+ }
+ else
+ same_type = FALSE;
+
+ if(!same_type)
FAIL_PUTS_ERROR("destination attribute does not use the same committed datatype")
/* Verify that there are only 2 links int he destination root group */
@@ -2015,8 +2040,8 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -2053,7 +2078,7 @@ test_copy_dataset_simple(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -2144,8 +2169,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
h5_fixname(FILENAME[4], fapl_src, src_fname, sizeof src_fname);
h5_fixname(FILENAME[5], fapl_dst, dst_fname, sizeof dst_fname);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Create source file */
fid_src = H5Fcreate(src_fname, H5F_ACC_TRUNC, fcpl_src, fapl_src);
@@ -2187,8 +2212,8 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
/* Loop through all the combinations of low/high library format bounds,
skipping invalid combinations. Create a destination file and copy the
source dataset to it, then verify */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -2202,7 +2227,7 @@ test_copy_dataset_versionbounds(hid_t fcpl_src, hid_t fapl_src)
fid_dst = H5Fcreate(dst_fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_dst);
if (fid_dst < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses
+ /* Create an uncopied object in destination file so that tokens
in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -2306,8 +2331,8 @@ test_copy_dataset_simple_samefile(hid_t fcpl, hid_t fapl)
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
@@ -2413,8 +2438,8 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -2451,7 +2476,7 @@ test_copy_dataset_simple_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -2537,8 +2562,8 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -2582,7 +2607,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -2669,8 +2694,8 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -2867,7 +2892,7 @@ test_copy_dataset_chunked(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datasets from SRC to DST */
@@ -3072,8 +3097,8 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -3265,7 +3290,7 @@ test_copy_dataset_chunked_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datasets from SRC to DST */
@@ -3482,8 +3507,8 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -3640,7 +3665,7 @@ test_copy_dataset_chunked_sparse(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the datasets from SRC to DST */
@@ -3795,8 +3820,8 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -3942,7 +3967,7 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4129,8 +4154,8 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4180,7 +4205,7 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4276,8 +4301,8 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4323,7 +4348,7 @@ test_copy_dataset_compact(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4408,8 +4433,8 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4450,7 +4475,7 @@ test_copy_dataset_external(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4530,8 +4555,8 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4571,7 +4596,7 @@ test_copy_dataset_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hi
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4652,8 +4677,8 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4708,7 +4733,7 @@ test_copy_dataset_named_dtype_hier(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4791,8 +4816,8 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4847,7 +4872,7 @@ test_copy_dataset_named_dtype_hier_outside(hid_t fcpl_src, hid_t fcpl_dst, hid_t
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -4936,8 +4961,8 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -4991,7 +5016,7 @@ test_copy_dataset_multi_ohdr_chunks(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fa
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -5078,8 +5103,8 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -5137,7 +5162,7 @@ test_copy_dataset_attr_named_dtype(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -5224,8 +5249,8 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -5258,7 +5283,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -5290,7 +5315,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -5307,7 +5332,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Sclose(sid);
@@ -5362,8 +5387,8 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -5417,7 +5442,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -5473,7 +5498,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -5490,7 +5515,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Pclose(pid);
H5Tclose(tid);
@@ -5545,8 +5570,8 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -5586,7 +5611,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -5618,7 +5643,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -5635,7 +5660,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Sclose(sid);
@@ -5677,8 +5702,8 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -5712,7 +5737,7 @@ test_copy_attribute_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -5784,7 +5809,8 @@ attach_attribute_compound_vlstr(hid_t loc_id)
int i;
char *v;
} s1;
- s1 buf; /* Buffer */
+ size_t len;
+ s1 buf = {0, NULL}; /* Buffer */
int ret_value = -1; /* Return value */
/* Create dataspace */
@@ -5814,8 +5840,11 @@ attach_attribute_compound_vlstr(hid_t loc_id)
goto done;
/* Write to the attribute */
+ len = HDstrlen(ATTR_CMPD_STRING) + 1;
buf.i = 9;
- buf.v = "ThisIsAString";
+ if(NULL == (buf.v = (char *)HDcalloc(len, sizeof(char))))
+ goto done;
+ HDstrncpy(buf.v, ATTR_CMPD_STRING, len);
if(H5Awrite(aid, cmpd_tid, &buf) < 0)
goto done;
@@ -5832,6 +5861,9 @@ done:
H5Tclose(cmpd_tid);
if(aid > 0)
H5Aclose(aid);
+
+ HDfree(buf.v);
+
return ret_value;
} /* attach_attribute_compound_vlstr */
@@ -5896,8 +5928,8 @@ compare_attribute_compound_vlstr(hid_t loc, hid_t loc2)
/* Reclaim vlen buffer */
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, &rbuf) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, &rbuf2) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, &rbuf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, &rbuf2) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
/* Close the dataspaces */
@@ -5917,8 +5949,8 @@ error:
H5E_BEGIN_TRY {
H5Aclose(aid);
H5Aclose(aid2);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, &rbuf);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, &rbuf2);
+ H5Treclaim(tid, sid, H5P_DEFAULT, &rbuf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, &rbuf2);
H5Sclose(sid);
H5Sclose(sid2);
H5Tclose(tid);
@@ -5963,8 +5995,8 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
@@ -6019,7 +6051,7 @@ test_copy_attribute_compound_vlstr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0)
FAIL_STACK_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
FAIL_STACK_ERROR
@@ -6145,8 +6177,8 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6188,7 +6220,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -6219,7 +6251,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -6239,7 +6271,7 @@ error:
H5Dclose(did2);
H5Dclose(did);
H5Pclose(pid);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Sclose(sid);
@@ -6278,8 +6310,8 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6303,7 +6335,7 @@ test_copy_group_empty(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -6382,8 +6414,8 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6431,7 +6463,7 @@ test_copy_root_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -6513,8 +6545,8 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6563,7 +6595,7 @@ test_copy_group(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -6646,8 +6678,8 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6705,7 +6737,7 @@ test_copy_group_deep(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -6777,8 +6809,8 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6816,7 +6848,7 @@ test_copy_group_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_f
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -6894,8 +6926,8 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -6945,7 +6977,7 @@ test_copy_group_wide_loop(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -7011,7 +7043,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
hid_t plid = -1; /* Object copy plist ID */
hsize_t dim2d[2];
hsize_t dim1d[1];
- H5L_info_t linfo;
+ H5L_info2_t linfo;
int buf[DIM_SIZE_1][DIM_SIZE_2];
int i, j;
unsigned expand_soft;
@@ -7033,8 +7065,8 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename);
h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -7128,7 +7160,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the group from SRC to DST */
@@ -7145,7 +7177,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
* re-add it as a soft link so compare_groups() works */
if(expand_soft) {
/* Check link type */
- if(H5Lget_info(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid_dst, NAME_LINK_SOFT, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.type != H5L_TYPE_HARD)
FAIL_PUTS_ERROR("Soft link was not expanded to a hard link")
@@ -7168,7 +7200,7 @@ test_copy_group_links(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_
* and re-add it as an external link so compare_groups() works */
if(expand_ext) {
/* Check link type */
- if(H5Lget_info(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(fid_dst, NAME_LINK_EXTERN, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
if(linfo.type != H5L_TYPE_HARD)
FAIL_PUTS_ERROR("External link was not expanded to a hard link")
@@ -7288,8 +7320,8 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -7334,7 +7366,7 @@ test_copy_soft_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fa
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -7418,8 +7450,8 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap
h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename);
h5_fixname(FILENAME[2], dst_fapl, ext_filename, sizeof ext_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -7467,7 +7499,7 @@ test_copy_ext_link(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -7551,8 +7583,8 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -7589,7 +7621,7 @@ test_copy_exist(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -7660,8 +7692,8 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -7698,7 +7730,7 @@ test_copy_path(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl)
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST (should fail - intermediate groups not there) */
@@ -7782,8 +7814,8 @@ test_copy_same_file_named_datatype(hid_t fcpl_src, hid_t fapl)
/* Initialize the filenames */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl_src, fapl)) < 0) TEST_ERROR
@@ -7861,8 +7893,8 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
/* Initialize the destination filename */
h5_fixname(FILENAME[1], fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Setup */
if((src_fapl = h5_fileaccess_flags(H5_FILEACCESS_LIBVER)) < 0) TEST_ERROR
@@ -7876,7 +7908,7 @@ test_copy_old_layout(hid_t fcpl_dst, hid_t fapl, hbool_t test_open)
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(test_open) {
@@ -7968,8 +8000,8 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -8018,7 +8050,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -8050,7 +8082,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -8068,7 +8100,7 @@ error:
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid_copy, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
@@ -8122,8 +8154,8 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -8165,7 +8197,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -8197,7 +8229,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -8214,7 +8246,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid_copy, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
@@ -8277,8 +8309,8 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -8330,7 +8362,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -8364,7 +8396,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -8382,7 +8414,7 @@ error:
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid_copy, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
@@ -8438,8 +8470,8 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -8489,7 +8521,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -8521,7 +8553,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_
if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -8539,7 +8571,7 @@ error:
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid_copy, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid_copy);
@@ -8608,8 +8640,8 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -8652,7 +8684,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -8683,7 +8715,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -8701,7 +8733,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid2, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Pclose(pid);
H5Tclose(tid);
@@ -8778,8 +8810,8 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -8823,7 +8855,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -8856,7 +8888,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -8874,7 +8906,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid2, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Pclose(pid);
H5Tclose(tid);
@@ -8944,8 +8976,8 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -9057,7 +9089,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -9076,7 +9108,7 @@ error:
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid2, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid2);
@@ -9152,8 +9184,8 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -9233,7 +9265,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -9252,7 +9284,7 @@ error:
H5Pclose(pid);
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid2, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid);
H5Tclose(tid2);
@@ -9319,8 +9351,8 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -9357,7 +9389,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -9389,7 +9421,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -9407,7 +9439,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Tclose(tid2);
H5Tclose(tid);
@@ -9465,8 +9497,8 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -9510,7 +9542,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -9542,7 +9574,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -9560,7 +9592,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Pclose(pid);
H5Tclose(tid2);
@@ -9618,8 +9650,8 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -9663,7 +9695,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy the dataset from SRC to DST */
@@ -9695,7 +9727,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR
if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR
- if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
+ if(H5Treclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR
if(H5Pclose(dxpl_id) < 0) TEST_ERROR
} /* end if */
@@ -9713,7 +9745,7 @@ error:
H5E_BEGIN_TRY {
H5Dclose(did2);
H5Dclose(did);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf);
+ H5Treclaim(tid, sid, H5P_DEFAULT, buf);
H5Pclose(dxpl_id);
H5Pclose(pid);
H5Tclose(tid2);
@@ -9769,8 +9801,8 @@ test_copy_null_ref(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fap
h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename);
h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Create source file */
if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
@@ -9938,8 +9970,8 @@ test_copy_null_ref_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
h5_fixname(FILENAME[1], src_fapl, mid_filename, sizeof mid_filename);
h5_fixname(FILENAME[2], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Create source file */
if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
@@ -10100,8 +10132,8 @@ test_copy_attr_crt_order(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Create source file */
if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
@@ -10218,11 +10250,12 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src1_filename[NAME_BUF_SIZE];
char src2_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
if(reopen) {
TESTING("H5Ocopy(): merging committed datatypes with reopen")
@@ -10239,8 +10272,8 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
h5_fixname(FILENAME[3], src_fapl, src2_filename, sizeof src2_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source files */
if((fid_src1 = H5Fcreate(src1_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -10316,7 +10349,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy SRC1 to DST */
@@ -10331,31 +10364,34 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open SRC1 committed dtype, get address */
+ /* Open SRC1 committed dtype, get token */
if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open SRC1 dset dtype, check address */
+ /* Open SRC1 dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open SRC2 committed dtype, check address */
+ /* Open SRC2 committed dtype, check token */
if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open SRC2 dset dtype, check address */
+ /* Open SRC2 dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -10369,7 +10405,7 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
/* recreate destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* copy SRC1 to DST */
@@ -10384,19 +10420,20 @@ test_copy_committed_datatype_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open SRC1 dset dtype, get address */
+ /* Open SRC1 dset dtype, get token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open SRC2 dset dtype, check address */
+ /* Open SRC2 dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -10456,9 +10493,10 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char filename[NAME_BUF_SIZE];
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): merging committed datatypes to the source file with reopen")
@@ -10472,8 +10510,8 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
/* Initialize the filename */
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create file */
if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR
@@ -10546,7 +10584,7 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
/*
* First copy each group to the destination group 3 (each with their own
* group), and verify the committed datatypes are merged as expected. All
- * datatypes copied should reference (share an address with) the
+ * datatypes copied should reference (share a token with) the
* corresponding source datatype.
*/
/* Create destination group */
@@ -10565,61 +10603,68 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open group 1 source committed dtype, get address */
+ /* Open group 1 source committed dtype, get token */
if((tid = H5Topen2(fid, NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open group 1 source dset dtype, check address */
+ /* Open group 1 source dset dtype, check token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open group 1 committed dtype, check address */
+ /* Open group 1 committed dtype, check token */
if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open group 1 dset dtype, check address */
+ /* Open group 1 dset dtype, check token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open group 2 source committed dtype, get address and make sure it is
+ /* Open group 2 source committed dtype, get token and make sure it is
* different from group 1 source committed dtype */
if((tid = H5Topen2(fid, NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr == exp_addr) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open group 2 source dset dtype, check address */
+ /* Open group 2 source dset dtype, check token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open group 2 committed dtype, check address */
+ /* Open group 2 committed dtype, check token */
if((tid = H5Topen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATATYPE_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open group 2 dset dtype, check address */
+ /* Open group 2 dset dtype, check token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP3 "/" NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -10643,37 +10688,40 @@ test_copy_committed_datatype_merge_same_file(hid_t fcpl, hid_t fapl, hbool_t reo
if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open group 1 source dset dtype, get address */
+ /* Open group 1 source dset dtype, get token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open group 1 dset dtype, check address */
+ /* Open group 1 dset dtype, check token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open group 2 source dset dtype, get address and make sure it is
+ /* Open group 2 source dset dtype, get token and make sure it is
* different from group 1 source dset dtype */
if((did = H5Dopen2(fid, NAME_GROUP_TOP2 "/" NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr == exp_addr) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open group 2 dset dtype, check address */
+ /* Open group 2 dset dtype, check token */
if((did = H5Dopen2(fid, NAME_GROUP_TOP4 "/" NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -10729,10 +10777,11 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen")
@@ -10747,8 +10796,8 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -10837,17 +10886,18 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "b", get address */
+ /* Open committed dtype "b", get token */
if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open dset dtype, check address */
+ /* Open dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -10875,31 +10925,33 @@ test_copy_committed_dt_merge_sugg(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "a", get address */
+ /* Open committed dtype "a", get token */
if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open dset 2 dtype, check address */
+ /* Open dset 2 dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open committed dtype "b", get address */
+ /* Open committed dtype "b", get token */
if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open dset dtype, check address */
+ /* Open dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -10960,10 +11012,11 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): merging committed datatypes with attributes and reopen")
@@ -10978,8 +11031,8 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -11071,19 +11124,20 @@ test_copy_committed_dt_merge_attr(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open attribute dtype, get address */
+ /* Open attribute dtype, get token */
if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_TOP, "attr", H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Aclose(aid) < 0) TEST_ERROR
- /* Open dset dtype, check address */
+ /* Open dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -11191,10 +11245,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
int i; /* Local index variable */
hsize_t dim1d[1]; /* dimension sizes */
int buf[DIM_SIZE_1]; /* Buffer for data */
- haddr_t exp_addr_int, exp_addr_short; /* Expected object addresses */
- H5O_info_t oinfo; /* Object info */
+ H5O_token_t exp_token_int, exp_token_short; /* Expected object tokenes */
+ H5O_info2_t oinfo; /* Object info */
char src_filename[NAME_BUF_SIZE]; /* Source file name */
char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): hier. of committed datatypes and merging with reopen")
@@ -11209,8 +11264,8 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/*
* Populate source file
@@ -11331,16 +11386,16 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
*/
if(H5Ocopy(fid_src, "/", fid_dst, SRC_ROOT_GROUP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
- /* get address of committed datatype at root group */
+ /* get token of committed datatype at root group */
if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP "/" ROOT_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr_int = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token_int, &oinfo.token, sizeof(exp_token_int));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype at /g0 */
+ /* get token of committed datatype at /g0 */
if((tid = H5Topen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr_short = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token_short, &oinfo.token, sizeof(exp_token_short));
if(H5Tclose(tid) < 0) TEST_ERROR
/* verify the datatype of first dataset is not committed */
@@ -11350,19 +11405,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for second dataset */
+ /* check token of datatype for second dataset */
if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_short) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for third dataset */
+ /* check token of datatype for third dataset */
if((did = H5Dopen2(fid_dst, SRC_ROOT_GROUP NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_int) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -11371,10 +11428,11 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
*/
if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
- /* get address of committed datatype at /g0 */
+ /* get token of committed datatype at /g0 */
if((tid = H5Topen2(fid_dst, NAME_GROUP_TOP "/" GROUP_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_short) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
/* verify the datatype of first dataset is not committed */
@@ -11384,19 +11442,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for second dataset */
+ /* check token of datatype for second dataset */
if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_short) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for third dataset */
+ /* check token of datatype for third dataset */
if((did = H5Dopen2(fid_dst, NAME_GROUP_TOP "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_int) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -11407,19 +11467,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET2, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Ocopy(fid_src, NAME_GROUP_TOP "/" SRC_NDT_DSET3, fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, ocpypl_id, H5P_DEFAULT) < 0) TEST_ERROR
- /* Open attribute with anon ndt (short), get address */
+ /* Open attribute with anon ndt (short), get token */
if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_SHORT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_short) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Aclose(aid) < 0) TEST_ERROR
- /* Open attribute with anon ndt (int), get address */
+ /* Open attribute with anon ndt (int), get token */
if((aid = H5Aopen_by_name(fid_dst, NAME_GROUP_UNCOPIED, DST_ATTR_ANON_INT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_int) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Aclose(aid) < 0) TEST_ERROR
@@ -11430,19 +11492,21 @@ test_copy_cdt_hier_merge(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t d
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for second dataset */
+ /* check token of datatype for second dataset */
if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_short) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_short, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for third dataset */
+ /* check token of datatype for third dataset */
if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr_int) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token_int, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -11464,8 +11528,8 @@ error:
H5Tclose(f_tid);
H5Tclose(g_tid);
H5Tclose(anon_tid);
- H5Pclose(ocpypl_id);
- H5Aclose(aid);
+ H5Pclose(ocpypl_id);
+ H5Aclose(aid);
H5Dclose(did);
H5Sclose(sid);
H5Gclose(gid);
@@ -11515,10 +11579,11 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
hid_t aid = -1; /* Attribute ID */
hid_t ocpypl_id = -1; /* Object copy plist ID */
hsize_t dim1d[1]; /* dimension sizes */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object addresses */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src_filename[NAME_BUF_SIZE]; /* Source file name */
char dst_filename[NAME_BUF_SIZE]; /* Destination file name */
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): merging various committed datatypes with reopen")
@@ -11529,8 +11594,8 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/*
* Populate source file
@@ -11642,53 +11707,57 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
/*
* Verification
*/
- /* get address of committed datatype: /src_root/src_ndt_double */
+ /* get token of committed datatype: /src_root/src_ndt_double */
if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype: /dst_ndt_double */
+ /* get token of committed datatype: /dst_ndt_double */
if((tid = H5Topen2(fid_dst, "/" DST_NDT_DOUBLE, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype: /src_root/src_ndt_float */
+ /* get token of committed datatype: /src_root/src_ndt_float */
if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype: /dst_ndt_float */
+ /* get token of committed datatype: /dst_ndt_float */
if((tid = H5Topen2(fid_dst, "/" DST_NDT_FLOAT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype: /src_root/src_ndt_int */
+ /* get token of committed datatype: /src_root/src_ndt_int */
if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype: /dst_ndt_int */
+ /* get token of committed datatype: /dst_ndt_int */
if((tid = H5Topen2(fid_dst, "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
- /* get address of committed datatype: /src_root/src_ndt_short */
+ /* get token of committed datatype: /src_root/src_ndt_short */
if((tid = H5Topen2(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* open attribute; get its dtype; get dtype's address: /src_root/src_ndt_double/dst_attr */
+ /* open attribute; get its dtype; get dtype's token: /src_root/src_ndt_double/dst_attr */
if((aid = H5Aopen_by_name(fid_dst, "/" SRC_ROOT_GROUP "/" SRC_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Aclose(aid) < 0) TEST_ERROR
@@ -11704,14 +11773,14 @@ test_copy_cdt_merge_cdt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t ds
error:
H5E_BEGIN_TRY {
- H5Pclose(ocpypl_id);
- H5Tclose(tid);
- H5Tclose(tid1);
- H5Tclose(tid2);
- H5Tclose(tid3);
- H5Tclose(tid4);
- H5Tclose(tid5);
- H5Aclose(aid);
+ H5Pclose(ocpypl_id);
+ H5Tclose(tid);
+ H5Tclose(tid1);
+ H5Tclose(tid2);
+ H5Tclose(tid3);
+ H5Tclose(tid4);
+ H5Tclose(tid5);
+ H5Aclose(aid);
H5Sclose(sid);
H5Fclose(fid_dst);
H5Fclose(fid_src);
@@ -11741,10 +11810,11 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
hid_t fid_src = -1, fid_dst = -1; /* File IDs */
hid_t tid = -1; /* Datatype ID */
hid_t ocpypl_id = -1; /* Object copy plist ID */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): merging committed datatypes with suggestions and reopen")
@@ -11755,8 +11825,8 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/*
* Populate source file
@@ -11816,16 +11886,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* open committed dtype "/dst_ndt_int", get its address */
+ /* open committed dtype "/dst_ndt_int", get its token */
if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* check address of "/uncopied/src_ndt_int" */
+ /* check token of "/uncopied/src_ndt_int" */
if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
/* close the DST file */
@@ -11849,16 +11920,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* open committed dtype "/uncopied/src_ndt_int", get its address */
+ /* open committed dtype "/uncopied/src_ndt_int", get its token */
if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* check address of "/src_ndt_int" */
+ /* check token of "/src_ndt_int" */
if((tid = H5Topen2(fid_dst, SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
/* close the DST file */
@@ -11887,16 +11959,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "/uncopied/src_ndt_int", get its address */
+ /* Open committed dtype "/uncopied/src_ndt_int", get its token */
if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* check address of "/src_ndt_int2" */
+ /* check token of "/src_ndt_int2" */
if((tid = H5Topen2(fid_dst, SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
/* close the DST file */
@@ -11921,16 +11994,17 @@ test_copy_cdt_merge_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "/dst_dt_int", get its address */
+ /* Open committed dtype "/dst_dt_int", get its token */
if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* check address of "/uncopied/src_ndt_int2" */
+ /* check token of "/uncopied/src_ndt_int2" */
if((tid = H5Topen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_INT2, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
/* close the DST file */
@@ -11981,10 +12055,11 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): merging committed datatypes of datasets with suggestions and reopen")
@@ -11999,8 +12074,8 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/*
* Populate source file
@@ -12077,17 +12152,18 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "/dst_ndt_int", get its address */
+ /* Open committed dtype "/dst_ndt_int", get its token */
if((tid = H5Topen2(fid_dst, DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* check address of datatype for the copied dataset: "/uncopied/src_ndt_dset" */
+ /* check token of datatype for the copied dataset: "/uncopied/src_ndt_dset" */
if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -12112,19 +12188,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype address */
+ /* Open committed dtype dataset "/uncopied/src_ndt_dset", get its datatype token */
if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for the copied dataset: "/src_ndt_dset" */
+ /* check token of datatype for the copied dataset: "/src_ndt_dset" */
if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -12154,19 +12231,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* open the copied dataset: /uncopied/src_ndt_dset", get its address */
+ /* open the copied dataset: /uncopied/src_ndt_dset", get its token */
if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for the copied dataset: "/src_ndt_dset2" */
+ /* check token of datatype for the copied dataset: "/src_ndt_dset2" */
if((did = H5Dopen2(fid_dst, SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -12192,19 +12270,20 @@ test_copy_cdt_merge_dset_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* open the copied dataset: "/src_ndt_dset", get its datatype address */
+ /* open the copied dataset: "/src_ndt_dset", get its datatype token */
if((did = H5Dopen2(fid_dst, SRC_NDT_DSET, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* check address of datatype for the copied dataset: /uncopied/src_ndt_dset2 */
+ /* check token of datatype for the copied dataset: /uncopied/src_ndt_dset2 */
if((did = H5Dopen2(fid_dst, NAME_GROUP_UNCOPIED "/" SRC_NDT_DSET2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -12272,8 +12351,8 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/*
* Populate source file
@@ -12537,7 +12616,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* open committed dtype "/dst_grp/dst_dt_int", get its address */
+ /* open committed dtype "/dst_grp/dst_dt_int", get its token */
if((exp_tid = H5Topen2(fid_dst, "/" DST_GRP "/" DST_NDT_INT, H5P_DEFAULT)) < 0) TEST_ERROR
/* open datatype of dataset */
@@ -12630,7 +12709,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((aid = H5Aopen_by_name(fid_dst, DST_NDT_DOUBLE, DST_ATTR, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if((exp_tid = H5Aget_type(aid)) < 0) TEST_ERROR
- /* Open datatype of dataset, check address */
+ /* Open datatype of dataset, check token */
if((did = H5Dopen2(fid_dst, "A_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
@@ -12667,7 +12746,7 @@ test_copy_cdt_merge_all_suggs(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
/* open committed dtype "/dst_ndt_short" */
if((exp_tid = H5Topen2(fid_dst, "/" DST_NDT_SHORT, H5P_DEFAULT)) < 0) TEST_ERROR
- /* open datatype of dataset, check address */
+ /* open datatype of dataset, check token */
if((did = H5Dopen2(fid_dst, "B_src_dset", H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
@@ -12749,11 +12828,12 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
unsigned int i; /* Local index variables */
hsize_t dim1d[1]; /* Dataset dimensions */
int buf[DIM_SIZE_1]; /* Buffer for writing data */
- H5O_info_t oinfo; /* Object info */
- haddr_t exp_addr; /* Expected object address */
+ H5O_info2_t oinfo; /* Object info */
+ H5O_token_t exp_token; /* Expected object token */
char src_filename[NAME_BUF_SIZE];
char dst_filename[NAME_BUF_SIZE];
mcdt_search_cb_ud cb_udata; /* User data for callback */
+ int token_cmp;
if(reopen)
TESTING("H5Ocopy(): H5Pset_mcdt_search_cb and reopen")
@@ -12768,8 +12848,8 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -12861,17 +12941,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "b", get address */
+ /* Open committed dtype "b", get token */
if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open dset dtype, check address */
+ /* Open dset dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -12909,17 +12990,18 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "a", get address */
+ /* Open committed dtype "a", get token */
if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open copied dataset and its dtype, check address */
+ /* Open copied dataset and its dtype, check token */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE2, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr != exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -12948,31 +13030,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "a", get address */
+ /* Open committed dtype "a", get token */
if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open the copied dataset and get its dtype, addresses should not be equal */
+ /* Open the copied dataset and get its dtype, tokens should not be equal */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr == exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open committed dtype "b", get address */
+ /* Open committed dtype "b", get token */
if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open the copied dataset and get its dtype, addresses should not be equal */
+ /* Open the copied dataset and get its dtype, tokens should not be equal */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr == exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -13008,31 +13092,33 @@ test_copy_set_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
if((fid_dst = H5Fopen(dst_filename, H5F_ACC_RDONLY, dst_fapl)) < 0) TEST_ERROR
} /* end if */
- /* Open committed dtype "a", get address */
+ /* Open committed dtype "a", get token */
if((tid = H5Topen2(fid_dst, "/a", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open the copied dataset and get its dtype, addresses should not be equal */
+ /* Open the copied dataset and get its dtype, tokens should not be equal */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr == exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- /* Open committed dtype "b", get address */
+ /* Open committed dtype "b", get token */
if((tid = H5Topen2(fid_dst, "/b", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- exp_addr = oinfo.addr;
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ HDmemcpy(&exp_token, &oinfo.token, sizeof(exp_token));
if(H5Tclose(tid) < 0) TEST_ERROR
- /* Open the copied dataset and get its dtype, addresses should not be equal */
+ /* Open the copied dataset and get its dtype, tokens should not be equal */
if((did = H5Dopen2(fid_dst, NAME_DATASET_SIMPLE3, H5P_DEFAULT)) < 0) TEST_ERROR
if((tid = H5Dget_type(did)) < 0) TEST_ERROR
- if(H5Oget_info2(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
- if(oinfo.addr == exp_addr) TEST_ERROR
+ if(H5Oget_info3(tid, &oinfo, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(tid, &oinfo.token, &exp_token, &token_cmp) < 0) TEST_ERROR
+ if(!token_cmp) TEST_ERROR
if(H5Tclose(tid) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
@@ -13127,8 +13213,8 @@ test_copy_set_get_mcdt_search_cb(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -13375,7 +13461,7 @@ error:
*/
static herr_t
test_copy_iterate_cb(hid_t loc_id, const char *name,
- const H5L_info_t H5_ATTR_UNUSED *link_info, void *op_data)
+ const H5L_info2_t H5_ATTR_UNUSED *link_info, void *op_data)
{
hid_t dst_loc_id = *((hid_t *)op_data);
@@ -13404,8 +13490,8 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], src_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Create source file */
if((fid1 = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0)
@@ -13435,8 +13521,7 @@ test_copy_iterate(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl
/* Iterate over links in the root group, copying each object */
if((gid = H5Gopen2(fid1, "/", H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb,
- &fid2) < 0)
+ if(H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_copy_iterate_cb, &fid2) < 0)
TEST_ERROR
/* Close */
@@ -13499,8 +13584,8 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -13634,7 +13719,7 @@ test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination
+ /* Create an uncopied object in destination file so that tokens in source and destination
files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
@@ -13820,8 +13905,8 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* create source file */
if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
@@ -13829,7 +13914,7 @@ test_copy_dataset_open(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst
/* create destination file */
if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
- /* Create an uncopied object in destination file so that addresses in source and destination files aren't the same */
+ /* Create an uncopied object in destination file so that tokens in source and destination files aren't the same */
if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Set dataspace dimensions */
@@ -14366,8 +14451,8 @@ main(void)
*/
} /* end for */
- /* Reset file address checking info */
- addr_reset();
+ /* Reset file token checking info */
+ token_reset();
/* Verify symbol table messages are cached */
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
diff --git a/test/objcopy_ref.c b/test/objcopy_ref.c
new file mode 100644
index 0000000..20c6138
--- /dev/null
+++ b/test/objcopy_ref.c
@@ -0,0 +1,1698 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Peter X. Cao
+ * May 01, 2005
+ *
+ * Purpose: Test H5Ocopy() for references.
+ */
+
+#include "testhdf5.h"
+
+#define H5F_FRIEND /*suppress error about including H5Fpkg */
+#define H5F_TESTING
+#include "H5Fpkg.h" /* File access */
+
+const char *FILENAME[] = {
+ "objcopy_ref_src",
+ "objcopy_ref_dst",
+ "objcopy_ref_ext",
+ "objcopy_ref_src2",
+ "verbound_ref_src",
+ "verbound_ref_dst",
+ NULL
+};
+
+/* Configuration, really a series of bit flags. Maximum value is all three
+ * bit flags enabled.
+ */
+#define CONFIG_SHARE_SRC 1
+#define CONFIG_SHARE_DST 2
+#define CONFIG_SRC_NEW_FORMAT 4
+#define CONFIG_DST_NEW_FORMAT 8
+#define CONFIG_DENSE 16
+#define MAX_CONFIGURATION 31
+
+#define NAME_DATASET_SIMPLE "dataset_simple"
+#define NAME_DATASET_SUB_SUB "/g0/g00/g000/dataset_simple"
+#define NAME_GROUP_UNCOPIED "/uncopied"
+#define NAME_GROUP_TOP "/g0"
+#define NAME_GROUP_SUB "/g0/g00"
+#define NAME_GROUP_SUB_SUB2 "g000"
+#define NAME_GROUP_LINK "/g_links"
+#define NAME_GROUP_LINK2 "/g_links2"
+#define NAME_GROUP_REF "ref_grp"
+#define NAME_LINK_SOFT "/g_links/soft_link_to_dataset_simple"
+#define NAME_LINK_SOFT2 "/g_links2/soft_link_to_dataset_simple"
+#define NAME_LINK_EXTERN "/g_links/external_link_to_dataset_simple"
+#define NAME_LINK_EXTERN2 "/g_links2/external_link_to_dataset_simple"
+#define NAME_LINK_SOFT_DANGLE "/g_links/soft_link_to_nowhere"
+#define NAME_LINK_SOFT_DANGLE2 "/g_links2/soft_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE "/g_links/external_link_to_nowhere"
+#define NAME_LINK_EXTERN_DANGLE2 "/g_links2/external_link_to_nowhere"
+
+#define NAME_BUF_SIZE 1024
+#define ATTR_NAME_LEN 80
+#define DIM_SIZE_1 12
+#define DIM_SIZE_2 6
+
+unsigned num_attributes_g; /* Number of attributes created */
+
+/* Table containing object id and object name */
+/* (Used for detecting duplicate objects when comparing groups */
+static struct {
+ size_t nalloc; /* number of slots allocated */
+ size_t nobjs; /* number of objects */
+ H5O_token_t *obj; /* tokens for objects seen */
+} idtab_g;
+
+/* Local function prototypes */
+static int
+compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
+ const void *buf1, const void *buf2, hid_t obj_owner);
+static int
+compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf);
+static int
+compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags);
+
+/*-------------------------------------------------------------------------
+ * Function: token_insert
+ *
+ * Purpose: Add a token to the table.
+ *
+ * Return: void
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 5, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+token_insert(H5O_info2_t *oinfo)
+{
+ size_t n;
+
+ /* Don't add it if the link count is 1 because such an object can only
+ * be encountered once. */
+ if(oinfo->rc < 2)
+ return;
+
+ /* Extend the table */
+ if(idtab_g.nobjs >= idtab_g.nalloc) {
+ idtab_g.nalloc = MAX(256, 2 * idtab_g.nalloc);
+ idtab_g.obj = (H5O_token_t *)HDrealloc(idtab_g.obj, idtab_g.nalloc * sizeof(idtab_g.obj[0]));
+ }
+
+ /* Insert the entry */
+ n = idtab_g.nobjs++;
+ idtab_g.obj[n] = oinfo->token;
+} /* end token_insert() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: token_lookup
+ *
+ * Purpose: Check if a token has already been encountered
+ *
+ * Return: Success: TRUE/FALSE
+ * Failure: (can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 5, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5_ATTR_PURE hbool_t
+token_lookup(hid_t loc_id, H5O_info2_t *oinfo)
+{
+ size_t n;
+ int token_cmp;
+
+ if(oinfo->rc < 2)
+ return FALSE; /*only one link possible*/
+
+ for(n = 0; n < idtab_g.nobjs; n++) {
+ if(H5Otoken_cmp(loc_id, &(idtab_g.obj[n]), &oinfo->token, &token_cmp) < 0)
+ return FALSE;
+ if(0 == token_cmp)
+ return TRUE;
+ }
+
+ return FALSE;
+} /* end token_lookup() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: token_reset
+ *
+ * Purpose: Reset the token tracking data structures
+ *
+ * Return: void
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, November 5, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+token_reset(void)
+{
+ if(idtab_g.obj)
+ HDfree(idtab_g.obj);
+ idtab_g.obj = NULL;
+ idtab_g.nalloc = idtab_g.nobjs = 0;
+} /* end token_reset() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: attach_ref_attr
+ *
+ * Purpose: Create an attribute with object references
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+attach_ref_attr(hid_t file_id, hid_t loc_id)
+{
+ char dsetname1[] = "dataset1_pointed_by_ref_attr";
+ char dsetname2[] = "dataset2_pointed_by_ref_attr";
+ hid_t did1 = (-1), did2 = (-1), aid = (-1), sid = (-1), sid_ref = (-1);
+ hsize_t dims[2] = {2,9};
+ hsize_t dims_ref[1] = {2};
+ H5R_ref_t ref[2];
+ int data1[2][9] = {{1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,18}};
+ int data2[2][9] = {{2,2,2,2,2,2,2,2,2},{2,2,2,2,2,2,2,2,18}};
+
+ /* creates two simple datasets */
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
+ if((sid_ref = H5Screate_simple(1, dims_ref, NULL)) < 0) TEST_ERROR
+ if((did1 = H5Dcreate2(file_id, dsetname1, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did1, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data1) < 0) TEST_ERROR
+ if((did2 = H5Dcreate2(file_id, dsetname2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data2) < 0) TEST_ERROR
+
+ /* create an attribute with two object references */
+ if(H5Rcreate_object(file_id, dsetname1, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR
+ if(H5Rcreate_object(file_id, dsetname2, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR
+ if((aid = H5Acreate2(loc_id, "obj_ref_attr", H5T_STD_REF, sid_ref, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR
+
+ if(H5Sclose(sid) < 0) TEST_ERROR
+ if(H5Sclose(sid_ref) < 0) TEST_ERROR
+ if(H5Dclose(did1) < 0) TEST_ERROR
+ if(H5Dclose(did2) < 0) TEST_ERROR
+ if(H5Aclose(aid) < 0) TEST_ERROR
+ if(H5Rdestroy(&ref[0]) < 0) TEST_ERROR
+ if(H5Rdestroy(&ref[1]) < 0) TEST_ERROR
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(sid);
+ H5Sclose(sid_ref);
+ H5Dclose(did1);
+ H5Dclose(did2);
+ H5Aclose(aid);
+ H5Rdestroy(&ref[0]);
+ H5Rdestroy(&ref[1]);
+ } H5E_END_TRY;
+
+ return(-1);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: attach_reg_ref_attr
+ *
+ * Purpose: Create an attribute with object references
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Monday, March 5, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+attach_reg_ref_attr(hid_t file_id, hid_t loc_id)
+{
+ const char dsetnamev[] = "dataset_pointed_by_reg_ref_attr";
+ hid_t aid = (-1);
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1); /* dataspace identifiers */
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hsize_t dims[2] = {2,9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr =1;
+ H5R_ref_t ref[2];
+ int data[2][9] = {{1,1,2,3,3,4,5,5,999},{1,2,2,3,4,4,5,6,999}};
+ hsize_t start[2] = {0, 3};
+ hsize_t count[2] = {2, 3};
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
+
+ /* create a 2D dataset */
+ if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
+ if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
+ if((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
+
+ /* create reg_ref of block selection */
+ if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
+ if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR
+
+ /* create reg_ref of point selection */
+ if(H5Sselect_none(space_id) < 0) TEST_ERROR
+ if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR
+ if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR
+
+ /* create reg_ref attribute */
+ if((aid = H5Acreate2(loc_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR
+
+ /* attach the reg_ref attribute to the dataset itself */
+ if(H5Aclose(aid) < 0) TEST_ERROR
+ if((aid = H5Acreate2(dsetv_id, "reg_ref_attr", H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Awrite(aid, H5T_STD_REF, ref) < 0) TEST_ERROR
+
+ if(H5Sclose(spacer_id) < 0) TEST_ERROR
+ if(H5Sclose(space_id) < 0) TEST_ERROR
+ if(H5Dclose(dsetv_id) < 0) TEST_ERROR
+ if(H5Aclose(aid) < 0) TEST_ERROR
+ if(H5Rdestroy(&ref[0]) < 0) TEST_ERROR
+ if(H5Rdestroy(&ref[1]) < 0) TEST_ERROR
+
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(spacer_id);
+ H5Sclose(space_id);
+ H5Dclose(dsetv_id);
+ H5Aclose(aid);
+ H5Rdestroy(&ref[0]);
+ H5Rdestroy(&ref[1]);
+ } H5E_END_TRY;
+
+ return(-1);
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: create_reg_ref_dataset
+ *
+ * Purpose: Create a dataset with region references
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Friday, August 4, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+create_reg_ref_dataset(hid_t file_id, hid_t loc_id)
+{
+ const char dsetnamev[] = "dataset_pointed_by_ref_dset";
+ const char dsetnamer[] = "dataset_with_reg_ref";
+ const char dsetnamer1[] = "compact_dataset_with_reg_ref";
+ const char dsetnamer2[] = "compressed_dataset_with_reg_ref";
+ hid_t space_id = (-1); /* dataspace identifiers */
+ hid_t spacer_id = (-1);
+ hid_t dsetv_id = (-1); /*dataset identifiers*/
+ hid_t dsetr_id = (-1);
+ hsize_t dims[2] = {2,9};
+ hsize_t dimsr[1] = {2};
+ int rank = 2;
+ int rankr =1;
+ hsize_t chunk_size=1;
+ H5R_ref_t ref[2];
+ int data[2][9] = {{1,1,2,3,3,4,5,5,6},{1,2,2,3,4,4,5,6,6}};
+ hsize_t start[2];
+ hsize_t count[2];
+ hsize_t coord[3][2] = {{0, 0}, {1, 6}, {0, 8}};
+ size_t num_points = 3;
+ hid_t pid = (-1);
+
+ if((space_id = H5Screate_simple(rank, dims, NULL)) < 0) TEST_ERROR
+ if((spacer_id = H5Screate_simple(rankr, dimsr, NULL)) < 0) TEST_ERROR
+ if((dsetv_id = H5Dcreate2(file_id, dsetnamev, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(dsetv_id, H5T_NATIVE_INT, H5S_ALL , H5S_ALL, H5P_DEFAULT,data) < 0) TEST_ERROR
+ if((dsetr_id = H5Dcreate2(loc_id, dsetnamer, H5T_STD_REF, spacer_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ start[0] = 0;
+ start[1] = 3;
+ count[0] = 2;
+ count[1] = 3;
+ if(H5Sselect_hyperslab(space_id,H5S_SELECT_SET,start,NULL,count,NULL) < 0) TEST_ERROR
+ if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[0]) < 0) TEST_ERROR
+ if(H5Sselect_none(space_id) < 0) TEST_ERROR
+ if(H5Sselect_elements(space_id, H5S_SELECT_SET, num_points, (const hsize_t *)coord) < 0) TEST_ERROR
+ if(H5Rcreate_region(file_id, dsetnamev, space_id, H5P_DEFAULT, &ref[1]) < 0) TEST_ERROR
+ if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
+ if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+
+ /* create and set compact plist */
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_layout(pid, H5D_COMPACT) < 0) TEST_ERROR
+
+ if((dsetr_id = H5Dcreate2(loc_id, dsetnamer1, H5T_STD_REF, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref) < 0) TEST_ERROR
+ if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+
+ /* create and set comp & chunk plist */
+ if((pid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, 1, &chunk_size) < 0) TEST_ERROR
+ if(H5Pset_deflate(pid, 9) < 0) TEST_ERROR
+
+ if((dsetr_id = H5Dcreate2(loc_id, dsetnamer2, H5T_STD_REF, spacer_id, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Dwrite(dsetr_id, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT,ref) < 0) TEST_ERROR
+ if(H5Dclose(dsetr_id) < 0) TEST_ERROR
+
+ if(H5Sclose(space_id) < 0) TEST_ERROR
+ if(H5Sclose(spacer_id) < 0) TEST_ERROR
+ if(H5Dclose(dsetv_id) < 0) TEST_ERROR
+ if(H5Rdestroy(&ref[0]) < 0) TEST_ERROR
+ if(H5Rdestroy(&ref[1]) < 0) TEST_ERROR
+
+ return 0;
+
+
+error:
+ H5E_BEGIN_TRY {
+ H5Sclose(space_id);
+ H5Sclose(spacer_id);
+ H5Dclose(dsetr_id);
+ H5Dclose(dsetv_id);
+ H5Pclose(pid);
+ H5Rdestroy(&ref[0]);
+ H5Rdestroy(&ref[1]);
+ } H5E_END_TRY;
+
+ return(-1);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_attach_attributes
+ *
+ * Purpose: Attach NUM_ATTRIBUTES attributes to the object to be copied
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Peter Cao
+ * Friday, September 30, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_attach_attributes(hid_t loc_id, hid_t type_id)
+{
+ hid_t aid = -1, sid = -1;
+ char attr_name[ATTR_NAME_LEN];
+ int attr_data[2];
+ hsize_t dim1 = 2;
+ hid_t acpl = -1;
+ unsigned u;
+ int ret_value = -1;
+
+ if((sid = H5Screate_simple(1, &dim1, NULL)) < 0 )
+ goto done;
+
+ /* Create attribute creation plist */
+ if((acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE)) < 0)
+ goto done;
+
+ for(u = 0; u < num_attributes_g; u++) {
+ HDsprintf(attr_name, "%u attr", u);
+
+ /* Set attribute data */
+ attr_data[0] = (int)(100 * u);
+ attr_data[1] = (int)(200 * u);
+
+ /* Set attribute character set (alternate) */
+ if(u % 2) {
+ if(H5Pset_char_encoding(acpl, H5T_CSET_ASCII) < 0)
+ goto done;
+ } /* end if */
+ else
+ if(H5Pset_char_encoding(acpl, H5T_CSET_UTF8) < 0)
+ goto done;
+
+ if((aid = H5Acreate2(loc_id, attr_name, type_id, sid, acpl, H5P_DEFAULT)) < 0)
+ goto done;
+
+ if(H5Awrite(aid, H5T_NATIVE_INT, attr_data) < 0)
+ goto done;
+
+ if(aid > 0)
+ H5Aclose(aid);
+
+ aid = -1;
+ }
+
+ ret_value = 0;
+
+done:
+ if(sid > 0)
+ H5Sclose(sid);
+ if(aid > 0)
+ H5Aclose(aid);
+ if(acpl > 0)
+ H5Pclose(acpl);
+
+ return ret_value;
+}
+
+/*-------------------------------------------------------------------------
+ * Function: compare_attribute
+ *
+ * Purpose: Compare two attributes to check that they are equal
+ *
+ * Return: TRUE if attributes are equal/FALSE if they are different
+ *
+ * Programmer: Peter Cao
+ * Saturday, December 17, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_attribute(hid_t aid, hid_t aid2, hid_t pid, const void *wbuf, hid_t obj_owner)
+{
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ size_t elmt_size; /* Size of datatype */
+ htri_t is_committed; /* If the datatype is committed */
+ htri_t is_committed2; /* If the datatype is committed */
+ H5A_info_t ainfo; /* Attribute info */
+ H5A_info_t ainfo2; /* Attribute info */
+ hssize_t nelmts; /* # of elements in dataspace */
+ void *rbuf = NULL; /* Buffer for reading raw data */
+ void *rbuf2 = NULL; /* Buffer for reading raw data */
+
+ /* Check the character sets are equal */
+ if(H5Aget_info(aid, &ainfo) < 0) TEST_ERROR
+ if(H5Aget_info(aid2, &ainfo2) < 0) TEST_ERROR
+ if(ainfo.cset != ainfo2.cset) TEST_ERROR
+
+ /* Check the creation orders are equal (if appropriate) */
+ if(ainfo.corder_valid != ainfo2.corder_valid) TEST_ERROR
+ if(ainfo.corder_valid)
+ if(ainfo.corder != ainfo2.corder) TEST_ERROR
+
+ /* Check the datatypes are equal */
+
+ /* Open the datatype for the source attribute */
+ if((tid = H5Aget_type(aid)) < 0) TEST_ERROR
+
+ /* Open the datatype for the destination attribute */
+ if((tid2 = H5Aget_type(aid2)) < 0) TEST_ERROR
+
+ /* Check that both datatypes are committed/not committed */
+ if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
+ if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
+ if(is_committed != is_committed2) TEST_ERROR
+
+ /* Compare the datatypes */
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+
+ /* Determine the size of datatype (for later) */
+ if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+
+ /* Check the dataspaces are equal */
+
+ /* Open the dataspace for the source attribute */
+ if((sid = H5Aget_space(aid)) < 0) TEST_ERROR
+
+ /* Open the dataspace for the destination attribute */
+ if((sid2 = H5Aget_space(aid2)) < 0) TEST_ERROR
+
+ /* Compare the dataspaces */
+ if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+
+ /* Determine the number of elements in dataspace (for later) */
+ if((nelmts = H5Sget_simple_extent_npoints(sid2)) < 0) TEST_ERROR
+
+ /* Check the raw data is equal */
+
+ /* Allocate & initialize space for the raw data buffers */
+ if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+
+ /* Read data from the source attribute */
+ if(H5Aread(aid, tid, rbuf) < 0) TEST_ERROR
+
+ /* Read data from the destination attribute */
+ if(H5Aread(aid2, tid2, rbuf2) < 0) TEST_ERROR
+
+ /* Check raw data read in against data written out */
+ if(wbuf) {
+ if(!compare_data(aid, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, obj_owner)) TEST_ERROR
+ if(!compare_data(aid2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, obj_owner)) TEST_ERROR
+ } /* end if */
+ /* Don't have written data, just compare data between the two attributes */
+ else
+ if(!compare_data(aid, aid2, pid, tid, (size_t)nelmts, rbuf, rbuf2, obj_owner)) TEST_ERROR
+
+ /* Reclaim vlen data, if necessary */
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE || H5Tdetect_class(tid, H5T_REFERENCE) == TRUE)
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE || H5Tdetect_class(tid2, H5T_REFERENCE) == TRUE)
+ if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+
+ /* Release raw data buffers */
+ HDfree(rbuf);
+ rbuf = NULL;
+ HDfree(rbuf2);
+ rbuf2 = NULL;
+
+ /* close the source dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ /* close the destination dataspace */
+ if(H5Sclose(sid2) < 0) TEST_ERROR
+
+ /* close the source datatype */
+ if(H5Tclose(tid) < 0) TEST_ERROR
+
+ /* close the destination datatype */
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+
+ return TRUE;
+
+error:
+ if(rbuf)
+ HDfree(rbuf);
+ if(rbuf2)
+ HDfree(rbuf2);
+ H5E_BEGIN_TRY {
+ H5Sclose(sid2);
+ H5Sclose(sid);
+ H5Tclose(tid2);
+ H5Tclose(tid);
+ } H5E_END_TRY;
+ return FALSE;
+} /* end compare_attribute() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: compare_std_attributes
+ *
+ * Purpose: Compare "standard" attributes on two objects to check that they are equal
+ *
+ * Return: TRUE if objects have same attributes/FALSE if they are different
+ *
+ * Programmer: Quincey Koziol
+ * Monday, October 31, 2005
+ *
+ * Note: This isn't very general, the attributes are assumed to be
+ * those written in test_copy_attach_attributes().
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_std_attributes(hid_t oid, hid_t oid2, hid_t pid)
+{
+ hid_t aid = -1, aid2 = -1; /* Attribute IDs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info */
+ unsigned cpy_flags; /* Object copy flags */
+
+ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
+ if(pid != H5P_DEFAULT) {
+ if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ } /* end if */
+ else
+ cpy_flags = 0;
+
+ /* Check the number of attributes on source dataset */
+ if(H5Oget_info3(oid, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+
+ /* Check the number of attributes on destination dataset */
+ if(H5Oget_info3(oid2, &oinfo2, H5O_INFO_NUM_ATTRS) < 0) TEST_ERROR
+
+ if(cpy_flags & H5O_COPY_WITHOUT_ATTR_FLAG) {
+ /* Check that the destination has no attributes */
+ if(oinfo2.num_attrs != 0) TEST_ERROR
+ } /* end if */
+ else {
+ char attr_name[ATTR_NAME_LEN]; /* Attribute name */
+ unsigned i; /* Local index variable */
+
+ /* Compare the number of attributes */
+ if(oinfo1.num_attrs != oinfo2.num_attrs) TEST_ERROR
+
+ /* Check the attributes are equal */
+ for(i = 0; i < (unsigned)oinfo1.num_attrs; i++) {
+ if((aid = H5Aopen_by_idx(oid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)i, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Aget_name(aid, (size_t)ATTR_NAME_LEN, attr_name) < 0) TEST_ERROR
+
+ if((aid2 = H5Aopen(oid2, attr_name, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check the attributes are equal */
+ if(!compare_attribute(aid, aid2, pid, NULL, oid)) TEST_ERROR
+
+ /* Close the attributes */
+ if(H5Aclose(aid) < 0) TEST_ERROR
+ if(H5Aclose(aid2) < 0) TEST_ERROR
+ } /* end for */
+ } /* end if */
+
+ /* Objects should be the same. :-) */
+ return TRUE;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Aclose(aid2);
+ H5Aclose(aid);
+ } H5E_END_TRY;
+ return FALSE;
+} /* end compare_std_attributes() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: compare_data
+ *
+ * Purpose: Compare two buffers of data to check that they are equal
+ *
+ * Return: TRUE if buffer are equal/FALSE if they are different
+ *
+ * Programmer: Quincey Koziol
+ * Monday, November 21, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_data(hid_t parent1, hid_t parent2, hid_t pid, hid_t tid, size_t nelmts,
+ const void *buf1, const void *buf2, hid_t obj_owner)
+{
+ size_t elmt_size; /* Size of an element */
+
+ /* Check size of each element */
+ if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+
+ /* If the type is a compound containing a vlen, loop over all elements for
+ * each compound member. Compounds containing reference are not supported
+ * yet. */
+ if((H5Tget_class(tid) == H5T_COMPOUND)
+ && (H5Tdetect_class(tid, H5T_VLEN) == TRUE)) {
+ hid_t memb_id; /* Member id */
+ const uint8_t *memb1; /* Pointer to current member */
+ const uint8_t *memb2; /* Pointer to current member */
+ int nmembs; /* Number of members */
+ size_t memb_off; /* Member offset */
+ size_t memb_size; /* Member size */
+ unsigned memb_idx; /* Member index */
+ size_t elmt; /* Current element */
+
+ /* Get number of members in compound */
+ if((nmembs = H5Tget_nmembers(tid)) < 0) TEST_ERROR
+
+ /* Loop over members */
+ for(memb_idx=0; memb_idx<(unsigned)nmembs; memb_idx++) {
+ /* Get member offset. Note that we cannot check for an error here.
+ */
+ memb_off = H5Tget_member_offset(tid, memb_idx);
+
+ /* Get member id */
+ if((memb_id = H5Tget_member_type(tid, memb_idx)) < 0) TEST_ERROR
+
+ /* Get member size */
+ if((memb_size = H5Tget_size(memb_id)) == 0) TEST_ERROR
+
+ /* Set up pointers to member in the first element */
+ memb1 = (const uint8_t *)buf1 + memb_off;
+ memb2 = (const uint8_t *)buf2 + memb_off;
+
+ /* Check if this member contains (or is) a vlen */
+ if(H5Tget_class(memb_id) == H5T_VLEN) {
+ hid_t base_id; /* vlen base type id */
+
+ /* Get base type of vlen datatype */
+ if((base_id = H5Tget_super(memb_id)) < 0) TEST_ERROR
+
+ /* Iterate over all elements, recursively calling this function
+ * for each */
+ for(elmt=0; elmt<nelmts; elmt++) {
+ /* Check vlen lengths */
+ if(((const hvl_t *)((const void *)memb1))->len
+ != ((const hvl_t *)((const void *)memb2))->len)
+ TEST_ERROR
+
+ /* Check vlen data */
+ if(!compare_data(parent1, parent2, pid, base_id,
+ ((const hvl_t *)((const void *)memb1))->len,
+ ((const hvl_t *)((const void *)memb1))->p,
+ ((const hvl_t *)((const void *)memb2))->p, obj_owner))
+ TEST_ERROR
+
+ /* Update member pointers */
+ memb1 += elmt_size;
+ memb2 += elmt_size;
+ } /* end for */
+ } else {
+ /* vlens cannot currently be nested below the top layer of a
+ * compound */
+ HDassert(H5Tdetect_class(memb_id, H5T_VLEN) == FALSE);
+
+ /* Iterate over all elements, calling memcmp() for each */
+ for(elmt=0; elmt<nelmts; elmt++) {
+ if(HDmemcmp(memb1, memb2, memb_size))
+ TEST_ERROR
+
+ /* Update member pointers */
+ memb1 += elmt_size;
+ memb2 += elmt_size;
+ } /* end for */
+ } /* end else */
+ } /* end for */
+ } else if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) {
+ const hvl_t *vl_buf1, *vl_buf2; /* Aliases for buffers to compare */
+ hid_t base_tid; /* Base type of vlen datatype */
+ size_t u; /* Local index variable */
+
+ /* Check for "simple" vlen datatype */
+ if(H5Tget_class(tid) != H5T_VLEN) TEST_ERROR
+
+ /* Get base type of vlen datatype */
+ if((base_tid = H5Tget_super(tid)) < 0) TEST_ERROR
+
+ /* Loop over elements in buffers */
+ vl_buf1 = (const hvl_t *)buf1;
+ vl_buf2 = (const hvl_t *)buf2;
+ for(u = 0; u < nelmts; u++, vl_buf1++, vl_buf2++) {
+ /* Check vlen lengths */
+ if(vl_buf1->len != vl_buf2->len) TEST_ERROR
+
+ /* Check vlen data */
+ if(!compare_data(parent1, parent2, pid, base_tid, vl_buf1->len, vl_buf1->p, vl_buf2->p, obj_owner)) TEST_ERROR
+ } /* end for */
+
+ if(H5Tclose(base_tid) < 0) TEST_ERROR
+ } /* end if */
+ else if(H5Tdetect_class(tid, H5T_REFERENCE) == TRUE) {
+ size_t u; /* Local index variable */
+
+ /* Check for "simple" reference datatype */
+ if(H5Tget_class(tid) != H5T_REFERENCE) TEST_ERROR
+
+ /* Check for object or region reference */
+ if(H5Tequal(tid, H5T_STD_REF) > 0) {
+ H5R_ref_t *ref_buf1, *ref_buf2; /* Aliases for buffers to compare */
+
+ /* Loop over elements in buffers */
+ ref_buf1 = (H5R_ref_t *)buf1;
+ ref_buf2 = (H5R_ref_t *)buf2;
+ for(u = 0; u < nelmts; u++, ref_buf1++, ref_buf2++) {
+ hid_t obj1_id, obj2_id; /* IDs for objects referenced */
+ H5O_type_t obj1_type, obj2_type; /* Types of objects referenced */
+
+ /* Check for types of objects handled */
+ if(H5Rget_obj_type3(ref_buf1, H5P_DEFAULT, &obj1_type) < 0) TEST_ERROR
+ if(H5Rget_obj_type3(ref_buf2, H5P_DEFAULT, &obj2_type) < 0) TEST_ERROR
+ if(obj1_type != obj2_type) TEST_ERROR
+
+ /* Open referenced objects */
+ if((obj1_id = H5Ropen_object(ref_buf1, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((obj2_id = H5Ropen_object(ref_buf2, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* break the infinite loop when the ref_object points to itself */
+ if(obj_owner > 0) {
+ H5O_info2_t oinfo1, oinfo2;
+ int token_cmp;
+
+ if(H5Oget_info3(obj_owner, &oinfo1, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Oget_info3(obj1_id, &oinfo2, H5O_INFO_BASIC) < 0) TEST_ERROR
+ if(H5Otoken_cmp(obj1_id, &oinfo1.token, &oinfo2.token, &token_cmp) < 0) TEST_ERROR
+ if(0 == token_cmp) {
+ if(H5Oclose(obj1_id) < 0) TEST_ERROR
+ if(H5Oclose(obj2_id) < 0) TEST_ERROR
+ return TRUE;
+ }
+ }
+
+ /* Check for types of objects handled */
+ switch(obj1_type) {
+ case H5O_TYPE_DATASET:
+ if(compare_datasets(obj1_id, obj2_id, pid, NULL) != TRUE) TEST_ERROR
+ break;
+
+ case H5O_TYPE_GROUP:
+ if(compare_groups(obj1_id, obj2_id, pid, -1, 0) != TRUE) TEST_ERROR
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ if(H5Tequal(obj1_id, obj2_id) != TRUE) TEST_ERROR
+ break;
+
+ case H5O_TYPE_MAP:
+ /* Maps not supported in native VOL connector */
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ TEST_ERROR
+ } /* end switch */
+
+ /* Close objects */
+ if(H5Oclose(obj1_id) < 0) TEST_ERROR
+ if(H5Oclose(obj2_id) < 0) TEST_ERROR
+
+ if(H5Rget_type(ref_buf1) == H5R_DATASET_REGION2) {
+ hid_t obj1_sid, obj2_sid; /* Dataspace IDs for objects referenced */
+
+ /* Get regions for referenced datasets */
+ if((obj1_sid = H5Ropen_region(ref_buf1, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((obj2_sid = H5Ropen_region(ref_buf2, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* Check if dataspaces are the same shape */
+ if(H5Sselect_shape_same(obj1_sid, obj2_sid) < 0) TEST_ERROR
+
+ /* Close dataspaces */
+ if(H5Sclose(obj1_sid) < 0) TEST_ERROR
+ if(H5Sclose(obj2_sid) < 0) TEST_ERROR
+ } /* end if */
+ } /* end for */
+ } /* end if */
+ else
+ TEST_ERROR
+ } /* end else */
+ else
+ if(HDmemcmp(buf1, buf2, (elmt_size * nelmts))) TEST_ERROR
+
+ /* Data should be the same. :-) */
+ return TRUE;
+
+error:
+ return FALSE;
+} /* end compare_data() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: compare_datasets
+ *
+ * Purpose: Compare two datasets to check that they are equal
+ *
+ * Return: TRUE if datasets are equal/FALSE if they are different
+ *
+ * Programmer: Quincey Koziol
+ * Tuesday, October 25, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf)
+{
+ hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
+ hid_t tid = -1, tid2 = -1; /* Datatype IDs */
+ hid_t dcpl = -1, dcpl2 = -1; /* Dataset creation property list IDs */
+ size_t elmt_size; /* Size of datatype */
+ htri_t is_committed; /* If the datatype is committed */
+ htri_t is_committed2; /* If the datatype is committed */
+ int nfilters; /* Number of filters applied to dataset */
+ hssize_t nelmts; /* # of elements in dataspace */
+ void *rbuf = NULL; /* Buffer for reading raw data */
+ void *rbuf2 = NULL; /* Buffer for reading raw data */
+ H5D_space_status_t space_status; /* Dataset's raw dataspace status */
+ H5D_space_status_t space_status2; /* Dataset's raw dataspace status */
+
+ /* Check the datatypes are equal */
+
+ /* Open the datatype for the source dataset */
+ if((tid = H5Dget_type(did)) < 0) TEST_ERROR
+
+ /* Open the datatype for the destination dataset */
+ if((tid2 = H5Dget_type(did2)) < 0) TEST_ERROR
+
+ /* Check that both datatypes are committed/not committed */
+ if((is_committed = H5Tcommitted(tid)) < 0) TEST_ERROR
+ if((is_committed2 = H5Tcommitted(tid2)) < 0) TEST_ERROR
+ if(is_committed != is_committed2) TEST_ERROR
+
+ /* Compare the datatypes */
+ if(H5Tequal(tid, tid2) != TRUE) TEST_ERROR
+
+ /* Determine the size of datatype (for later) */
+ if((elmt_size = H5Tget_size(tid)) == 0) TEST_ERROR
+
+
+ /* Check the dataspaces are equal */
+
+ /* Open the dataspace for the source dataset */
+ if((sid = H5Dget_space(did)) < 0) TEST_ERROR
+
+ /* Open the dataspace for the destination dataset */
+ if((sid2 = H5Dget_space(did2)) < 0) TEST_ERROR
+
+ /* Compare the dataspaces */
+ if(H5Sextent_equal(sid, sid2) != TRUE) TEST_ERROR
+
+ /* Determine the number of elements in dataspace (for later) */
+ if((nelmts = H5Sget_simple_extent_npoints(sid)) < 0) TEST_ERROR
+
+
+ /* Check the dataset creation property lists are equal */
+
+ /* Open the dataset creation property list for the source dataset */
+ if((dcpl = H5Dget_create_plist(did)) < 0) TEST_ERROR
+
+ /* Open the dataset creation property list for the destination dataset */
+ if((dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR
+
+ /* Compare the rest of the dataset creation property lists */
+ if(H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR
+
+ /* Get the number of filters on dataset (for later) */
+ if((nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR
+
+ /* close the source dataset creation property list */
+ if(H5Pclose(dcpl) < 0) TEST_ERROR
+
+ /* close the destination dataset creation property list */
+ if(H5Pclose(dcpl2) < 0) TEST_ERROR
+
+
+ /* Check the allocated storage is the same */
+
+ /* Check that the space allocation status is the same */
+ if(H5Dget_space_status(did, &space_status) < 0) TEST_ERROR
+ if(H5Dget_space_status(did2, &space_status2) < 0) TEST_ERROR
+ if(space_status != space_status2) TEST_ERROR
+
+ /* Check that the space used is the same */
+ /* (Don't check if the dataset is filtered (i.e. compressed, etc.) and
+ * the datatype is VLEN, since the addresses for the vlen
+ * data in each dataset will (probably) be different and the storage
+ * size will thus vary)
+ */
+ if(!(nfilters > 0 && (H5Tdetect_class(tid, H5T_VLEN) ||
+ (H5Tdetect_class(tid, H5T_REFERENCE) && H5Tequal(tid, H5T_STD_REF))))) {
+ hsize_t storage_size = H5Dget_storage_size(did); /* Dataset's raw data storage size */
+ hsize_t storage_size2 = H5Dget_storage_size(did2); /* 2nd Dataset's raw data storage size */
+
+ if(storage_size != storage_size2) TEST_ERROR
+ } /* end if */
+
+ /* Check the raw data is equal */
+
+ /* Allocate & initialize space for the raw data buffers */
+ if((rbuf = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+ if((rbuf2 = HDcalloc( elmt_size, (size_t)nelmts)) == NULL) TEST_ERROR
+
+ /* Read data from datasets */
+ if(H5Dread(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
+ if(H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+
+ /* Check raw data read in against data written out */
+ if(wbuf) {
+ if(!compare_data(did, (hid_t)0, pid, tid, (size_t)nelmts, wbuf, rbuf, did)) TEST_ERROR
+ if(!compare_data(did2, (hid_t)0, pid, tid2, (size_t)nelmts, wbuf, rbuf2, did2)) TEST_ERROR
+ } /* end if */
+ /* Don't have written data, just compare data between the two datasets */
+ else
+ if(!compare_data(did, did2, pid, tid, (size_t)nelmts, rbuf, rbuf2, did)) TEST_ERROR
+
+ /* Reclaim vlen data, if necessary */
+ if(H5Tdetect_class(tid, H5T_VLEN) == TRUE || H5Tdetect_class(tid, H5T_REFERENCE) == TRUE)
+ if(H5Treclaim(tid, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR
+ if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE || H5Tdetect_class(tid2, H5T_REFERENCE) == TRUE)
+ if(H5Treclaim(tid2, sid2, H5P_DEFAULT, rbuf2) < 0) TEST_ERROR
+
+ /* Release raw data buffers */
+ HDfree(rbuf);
+ rbuf = NULL;
+ HDfree(rbuf2);
+ rbuf2 = NULL;
+
+ /* close the source dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ /* close the destination dataspace */
+ if(H5Sclose(sid2) < 0) TEST_ERROR
+
+ /* close the source datatype */
+ if(H5Tclose(tid) < 0) TEST_ERROR
+
+ /* close the destination datatype */
+ if(H5Tclose(tid2) < 0) TEST_ERROR
+
+
+ /* Check if the attributes are equal */
+ if(compare_std_attributes(did, did2, pid) != TRUE) TEST_ERROR
+
+
+ /* Datasets should be the same. :-) */
+ return TRUE;
+
+error:
+ H5E_BEGIN_TRY {
+ if(rbuf)
+ HDfree(rbuf);
+ if(rbuf2)
+ HDfree(rbuf2);
+ H5Pclose(dcpl2);
+ H5Pclose(dcpl);
+ H5Sclose(sid2);
+ H5Sclose(sid);
+ H5Tclose(tid2);
+ H5Tclose(tid);
+ } H5E_END_TRY;
+ return FALSE;
+} /* end compare_datasets() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: compare_groups
+ *
+ * Purpose: Compare two groups to check that they are "equal"
+ *
+ * Return: TRUE if group are equal/FALSE if they are different
+ *
+ * Programmer: Quincey Koziol
+ * Monday, October 31, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+compare_groups(hid_t gid, hid_t gid2, hid_t pid, int depth, unsigned copy_flags)
+{
+ H5G_info_t ginfo; /* Group info struct */
+ H5G_info_t ginfo2; /* Group info struct */
+ hsize_t idx; /* Index over the objects in group */
+ unsigned cpy_flags; /* Object copy flags */
+
+ /* Retrieve the object copy flags from the property list, if it's non-DEFAULT */
+ if(pid != H5P_DEFAULT) {
+ if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ } /* end if */
+ else
+ cpy_flags = 0;
+
+ /* Check if both groups have the same # of objects */
+ if(H5Gget_info(gid, &ginfo) < 0) TEST_ERROR
+ if(H5Gget_info(gid2, &ginfo2) < 0) TEST_ERROR
+ if((cpy_flags & H5O_COPY_SHALLOW_HIERARCHY_FLAG) && depth == 0) {
+ if(ginfo2.nlinks != 0) TEST_ERROR
+ } /* end if */
+ else {
+ if(ginfo.nlinks != ginfo2.nlinks) TEST_ERROR
+ } /* end if */
+
+ /* Check contents of groups */
+ if(ginfo2.nlinks > 0) {
+ char objname[NAME_BUF_SIZE]; /* Name of object in group */
+ char objname2[NAME_BUF_SIZE]; /* Name of object in group */
+ H5L_info2_t linfo; /* Link information */
+ H5L_info2_t linfo2; /* Link information */
+
+ /* Loop over contents of groups */
+ for(idx = 0; idx < ginfo.nlinks; idx++) {
+ /* Check name of objects */
+ if(H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_name_by_idx(gid2, ".", H5_INDEX_NAME, H5_ITER_INC, idx, objname2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(HDstrcmp(objname, objname2)) TEST_ERROR
+
+ /* Get link info */
+ if(H5Lget_info2(gid, objname, &linfo, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_info2(gid2, objname2, &linfo2, H5P_DEFAULT) < 0) TEST_ERROR
+ if(linfo.type != linfo2.type) TEST_ERROR
+
+ /* Extra checks for "real" objects */
+ if(linfo.type == H5L_TYPE_HARD) {
+ hid_t oid, oid2; /* IDs of objects within group */
+ H5O_info2_t oinfo, oinfo2; /* Data model object info */
+ H5O_native_info_t ninfo, ninfo2; /* Native file format object info */
+
+ /* Compare some pieces of the object info */
+ /* Get data model object info */
+ if(H5Oget_info_by_name3(gid, objname, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_info_by_name3(gid2, objname2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Get native object info */
+ if(H5Oget_native_info_by_name(gid, objname, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Oget_native_info_by_name(gid2, objname2, &ninfo2, H5O_NATIVE_INFO_HDR, H5P_DEFAULT) < 0) TEST_ERROR
+
+ if(oinfo.type != oinfo2.type) TEST_ERROR
+ if(oinfo.rc != oinfo2.rc) TEST_ERROR
+
+ /* If NULL messages are preserved, the number of messages
+ * should be the same in the destination.
+ * Otherwise, it should simply be true that the number
+ * of messages hasn't increased.
+ */
+ if(H5O_COPY_PRESERVE_NULL_FLAG & copy_flags) {
+ if(ninfo.hdr.nmesgs != ninfo2.hdr.nmesgs)
+ ;
+ else
+ if(ninfo.hdr.nmesgs < ninfo2.hdr.nmesgs)
+ TEST_ERROR
+ }
+
+ /* Check for object already having been compared */
+ if(token_lookup(gid, &oinfo))
+ continue;
+ else
+ token_insert(&oinfo);
+
+ /* Open objects */
+ if((oid = H5Oopen(gid, objname, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if((oid2 = H5Oopen(gid2, objname2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Compare objects within group */
+ switch(oinfo.type) {
+ case H5O_TYPE_GROUP:
+ /* Compare groups */
+ if(compare_groups(oid, oid2, pid, depth - 1, copy_flags) != TRUE) TEST_ERROR
+ break;
+
+ case H5O_TYPE_DATASET:
+ /* Compare datasets */
+ if(compare_datasets(oid, oid2, pid, NULL) != TRUE) TEST_ERROR
+ break;
+
+ case H5O_TYPE_NAMED_DATATYPE:
+ /* Compare datatypes */
+ if(H5Tequal(oid, oid2) != TRUE) TEST_ERROR
+ break;
+
+ case H5O_TYPE_MAP:
+ HDassert(0 && "maps not supported in native VOL connector");
+
+ case H5O_TYPE_UNKNOWN:
+ case H5O_TYPE_NTYPES:
+ default:
+ HDassert(0 && "Unknown type of object");
+ break;
+ } /* end switch */
+
+ /* Close objects */
+ if(H5Oclose(oid) < 0) TEST_ERROR
+ if(H5Oclose(oid2) < 0) TEST_ERROR
+ } /* end if */
+ else {
+ /* Check that both links are the same size */
+ if(linfo.u.val_size != linfo2.u.val_size) TEST_ERROR
+
+ /* Compare link values */
+ if(linfo.type == H5L_TYPE_SOFT ||
+ (linfo.type >= H5L_TYPE_UD_MIN && linfo.type <= H5L_TYPE_MAX)) {
+ char linkval[NAME_BUF_SIZE]; /* Link value */
+ char linkval2[NAME_BUF_SIZE]; /* Link value */
+
+ /* Get link values */
+ HDassert(linfo.u.val_size <= NAME_BUF_SIZE);
+ if(H5Lget_val(gid, objname, linkval, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lget_val(gid2, objname2, linkval2, (size_t)NAME_BUF_SIZE, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* Compare link data */
+ if(HDmemcmp(linkval, linkval2, linfo.u.val_size)) TEST_ERROR
+ } /* end else-if */
+ else {
+HDassert(0 && "Unknown type of link");
+ } /* end else */
+ } /* end else */
+ } /* end for */
+ } /* end if */
+
+ /* Check if the attributes are equal */
+ if(compare_std_attributes(gid, gid2, pid) != TRUE) TEST_ERROR
+
+ /* Groups should be the same. :-) */
+ return TRUE;
+
+error:
+ H5E_BEGIN_TRY {
+ } H5E_END_TRY;
+ return FALSE;
+} /* end compare_groups() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_copy_option
+ *
+ * Purpose: Create a group in SRC file and copy it to DST file
+ *
+ * Return: Success: 0
+ * Failure: number of errors
+ *
+ * Programmer: Peter Cao
+ * March 11, 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+test_copy_option(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t dst_fapl,
+ unsigned flag, hbool_t crt_intermediate_grp, const char* test_desciption)
+{
+ hid_t fid_src = -1, fid_dst = -1, fid_ext = -1; /* File IDs */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t did = -1; /* Dataset ID */
+ hid_t gid=-1, gid2=-1, gid_ref=-1; /* Group IDs */
+ hid_t gid_sub=-1, gid_sub_sub=-1; /* Sub-group ID */
+ hid_t pid=-1, lcpl_id=-1; /* Property IDs */
+ unsigned cpy_flags; /* Object copy flags */
+ int depth = -1; /* Copy depth */
+ hsize_t dim2d[2];
+ int buf[DIM_SIZE_1][DIM_SIZE_2];
+ int i, j;
+ char src_filename[NAME_BUF_SIZE];
+ char dst_filename[NAME_BUF_SIZE];
+
+ TESTING(test_desciption);
+
+ /* set initial data values */
+ for (i=0; i<DIM_SIZE_1; i++)
+ for (j=0; j<DIM_SIZE_2; j++)
+ buf[i][j] = 10000 + 100*i+j;
+
+ /* Initialize the filenames */
+ h5_fixname(FILENAME[0], src_fapl, src_filename, sizeof src_filename);
+ h5_fixname(FILENAME[1], dst_fapl, dst_filename, sizeof dst_filename);
+
+ /* Reset file token checking info */
+ token_reset();
+
+ /* create source file */
+ if((fid_src = H5Fcreate(src_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+
+ /* create group at the SRC file */
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* attach attributes to the group */
+ if(test_copy_attach_attributes(gid, H5T_NATIVE_INT) < 0) TEST_ERROR
+
+ /* Set dataspace dimensions */
+ dim2d[0]=DIM_SIZE_1;
+ dim2d[1]=DIM_SIZE_2;
+
+ /* create dataspace */
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+
+ /* add a dataset to the top group */
+ if((did = H5Dcreate2(gid, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* create a sub-group */
+ if((gid_sub = H5Gcreate2(fid_src, NAME_GROUP_SUB, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* add a dataset to the sub group */
+ if((did = H5Dcreate2(gid_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* create sub-sub-group */
+ if((gid_sub_sub = H5Gcreate2(gid_sub, NAME_GROUP_SUB_SUB2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* add a dataset to the sub sub group */
+ if((did = H5Dcreate2(gid_sub_sub, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+
+ /* close dataset */
+ if(H5Dclose(did) < 0) TEST_ERROR
+
+ /* close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+
+ if(H5Gclose(gid_sub_sub) < 0) TEST_ERROR
+
+ if(H5Gclose(gid_sub) < 0) TEST_ERROR
+
+ /* close the group */
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ /* Create group to copy */
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft(NAME_DATASET_SUB_SUB, fid_src, NAME_LINK_SOFT, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+
+ /* Create group to compare with */
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_hard(fid_src, NAME_DATASET_SUB_SUB, H5L_SAME_LOC, NAME_LINK_SOFT2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Lcreate_soft("nowhere", fid_src, NAME_LINK_SOFT_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Gclose(gid) < 0) FAIL_STACK_ERROR
+ } /* end if */
+
+ if((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0) {
+ char ext_filename[NAME_BUF_SIZE];
+
+ h5_fixname(FILENAME[2], src_fapl, ext_filename, sizeof ext_filename);
+
+ /* Create the external file and dataset */
+ if((fid_ext = H5Fcreate(ext_filename, H5F_ACC_TRUNC, fcpl_src, src_fapl)) < 0) TEST_ERROR
+ if((sid = H5Screate_simple(2, dim2d, NULL)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid_ext, NAME_DATASET_SIMPLE, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Fclose(fid_ext) < 0) TEST_ERROR
+
+ /* Create group to copy */
+ if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ } /* end if */
+ else
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Lcreate_external(ext_filename, NAME_DATASET_SIMPLE, fid_src, NAME_LINK_EXTERN, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Create group to compare with */
+ if(!(flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG)) {
+ if((gid = H5Gcreate2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ } /* end if */
+ else
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid_src, NAME_LINK_EXTERN2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
+ if(H5Lcreate_external("no_file", "no_object", fid_src, NAME_LINK_EXTERN_DANGLE2, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR
+ } /* end if */
+
+ if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if((gid_ref = H5Gcreate2(fid_src, NAME_GROUP_REF, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* create an attribute of new object references */
+ if(attach_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+
+ /* create an attribute of region references */
+ if(attach_reg_ref_attr(fid_src, gid_ref) < 0) TEST_ERROR
+
+ /* create a dataset of region references */
+ if(create_reg_ref_dataset(fid_src, gid_ref) < 0) TEST_ERROR
+
+ /* Close group holding reference objects */
+ if(H5Gclose(gid_ref) < 0) TEST_ERROR
+ } /* end if */
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* open the source file with read-only */
+ /* (except when expanding soft links */
+ if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0) {
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDWR, src_fapl)) < 0) TEST_ERROR
+ } /* end if */
+ else
+ if((fid_src = H5Fopen(src_filename, H5F_ACC_RDONLY, src_fapl)) < 0) TEST_ERROR
+
+ /* create destination file */
+ if((fid_dst = H5Fcreate(dst_filename, H5F_ACC_TRUNC, fcpl_dst, dst_fapl)) < 0) TEST_ERROR
+
+ /* Create an uncopied object in destination file so that tokens in source and destination
+ files aren't the same */
+ if(H5Gclose(H5Gcreate2(fid_dst, NAME_GROUP_UNCOPIED, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
+ /* create property to pass copy options */
+ if((pid = H5Pcreate(H5P_OBJECT_COPY)) < 0) TEST_ERROR
+
+ /* set options for object copy */
+ if(H5Pset_copy_object(pid, flag) < 0) TEST_ERROR
+
+ /* Verify object copy flags */
+ if(H5Pget_copy_object(pid, &cpy_flags) < 0) TEST_ERROR
+ if(cpy_flags != flag) TEST_ERROR
+
+ /* copy the group from SRC to DST */
+ if(crt_intermediate_grp) {
+ /* Create link creation plist to pass in intermediate group creation */
+ if((lcpl_id = H5Pcreate(H5P_LINK_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_create_intermediate_group(lcpl_id, TRUE) < 0) TEST_ERROR
+
+ if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, "/new_g0/new_g00", pid, lcpl_id) < 0) TEST_ERROR
+
+ if(H5Pclose(lcpl_id) < 0) TEST_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, "/new_g0/new_g00", H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ } else if(((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
+ || ((flag & H5O_COPY_EXPAND_EXT_LINK_FLAG) > 0)) {
+ if(H5Ocopy(fid_src, NAME_GROUP_LINK, fid_dst, NAME_GROUP_LINK, pid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ if((flag & H5O_COPY_EXPAND_SOFT_LINK_FLAG) > 0)
+ /* Unlink dataset to copy from original location */
+ /* (So group comparison works properly) */
+ if(H5Ldelete(fid_src, NAME_DATASET_SUB_SUB, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_LINK2, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_LINK, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ } else if(flag & (H5O_COPY_WITHOUT_ATTR_FLAG | H5O_COPY_PRESERVE_NULL_FLAG)) {
+ if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ } else if(flag & H5O_COPY_SHALLOW_HIERARCHY_FLAG) {
+ if(H5Ocopy(fid_src, NAME_GROUP_TOP, fid_dst, NAME_GROUP_TOP, pid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_TOP, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* Set the copy depth */
+ depth = 1;
+ } else if((flag & H5O_COPY_EXPAND_REFERENCE_FLAG) > 0) {
+ if(H5Ocopy(fid_src, NAME_GROUP_REF, fid_dst, NAME_GROUP_REF, pid, H5P_DEFAULT) < 0) TEST_ERROR
+
+ /* open the group for copy */
+ if((gid = H5Gopen2(fid_src, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+
+ /* open the destination group */
+ if((gid2 = H5Gopen2(fid_dst, NAME_GROUP_REF, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
+ } else {
+ /* Unknown flag */
+ TEST_ERROR
+ } /* end else */
+
+ /* Check if the groups are equal */
+ if(compare_groups(gid, gid2, pid, depth, flag) != TRUE) TEST_ERROR
+ if(H5Gclose(gid2) < 0) TEST_ERROR
+ if(H5Gclose(gid) < 0) TEST_ERROR
+
+ /* close the SRC file */
+ if(H5Fclose(fid_src) < 0) TEST_ERROR
+
+ /* close the DST file */
+ if(H5Fclose(fid_dst) < 0) TEST_ERROR
+
+ /* close properties */
+ if(H5Pclose(pid) < 0) TEST_ERROR
+
+ PASSED();
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(lcpl_id);
+ H5Pclose(pid);
+ H5Sclose(sid);
+ H5Dclose(did);
+ H5Gclose(gid_ref);
+ H5Gclose(gid_sub);
+ H5Gclose(gid2);
+ H5Gclose(gid);
+ H5Fclose(fid_dst);
+ H5Fclose(fid_src);
+ H5Fclose(fid_ext);
+ } H5E_END_TRY;
+ return 1;
+} /* end test_copy_option */
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test H5Ocopy()
+ *
+ * Tests a number of cases: messages can be stored in the
+ * new or old format, messages can be shared in either,
+ * both, or neither of the source and destination files.
+ *
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
+ *
+ * Programmer: Peter Cao
+ * Friday, September 30, 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ int nerrors = 0;
+ hid_t fapl, fapl2;
+ hid_t fcpl_shared, ocpl;
+ unsigned max_compact, min_dense;
+ int configuration; /* Configuration of tests. */
+ int ExpressMode;
+
+ /* Setup */
+ h5_reset();
+ fapl = h5_fileaccess();
+
+ ExpressMode = GetTestExpress();
+ if (ExpressMode > 1)
+ HDprintf("***Express test mode on. Some tests may be skipped\n");
+
+ /* Copy the file access property list */
+ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
+
+ /* Set the "use the latest version of the format" bounds for creating objects in the file */
+ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
+
+ /* Create an FCPL with sharing enabled */
+ if((fcpl_shared = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_shared_mesg_nindexes(fcpl_shared, 1) < 0) TEST_ERROR
+ if(H5Pset_shared_mesg_index(fcpl_shared, 0, H5O_SHMESG_ALL_FLAG, 10) < 0) TEST_ERROR
+
+ /* Obtain the default attribute storage phase change values */
+ if((ocpl = H5Pcreate(H5P_OBJECT_CREATE)) < 0) TEST_ERROR
+ if(H5Pget_attr_phase_change(ocpl, &max_compact, &min_dense) < 0) TEST_ERROR
+ if(H5Pclose(ocpl) < 0) TEST_ERROR
+
+ /* Test in all configurations */
+ for(configuration = 0; configuration <= MAX_CONFIGURATION; configuration++) {
+ hid_t src_fapl;
+ hid_t dst_fapl;
+ hid_t fcpl_src;
+ hid_t fcpl_dst;
+
+ /* No need to test dense attributes with old format */
+ if(!(configuration & CONFIG_SRC_NEW_FORMAT) && (configuration & CONFIG_DENSE))
+ continue;
+
+ /* TODO Region references currently do not support copy from new format to old format
+ * (this may be fixed once H5Sencode/decode and H5CXis fixed) */
+ if((configuration & CONFIG_SRC_NEW_FORMAT) && !(configuration & CONFIG_DST_NEW_FORMAT))
+ continue;
+
+ /* Test with and without shared messages */
+ if(configuration & CONFIG_SHARE_SRC) {
+ HDputs("\nTesting with shared src messages:");
+ fcpl_src = fcpl_shared;
+ }
+ else {
+ HDputs("\nTesting without shared src messages:");
+ fcpl_src = H5P_DEFAULT;
+ }
+ if(configuration & CONFIG_SHARE_DST) {
+ HDputs("Testing with shared dst messages:");
+ fcpl_dst = fcpl_shared;
+ }
+ else {
+ HDputs("Testing without shared dst messages:");
+ fcpl_dst = H5P_DEFAULT;
+ }
+
+ /* Set the FAPL for the source file's type of format */
+ if(configuration & CONFIG_SRC_NEW_FORMAT) {
+ HDputs("Testing with latest format for source file:");
+ src_fapl = fapl2;
+
+ /* Test with and without dense attributes */
+ if(configuration & CONFIG_DENSE) {
+ HDputs("Testing with dense attributes:");
+ num_attributes_g = max_compact + 1;
+ }
+ else {
+ HDputs("Testing without dense attributes:");
+ num_attributes_g = MAX(min_dense, 2) - 2;
+ }
+ } /* end if */
+ else {
+ HDputs("Testing with oldest file format for source file:");
+ src_fapl = fapl;
+ num_attributes_g = 4;
+ } /* end else */
+
+ /* Set the FAPL for the destination file's type of format */
+ if(configuration & CONFIG_DST_NEW_FORMAT) {
+ HDputs("Testing with latest format for destination file:");
+ dst_fapl = fapl2;
+ } /* end if */
+ else {
+ HDputs("Testing with oldest file format for destination file:");
+ dst_fapl = fapl;
+ } /* end else */
+
+ /* The tests... */
+ nerrors += test_copy_option(fcpl_src, fcpl_dst, src_fapl, dst_fapl,
+ H5O_COPY_EXPAND_REFERENCE_FLAG,
+ FALSE, "H5Ocopy(): expand object reference");
+ } /* end for */
+
+ /* Reset file token checking info */
+ token_reset();
+
+ /* Verify symbol table messages are cached */
+ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
+
+ /* Results */
+ if(nerrors) {
+ HDprintf("***** %d OBJECT COPY TEST%s FAILED! *****\n",
+ nerrors, (1 == nerrors ? "" : "S"));
+ HDexit(EXIT_FAILURE);
+ } /* end if */
+
+ HDputs ("All object copying tests passed.");
+
+ /* close property list.
+ * NOTE: if this property list is not closed and the test is
+ * run with the split or multi driver, an interesting
+ * problem is exposed in the property list shutdown code.
+ *
+ * Namely, since the split/multi driver copies property
+ * lists for internal use, there's a (high) chance that
+ * leaving the FAPL open and having the library's shutdown
+ * code close it will cause the underlying property lists
+ * to be cleaned up first, causing the actual property list
+ * close operation to fail (since it won't be able to close
+ * the already closed underlying property list).
+ *
+ * The could be addressed by converting the split/multi to
+ * use non-public API routines, or putting some way into the
+ * public H5I routines to indicate ordering at shutdown.
+ *
+ * For now, we just make certain to close the property list.
+ * (QAK - 2016/04/06)
+ *
+ */
+ H5Pclose(fapl2);
+
+ h5_cleanup(FILENAME, fapl);
+
+ HDexit(EXIT_SUCCESS);
+
+error:
+ HDexit(EXIT_FAILURE);
+} /* main */
+
diff --git a/test/ohdr.c b/test/ohdr.c
index 13bac9e..120935c 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -50,7 +50,8 @@ const char *FILENAME[] = {
* To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild
* the library and simply compile gen_bogus.c with that HDF5 library and run it.
*/
-#define FILE_BOGUS "tbogus.h5"
+#define FILE_BOGUS "tbogus.h5"
+#define TESTFILE_LEN 256
/* */
#define FILE_OHDR_SWMR "ohdr_swmr.h5"
@@ -321,7 +322,7 @@ test_ohdr_swmr(hbool_t new_format)
hsize_t dims[1]; /* Dimension sizes */
size_t u; /* Iterator */
int n; /* Data variable */
- H5O_info_t obj_info; /* Information for the object */
+ H5O_native_info_t ninfo; /* Information for the object */
if(new_format) {
TESTING("exercise the coding for the re-read of the object header for SWMR access: latest-format");
@@ -391,16 +392,16 @@ test_ohdr_swmr(hbool_t new_format)
FAIL_STACK_ERROR
/* Get the object information */
- if(H5Oget_info2(did, &obj_info, H5O_INFO_HDR) < 0)
+ if(H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR) < 0)
FAIL_STACK_ERROR
if(new_format)
- if(obj_info.hdr.version != OBJ_VERSION_LATEST)
+ if(ninfo.hdr.version != OBJ_VERSION_LATEST)
FAIL_STACK_ERROR
/* The size of object header should be greater than the speculative read size of H5O_SPEC_READ_SIZE */
/* This will exercise the coding for the re-read of the object header for SWMR access */
- if(obj_info.hdr.space.total < H5O_SPEC_READ_SIZE)
+ if(ninfo.hdr.space.total < H5O_SPEC_READ_SIZE)
TEST_ERROR;
/* Close the dataset */
@@ -473,13 +474,13 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
hid_t fid_bogus = -1; /* bogus file ID */
hid_t gid_bogus = -1; /* bogus group ID */
hid_t loc_bogus = -1; /* location: bogus file or group ID */
- char testfile[256];
+ char testfile[TESTFILE_LEN];
/* create a different name for a local copy of the data file to be
opened with rd/wr file permissions in case build and test are
done in the source directory. */
- HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS));
- testfile[HDstrlen(FILE_BOGUS)]='\0';
+ HDstrncpy(testfile, FILE_BOGUS, TESTFILE_LEN);
+ testfile[TESTFILE_LEN - 1]='\0';
HDstrncat(testfile, ".copy", 5);
/* Make a copy of the data file from svn. */
@@ -756,10 +757,10 @@ error:
*/
static int
count_attributes(hid_t dset_id)
-{
- H5O_info_t info;
-
- if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0)
+{
+ H5O_info2_t info;
+
+ if(H5Oget_info3(dset_id, &info, H5O_INFO_NUM_ATTRS) < 0)
return -1;
else
return (int)info.num_attrs; /* should never exceed int bounds */
@@ -773,10 +774,13 @@ count_attributes(hid_t dset_id)
static herr_t
_oh_getsize(hid_t did, hsize_t *size_out)
{
- H5O_info_t info;
- if(FAIL == H5Oget_info2(did, &info, H5O_INFO_HDR))
+ H5O_native_info_t ninfo;
+
+ if(FAIL == H5Oget_native_info(did, &ninfo, H5O_NATIVE_INFO_HDR))
return FAIL;
- *size_out = info.hdr.space.total;
+
+ *size_out = ninfo.hdr.space.total;
+
return SUCCEED;
} /* _oh_getsize */
@@ -1624,8 +1628,8 @@ main(void)
api_ctx_pushed = TRUE;
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
const char *low_string; /* Message for library version low bound */
const char *high_string; /* Message for library version high bound */
char msg[80]; /* Message for file format version */
diff --git a/test/page_buffer.c b/test/page_buffer.c
index e11a6d6..21ffbf5 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -38,23 +38,25 @@
#define FILENAME_LEN 1024
+
+/* test routines */
+#ifdef H5_HAVE_PARALLEL
+static unsigned verify_page_buffering_disabled(hid_t orig_fapl,
+ const char *env_h5_drvr);
+#else
#define NUM_DSETS 5
#define NX 100
#define NY 50
-/* helper routines */
-static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl);
-static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size);
-
-/* test routines */
static unsigned test_args(hid_t fapl, const char *env_h5_drvr);
static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr);
-#ifdef H5_HAVE_PARALLEL
-static unsigned verify_page_buffering_disabled(hid_t orig_fapl,
- const char *env_h5_drvr);
+
+/* helper routines */
+static unsigned create_file(char *filename, hid_t fcpl, hid_t fapl);
+static unsigned open_file(char *filename, hid_t fapl, hsize_t page_size, size_t page_buffer_size);
#endif /* H5_HAVE_PARALLEL */
const char *FILENAME[] = {
@@ -62,6 +64,7 @@ const char *FILENAME[] = {
NULL
};
+#ifndef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
* Function: create_file()
@@ -296,6 +299,7 @@ error:
} H5E_END_TRY;
return 1;
}
+#endif /* H5_HAVE_PARALLEL */
/*
*
@@ -336,7 +340,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize)
memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
} else {
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
} /* end else */
@@ -345,7 +349,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
} /* end if */
@@ -357,6 +361,7 @@ error:
} /* set_multi_split() */
+#ifndef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
* Function: test_args()
@@ -379,6 +384,7 @@ error:
*
*-------------------------------------------------------------------------
*/
+
static unsigned
test_args(hid_t orig_fapl, const char *env_h5_drvr)
{
@@ -2002,6 +2008,7 @@ error:
return 1;
} /* test_stats_collection */
+#endif /* #ifndef H5_HAVE_PARALLEL */
/*-------------------------------------------------------------------------
diff --git a/test/set_extent.c b/test/set_extent.c
index 20322a3..17d439e 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -358,7 +358,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format )
/* Iterate over different index types, but only if using the new format
*/
- for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) {
+ for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; index_type++) {
/* Standard test */
if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) {
DO_RANKS_PRINT_CONFIG("Randomized rank 4")
@@ -433,8 +433,8 @@ static int do_layouts( hid_t fapl )
TESTING("storage layout use - tested with all low/high library format bounds");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Copy plist to use locally to avoid modifying the original */
new_fapl = H5Pcopy(fapl);
@@ -2658,7 +2658,7 @@ static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
} /* end else */
/* Free read buffer */
- if(H5Dvlen_reclaim(type, mspace, H5P_DEFAULT, rbuf) < 0)
+ if(H5Treclaim(type, mspace, H5P_DEFAULT, rbuf) < 0)
TEST_ERROR
} /* end if */
@@ -2678,7 +2678,7 @@ static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
/* Close */
if(H5Sselect_all(mspace) < 0)
TEST_ERROR
- if(H5Dvlen_reclaim(type, mspace, H5P_DEFAULT, wbuf) < 0)
+ if(H5Treclaim(type, mspace, H5P_DEFAULT, wbuf) < 0)
TEST_ERROR
free(fill_value.p);
if(H5Sclose(mspace) < 0)
diff --git a/test/stab.c b/test/stab.c
index 80c8b06..215d748 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -70,8 +70,10 @@ const char *FILENAME[] = {
#define GCPL_ON_ROOT_MAX_COMPACT 4
#define GCPL_ON_ROOT_MIN_DENSE 2
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Definitions for 'old_api' test */
#define OLD_API_GROUP "/old_api"
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Definitions for 'corrupt_stab_msg' test */
#define CORRUPT_STAB_FILE "corrupt_stab_msg.h5"
@@ -328,7 +330,7 @@ lifecycle(hid_t fcpl, hid_t fapl2)
unsigned est_num_entries; /* Estimated # of entries in group */
unsigned est_name_len; /* Estimated length of entry name */
unsigned nmsgs; /* Number of messages in group's header */
- H5O_info_t oinfo; /* Object info */
+ H5O_native_info_t ninfo; /* Object info */
char objname[NAME_BUF_SIZE]; /* Object name */
char filename[NAME_BUF_SIZE];
h5_stat_size_t empty_size; /* Size of an empty file */
@@ -419,11 +421,11 @@ lifecycle(hid_t fcpl, hid_t fapl2)
if(H5G__is_new_dense_test(gid) != FALSE) TEST_ERROR
/* Check that the object header is only one chunk and the space has been allocated correctly */
- if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR
- if(oinfo.hdr.space.total != 151) TEST_ERROR
- if(oinfo.hdr.space.free != 0) TEST_ERROR
- if(oinfo.hdr.nmesgs != 6) TEST_ERROR
- if(oinfo.hdr.nchunks != 1) TEST_ERROR
+ if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
+ if(ninfo.hdr.space.total != 151) TEST_ERROR
+ if(ninfo.hdr.space.free != 0) TEST_ERROR
+ if(ninfo.hdr.nmesgs != 6) TEST_ERROR
+ if(ninfo.hdr.nchunks != 1) TEST_ERROR
/* Create one more "bottom" group, which should push top group into using a symbol table */
HDsprintf(objname, LIFECYCLE_BOTTOM_GROUP, u);
@@ -441,11 +443,11 @@ lifecycle(hid_t fcpl, hid_t fapl2)
if(H5G__is_new_dense_test(gid) != TRUE) TEST_ERROR
/* Check that the object header is still one chunk and the space has been allocated correctly */
- if(H5Oget_info2(gid, &oinfo, H5O_INFO_HDR) < 0) TEST_ERROR
- if(oinfo.hdr.space.total != 151) TEST_ERROR
- if(oinfo.hdr.space.free != 92) TEST_ERROR
- if(oinfo.hdr.nmesgs != 3) TEST_ERROR
- if(oinfo.hdr.nchunks != 1) TEST_ERROR
+ if(H5Oget_native_info(gid, &ninfo, H5O_NATIVE_INFO_HDR) < 0) TEST_ERROR
+ if(ninfo.hdr.space.total != 151) TEST_ERROR
+ if(ninfo.hdr.space.free != 92) TEST_ERROR
+ if(ninfo.hdr.nmesgs != 3) TEST_ERROR
+ if(ninfo.hdr.nchunks != 1) TEST_ERROR
/* Unlink objects from top group */
while(u >= LIFECYCLE_MIN_DENSE) {
diff --git a/test/swmr_common.c b/test/swmr_common.c
index b323769..925dc33 100644
--- a/test/swmr_common.c
+++ b/test/swmr_common.c
@@ -26,7 +26,8 @@
#include "h5test.h"
#include "swmr_common.h"
-
+#include "vds_swmr.h"
+
/*******************/
/* Local Variables */
/*******************/
@@ -73,6 +74,27 @@ unsigned symbol_count[NLEVELS] = {100, 200, 400, 800, 1600};
/* Array of dataset information entries (1 per dataset) */
symbol_info_t *symbol_info[NLEVELS];
+hsize_t PLANES[N_SOURCES][RANK] = {
+ {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH},
+ {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH},
+ {1, SM_HEIGHT, WIDTH},
+ {1, LG_HEIGHT, WIDTH}
+};
+
+char FILE_NAMES[N_SOURCES][NAME_LEN] = {
+ {"vds_swmr_src_a.h5"},
+ {"vds_swmr_src_b.h5"},
+ {"vds_swmr_src_c.h5"},
+ {"vds_swmr_src_d.h5"},
+ {"vds_swmr_src_e.h5"},
+ {"vds_swmr_src_f.h5"}
+};
+
+char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5";
+char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
+char VDS_DSET_NAME[NAME_LEN] = "vds_dset";
/*-------------------------------------------------------------------------
* Function: choose_dataset
diff --git a/test/tarray.c b/test/tarray.c
index 0024746..e643fb0 100644
--- a/test/tarray.c
+++ b/test/tarray.c
@@ -1268,15 +1268,15 @@ test_array_vlen_atomic(void)
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close dataset transfer property list */
ret = H5Pclose(xfer_pid);
@@ -1523,15 +1523,15 @@ test_array_vlen_array(void)
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close dataset transfer property list */
ret = H5Pclose(xfer_pid);
diff --git a/test/tattr.c b/test/tattr.c
index 7c2b5ce..dab03a7 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -20,6 +20,7 @@
*************************************************************/
#include "testhdf5.h"
+#include "H5VLnative_private.h"
/*
* This file needs to access private information from the H5O package.
@@ -427,7 +428,7 @@ test_attr_basic_read(hid_t fapl)
hid_t dataset; /* Dataset ID */
hid_t group; /* Group ID */
hid_t attr; /* Attribute ID */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
int read_data1[ATTR1_DIM1] = {0}; /* Buffer for reading 1st attribute */
int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
int i, j; /* Local index variables */
@@ -445,9 +446,9 @@ test_attr_basic_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 2, "H5Oget_info3");
/* Open first attribute for the dataset */
attr = H5Aopen(dataset, ATTR_TMP_NAME, H5P_DEFAULT);
@@ -474,9 +475,9 @@ test_attr_basic_read(hid_t fapl)
CHECK(group, FAIL, "H5Gopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(group, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(group, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open the attribute for the group */
attr = H5Aopen(group, ATTR2_NAME, H5P_DEFAULT);
@@ -541,7 +542,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
+ if(!H5_DBL_ABS_EQUAL(rdata, 0.0))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Fflush(fil, H5F_SCOPE_GLOBAL);
@@ -550,7 +551,7 @@ test_attr_flush(hid_t fapl)
ret=H5Aread(att, H5T_NATIVE_DOUBLE, &rdata);
CHECK(ret, FAIL, "H5Awrite");
- if(!H5_DBL_ABS_EQUAL(rdata, H5_DOUBLE(0.0)))
+ if(!H5_DBL_ABS_EQUAL(rdata, 0.0))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
@@ -811,7 +812,7 @@ test_attr_compound_read(hid_t fapl)
hid_t field; /* Attribute field datatype */
struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; /* Buffer for reading 4th attribute */
ssize_t name_len; /* Length of attribute name */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
int i, j; /* Local index variables */
herr_t ret; /* Generic return value */
@@ -827,9 +828,9 @@ test_attr_compound_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open 1st attribute for the dataset */
attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
@@ -1016,7 +1017,7 @@ test_attr_scalar_read(hid_t fapl)
hid_t attr; /* Attribute ID */
H5S_class_t stype; /* Dataspace class */
float rdata = 0.0F; /* Buffer for reading 1st attribute */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1031,9 +1032,9 @@ test_attr_scalar_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open an attribute for the dataset */
attr = H5Aopen(dataset, ATTR5_NAME, H5P_DEFAULT);
@@ -1218,7 +1219,7 @@ test_attr_mult_read(hid_t fapl)
int read_data2[ATTR2_DIM1][ATTR2_DIM2] = {{0}}; /* Buffer for reading 2nd attribute */
double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3] = {{{0}}}; /* Buffer for reading 3rd attribute */
ssize_t name_len; /* Length of attribute name */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
int i, j, k; /* Local index values */
herr_t ret; /* Generic return value */
@@ -1234,9 +1235,9 @@ test_attr_mult_read(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Open 1st attribute for the dataset */
attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
@@ -1468,7 +1469,7 @@ test_attr_iterate(hid_t fapl)
hid_t dataset; /* Dataset ID */
hid_t sid; /* Dataspace ID */
int count; /* operator data for the iterator */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1491,9 +1492,9 @@ test_attr_iterate(hid_t fapl)
CHECK(ret, FAIL, "H5Sclose");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 0, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 0, "H5Oget_info3");
/* Iterate over attributes on dataset */
count = 0;
@@ -1509,9 +1510,9 @@ test_attr_iterate(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Iterate over attributes on dataset */
count = 0;
@@ -1541,7 +1542,7 @@ test_attr_delete(hid_t fapl)
hid_t attr; /* Attribute ID */
char attr_name[ATTR_NAME_LEN]; /* Buffer for attribute names */
ssize_t name_len; /* Length of attribute name */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -1556,27 +1557,27 @@ test_attr_delete(hid_t fapl)
CHECK(dataset, FAIL, "H5Dopen2");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Try to delete bogus attribute */
ret = H5Adelete(dataset, "Bogus");
VERIFY(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 3, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 3, "H5Oget_info3");
/* Delete middle (2nd) attribute */
ret = H5Adelete(dataset, ATTR2_NAME);
CHECK(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 2, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 2, "H5Oget_info3");
/* Open 1st attribute for the dataset */
attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
@@ -1611,9 +1612,9 @@ test_attr_delete(hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 1, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 1, "H5Oget_info3");
/* Open last (formally 3rd) attribute for the dataset */
attr = H5Aopen_by_idx(dataset, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, H5P_DEFAULT, H5P_DEFAULT);
@@ -1634,9 +1635,9 @@ test_attr_delete(hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Verify the correct number of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, 0, "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, 0, "H5Oget_info3");
/* Close dataset */
ret = H5Dclose(dataset);
@@ -1664,7 +1665,7 @@ test_attr_dtype_shared(hid_t fapl)
hid_t attr_id; /* Attribute ID */
int data = 8; /* Data to write */
int rdata = 0; /* Read read in */
- H5O_info_t oinfo; /* Object's information */
+ H5O_info2_t oinfo; /* Object's information */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
herr_t ret; /* Generic return value */
@@ -1698,9 +1699,9 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(ret, FAIL, "H5Tcommit2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
/* Create dataspace for dataset */
space_id = H5Screate(H5S_SCALAR);
@@ -1711,18 +1712,18 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
/* Create attribute on dataset */
attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
/* Close attribute */
ret = H5Aclose(attr_id);
@@ -1733,18 +1734,18 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(ret, FAIL, "H5Adelete");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "H5Oget_info_by_name3");
/* Create attribute on dataset */
attr_id = H5Acreate2(dset_id, ATTR1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attr_id, FAIL, "H5Acreate2");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
/* Write data into the attribute */
ret = H5Awrite(attr_id, H5T_NATIVE_INT, &data);
@@ -1797,18 +1798,18 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(ret, FAIL, "H5Dclose");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 3, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 3, "H5Oget_info_by_name3");
/* Unlink the dataset */
ret = H5Ldelete(file_id, DSET1_NAME, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Ldelete");
/* Check reference count on named datatype */
- ret = H5Oget_info_by_name2(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file_id, TYPE1_NAME, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info_by_name3");
/* Unlink the named datatype */
ret = H5Ldelete(file_id, TYPE1_NAME, H5P_DEFAULT);
@@ -2440,7 +2441,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
unsigned u; /* Local index variable */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
herr_t ret; /* Generic return value */
@@ -2523,9 +2524,9 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2634,7 +2635,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
htri_t is_dense; /* Are attributes stored densely? */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
unsigned u; /* Local index variable */
int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
unsigned use_corder; /* Track creation order or not */
@@ -2726,9 +2727,9 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Arename_by_name");
/* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -2826,7 +2827,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
size_t mesg_count; /* # of shared messages */
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
unsigned u; /* Local index variable */
int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
herr_t ret; /* Generic return value */
@@ -2904,9 +2905,9 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Aclose");
/* Check # of attributes */
- ret = H5Oget_info2(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info");
+ ret = H5Oget_info3(dataset, &oinfo, H5O_INFO_NUM_ATTRS);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.num_attrs, (u + 1), "H5Oget_info3");
} /* end for */
/* Check on dataset's attribute storage status */
@@ -6272,9 +6273,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -7226,9 +7227,9 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
iter_info.visited = visited;
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -7586,9 +7587,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Pget_attr_phase_change");
/* Loop over operating on different indices on link fields */
- for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) {
+ for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) {
/* Loop over operating in different orders */
- for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) {
+ for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) {
/* Loop over using index for creation order value */
for(use_index = FALSE; use_index <= TRUE; use_index++) {
/* Print appropriate test message */
@@ -10863,9 +10864,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
hid_t gid; /* Group ID */
hid_t oid; /* Object ID */
hsize_t dims = 256; /* Attribute dimensions */
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
H5A_info_t ainfo; /* Attribute info */
haddr_t root_addr; /* Root group address */
+ haddr_t link_addr; /* Link (to root group) address */
herr_t ret; /* Generic return status */
/* Output message about test being performed */
@@ -10881,9 +10883,10 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gcreate2");
/* Get root group address */
- ret = H5Oget_info2(fid, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(fid, &oinfo, H5O_INFO_BASIC);
CHECK(ret, FAIL, "H5Oget_info");
- root_addr = oinfo.addr;
+ ret = H5VLnative_token_to_addr(fid, oinfo.token, &root_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
/*
* Create link to root group
@@ -10906,10 +10909,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT);
CHECK(oid, FAIL, "H5Oopen");
- ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC);
CHECK(ret, FAIL, "H5Oget_info");
- if(oinfo.addr != root_addr)
- TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr);
+ ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
+ if(link_addr != root_addr)
+ TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr);
/* Close file */
ret = H5Fclose(fid);
@@ -10951,10 +10956,12 @@ test_attr_bug8(hid_t fcpl, hid_t fapl)
CHECK(gid, FAIL, "H5Gopen2");
oid = H5Oopen(gid, LINK1_NAME, H5P_DEFAULT);
CHECK(oid, FAIL, "H5Oopen");
- ret = H5Oget_info2(oid, &oinfo, H5O_INFO_BASIC);
+ ret = H5Oget_info3(oid, &oinfo, H5O_INFO_BASIC);
CHECK(ret, FAIL, "H5Oget_info");
- if(oinfo.addr != root_addr)
- TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)oinfo.addr, (long long unsigned)root_addr);
+ ret = H5VLnative_token_to_addr(fid, oinfo.token, &link_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
+ if(link_addr != root_addr)
+ TestErrPrintf("incorrect link target address: addr: %llu, expected: %llu\n", (long long unsigned)link_addr, (long long unsigned)root_addr);
ret = H5Aget_info_by_name(gid, ".", ATTR1_NAME, &ainfo, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Aget_info_by_name");
if(ainfo.data_size != dims)
diff --git a/test/testhdf5.c b/test/testhdf5.c
index e136086..72acf6c 100644
--- a/test/testhdf5.c
+++ b/test/testhdf5.c
@@ -57,7 +57,8 @@ main(int argc, char *argv[])
AddTest("attr", test_attr, cleanup_attr, "Attributes", NULL);
AddTest("select", test_select, cleanup_select, "Selections", NULL);
AddTest("time", test_time, cleanup_time, "Time Datatypes", NULL);
- AddTest("reference", test_reference, cleanup_reference, "References", NULL);
+ AddTest("ref_deprec", test_reference_deprec, cleanup_reference_deprec, "Deprecated References", NULL);
+ AddTest("ref", test_reference, cleanup_reference, "References", NULL);
AddTest("vltypes", test_vltypes, cleanup_vltypes, "Variable-Length Datatypes", NULL);
AddTest("vlstrings", test_vlstrings, cleanup_vlstrings, "Variable-Length Strings", NULL);
AddTest("iterate", test_iterate, cleanup_iterate, "Group & Attribute Iteration", NULL);
diff --git a/test/testhdf5.h b/test/testhdf5.h
index ef3b784..6b13cae 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -192,6 +192,7 @@ void test_attr(void);
void test_select(void);
void test_time(void);
void test_reference(void);
+void test_reference_deprec(void);
void test_vltypes(void);
void test_vlstrings(void);
void test_iterate(void);
@@ -215,6 +216,7 @@ void cleanup_attr(void);
void cleanup_select(void);
void cleanup_time(void);
void cleanup_reference(void);
+void cleanup_reference_deprec(void);
void cleanup_vltypes(void);
void cleanup_vlstrings(void);
void cleanup_iterate(void);
diff --git a/test/tfile.c b/test/tfile.c
index cf4403c..d6047dc 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -25,6 +25,7 @@
#include "H5Iprivate.h"
#include "H5Pprivate.h"
#include "H5VLprivate.h" /* Virtual Object Layer */
+#include "H5private.h"
/*
* This file needs to access private information from the H5F package.
@@ -2640,8 +2641,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
HDmemset(buffer, 0, sizeof(char*) * 5);
ret = H5Dread(did2, tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
CHECK(ret, FAIL, "H5Dread");
- ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, buffer);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, buffer);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Second file's dataset close */
ret = H5Dclose(did2);
@@ -2655,8 +2656,8 @@ test_file_double_file_dataset_open(hbool_t new_format)
HDmemset(buffer, 0, sizeof(char*) * 5);
ret = H5Dread(did1, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buffer);
CHECK(ret, FAIL, "H5Dread");
- ret = H5Dvlen_reclaim(tid2, sid1, H5P_DEFAULT, buffer);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid2, sid1, H5P_DEFAULT, buffer);
+ CHECK(ret, FAIL, "H5Treclaim");
/* First file's dataset close */
ret = H5Dclose(did1);
@@ -4083,7 +4084,7 @@ test_filespace_info(const char *env_h5_drvr)
for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) {
/* Test with 4 file space strategies */
- for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; H5_INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) {
+ for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) {
if(!contig_addr_vfd && (fs_strategy == H5F_FSPACE_STRATEGY_PAGE || fs_persist))
continue;
@@ -4208,7 +4209,7 @@ test_filespace_info(const char *env_h5_drvr)
**
*****************************************************************/
static int
-set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
+set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t split)
{
H5FD_mem_t memb_map[H5FD_MEM_NTYPES];
hid_t memb_fapl_arr[H5FD_MEM_NTYPES];
@@ -4217,7 +4218,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
hbool_t relax;
H5FD_mem_t mt;
- HDassert(split || multi);
+ HDassert(split);
HDmemset(memb_name, 0, sizeof memb_name);
@@ -4231,7 +4232,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize;
} else {
/* Set memb_addr aligned */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize;
} /* end else */
@@ -4240,7 +4241,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split)
TEST_ERROR
/* Free memb_name */
- for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt))
+ for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++)
free(memb_name[mt]);
return 0;
@@ -4308,7 +4309,7 @@ test_file_freespace(const char *env_h5_drvr)
my_fapl = new_fapl;
if(multi_vfd || split_vfd) {
- ret = set_multi_split(new_fapl, FSP_SIZE_DEF, multi_vfd, split_vfd);
+ ret = set_multi_split(new_fapl, FSP_SIZE_DEF, split_vfd);
CHECK(ret, FAIL, "set_multi_split");
}
@@ -4474,7 +4475,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
/* Set up paged aligned address space for multi/split driver */
if(multi_vfd || split_vfd) {
- ret = set_multi_split(fapl, FSP_SIZE_DEF, multi_vfd, split_vfd);
+ ret = set_multi_split(fapl, FSP_SIZE_DEF, split_vfd);
CHECK(ret, FAIL, "set_multi_split");
}
@@ -4607,7 +4608,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format)
if(multi_vfd) {
hssize_t ntmp;
- for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) {
+ for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) {
if(type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP)
continue;
/* Get the # of free-space sections in the file for metadata */
@@ -5177,7 +5178,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
{
hid_t file, group; /* Handles */
hid_t fapl; /* File access property list */
- H5O_info_t oinfo; /* Object info */
+ H5O_native_info_t ninfo; /* Object info */
herr_t ret; /* Return value */
/*
@@ -5195,9 +5196,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
/*
* Make sure the root group has the correct object header version
*/
- ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name");
/*
* Reopen the file and make sure the root group still has the correct version
@@ -5211,9 +5212,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
file = H5Fopen("tfile5.h5", H5F_ACC_RDWR, fapl);
CHECK(file, FAIL, "H5Fopen");
- ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name");
/*
* Create a group named "G1" in the file, and make sure it has the correct
@@ -5222,9 +5223,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
group = H5Gcreate2(file, "/G1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate");
- ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR);
- CHECK(ret, FAIL, "H5Oget_info");
- VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info");
+ ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR);
+ CHECK(ret, FAIL, "H5Oget_native)info");
+ VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info");
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
@@ -5236,9 +5237,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
group = H5Gcreate2(file, "/G1/G3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group, FAIL, "H5Gcreate");
- ret = H5Oget_info2(group, &oinfo, H5O_INFO_HDR);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.version, oh_vers_mod, "H5Oget_info_by_name");
+ ret = H5Oget_native_info(group, &ninfo, H5O_NATIVE_INFO_HDR);
+ CHECK(ret, FAIL, "H5Oget_native_info");
+ VERIFY(ninfo.hdr.version, oh_vers_mod, "H5Oget_native_info");
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
@@ -5246,9 +5247,9 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
/*
* Make sure the root group still has the correct object header version
*/
- ret = H5Oget_info_by_name2(file, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.version, oh_vers_create, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(file, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.version, oh_vers_create, "H5Oget_native_info_by_name");
ret = H5Fclose(file);
CHECK(ret, FAIL, "H5Fclose");
@@ -5348,7 +5349,7 @@ test_libver_bounds_open(void)
/* Opening VERBFNAME in these combination should succeed.
For each low bound, verify that it is upgraded properly */
high = H5F_LIBVER_LATEST;
- for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low))
+ for (low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
{
H5F_libver_t new_low = H5F_LIBVER_EARLIEST;
@@ -5515,8 +5516,8 @@ test_libver_bounds_low_high(void)
CHECK(fapl, H5I_INVALID_HID, "H5Pcreate");
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low))
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++)
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
H5E_BEGIN_TRY {
/* Set the low/high version bounds */
@@ -5919,8 +5920,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non
CHECK(new_fapl, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high bounds in new_fapl */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6034,7 +6035,7 @@ test_libver_bounds_obj(hid_t fapl)
hid_t new_fapl = H5I_INVALID_HID; /* File access property list */
H5F_t *f = NULL; /* Internal file pointer */
H5F_libver_t low, high; /* Low and high bounds */
- H5O_info_t oinfo; /* Object info */
+ H5O_native_info_t ninfo; /* Object info */
H5G_info_t ginfo; /* Group info */
herr_t ret; /* Return value */
@@ -6058,11 +6059,11 @@ test_libver_bounds_obj(hid_t fapl)
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Get root group's object info */
- ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
/* Verify object header version is 2 because shared message is enabled */
- VERIFY(oinfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds");
+ VERIFY(ninfo.hdr.version, H5O_VERSION_2, "H5O_obj_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -6077,11 +6078,11 @@ test_libver_bounds_obj(hid_t fapl)
CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Get root group's object info */
- ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(fid, "/", &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
/* Verify object header version is as indicated by low_bound */
- VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds");
+ VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[low], "H5O_obj_ver_bounds");
/* Close the file */
ret = H5Fclose(fid);
@@ -6095,8 +6096,8 @@ test_libver_bounds_obj(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl; create a group and verify the
object header version, then delete the group and close the file.*/
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6132,11 +6133,11 @@ test_libver_bounds_obj(hid_t fapl)
VERIFY(ginfo.storage_type, H5G_STORAGE_TYPE_SYMBOL_TABLE, "H5Gget_info");
/* Get object header information */
- ret = H5Oget_info_by_name2(gid, GRP_NAME, &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(gid, GRP_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
/* Verify object header version as indicated by low_bound */
- VERIFY(oinfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds");
+ VERIFY(ninfo.hdr.version, H5O_obj_ver_bounds[f->shared->low_bound], "H5O_obj_ver_bounds");
/* Close the group */
ret = H5Gclose(gid);
@@ -6306,8 +6307,8 @@ test_libver_bounds_dataset(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file with the fapl and create the chunked dataset */
/* Verify the dataset's layout, fill value and filter pipleline message versions */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -6519,8 +6520,8 @@ test_libver_bounds_dataspace(hid_t fapl)
/* Loop through all the combinations of low/high bounds in new_fapl */
/* Open the file and create the chunked/compact/contiguous datasets */
/* Verify the dataspace message version for the three datasets */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
hid_t tmp_sid, tmp_sid_compact, tmp_sid_contig; /* Dataspace IDs */
H5S_t *tmp_space, *tmp_space_compact, *tmp_space_contig; /* Internal dataspace pointers */
@@ -6844,8 +6845,8 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid)
/* Open the file and create the chunked dataset with the input tid */
/* Verify the dataset's datatype message version */
/* Also verify the committed atatype message version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
@@ -7165,8 +7166,8 @@ test_libver_bounds_attributes(hid_t fapl)
/* Loop through all the combinations of low/high bounds */
/* Open the file and group and attach an attribute to the group */
/* Verify the attribute version */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
H5E_BEGIN_TRY {
ret = H5Pset_libver_bounds(new_fapl, low, high);
} H5E_END_TRY;
diff --git a/test/th5o.c b/test/th5o.c
index 93a12e8..ab4a8de 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -20,6 +20,9 @@
*************************************************************/
#include "testhdf5.h"
+#include "H5Fprivate.h"
+#include "H5VLprivate.h"
+#include "H5VLnative_private.h"
#define TEST_FILENAME "th5o_file"
@@ -231,6 +234,7 @@ test_h5o_close(void)
}
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************************************************************
**
** test_h5o_open_by_addr(): Test H5Oopen_by_addr function.
@@ -239,17 +243,17 @@ test_h5o_close(void)
static void
test_h5o_open_by_addr(void)
{
- hid_t fid; /* HDF5 File ID */
- hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5L_info_t li; /* Buffer for H5Lget_info */
- haddr_t grp_addr; /* Addresses for objects */
- haddr_t dset_addr;
- haddr_t dtype_addr;
- hsize_t dims[RANK];
- H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
- H5G_info_t ginfo; /* Group info struct */
- H5T_class_t type_class; /* Class of the datatype */
- herr_t ret; /* Value returned from API calls */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info2_t li; /* Buffer for H5Lget_info */
+ haddr_t grp_addr; /* Addresses for objects */
+ haddr_t dset_addr;
+ haddr_t dtype_addr;
+ hsize_t dims[RANK];
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -285,15 +289,20 @@ test_h5o_open_by_addr(void)
CHECK(ret, FAIL, "H5Sclose");
/* Get address for each object */
- ret = H5Lget_info(fid, "group", &li, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lget_info");
- grp_addr = li.u.address;
- ret = H5Lget_info(fid, "group/datatype", &li, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lget_info");
- dtype_addr = li.u.address;
- ret = H5Lget_info(fid, "dataset", &li, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lget_info");
- dset_addr = li.u.address;
+ ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info2");
+ ret = H5VLnative_token_to_addr(fid, li.u.token, &grp_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
+
+ ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info2");
+ ret = H5VLnative_token_to_addr(fid, li.u.token, &dtype_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
+
+ ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info2");
+ ret = H5VLnative_token_to_addr(fid, li.u.token, &dset_addr);
+ CHECK(ret, FAIL, "H5VLnative_token_to_addr");
/* Now make sure that H5Oopen_by_addr can open all three types of objects */
grp = H5Oopen_by_addr(fid, grp_addr);
@@ -366,7 +375,122 @@ test_h5o_open_by_addr(void)
}H5E_END_TRY
VERIFY(dtype, FAIL, "H5Oopen_by_addr");
} /* test_h5o_open_by_addr() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+
+/****************************************************************
+**
+** test_h5o_open_by_token(): Test H5Oopen_by_token function.
+**
+****************************************************************/
+static void
+test_h5o_open_by_token(void)
+{
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info2_t li; /* Buffer for H5Lget_info */
+ hsize_t dims[RANK];
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
+
+ /* Create a new HDF5 file */
+ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create a group, dataset, and committed datatype within the file */
+ /* Create the group */
+ grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp, FAIL, "H5Gcreate2");
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Commit the type inside the group */
+ dtype = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(dtype, FAIL, "H5Tcopy");
+ ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Create the data space for the dataset. */
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ dspace = H5Screate_simple(RANK, dims, NULL);
+ CHECK(dspace, FAIL, "H5Screate_simple");
+
+ /* Create the dataset. */
+ dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Make sure that H5Oopen_by_token can open all three types of objects */
+ ret = H5Lget_info2(fid, "group", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info");
+ grp = H5Oopen_by_token(fid, li.u.token);
+ CHECK(grp, FAIL, "H5Oopen_by_token");
+
+ ret = H5Lget_info2(fid, "group/datatype", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info");
+ dtype = H5Oopen_by_token(fid, li.u.token);
+ CHECK(dtype, FAIL, "H5Oopen_by_token");
+
+ ret = H5Lget_info2(fid, "dataset", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info");
+ /* Check that we can use the group ID as a valid location */
+ dset = H5Oopen_by_token(grp, li.u.token);
+ CHECK(dset, FAIL, "H5Oopen_by_token");
+
+ /* Make sure that each is the right kind of ID */
+ id_type = H5Iget_type(grp);
+ VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID");
+ id_type = H5Iget_type(dtype);
+ VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID");
+ id_type = H5Iget_type(dset);
+ VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID");
+
+ /* Do something more complex with each of the IDs to make sure they "work" */
+ ret = H5Gget_info(grp, &ginfo);
+ CHECK(ret, FAIL, "H5Gget_info");
+ VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */
+
+ type_class = H5Tget_class(dtype);
+ VERIFY(type_class, H5T_INTEGER, "H5Tget_class");
+
+ dspace = H5Dget_space(dset);
+ CHECK(dspace, FAIL, "H5Dget_space");
+
+ /* Close the IDs */
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Try giving some bogus values to H5O_open_by_token */
+ /* Try opening an object using H5O_TOKEN_UNDEF (should fail) */
+ H5E_BEGIN_TRY{
+ dtype = H5Oopen_by_token(fid, H5O_TOKEN_UNDEF);
+ }H5E_END_TRY
+ VERIFY(dtype, FAIL, "H5Oopen_by_token");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Also, trying to open an object without a valid location (should fail) */
+ H5E_BEGIN_TRY{
+ dtype = H5Oopen_by_token(fid, li.u.token);
+ }H5E_END_TRY
+ VERIFY(dtype, FAIL, "H5Oopen_by_token");
+} /* test_h5o_open_by_token() */
/****************************************************************
**
@@ -378,7 +502,7 @@ test_h5o_refcount(void)
{
hid_t fid; /* HDF5 File ID */
hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5O_info_t oinfo; /* Object info struct */
+ H5O_info2_t oinfo; /* Object info struct */
hsize_t dims[RANK];
herr_t ret; /* Value returned from API calls */
@@ -410,15 +534,15 @@ test_h5o_refcount(void)
CHECK(ret, FAIL, "H5Sclose");
/* Get ref counts for each object. They should all be 1, since each object has a hard link. */
- ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
/* Increment each object's reference count. */
ret = H5Oincr_refcount(grp);
@@ -429,15 +553,15 @@ test_h5o_refcount(void)
CHECK(ret, FAIL, "H5Oincr_refcount");
/* Get ref counts for each object. They should all be 2 now. */
- ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3");
/* Decrement the reference counts and check that they decrease back to 1. */
ret = H5Odecr_refcount(grp);
@@ -447,15 +571,15 @@ test_h5o_refcount(void)
ret = H5Odecr_refcount(dset);
CHECK(ret, FAIL, "H5Odecr_refcount");
- ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
/* Increment the reference counts and then close the file to make sure the increment is permanant */
ret = H5Oincr_refcount(grp);
@@ -485,15 +609,15 @@ test_h5o_refcount(void)
dset = H5Dopen2(fid, "dataset", H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dopen2");
- ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 2, "reference count in H5Oget_info_by_name3");
/* Decrement the reference counts and close the file */
ret = H5Odecr_refcount(grp);
@@ -523,15 +647,15 @@ test_h5o_refcount(void)
dset = H5Dopen2(fid, "dataset", H5P_DEFAULT);
CHECK(dset, FAIL, "H5Dopen2");
- ret = H5Oget_info_by_name2(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid, "group", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "datatype", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid, "dataset", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ VERIFY(oinfo.rc, 1, "reference count in H5Oget_info_by_name3");
/* Close the IDs */
ret = H5Gclose(grp);
@@ -806,8 +930,8 @@ test_h5o_link(void)
CHECK(fapl_id, FAIL, "H5Pcreate");
/* Loop through all the combinations of low/high library format bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Set version bounds */
H5E_BEGIN_TRY {
@@ -1254,7 +1378,7 @@ test_h5o_getinfo_same_file(void)
{
hid_t fid1, fid2; /* HDF5 File ID */
hid_t gid1, gid2; /* Group IDs */
- H5O_info_t oinfo1, oinfo2; /* Object info structs */
+ H5O_info2_t oinfo1, oinfo2; /* Object info structs */
herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
@@ -1272,24 +1396,24 @@ test_h5o_getinfo_same_file(void)
HDmemset(&oinfo2, 0, sizeof(oinfo2));
/* Query the object info for each object, through group IDs */
- ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC);
- CHECK(ret, FAIL, "H5Oget_info");
- ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC);
- CHECK(ret, FAIL, "H5Oget_info");
+ ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC);
+ CHECK(ret, FAIL, "H5Oget_info3");
- VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info");
+ VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3");
/* Reset object info */
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
/* Query the object info for each object, by name */
- ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info");
+ VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3");
/* Close everything */
ret = H5Gclose(gid1);
@@ -1317,24 +1441,24 @@ test_h5o_getinfo_same_file(void)
HDmemset(&oinfo2, 0, sizeof(oinfo2));
/* Query the object info for each object, through group IDs */
- ret = H5Oget_info2(gid1, &oinfo1, H5O_INFO_BASIC);
- CHECK(ret, FAIL, "H5Oget_info");
- ret = H5Oget_info2(gid2, &oinfo2, H5O_INFO_BASIC);
- CHECK(ret, FAIL, "H5Oget_info");
+ ret = H5Oget_info3(gid1, &oinfo1, H5O_INFO_BASIC);
+ CHECK(ret, FAIL, "H5Oget_info3");
+ ret = H5Oget_info3(gid2, &oinfo2, H5O_INFO_BASIC);
+ CHECK(ret, FAIL, "H5Oget_info3");
- VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info");
+ VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3");
/* Reset object info */
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
/* Query the object info for each object, by name */
- ret = H5Oget_info_by_name2(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(fid1, "group1", &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(fid1, "group2", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
- VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info");
+ VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info3");
/* Close everything */
ret = H5Gclose(gid1);
@@ -1352,6 +1476,143 @@ test_h5o_getinfo_same_file(void)
/****************************************************************
**
+** test_h5o_open_by_addr_deprec(): Test H5Oopen_by_addr function.
+**
+****************************************************************/
+static void
+test_h5o_open_by_addr_deprec(void)
+{
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info1_t li; /* Buffer for H5Lget_info1 */
+ haddr_t grp_addr; /* Addresses for objects */
+ haddr_t dset_addr;
+ haddr_t dtype_addr;
+ hsize_t dims[RANK];
+ H5I_type_t id_type; /* Type of IDs returned from H5Oopen */
+ H5G_info_t ginfo; /* Group info struct */
+ H5T_class_t type_class; /* Class of the datatype */
+ herr_t ret; /* Value returned from API calls */
+
+ /* Create a new HDF5 file */
+ fid = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create a group, dataset, and committed datatype within the file */
+ /* Create the group */
+ grp = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(grp, FAIL, "H5Gcreate2");
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Commit the type inside the group */
+ dtype = H5Tcopy(H5T_NATIVE_INT);
+ CHECK(dtype, FAIL, "H5Tcopy");
+ ret = H5Tcommit2(fid, "group/datatype", dtype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Create the data space for the dataset. */
+ dims[0] = DIM0;
+ dims[1] = DIM1;
+ dspace = H5Screate_simple(RANK, dims, NULL);
+ CHECK(dspace, FAIL, "H5Screate_simple");
+
+ /* Create the dataset. */
+ dset = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, dspace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset, FAIL, "H5Dcreate2");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Get address for each object */
+ ret = H5Lget_info1(fid, "group", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info");
+ grp_addr = li.u.address;
+ ret = H5Lget_info1(fid, "group/datatype", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info");
+ dtype_addr = li.u.address;
+ ret = H5Lget_info1(fid, "dataset", &li, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info");
+ dset_addr = li.u.address;
+
+ /* Now make sure that H5Oopen_by_addr can open all three types of objects */
+ grp = H5Oopen_by_addr(fid, grp_addr);
+ CHECK(grp, FAIL, "H5Oopen_by_addr");
+ dtype = H5Oopen_by_addr(fid, dtype_addr);
+ CHECK(dtype, FAIL, "H5Oopen_by_addr");
+ /* Check that we can use the group ID as a valid location */
+ dset = H5Oopen_by_addr(grp, dset_addr);
+ CHECK(dset, FAIL, "H5Oopen_by_addr");
+
+ /* Make sure that each is the right kind of ID */
+ id_type = H5Iget_type(grp);
+ VERIFY(id_type, H5I_GROUP, "H5Iget_type for group ID");
+ id_type = H5Iget_type(dtype);
+ VERIFY(id_type, H5I_DATATYPE, "H5Iget_type for datatype ID");
+ id_type = H5Iget_type(dset);
+ VERIFY(id_type, H5I_DATASET, "H5Iget_type for dataset ID");
+
+ /* Do something more complex with each of the IDs to make sure they "work" */
+ ret = H5Gget_info(grp, &ginfo);
+ CHECK(ret, FAIL, "H5Gget_info");
+ VERIFY(ginfo.nlinks, 1, "H5Gget_info"); /* There should be one object, the datatype */
+
+ type_class = H5Tget_class(dtype);
+ VERIFY(type_class, H5T_INTEGER, "H5Tget_class");
+
+ dspace = H5Dget_space(dset);
+ CHECK(dspace, FAIL, "H5Dget_space");
+
+ /* Close the IDs */
+ ret = H5Sclose(dspace);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Gclose(grp);
+ CHECK(ret, FAIL, "H5Gclose");
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+ ret = H5Dclose(dset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Try giving some bogus values to H5O_open_by_addr. */
+ /* Try to open an object with a bad address */
+ grp_addr += 20;
+ H5E_BEGIN_TRY{
+ grp = H5Oopen_by_addr(fid, grp_addr);
+ }H5E_END_TRY
+ VERIFY(grp, FAIL, "H5Oopen_by_addr");
+
+ /* For instance, an objectno smaller than the end of the file's superblock should
+ * trigger an error */
+ grp_addr = 10;
+ H5E_BEGIN_TRY{
+ grp = H5Oopen_by_addr(fid, grp_addr);
+ }H5E_END_TRY
+ VERIFY(grp, FAIL, "H5Oopen_by_addr");
+
+ /* Likewise, an objectno larger than the size of the file should fail */
+ grp_addr = 0;
+ grp_addr = 1000000000;
+ H5E_BEGIN_TRY{
+ grp = H5Oopen_by_addr(fid, grp_addr);
+ }H5E_END_TRY
+ VERIFY(grp, FAIL, "H5Oopen_by_addr");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Also, trying to open an object without a valid location should fail */
+ H5E_BEGIN_TRY{
+ dtype = H5Oopen_by_addr(fid, dtype_addr);
+ }H5E_END_TRY
+ VERIFY(dtype, FAIL, "H5Oopen_by_addr");
+} /* test_h5o_open_by_addr_deprec() */
+
+
+/****************************************************************
+**
** visit_obj_cb():
** This is the callback function invoked by H5Ovisit1() in
** test_h5o_getinfo_visit():
@@ -1360,10 +1621,10 @@ test_h5o_getinfo_same_file(void)
**
****************************************************************/
static int
-visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1,
+visit_obj_cb(hid_t group_id, const char *name, const H5O_info1_t *oinfo1,
void H5_ATTR_UNUSED *_op_data)
{
- H5O_info_t oinfo2; /* Object info structs */
+ H5O_info1_t oinfo2; /* Object info structs */
/* Verify the object info for "group1", "group2" and the root group */
if(!(HDstrcmp(name, "group1"))) {
@@ -1399,7 +1660,7 @@ test_h5o_getinfo_visit(void)
hid_t gid1 = -1, gid2 = -1; /* Group IDs */
hid_t sid = -1; /* Dataspace ID */
hid_t aid = -1; /* Attribute ID */
- H5O_info_t oinfo1, oinfo2; /* Object info structs */
+ H5O_info1_t oinfo1, oinfo2; /* Object info structs */
char attrname[25]; /* Attribute name */
int j; /* Local index variable */
herr_t ret; /* Value returned from API calls */
@@ -1438,9 +1699,9 @@ test_h5o_getinfo_visit(void)
/* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */
ret = H5Oget_info1(gid1, &oinfo1);
- CHECK(ret, FAIL, "H5Oget_info");
+ CHECK(ret, FAIL, "H5Oget_info1");
ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS);
- CHECK(ret, FAIL, "H5Oget_info");
+ CHECK(ret, FAIL, "H5Oget_info2");
/* Verify the object info for "group1" is correct */
VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info1/2");
@@ -1452,9 +1713,9 @@ test_h5o_getinfo_visit(void)
/* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */
ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
/* Verify the object info for "group2" is correct */
VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info1/2");
@@ -1491,18 +1752,22 @@ test_h5o(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Objects\n"));
- test_h5o_open(); /* Test generic open function */
- test_h5o_open_by_addr(); /* Test opening objects by address */
- test_h5o_close(); /* Test generic close function */
- test_h5o_refcount(); /* Test incrementing and decrementing reference count */
- test_h5o_plist(); /* Test object creation properties */
- test_h5o_link(); /* Test object link routine */
- test_h5o_comment(); /* Test routines for comment */
- test_h5o_comment_by_name(); /* Test routines for comment by name */
- test_h5o_getinfo_same_file(); /* Test info for objects in the same file */
+ test_h5o_open(); /* Test generic open function */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */
-#endif
+ test_h5o_open_by_addr(); /* Test opening objects by address */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ test_h5o_open_by_token(); /* Test opening objects by token */
+ test_h5o_close(); /* Test generic close function */
+ test_h5o_refcount(); /* Test incrementing and decrementing reference count */
+ test_h5o_plist(); /* Test object creation properties */
+ test_h5o_link(); /* Test object link routine */
+ test_h5o_comment(); /* Test routines for comment */
+ test_h5o_comment_by_name(); /* Test routines for comment by name */
+ test_h5o_getinfo_same_file(); /* Test info for objects in the same file */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ test_h5o_open_by_addr_deprec(); /* Test opening objects by address with H5Lget_info1 */
+ test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* test_h5o() */
diff --git a/test/th5s.c b/test/th5s.c
index 1a4456a..c60b1ff 100644
--- a/test/th5s.c
+++ b/test/th5s.c
@@ -591,7 +591,7 @@ test_h5s_zero_dim(void)
wdata_real[i][j][k] = (int)(i + j + k);
/* Test with different space allocation times */
- for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) {
+ for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) {
/* Make sure we can create the space with the dimension size 0 (starting from v1.8.7).
* The dimension doesn't need to be unlimited. */
@@ -1739,12 +1739,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
case CONFIG_16:
stride = POWER16 - 1;
block = 4;
- expected_enc_size = expected_version == 3 ? 2 : 4;
+ expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4);
break;
case CONFIG_32:
stride = POWER32 - 1;
block = 4;
- expected_enc_size = expected_version == 3 ? 4 : 8;
+ expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8);
break;
default:
@@ -1765,12 +1765,12 @@ test_h5s_encode_regular_hyper(H5F_libver_t low, H5F_libver_t high)
case CONFIG_16:
stride = POWER16 - 1;
block = POWER16 - 2;
- expected_enc_size = expected_version == 3 ? 2 : 4;
+ expected_enc_size = (uint8_t)(expected_version == 3 ? 2 : 4);
break;
case CONFIG_32:
stride = POWER32 - 1;
block = POWER32 - 2;
- expected_enc_size = expected_version == 3 ? 4 : 8;
+ expected_enc_size = (uint8_t)(expected_version == 3 ? 4 : 8);
break;
default:
HDassert(0);
@@ -1912,7 +1912,7 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
for(config = CONFIG_8; config <= CONFIG_32; config++) {
hbool_t expected_to_fail = FALSE; /* Whether H5Sencode2 is expected to fail */
uint32_t expected_version = 0; /* Expected version for selection info */
- uint8_t expected_enc_size = 0; /* Expected encoded size for selection info */
+ uint32_t expected_enc_size = 0; /* Expected encoded size for selection info */
start = 0;
count = 2;
@@ -1984,7 +1984,8 @@ test_h5s_encode_irregular_hyper(H5F_libver_t low, H5F_libver_t high)
VERIFY(is_regular, FALSE, "H5Sis_regular_hyperslab");
/* Verify the version and encoded size expected for the configuration */
- ret = test_h5s_check_encoding(fapl, sid, expected_version, expected_enc_size, expected_to_fail);
+ HDassert(expected_enc_size <= 255);
+ ret = test_h5s_check_encoding(fapl, sid, expected_version, (uint8_t)expected_enc_size, expected_to_fail);
CHECK(ret, FAIL, "test_h5s_check_encoding");
} /* for config */
@@ -2458,11 +2459,12 @@ test_h5s_compound_scalar_read(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-} /* test_h5s_compound_scalar_read() */
+} /* end test_h5s_compound_scalar_read() */
-/* Data arrays for chunk test */
-double chunk_data_dbl[50000][3];
-float chunk_data_flt[50000][3];
+
+/* Data array sizes for chunk test */
+#define CHUNK_DATA_NX 50000
+#define CHUNK_DATA_NY 3
/****************************************************************
**
@@ -2480,22 +2482,41 @@ test_h5s_chunk(void)
hid_t space_id;
hsize_t dims[2];
hsize_t csize[2];
+ double **chunk_data_dbl = NULL;
+ double *chunk_data_dbl_data = NULL;
+ float **chunk_data_flt = NULL;
+ float *chunk_data_flt_data = NULL;
int i,j;
+ /* Allocate memory */
+ chunk_data_dbl_data = (double *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(double));
+ CHECK_PTR(chunk_data_dbl_data, "HDcalloc");
+ chunk_data_dbl = (double **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_dbl_data));
+ CHECK_PTR(chunk_data_dbl, "HDcalloc");
+ for (i = 0; i < CHUNK_DATA_NX; i++)
+ chunk_data_dbl[i] = chunk_data_dbl_data + (i * CHUNK_DATA_NY);
+
+ chunk_data_flt_data = (float *)HDcalloc(CHUNK_DATA_NX * CHUNK_DATA_NY, sizeof(float));
+ CHECK_PTR(chunk_data_flt_data, "HDcalloc");
+ chunk_data_flt = (float **)HDcalloc(CHUNK_DATA_NX, sizeof(chunk_data_flt_data));
+ CHECK_PTR(chunk_data_flt, "HDcalloc");
+ for (i = 0; i < CHUNK_DATA_NX; i++)
+ chunk_data_flt[i] = chunk_data_flt_data + (i * CHUNK_DATA_NY);
+
fileID = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(fileID, FAIL, "H5Fcreate");
plist_id = H5Pcreate(H5P_DATASET_CREATE);
CHECK(plist_id, FAIL, "H5Pcreate");
- csize[0] = 50000;
- csize[1] = 3;
+ csize[0] = CHUNK_DATA_NX;
+ csize[1] = CHUNK_DATA_NY;
status = H5Pset_chunk(plist_id, 2, csize);
CHECK(status, FAIL, "H5Pset_chunk");
/* Create the dataspace */
- dims[0] = 50000;
- dims[1] = 3;
+ dims[0] = CHUNK_DATA_NX;
+ dims[1] = CHUNK_DATA_NY;
space_id = H5Screate_simple(2, dims, NULL);
CHECK(space_id, FAIL, "H5Screate_simple");
@@ -2503,11 +2524,11 @@ test_h5s_chunk(void)
CHECK(dsetID, FAIL, "H5Dcreate2");
/* Initialize float array */
- for(i = 0; i < 50000; i++)
- for(j = 0; j < 3; j++)
+ for(i = 0; i < CHUNK_DATA_NX; i++)
+ for(j = 0; j < CHUNK_DATA_NY; j++)
chunk_data_flt[i][j] = (float)(i + 1) * 2.5F - (float)j * 100.3F;
- status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
+ status = H5Dwrite(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
CHECK(status, FAIL, "H5Dwrite");
status = H5Pclose(plist_id);
@@ -2520,17 +2541,17 @@ test_h5s_chunk(void)
CHECK(status, FAIL, "H5Fclose");
/* Reset/initialize the data arrays to read in */
- HDmemset(chunk_data_dbl, 0, sizeof(double) * 50000 * 3);
- HDmemset(chunk_data_flt, 0, sizeof(float) * 50000 * 3);
+ HDmemset(chunk_data_dbl_data, 0, sizeof(double) * CHUNK_DATA_NX * CHUNK_DATA_NY);
+ HDmemset(chunk_data_flt_data, 0, sizeof(float) * CHUNK_DATA_NX * CHUNK_DATA_NY);
fileID = H5Fopen(DATAFILE, H5F_ACC_RDONLY, H5P_DEFAULT);
CHECK(fileID, FAIL, "H5Fopen");
dsetID = H5Dopen2(fileID, "coords", H5P_DEFAULT);
CHECK(dsetID, FAIL, "H5Dopen2");
- status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl);
+ status= H5Dread(dsetID, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_dbl_data);
CHECK(status, FAIL, "H5Dread");
- status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt);
+ status= H5Dread(dsetID, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, chunk_data_flt_data);
CHECK(status, FAIL, "H5Dread");
status = H5Dclose(dsetID);
@@ -2538,13 +2559,18 @@ test_h5s_chunk(void)
status = H5Fclose(fileID);
CHECK(status, FAIL, "H5Fclose");
- for(i=0; i<50000; i++) {
- for(j=0; j<3; j++) {
+ for(i = 0; i < CHUNK_DATA_NX; i++) {
+ for(j = 0; j < CHUNK_DATA_NY; j++) {
/* Check if the two values are within 0.001% range. */
if(!H5_DBL_REL_EQUAL(chunk_data_dbl[i][j], (double)chunk_data_flt[i][j], (double)0.00001F))
TestErrPrintf("%u: chunk_data_dbl[%d][%d]=%e, chunk_data_flt[%d][%d]=%e\n", (unsigned)__LINE__, i, j, chunk_data_dbl[i][j], i, j, (double)chunk_data_flt[i][j]);
} /* end for */
} /* end for */
+
+ HDfree(chunk_data_dbl);
+ HDfree(chunk_data_dbl_data);
+ HDfree(chunk_data_flt);
+ HDfree(chunk_data_flt_data);
} /* test_h5s_chunk() */
/****************************************************************
@@ -3366,8 +3392,8 @@ test_h5s(void)
test_h5s_zero_dim(); /* Test dataspace with zero dimension size */
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Invalid combinations, just continue */
if(high == H5F_LIBVER_EARLIEST || high < low)
diff --git a/test/thread_id.c b/test/thread_id.c
new file mode 100644
index 0000000..af36625
--- /dev/null
+++ b/test/thread_id.c
@@ -0,0 +1,192 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Check that a thread ID returned by H5TS_thread_id() possesses the
+ * following properties:
+ *
+ * 1 ID >= 1.
+ * 2 The ID is constant over the thread's lifetime.
+ * 3 No two threads share an ID during their lifetimes.
+ * 4 A thread's ID is available for reuse as soon as it is joined.
+ */
+
+/*
+ * Include required headers. This file tests internal library functions,
+ * so we include the private headers here.
+ */
+#include "testhdf5.h"
+
+static void my_errx(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3);
+
+static void
+my_errx(int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ (void)HDfprintf(stderr, "thread_id: ");
+ HDva_start(ap, fmt);
+ (void)HDvfprintf(stderr, fmt, ap);
+ HDva_end(ap);
+ (void)HDfputc('\n', stderr);
+ HDexit(code);
+}
+
+#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS)
+
+static void my_err(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3);
+
+static void
+my_err(int code, const char *fmt, ...)
+{
+ va_list ap;
+ int errno_copy = errno;
+
+ (void)HDfprintf(stderr, "thread_id: ");
+ HDva_start(ap, fmt);
+ (void)HDvfprintf(stderr, fmt, ap);
+ HDva_end(ap);
+ (void)HDfprintf(stderr, ": %s\n", HDstrerror(errno_copy));
+ HDexit(code);
+}
+
+#define threads_failure(_call, _result) do { \
+ my_errx(EXIT_FAILURE, "%s.%d: " #_call ": %s", __func__, \
+ __LINE__, HDstrerror(_result)); \
+} while (false)
+
+#define NTHREADS 5
+
+static volatile bool failed = false;
+static pthread_barrier_t barrier;
+static bool used[NTHREADS];
+static pthread_mutex_t used_lock;
+
+static void
+atomic_printf(const char *fmt, ...)
+{
+ char buf[80];
+ va_list ap;
+ ssize_t nprinted, nwritten;
+
+ va_start(ap, fmt);
+ nprinted = vsnprintf(buf, sizeof(buf), fmt, ap);
+ va_end(ap);
+
+ if (nprinted == -1)
+ my_err(EXIT_FAILURE, "%s.%d: vsnprintf", __func__, __LINE__);
+ else if (nprinted >= (ssize_t)sizeof(buf))
+ my_errx(EXIT_FAILURE, "%s.%d: vsnprintf overflowed", __func__, __LINE__);
+
+ nwritten = write(STDOUT_FILENO, buf, (size_t)nprinted);
+ if (nwritten < nprinted) {
+ my_errx(EXIT_FAILURE, "%s.%d: write error or short write",
+ __func__, __LINE__);
+ }
+}
+
+/* Each thread runs this routine. The routine fetches the current
+ * thread's ID, makes sure that it is in the expected range, makes
+ * sure that in this round of testing, no two threads shared the
+ * same ID,
+ */
+static void *
+thread_main(void H5_ATTR_UNUSED *arg)
+{
+ uint64_t ntid, tid;
+
+ tid = H5TS_thread_id();
+
+ if (tid < 1 || NTHREADS < tid) {
+ atomic_printf("unexpected tid %" PRIu64 " FAIL\n", tid);
+ goto pre_barrier_error;
+ }
+ pthread_mutex_lock(&used_lock);
+ if (used[tid - 1]) {
+ atomic_printf("reused tid %" PRIu64 " FAIL\n", tid);
+ pthread_mutex_unlock(&used_lock);
+ goto pre_barrier_error;
+ }
+ used[tid - 1] = true;
+ pthread_mutex_unlock(&used_lock);
+
+ atomic_printf("tid %" PRIu64 " in [1, %d] PASS\n", tid, NTHREADS);
+ pthread_barrier_wait(&barrier);
+
+ ntid = H5TS_thread_id();
+ if (ntid != tid) {
+ atomic_printf("tid changed from %" PRIu64 " to %" PRIu64 " FAIL\n",
+ tid, ntid);
+ failed = true;
+ }
+ return NULL;
+pre_barrier_error:
+ pthread_barrier_wait(&barrier);
+ failed = true;
+ return NULL;
+}
+
+int
+main(void)
+{
+ int i, rc, times;
+ pthread_t threads[NTHREADS];
+
+ /* Run H5open() to initialize the library's thread-ID freelist,
+ * mutex, etc.
+ */
+ if (H5open() != SUCCEED)
+ my_errx(EXIT_FAILURE, "%s.%d: H5open failed", __func__, __LINE__);
+
+ if ((rc = pthread_mutex_init(&used_lock, NULL)) == -1)
+ threads_failure(pthread_mutex_init, rc);
+
+ if ((rc = pthread_barrier_init(&barrier, NULL, NTHREADS)) != 0)
+ threads_failure(pthread_barrier_init, rc);
+
+ /* Start the test threads and join them twice to make sure that
+ * the thread IDs are recycled in the second round.
+ */
+ for (times = 0; times < 2; times++) {
+
+ for (i = 0; i < NTHREADS; i++)
+ used[i] = false; // access synchronized by thread create/join
+
+ for (i = 0; i < NTHREADS; i++) {
+ rc = pthread_create(&threads[i], NULL, thread_main, NULL);
+ if (rc != 0)
+ threads_failure(pthread_create, rc);
+ }
+
+ for (i = 0; i < NTHREADS; i++) {
+ rc = pthread_join(threads[i], NULL);
+ if (rc != 0)
+ threads_failure(pthread_join, rc);
+ }
+
+ for (i = 0; i < NTHREADS; i++) {
+ if (!used[i]) // access synchronized by thread create/join
+ my_errx(EXIT_FAILURE, "thread ID %d did not run.", i + 1);
+ }
+ }
+ if ((rc = pthread_barrier_destroy(&barrier)) != 0)
+ threads_failure(pthread_barrier_destroy, rc);
+ return failed ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+#else /*H5_HAVE_THREADSAFE && !H5_HAVE_WIN_THREADS*/
+int
+main(void)
+{
+ HDfprintf(stderr, "not implemented in this configuration.\n");
+ return EXIT_SUCCESS;
+}
+#endif /*H5_HAVE_THREADSAFE && !H5_HAVE_WIN_THREADS*/
diff --git a/test/tid.c b/test/tid.c
index d0ae3e4..7a839d2 100644
--- a/test/tid.c
+++ b/test/tid.c
@@ -19,6 +19,13 @@
#define H5I_FRIEND /*suppress error about including H5Ipkg */
#include "H5Ipkg.h"
+static herr_t
+free_wrapper(void *p)
+{
+ HDfree(p);
+ return SUCCEED;
+}
+
/* Test basic functionality of registering and deleting types and IDs */
static int basic_id_test(void)
{
@@ -69,7 +76,7 @@ static int basic_id_test(void)
goto out;
/* Register a type */
- myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
+ myType = H5Iregister_type((size_t)64, 0, free_wrapper);
CHECK(myType, H5I_BADID, "H5Iregister_type");
if(myType == H5I_BADID)
@@ -163,7 +170,7 @@ static int basic_id_test(void)
H5E_END_TRY
/* Register another type and another object in that type */
- myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free );
+ myType = H5Iregister_type((size_t)64, 0, free_wrapper);
CHECK(myType, H5I_BADID, "H5Iregister_type");
if(myType == H5I_BADID)
@@ -238,7 +245,7 @@ out:
/* A dummy search function for the next test */
-static int test_search_func(void H5_ATTR_UNUSED * ptr1, void H5_ATTR_UNUSED * ptr2) { return 0; }
+static int test_search_func(void H5_ATTR_UNUSED * ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED * ptr2) { return 0; }
/* Ensure that public functions cannot access "predefined" ID types */
static int id_predefined_test(void )
@@ -264,7 +271,7 @@ static int id_predefined_test(void )
goto out;
H5E_BEGIN_TRY
- testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj);
+ testPtr = H5Isearch(H5I_GENPROP_LST, test_search_func, testObj);
H5E_END_TRY
CHECK_PTR_NULL(testPtr, "H5Isearch");
@@ -492,7 +499,7 @@ static int test_id_type_list(void)
H5I_type_t testType;
int i; /* Just a counter variable */
- startType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ startType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(startType, H5I_BADID, "H5Iregister_type");
if(startType == H5I_BADID)
goto out;
@@ -507,7 +514,7 @@ static int test_id_type_list(void)
/* Create types up to H5I_MAX_NUM_TYPES */
for(i = startType + 1; i < H5I_MAX_NUM_TYPES; i++)
{
- currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ currentType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(currentType, H5I_BADID, "H5Iregister_type");
if(currentType == H5I_BADID)
goto out;
@@ -516,7 +523,7 @@ static int test_id_type_list(void)
/* Wrap around to low type ID numbers */
for(i = H5I_NTYPES; i < startType; i++)
{
- currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ currentType = H5Iregister_type((size_t)8, 0, free_wrapper);
CHECK(currentType, H5I_BADID, "H5Iregister_type");
if(currentType == H5I_BADID)
goto out;
@@ -524,7 +531,7 @@ static int test_id_type_list(void)
/* There should be no room at the inn for a new ID type*/
H5E_BEGIN_TRY
- testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ testType = H5Iregister_type((size_t)8, 0, free_wrapper);
H5E_END_TRY
VERIFY(testType, H5I_BADID, "H5Iregister_type");
@@ -533,7 +540,7 @@ static int test_id_type_list(void)
/* Now delete a type and try to insert again */
H5Idestroy_type(H5I_NTYPES);
- testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free );
+ testType = H5Iregister_type((size_t)8, 0, free_wrapper);
VERIFY(testType, H5I_NTYPES, "H5Iregister_type");
if(testType != H5I_NTYPES)
diff --git a/test/titerate.c b/test/titerate.c
index 289a46c..9d60915 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -68,9 +68,9 @@ static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_clie
/* Local functions */
int iter_strcmp(const void *s1, const void *s2);
int iter_strcmp2(const void *s1, const void *s2);
-static herr_t liter_cb(hid_t group, const char *name, const H5L_info_t *info,
+static herr_t liter_cb(hid_t group, const char *name, const H5L_info2_t *info,
void *op_data);
-static herr_t liter_cb2(hid_t group, const char *name, const H5L_info_t *info,
+static herr_t liter_cb2(hid_t group, const char *name, const H5L_info2_t *info,
void *op_data);
herr_t aiter_cb(hid_t group, const char *name, const H5A_info_t *ainfo,
void *op_data);
@@ -91,7 +91,7 @@ H5_ATTR_PURE int iter_strcmp(const void *s1, const void *s2)
**
****************************************************************/
static herr_t
-liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info,
+liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
void *op_data)
{
iter_info *info = (iter_info *)op_data;
@@ -153,8 +153,8 @@ test_iter_group(hid_t fapl, hbool_t new_format)
/* Test iterating over empty group */
info.command = RET_ZERO;
idx = 0;
- ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
- VERIFY(ret, SUCCEED, "H5Literate");
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ VERIFY(ret, SUCCEED, "H5Literate2");
datatype = H5Tcopy(H5T_NATIVE_INT);
CHECK(datatype, FAIL, "H5Tcopy");
@@ -220,12 +220,12 @@ test_iter_group(hid_t fapl, hbool_t new_format)
VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info");
for(i = 0; i< (int)ginfo.nlinks; i++) {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
ret = (herr_t)H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_idx");
} /* end for */
@@ -246,13 +246,13 @@ test_iter_group(hid_t fapl, hbool_t new_format)
VERIFY(ginfo.nlinks, NDATASETS + 2, "H5Gget_info");
for(i = 0; i< (int)ginfo.nlinks; i++) {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
ret = (herr_t)H5Lget_name_by_idx(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, dataset_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx2(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_idx");
+ ret = H5Oget_info_by_idx3(file, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_idx3");
} /* end for */
H5E_BEGIN_TRY {
@@ -264,28 +264,28 @@ test_iter_group(hid_t fapl, hbool_t new_format)
info.command = RET_ZERO;
idx = (hsize_t)-1;
H5E_BEGIN_TRY {
- ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
} H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Literate");
+ VERIFY(ret, FAIL, "H5Literate2");
/* Test skipping exactly as many entries as in the group */
idx = NDATASETS + 2;
H5E_BEGIN_TRY {
- ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
} H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Literate");
+ VERIFY(ret, FAIL, "H5Literate2");
/* Test skipping more entries than are in the group */
idx = NDATASETS + 3;
H5E_BEGIN_TRY {
- ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info);
} H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Literate");
+ VERIFY(ret, FAIL, "H5Literate2");
/* Test all objects in group, when callback always returns 0 */
info.command = RET_ZERO;
idx = 0;
- if((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0)
+ if((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0)
TestErrPrintf("Group iteration function didn't return zero correctly!\n");
/* Test all objects in group, when callback always returns 1 */
@@ -293,15 +293,15 @@ test_iter_group(hid_t fapl, hbool_t new_format)
info.command = RET_TWO;
i = 0;
idx = 0;
- while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
+ while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) > 0) {
/* Verify return value from iterator gets propagated correctly */
- VERIFY(ret, 2, "H5Literate");
+ VERIFY(ret, 2, "H5Literate2");
/* Increment the number of times "2" is returned */
i++;
/* Verify that the index is the correct value */
- VERIFY(idx, (hsize_t)i, "H5Literate");
+ VERIFY(idx, (hsize_t)i, "H5Literate2");
if(idx > (NDATASETS + 2))
TestErrPrintf("Group iteration function walked too far!\n");
@@ -309,7 +309,7 @@ test_iter_group(hid_t fapl, hbool_t new_format)
if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
} /* end while */
- VERIFY(ret, -1, "H5Literate");
+ VERIFY(ret, -1, "H5Literate2");
if(i != (NDATASETS + 2))
TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__);
@@ -319,15 +319,15 @@ test_iter_group(hid_t fapl, hbool_t new_format)
info.command = new_format ? RET_CHANGE2 : RET_CHANGE;
i = 0;
idx = 0;
- while((ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
+ while((ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb, &info)) >= 0) {
/* Verify return value from iterator gets propagated correctly */
- VERIFY(ret, 1, "H5Literate");
+ VERIFY(ret, 1, "H5Literate2");
/* Increment the number of times "1" is returned */
i++;
/* Verify that the index is the correct value */
- VERIFY(idx, (hsize_t)(i + 10), "H5Literate");
+ VERIFY(idx, (hsize_t)(i + 10), "H5Literate2");
if(idx > (NDATASETS + 2))
TestErrPrintf("Group iteration function walked too far!\n");
@@ -335,7 +335,7 @@ test_iter_group(hid_t fapl, hbool_t new_format)
if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
} /* end while */
- VERIFY(ret, -1, "H5Literate");
+ VERIFY(ret, -1, "H5Literate2");
if(i != 42 || idx != 52)
TestErrPrintf("%u: Group iteration function didn't perform multiple iterations correctly!\n", __LINE__);
@@ -550,11 +550,11 @@ H5_ATTR_PURE int iter_strcmp2(const void *s1, const void *s2)
**
****************************************************************/
static herr_t
-liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_info,
+liter_cb2(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *link_info,
void *opdata)
{
const iter_info *test_info = (const iter_info *)opdata;
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
herr_t ret; /* Generic return value */
if(HDstrcmp(name, test_info->name)) {
@@ -565,8 +565,8 @@ liter_cb2(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *link_
/*
* Get type of the object and check it.
*/
- ret = H5Oget_info_by_name2(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(loc_id, name, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
if(test_info->type != oinfo.type) {
TestErrPrintf("test_info->type = %d, oinfo.type = %d\n", test_info->type, (int)oinfo.type);
@@ -683,14 +683,14 @@ test_iter_group_large(hid_t fapl)
/* Iterate through the file to see members of the root group */
curr_name = &names[0];
- ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
- CHECK(ret, FAIL, "H5Literate");
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, NULL, liter_cb2, curr_name);
+ CHECK(ret, FAIL, "H5Literate2");
for(i = 1; i < 100; i++) {
hsize_t idx = (hsize_t)i;
curr_name = &names[i];
- ret = H5Literate(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
- CHECK(ret, FAIL, "H5Literate");
+ ret = H5Literate2(file, H5_INDEX_NAME, H5_ITER_INC, &idx, liter_cb2, curr_name);
+ CHECK(ret, FAIL, "H5Literate2");
} /* end for */
/* Close file */
@@ -793,7 +793,7 @@ static void test_grp_memb_funcs(hid_t fapl)
VERIFY(ginfo.nlinks, (NDATASETS + 2), "H5Gget_info");
for(i = 0; i < (int)ginfo.nlinks; i++) {
- H5O_info_t oinfo; /* Object info */
+ H5O_info2_t oinfo; /* Object info */
/* Test with NULL for name, to query length */
name_len = H5Lget_name_by_idx(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, NULL, (size_t)NAMELEN, H5P_DEFAULT);
@@ -809,8 +809,8 @@ static void test_grp_memb_funcs(hid_t fapl)
obj_names[i] = HDstrdup(dataset_name);
CHECK_PTR(obj_names[i], "strdup");
- ret = H5Oget_info_by_idx2(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_idx");
+ ret = H5Oget_info_by_idx3(root_group, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_idx3");
if(!HDstrcmp(dataset_name, "grp"))
VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
@@ -890,21 +890,21 @@ static void test_links(hid_t fapl)
/* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */
for(i = 0; i < ginfo.nlinks; i++) {
- H5O_info_t oinfo; /* Object info */
- H5L_info_t linfo; /* Link info */
+ H5O_info2_t oinfo; /* Object info */
+ H5L_info2_t linfo; /* Link info */
/* Get link name */
name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT);
CHECK(name_len, FAIL, "H5Lget_name_by_idx");
/* Get link type */
- ret = H5Lget_info_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Lget_info_by_idx");
+ ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info_by_idx2");
/* Get object type */
if(linfo.type == H5L_TYPE_HARD) {
- ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_idx");
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_idx3");
} /* end if */
if(!HDstrcmp(obj_name, "g1.1"))
@@ -1015,6 +1015,87 @@ static void test_corrupted_attnamelen(void)
} /* test_corrupted_attnamelen() */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/****************************************************************
+**
+** test_links_deprec(): Test soft and hard link iteration
+**
+****************************************************************/
+static void test_links_deprec(hid_t fapl)
+{
+ hid_t file; /* File ID */
+ char obj_name[NAMELEN]; /* Names of the object in group */
+ ssize_t name_len; /* Length of object's name */
+ hid_t gid, gid1;
+ H5G_info_t ginfo; /* Buffer for querying object's info */
+ hsize_t i;
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Soft and Hard Link Iteration Functionality Using Deprecated Routines\n"));
+
+ /* Create the test file with the datasets */
+ file = H5Fcreate(DATAFILE, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(file, FAIL, "H5Fcreate");
+
+ /* create groups */
+ gid = H5Gcreate2(file, "/g1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gcreate2");
+
+ gid1 = H5Gcreate2(file, "/g1/g1.1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid1, FAIL, "H5Gcreate2");
+
+ /* create soft and hard links to the group "/g1". */
+ ret = H5Lcreate_soft("something", gid, "softlink", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_soft");
+
+ ret = H5Lcreate_hard(gid, "/g1", H5L_SAME_LOC, "hardlink", H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lcreate_hard");
+
+ ret = H5Gget_info(gid, &ginfo);
+ CHECK(ret, FAIL, "H5Gget_info");
+ VERIFY(ginfo.nlinks, 3, "H5Gget_info");
+
+ /* Test these two functions, H5Oget_info_by_idx and H5Lget_name_by_idx */
+ for(i = 0; i < ginfo.nlinks; i++) {
+ H5O_info2_t oinfo; /* Object info */
+ H5L_info2_t linfo; /* Link info */
+
+ /* Get link name */
+ name_len = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, (size_t)NAMELEN, H5P_DEFAULT);
+ CHECK(name_len, FAIL, "H5Lget_name_by_idx");
+
+ /* Get link type */
+ ret = H5Lget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &linfo, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Lget_info_by_idx1");
+
+ /* Get object type */
+ if(linfo.type == H5L_TYPE_HARD) {
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)i, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_idx");
+ } /* end if */
+
+ if(!HDstrcmp(obj_name, "g1.1"))
+ VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
+ else if(!HDstrcmp(obj_name, "hardlink"))
+ VERIFY(oinfo.type, H5O_TYPE_GROUP, "H5Lget_name_by_idx");
+ else if(!HDstrcmp(obj_name, "softlink"))
+ VERIFY(linfo.type, H5L_TYPE_SOFT, "H5Lget_name_by_idx");
+ else
+ CHECK(0, 0, "unknown object name");
+ } /* end for */
+
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ ret = H5Gclose(gid1);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ ret = H5Fclose(file);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* test_links_deprec() */
+#endif
+
/****************************************************************
**
** test_iterate(): Main iteration testing routine.
@@ -1045,10 +1126,13 @@ test_iterate(void)
/* These next tests use the same file */
for(new_format = FALSE; new_format <= TRUE; new_format++) {
test_iter_group(new_format ? fapl2 : fapl, new_format); /* Test group iteration */
- test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
+ test_iter_group_large(new_format ? fapl2 : fapl); /* Test group iteration for large # of objects */
test_iter_attr(new_format ? fapl2 : fapl, new_format); /* Test attribute iteration */
- test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
- test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+ test_grp_memb_funcs(new_format ? fapl2 : fapl); /* Test group member information functions */
+ test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ test_links_deprec(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
+#endif
} /* end for */
/* Test the fix for issue HDFFV-10588 */
diff --git a/test/tmisc.c b/test/tmisc.c
index 5225333..0ea9c4c 100644
--- a/test/tmisc.c
+++ b/test/tmisc.c
@@ -128,15 +128,19 @@ typedef struct
/* Definitions for misc. test #8 */
#define MISC8_FILE "tmisc8.h5"
#define MISC8_DSETNAME1 "Dataset1"
-#define MISC8_DSETNAME2 "Dataset2"
-#define MISC8_DSETNAME3 "Dataset3"
#define MISC8_DSETNAME4 "Dataset4"
#define MISC8_DSETNAME5 "Dataset5"
+#define MISC8_DSETNAME8 "Dataset8"
+
+#ifndef H5_HAVE_PARALLEL
+#define MISC8_DSETNAME2 "Dataset2"
+#define MISC8_DSETNAME3 "Dataset3"
#define MISC8_DSETNAME6 "Dataset6"
#define MISC8_DSETNAME7 "Dataset7"
-#define MISC8_DSETNAME8 "Dataset8"
#define MISC8_DSETNAME9 "Dataset9"
#define MISC8_DSETNAME10 "Dataset10"
+#endif
+
#define MISC8_RANK 2
#define MISC8_DIM0 50
#define MISC8_DIM1 50
@@ -309,6 +313,7 @@ typedef struct
/* Definitions for misc. test #30 */
#define MISC30_FILE "tmisc30.h5"
+#ifndef H5_NO_DEPRECATED_SYMBOLS
/* Definitions for misc. test #31 */
#define MISC31_FILE "tmisc31.h5"
#define MISC31_DSETNAME "dset"
@@ -317,6 +322,7 @@ typedef struct
#define MISC31_GROUPNAME "group"
#define MISC31_PROPNAME "misc31_prop"
#define MISC31_DTYPENAME "dtype"
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Definitions for misc. test #33 */
/* Note that this test file is generated by "gen_bad_offset.c" */
@@ -460,8 +466,8 @@ static void test_misc2_write_attribute(void)
ret = H5Aread(att1, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
- ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(type, dataspace, H5P_DEFAULT, &data_check);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Aclose(att1);
CHECK(ret, FAIL, "H5Aclose");
@@ -486,8 +492,8 @@ static void test_misc2_write_attribute(void)
ret = H5Aread(att2, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
- ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(type, dataspace, H5P_DEFAULT, &data_check);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Aclose(att2);
CHECK(ret, FAIL, "H5Aclose");
@@ -535,8 +541,8 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name
ret = H5Aread(att, type, &data_check);
CHECK(ret, FAIL, "H5Aread");
- ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_check);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(type, space, H5P_DEFAULT, &data_check);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Sclose(space);
CHECK(ret, FAIL, "H5Sclose");
@@ -649,7 +655,7 @@ static void
test_misc4(void)
{
hid_t file1, file2, group1, group2, group3;
- H5O_info_t oinfo1, oinfo2, oinfo3;
+ H5O_info2_t oinfo1, oinfo2, oinfo3;
herr_t ret;
/* Output message about test being performed */
@@ -674,12 +680,12 @@ test_misc4(void)
CHECK(group3, FAIL, "H5Gcreate2");
/* Get the stat information for each group */
- ret = H5Oget_info_by_name2(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
- ret = H5Oget_info_by_name2(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_info_by_name3(file1, MISC4_GROUP_1, &oinfo1, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(file1, MISC4_GROUP_2, &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
+ ret = H5Oget_info_by_name3(file2, MISC4_GROUP_1, &oinfo3, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name3");
/* Verify that the fileno values are the same for groups from file1 */
VERIFY(oinfo1.fileno, oinfo2.fileno, "H5Oget_info_by_name");
@@ -994,8 +1000,8 @@ test_misc5(void)
}
/* Reclaim the memory for the VL information */
- ret=H5Dvlen_reclaim(mem_type_id, space_id, H5P_DEFAULT, &buf);
- CHECK(ret,FAIL,"H5Dvlen_reclaim");
+ ret=H5Treclaim(mem_type_id, space_id, H5P_DEFAULT, &buf);
+ CHECK(ret,FAIL,"H5Treclaim");
/* Close dataspace */
ret=H5Sclose(space_id);
@@ -2061,8 +2067,8 @@ test_misc12(void)
CHECK(ret, FAIL, "H5Sselect_all");
/* Reclaim VL data memory */
- ret = H5Dvlen_reclaim(tid1, space, H5P_DEFAULT, rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid1, space, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Everything */
ret = H5Dclose(dataset);
@@ -2911,7 +2917,11 @@ test_misc18(void)
hid_t sid; /* 'Space ID */
hid_t did1, did2; /* Dataset IDs */
hid_t aid; /* Attribute ID */
- H5O_info_t oinfo; /* Information about object */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5O_info1_t old_oinfo; /* (deprecated) information about object */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ H5O_info2_t oinfo; /* Data model information about object */
+ H5O_native_info_t ninfo; /* Native file format information about object */
char attr_name[32]; /* Attribute name buffer */
unsigned u; /* Local index variable */
herr_t ret; /* Generic return value */
@@ -2929,26 +2939,48 @@ test_misc18(void)
CHECK(did1, FAIL, "H5Dcreate2");
/* Get object information */
- ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name");
/* Create second dataset */
did2 = H5Dcreate2(fid, MISC18_DSET2_NAME, H5T_STD_U32LE, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(did2, FAIL, "H5Dcreate2");
/* Get object information */
- ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nchunks, 1, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.total, 272, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.free, 152, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 0, "H5Oget_info_by_name");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nmesgs, 6, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nchunks, 1, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.total, 272, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.free, 152, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.num_attrs, 0, "H5Oget_info_by_name");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nmesgs, 6, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nchunks, 1, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.total, 272, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.free, 152, "H5Oget_native_info_by_name");
/* Loop creating attributes on each dataset, flushing them to the file each time */
for(u = 0; u < 10; u++) {
@@ -2975,22 +3007,44 @@ test_misc18(void)
} /* end for */
/* Get object information for dataset #1 now */
- ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, MISC18_DSET1_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET1_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ ret = H5Oget_native_info_by_name(fid, MISC18_DSET1_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name");
/* Get object information for dataset #2 now */
- ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, MISC18_DSET2_NAME, &oinfo, H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.nchunks, 9, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.total, 888, "H5Oget_info_by_name");
- VERIFY(oinfo.hdr.space.free, 16, "H5Oget_info_by_name");
VERIFY(oinfo.num_attrs, 10, "H5Oget_info_by_name");
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ ret = H5Oget_info_by_name2(fid, MISC18_DSET2_NAME, &old_oinfo, H5O_INFO_HDR|H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nmesgs, 24, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.nchunks, 9, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.total, 888, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.hdr.space.free, 16, "H5Oget_info_by_name");
+ VERIFY(old_oinfo.num_attrs, 10, "H5Oget_info_by_name");
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ ret = H5Oget_native_info_by_name(fid, MISC18_DSET2_NAME, &ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_mative_info_by_name");
+ VERIFY(ninfo.hdr.nmesgs, 24, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.nchunks, 9, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.total, 888, "H5Oget_native_info_by_name");
+ VERIFY(ninfo.hdr.space.free, 16, "H5Oget_native_info_by_name");
/* Close second dataset */
ret = H5Dclose(did2);
@@ -3915,7 +3969,7 @@ test_misc23(void)
hid_t file_id=0, group_id=0, type_id=0, space_id=0,
tmp_id=0, create_id=H5P_DEFAULT, access_id=H5P_DEFAULT;
char objname[MISC23_NAME_BUF_SIZE]; /* Name of object */
- H5O_info_t oinfo;
+ H5O_info2_t oinfo;
htri_t tri_status;
ssize_t namelen;
herr_t status;
@@ -3998,9 +4052,9 @@ test_misc23(void)
tmp_id = H5Gopen2(file_id, "/A/B01", H5P_DEFAULT);
CHECK(tmp_id, FAIL, "H5Gopen2");
- status = H5Oget_info2(tmp_id, &oinfo, H5O_INFO_BASIC);
- CHECK(status, FAIL, "H5Oget_info");
- VERIFY(oinfo.rc, 1, "H5Oget_info");
+ status = H5Oget_info3(tmp_id, &oinfo, H5O_INFO_BASIC);
+ CHECK(status, FAIL, "H5Oget_info3");
+ VERIFY(oinfo.rc, 1, "H5Oget_info3");
status = H5Gclose(tmp_id);
CHECK(status, FAIL, "H5Gclose");
@@ -5274,18 +5328,18 @@ test_misc29(void)
static int
-test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info_t H5_ATTR_UNUSED *info,
+test_misc30_get_info_cb(hid_t loc_id, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info,
void H5_ATTR_UNUSED *op_data)
{
- H5O_info_t object_info;
+ H5O_info2_t object_info;
- return H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT);
+ return H5Oget_info_by_name3(loc_id, name, &object_info, H5O_INFO_BASIC, H5P_DEFAULT);
}
static int
test_misc30_get_info(hid_t loc_id)
{
- return H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL);
+ return H5Literate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, test_misc30_get_info_cb, NULL);
}
@@ -5364,6 +5418,7 @@ test_misc30(void)
static void
test_misc31(void)
{
+#ifndef H5_NO_DEPRECATED_SYMBOLS
hid_t file_id; /* File id */
hid_t space_id; /* Dataspace id */
hid_t dset_id; /* Dataset id */
@@ -5371,6 +5426,7 @@ test_misc31(void)
hid_t group_id; /* Group id */
hid_t dtype_id; /* Datatype id */
herr_t ret; /* Generic return value */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
/* Output message about test being performed */
MESSAGE(5, ("Deprecated routines initialize after H5close()\n"));
@@ -5533,7 +5589,7 @@ test_misc33(void)
{
hid_t fid = -1; /* File ID */
const char *testfile = H5_get_srcdir_filename(MISC33_FILE); /* Corrected test file name */
- H5O_info_t oinfo; /* Structure for object metadata information */
+ H5O_info2_t oinfo; /* Structure for object metadata information */
herr_t ret; /* Generic return value */
/* Output message about test being performed */
@@ -5545,21 +5601,21 @@ test_misc33(void)
/* Case (1) */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_name2(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, "/soft_two", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(ret, FAIL, "H5Oget_info_by_name3");
/* Case (2) */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_name2(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, "/dsetA", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(ret, FAIL, "H5Oget_info_by_name3");
/* Case (3) */
H5E_BEGIN_TRY {
- ret = H5Oget_info_by_name2(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ ret = H5Oget_info_by_name3(fid, "/soft_one", &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
} H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Oget_info_by_name");
+ VERIFY(ret, FAIL, "H5Oget_info_by_name3");
/* Close the file */
ret = H5Fclose(fid);
@@ -5728,6 +5784,8 @@ cleanup_misc(void)
HDremove(MISC28_FILE);
HDremove(MISC29_COPY_FILE);
HDremove(MISC30_FILE);
+#ifndef H5_NO_DEPRECATED_SYMBOLS
HDremove(MISC31_FILE);
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
} /* end cleanup_misc() */
diff --git a/test/trefer.c b/test/trefer.c
index 7158984..32caf5e 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -21,9 +21,16 @@
#include "testhdf5.h"
-#define FILE1 "trefer1.h5"
-#define FILE2 "trefer2.h5"
-#define FILE3 "trefer3.h5"
+#define FILE_REF_PARAM "trefer_param.h5"
+#define FILE_REF_OBJ "trefer_obj.h5"
+#define FILE_REF_REG "trefer_reg.h5"
+#define FILE_REF_REG_1D "trefer_reg_1d.h5"
+#define FILE_REF_OBJ_DEL "trefer_obj_del.h5"
+#define FILE_REF_GRP "trefer_grp.h5"
+#define FILE_REF_ATTR "trefer_attr.h5"
+#define FILE_REF_EXT1 "trefer_ext1.h5"
+#define FILE_REF_EXT2 "trefer_ext2.h5"
+#define FILE_REF_COMPAT "trefer_compat.h5"
/* 1-D dataset with fixed dimensions */
#define SPACE1_RANK 1
@@ -55,6 +62,10 @@ typedef struct s1_t {
#define DSETNAME2 "dset2"
#define NAME_SIZE 16
+#define MAX_ITER_CREATE 1000
+#define MAX_ITER_WRITE MAX_ITER_CREATE
+#define MAX_ITER_READ MAX_ITER_CREATE
+
/****************************************************************
**
@@ -65,47 +76,58 @@ typedef struct s1_t {
static void
test_reference_params(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hid_t dapl_id; /* Dataset access property list */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t aapl_id; /* Attribute access property list */
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1};
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i; /* counting variables */
- const char *write_comment = "Foo!"; /* Comments for group */
- hid_t ret_id; /* Generic hid_t return value */
- ssize_t name_size; /* Size of reference name */
- herr_t ret; /* Generic return value */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ unsigned *obuf;
+ H5R_type_t type; /* Reference type */
+ unsigned int i; /* Counters */
+ const char *write_comment = "Foo!"; /* Comments for group */
+ hid_t ret_id; /* Generic hid_t return value */
+ ssize_t name_size; /* Size of reference name */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Reference Parameters\n"));
/* Allocate write & read buffers */
- wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ obuf[i] = i * 3;
/* Create file */
- fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid1 = H5Fcreate(FILE_REF_PARAM, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create attribute access property list */
+ aapl_id = H5Pcreate(H5P_ATTRIBUTE_ACCESS);
+ CHECK(aapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
- CHECK(dapl_id, FAIL, "H5Pcreate");
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(group, FAIL, "H5Gcreate2");
+ CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
/* Set group's comment */
ret = H5Oset_comment(group, write_comment);
@@ -113,13 +135,10 @@ test_reference_params(void)
/* Create a dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
-
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)i * 3;
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -128,7 +147,19 @@ test_reference_params(void)
/* Create another dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Create an attribute for the dataset */
+ attr = H5Acreate2(dataset, "Attr", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, obuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -136,7 +167,7 @@ test_reference_params(void)
/* Create a datatype to refer to */
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
- CHECK(tid1, FAIL, "H5Tcreate");
+ CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
@@ -161,58 +192,88 @@ test_reference_params(void)
CHECK(ret, FAIL, "H5Gclose");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
-
- /* Test parameters to H5Rcreate */
- ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
- VERIFY(ret, FAIL, "H5Rcreate ref");
- ret = H5Rcreate(&wbuf[0], (hid_t)-1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
- VERIFY(ret, FAIL, "H5Rcreate loc_id");
- ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)-1);
- VERIFY(ret, FAIL, "H5Rcreate name");
- ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)-1);
- VERIFY(ret, FAIL, "H5Rcreate null name");
- ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)-1);
- VERIFY(ret, FAIL, "H5Rcreate type");
- ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)-1);
- VERIFY(ret, FAIL, "H5Rcreate region space");
- ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0);
- VERIFY(ret, FAIL, "H5Rcreate space");
-
- /* Test parameters to H5Rdereference */
- dset2 = H5Rdereference2((hid_t)-1, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]);
- VERIFY(dset2, FAIL, "H5Rdereference2 loc_id");
- dset2 = H5Rdereference2(dataset, (hid_t)-1, H5R_OBJECT, &rbuf[0]);
- VERIFY(dset2, FAIL, "H5Rdereference2 oapl_id");
- dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL);
- VERIFY(dset2, FAIL, "H5Rdereference2 ref");
- dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]);
- VERIFY(dset2, FAIL, "H5Rdereference2 type");
-
- /* Test parameters to H5Rget_obj_type2 */
- ret = H5Rget_obj_type2((hid_t)-1, H5R_OBJECT, &rbuf[0], NULL);
- VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id");
- ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL);
- VERIFY(ret, FAIL, "H5Rget_obj_type2 ref");
- ret = H5Rget_obj_type2(fid1, H5R_MAXTYPE, &rbuf[0], NULL);
- VERIFY(ret, FAIL, "H5Rget_obj_type2 type");
-
- /* Test parameters to H5Rget_name */
- name_size = H5Rget_name((hid_t)-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0);
- VERIFY(name_size, FAIL, "H5Rget_name loc_id");
- name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0);
- VERIFY(name_size, FAIL, "H5Rget_name ref");
- name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0);
- VERIFY(name_size, FAIL, "H5Rget_name type");
-
- /* Test parameters to H5Rget_region */
- ret_id = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]);
- VERIFY(ret_id, FAIL, "H5Rget_region loc_id");
- ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL);
- VERIFY(ret_id, FAIL, "H5Rget_region ref");
- ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]);
- VERIFY(ret_id, FAIL, "H5Rget_region type");
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Test parameters to H5Rcreate_object */
+ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, NULL);
+ VERIFY(ret, FAIL, "H5Rcreate_object ref");
+ ret = H5Rcreate_object(H5I_INVALID_HID, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_object loc_id");
+ ret = H5Rcreate_object(fid1, NULL, H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_object name");
+ ret = H5Rcreate_object(fid1, "", H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_object null name");
+
+ /* Test parameters to H5Rcreate_region */
+ ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, NULL);
+ VERIFY(ret, FAIL, "H5Rcreate_region ref");
+ ret = H5Rcreate_region(H5I_INVALID_HID, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_region loc_id");
+ ret = H5Rcreate_region(fid1, NULL, sid1, H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_region name");
+ ret = H5Rcreate_region(fid1, "/Group1/Dataset1", H5I_INVALID_HID, H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_region dataspace");
+
+ /* Test parameters to H5Rcreate_attr */
+ ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr", H5P_DEFAULT, NULL);
+ VERIFY(ret, FAIL, "H5Rcreate_attr ref");
+ ret = H5Rcreate_attr(H5I_INVALID_HID, "/Group1/Dataset2", "Attr", H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_attr loc_id");
+ ret = H5Rcreate_attr(fid1, NULL, "Attr", H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_attr name");
+ ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", NULL, H5P_DEFAULT, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcreate_attr attr_name");
+
+ /* Test parameters to H5Rdestroy */
+ ret = H5Rdestroy(NULL);
+ VERIFY(ret, FAIL, "H5Rdestroy");
+
+ /* Test parameters to H5Rget_type */
+ type = H5Rget_type(NULL);
+ VERIFY(type, H5R_BADTYPE, "H5Rget_type ref");
+
+ /* Test parameters to H5Requal */
+ ret = H5Requal(NULL, &rbuf[0]);
+ VERIFY(ret, FAIL, "H5Requal ref1");
+ ret = H5Requal(&rbuf[0], NULL);
+ VERIFY(ret, FAIL, "H5Requal ref2");
+
+ /* Test parameters to H5Rcopy */
+ ret = H5Rcopy(NULL, &wbuf[0]);
+ VERIFY(ret, FAIL, "H5Rcopy src_ref");
+ ret = H5Rcopy(&rbuf[0], NULL);
+ VERIFY(ret, FAIL, "H5Rcopy dest_ref");
+
+ /* Test parameters to H5Ropen_object */
+ dset2 = H5Ropen_object(&rbuf[0], H5I_INVALID_HID, H5I_INVALID_HID);
+ VERIFY(dset2, FAIL, "H5Ropen_object oapl_id");
+ dset2 = H5Ropen_object(NULL, H5P_DEFAULT, dapl_id);
+ VERIFY(dset2, FAIL, "H5Ropen_object ref");
+
+ /* Test parameters to H5Ropen_region */
+ ret_id = H5Ropen_region(NULL, H5I_INVALID_HID, H5I_INVALID_HID);
+ VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_region ref");
+
+ /* Test parameters to H5Ropen_attr */
+ ret_id = H5Ropen_attr(NULL, H5P_DEFAULT, aapl_id);
+ VERIFY(ret_id, H5I_INVALID_HID, "H5Ropen_attr ref");
+
+ /* Test parameters to H5Rget_obj_type3 */
+ ret = H5Rget_obj_type3(NULL, H5P_DEFAULT, NULL);
+ VERIFY(ret, FAIL, "H5Rget_obj_type3 ref");
+
+ /* Test parameters to H5Rget_file_name */
+ name_size = H5Rget_file_name(NULL, NULL, 0);
+ VERIFY(name_size, (-1), "H5Rget_file_name ref");
+
+ /* Test parameters to H5Rget_obj_name */
+ name_size = H5Rget_obj_name(NULL, H5P_DEFAULT, NULL, 0);
+ VERIFY(name_size, (-1), "H5Rget_obj_name ref");
+
+ /* Test parameters to H5Rget_attr_name */
+ name_size = H5Rget_attr_name(NULL, NULL, 0);
+ VERIFY(name_size, (-1), "H5Rget_attr_name ref");
/* Close disk dataspace */
ret = H5Sclose(sid1);
@@ -222,6 +283,10 @@ test_reference_params(void)
ret = H5Pclose(dapl_id);
CHECK(ret, FAIL, "H5Pclose");
+ /* Close attribute access property list */
+ ret = H5Pclose(aapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
@@ -234,7 +299,8 @@ test_reference_params(void)
HDfree(wbuf);
HDfree(rbuf);
HDfree(tbuf);
-} /* test_reference_obj() */
+ HDfree(obuf);
+} /* test_reference_params() */
/****************************************************************
**
@@ -245,63 +311,55 @@ test_reference_params(void)
static void
test_reference_obj(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t group; /* Group ID */
- hid_t sid1; /* Dataspace ID */
- hid_t tid1; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1};
- hid_t dapl_id; /* Dataset access property list */
- hobj_ref_t *wbuf, /* buffer to write to disk */
- *rbuf, /* buffer read from disk */
- *tbuf; /* temp. buffer read from disk */
- hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
- unsigned *tu32; /* Temporary pointer to uint32 data */
- int i, j; /* counting variables */
- const char *write_comment="Foo!"; /* Comments for group */
- char read_comment[10];
- H5O_type_t obj_type; /* Object type */
- ssize_t size; /* Comment length */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ unsigned *ibuf, *obuf;
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Object Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
- tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+
+ for (i = 0; i < SPACE1_DIM1; i++)
+ obuf[i] = i * 3;
/* Create file */
- fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
- CHECK(dapl_id, FAIL, "H5Pcreate");
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(group, FAIL, "H5Gcreate2");
-
- /* Set group's comment */
- ret = H5Oset_comment(group, write_comment);
- CHECK(ret, FAIL, "H5Oset_comment");
+ CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
/* Create a dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
-
- for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
- *tu32++ = (unsigned)i * 3;
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -318,7 +376,7 @@ test_reference_obj(void)
/* Create a datatype to refer to */
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
- CHECK(tid1, FAIL, "H5Tcreate");
+ CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
@@ -343,39 +401,39 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Gclose");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Create reference to dataset */
- ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[0], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to dataset */
- ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[1], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ ret = H5Rcreate_object(fid1, "/Group1/Dataset2", H5P_DEFAULT, &wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ ret = H5Rget_obj_type3(&wbuf[1], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Create reference to group */
- ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[2], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type2");
+ ret = H5Rcreate_object(fid1, "/Group1", H5P_DEFAULT, &wbuf[2]);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
/* Create reference to named datatype */
- ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[3], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type2");
+ ret = H5Rcreate_object(fid1, "/Group1/Datatype1", H5P_DEFAULT, &wbuf[3]);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ ret = H5Rget_obj_type3(&wbuf[3], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close disk dataspace */
@@ -391,58 +449,50 @@ test_reference_obj(void)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(fid1, FAIL, "H5Fopen");
+ fid1 = H5Fopen(FILE_REF_OBJ, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
/* Open the dataset */
dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dopen2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
/* Read selection from disk */
- ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Open dataset object */
- dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, &rbuf[0]);
- CHECK(dset2, FAIL, "H5Rdereference2");
+ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Check information in referenced dataset */
sid1 = H5Dget_space(dset2);
- CHECK(sid1, FAIL, "H5Dget_space");
+ CHECK(sid1, H5I_INVALID_HID, "H5Dget_space");
ret = (int)H5Sget_simple_extent_npoints(sid1);
- VERIFY(ret, 4, "H5Sget_simple_extent_npoints");
+ VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints");
/* Read from disk */
- ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
+ ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
CHECK(ret, FAIL, "H5Dread");
- for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
- VERIFY(*tu32, (uint32_t)(i*3), "Data");
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(ibuf[i], i * 3, "Data");
/* Close dereferenced Dataset */
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
/* Open group object. GAPL isn't supported yet. But it's harmless to pass in */
- group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &rbuf[2]);
- CHECK(group, FAIL, "H5Rdereference2");
-
- /* Get group's comment */
- size = H5Oget_comment(group, read_comment, (size_t)10);
- CHECK(size, FAIL, "H5Oget_comment");
-
- /* Check for correct comment value */
- if(HDstrcmp(write_comment, read_comment) != 0)
- TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment);
+ group = H5Ropen_object(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, H5I_INVALID_HID, "H5Ropen_object");
/* Close group */
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
/* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */
- tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &rbuf[3]);
- CHECK(tid1, FAIL, "H5Rdereference2");
+ tid1 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object");
/* Verify correct datatype */
{
@@ -455,14 +505,6 @@ test_reference_obj(void)
VERIFY(ret, 3, "H5Tget_nmembers");
}
- /* Attempting to retrieve type of object using non-valid refs */
- for(j = 0; j < 3; j++) {
- H5E_BEGIN_TRY {
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Rget_obj_type2");
- } /* end for */
-
/* Close datatype */
ret = H5Tclose(tid1);
CHECK(ret, FAIL, "H5Tclose");
@@ -479,10 +521,19 @@ test_reference_obj(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+ /* Destroy references */
+ for(j = 0; j < SPACE1_DIM1; j++) {
+ ret = H5Rdestroy(&wbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&rbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
- HDfree(tbuf);
+ HDfree(ibuf);
+ HDfree(obuf);
} /* test_reference_obj() */
/****************************************************************
@@ -498,13 +549,13 @@ test_reference_obj(void)
static void
test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t fapl = -1; /* File access property list */
- hid_t dset1, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid2; /* Dataspace ID #2 */
- hid_t dapl_id; /* Dataset access property list */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1},
dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
@@ -512,62 +563,60 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hsize_t *coords; /* Coordinate buffer */
- hsize_t low[SPACE2_RANK]; /* Selection bounds */
- hsize_t high[SPACE2_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- hdset_reg_ref_t nvrbuf[3]={{0},{101},{255}}; /* buffer with non-valid refs */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
- H5O_type_t obj_type; /* Type of object */
- int i, j; /* counting variables */
- hssize_t hssize_ret; /* hssize_t return value */
- htri_t tri_ret; /* htri_t return value */
- herr_t ret; /* Generic return value */
- hdset_reg_ref_t undef_reg[1]; /* test for undefined reference */
- hid_t dset_NA; /* Dataset id for undefined reference */
- hid_t space_NA; /* Dataspace id for undefined reference */
- hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
- hdset_reg_ref_t wdata_NA[1], /* Write buffer */
- rdata_NA[1]; /* Read buffer */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ H5R_ref_t nvrbuf[3]={{{{0}}},{{{101}}},{{{255}}}}; /* buffer with non-valid refs */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
+ int i, j; /* Counters */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* Generic return value */
+ hid_t dset_NA; /* Dataset id for undefined reference */
+ hid_t space_NA; /* Dataspace id for undefined reference */
+ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
+ H5R_ref_t rdata_NA[1]; /* Read buffer */
/* Output message about test being performed */
MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+ for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
+ *tu8++ = (uint8_t)(i * 3);
+
/* Create file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl, FAIL, "H5Pcreate");
+ CHECK(fapl, H5I_INVALID_HID, "H5Pcreate");
/* Set the low/high version bounds in fapl */
ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
/* Create file with the fapl */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid1 = H5Fcreate(FILE_REF_REG, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for datasets */
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
- CHECK(sid2, FAIL, "H5Screate_simple");
+ CHECK(sid2, H5I_INVALID_HID, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
- CHECK(dapl_id, FAIL, "H5Pcreate");
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Create a dataset */
dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset2, FAIL, "H5Dcreate2");
-
- for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
- *tu8++ = (uint8_t)(i * 3);
+ CHECK(dset2, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -579,11 +628,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Create dataspace for the reference dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset1, H5I_INVALID_HID, "H5Dcreate2");
/* Create references */
@@ -599,11 +648,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(ret, 36, "H5Sget_select_npoints");
/* Store first dataset region */
- ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Select sequence of ten points for second reference */
coord1[0][0] = 6; coord1[0][1] = 9;
@@ -620,17 +669,21 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Sselect_elements");
ret = (int)H5Sget_select_npoints(sid2);
- VERIFY(ret, 10, "H5Sget_select_npoints");
+ VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints");
/* Store second dataset region */
- ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
- CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
/* Select unlimited hyperslab for third reference */
- start[0] = 1; start[1] = 8;
- stride[0] = 4; stride[1] = 1;
- count[0] = H5S_UNLIMITED; count[1] = 1;
- block[0] = 2; block[1] = 2;
+ start[0] = 1;
+ start[1] = 8;
+ stride[0] = 4;
+ stride[1] = 1;
+ count[0] = H5S_UNLIMITED;
+ count[1] = 1;
+ block[0] = 2;
+ block[1] = 2;
ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
@@ -638,41 +691,39 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
/* Store third dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[2]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+
+ ret = H5Rget_obj_type3(&wbuf[2], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+
+ /* Store fourth dataset region */
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid2, H5P_DEFAULT, &wbuf[3]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+
+ /* Write selection to disk */
H5E_BEGIN_TRY {
- ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ ret = H5Dwrite(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
} H5E_END_TRY;
if(libver_high < H5F_LIBVER_V110)
- VERIFY(ret, FAIL, "H5Rcreate");
+ VERIFY(ret, FAIL, "H5Dwrite");
else
- CHECK(ret, FAIL, "H5Rcreate");
-
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
-
- /* Write selection to disk */
- ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
- CHECK(ret, FAIL, "H5Dwrite");
+ CHECK(ret, FAIL, "H5Dwrite");
/*
* Store a dataset region reference which will not get written to disk
*/
- /* Create reference to an element in dset1 */
- ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
- CHECK(ret, FAIL, "H5Sselect_elements");
- ret = H5Rcreate(&wdata_NA[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid2);
- CHECK(ret, FAIL, "H5Rcreate");
-
/* Create the dataspace of the region references */
space_NA = H5Screate_simple(1, dims_NA, NULL);
- CHECK(space_NA, FAIL, "H5Screate_simple");
+ CHECK(space_NA, H5I_INVALID_HID, "H5Screate_simple");
/* Create the dataset and write the region references to it */
- dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF_DSETREG, space_NA, H5P_DEFAULT,
+ dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF, space_NA, H5P_DEFAULT,
H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset_NA, FAIL, "H5Dcreate");
+ CHECK(dset_NA, H5I_INVALID_HID, "H5Dcreate");
/* Close and release resources for undefined region reference tests */
ret = H5Dclose(dset_NA);
@@ -697,8 +748,8 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
- CHECK(fid1, FAIL, "H5Fopen");
+ fid1 = H5Fopen(FILE_REF_REG, H5F_ACC_RDWR, fapl);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
/*
* Start the test of an undefined reference
@@ -706,25 +757,25 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Open the dataset of the undefined references */
dset_NA = H5Dopen2(fid1, "DS_NA", H5P_DEFAULT);
- CHECK(dset_NA, FAIL, "H5Dopen2");
+ CHECK(dset_NA, H5I_INVALID_HID, "H5Dopen2");
/* Read the data */
- ret = H5Dread(dset_NA, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA);
+ ret = H5Dread(dset_NA, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA);
CHECK(ret, FAIL, "H5Dread");
/*
* Dereference an undefined reference (should fail)
*/
H5E_BEGIN_TRY {
- dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]);
+ dset2 = H5Ropen_object(&rdata_NA[0], H5P_DEFAULT, H5P_DEFAULT);
} H5E_END_TRY;
- VERIFY(dset2, FAIL, "H5Rdereference2");
+ VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Close and release resources. */
ret = H5Dclose(dset_NA);
CHECK(ret, FAIL, "H5Dclose");
- /* This close should fail since H5Rdereference2 never created
+ /* This close should fail since H5Ropen_object never created
* the id of the referenced object. */
H5E_BEGIN_TRY {
ret = H5Dclose(dset2);
@@ -737,115 +788,116 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Open the dataset */
dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
- CHECK(dset1, FAIL, "H5Dopen2");
+ CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
/* Read selection from disk */
- ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
- CHECK(ret, FAIL, "H5Dread");
-
- /* Try to read an unaddressed dataset */
- dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, undef_reg);
- VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef");
+ H5E_BEGIN_TRY {
+ ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ } H5E_END_TRY;
- /* Try to open objects */
- dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
- CHECK(dset2, FAIL, "H5Rdereference2");
+ if(libver_high < H5F_LIBVER_V110)
+ CHECK(ret, FAIL, "H5Dread");
+ else {
+ CHECK(ret, FAIL, "H5Dread");
- /* Check what H5Rget_obj_type2 function returns */
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ /* Try to open objects */
+ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
- /* Check information in referenced dataset */
- sid1 = H5Dget_space(dset2);
- CHECK(sid1, FAIL, "H5Dget_space");
+ /* Check what H5Rget_obj_type3 function returns */
+ ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- ret = (int)H5Sget_simple_extent_npoints(sid1);
- VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
+ /* Check information in referenced dataset */
+ sid1 = H5Dget_space(dset2);
+ CHECK(sid1, H5I_INVALID_HID, "H5Dget_space");
- /* Read from disk */
- ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
- CHECK(ret, FAIL, "H5Dread");
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
+ VERIFY(ret, (SPACE2_DIM1 * SPACE2_DIM2), "H5Sget_simple_extent_npoints");
- for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
- VERIFY(*tu8, (uint8_t)(i * 3), "Data");
+ /* Read from disk */
+ ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
+ CHECK(ret, FAIL, "H5Dread");
- /* Get the hyperslab selection */
- sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
- CHECK(sid2, FAIL, "H5Rget_region");
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ VERIFY(*tu8, (uint8_t)(i * 3), "Data");
- /* Verify correct hyperslab selected */
- ret = (int)H5Sget_select_npoints(sid2);
- VERIFY(ret, 36, "H5Sget_select_npoints");
- ret = (int)H5Sget_select_hyper_nblocks(sid2);
- VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
- ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
- CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
- VERIFY(coords[0], 2, "Hyperslab Coordinates");
- VERIFY(coords[1], 2, "Hyperslab Coordinates");
- VERIFY(coords[2], 7, "Hyperslab Coordinates");
- VERIFY(coords[3], 7, "Hyperslab Coordinates");
- HDfree(coords);
- ret = H5Sget_select_bounds(sid2, low, high);
- CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low[0], 2, "Selection Bounds");
- VERIFY(low[1], 2, "Selection Bounds");
- VERIFY(high[0], 7, "Selection Bounds");
- VERIFY(high[1], 7, "Selection Bounds");
+ /* Get the hyperslab selection */
+ sid2 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region");
- /* Close region space */
- ret = H5Sclose(sid2);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Verify correct hyperslab selected */
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, 36, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_hyper_nblocks(sid2);
+ VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 2, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 7, "Hyperslab Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid2, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 2, "Selection Bounds");
+ VERIFY(low[1], 2, "Selection Bounds");
+ VERIFY(high[0], 7, "Selection Bounds");
+ VERIFY(high[1], 7, "Selection Bounds");
- /* Get the element selection */
- sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
- CHECK(sid2, FAIL, "H5Rget_region");
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Verify correct elements selected */
- ret = (int)H5Sget_select_npoints(sid2);
- VERIFY(ret, 10, "H5Sget_select_npoints");
- ret = (int)H5Sget_select_elem_npoints(sid2);
- VERIFY(ret, 10, "H5Sget_select_elem_npoints");
- coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
- ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
- CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
- VERIFY(coords[0], coord1[0][0], "Element Coordinates");
- VERIFY(coords[1], coord1[0][1], "Element Coordinates");
- VERIFY(coords[2], coord1[1][0], "Element Coordinates");
- VERIFY(coords[3], coord1[1][1], "Element Coordinates");
- VERIFY(coords[4], coord1[2][0], "Element Coordinates");
- VERIFY(coords[5], coord1[2][1], "Element Coordinates");
- VERIFY(coords[6], coord1[3][0], "Element Coordinates");
- VERIFY(coords[7], coord1[3][1], "Element Coordinates");
- VERIFY(coords[8], coord1[4][0], "Element Coordinates");
- VERIFY(coords[9], coord1[4][1], "Element Coordinates");
- VERIFY(coords[10], coord1[5][0], "Element Coordinates");
- VERIFY(coords[11], coord1[5][1], "Element Coordinates");
- VERIFY(coords[12], coord1[6][0], "Element Coordinates");
- VERIFY(coords[13], coord1[6][1], "Element Coordinates");
- VERIFY(coords[14], coord1[7][0], "Element Coordinates");
- VERIFY(coords[15], coord1[7][1], "Element Coordinates");
- VERIFY(coords[16], coord1[8][0], "Element Coordinates");
- VERIFY(coords[17], coord1[8][1], "Element Coordinates");
- VERIFY(coords[18], coord1[9][0], "Element Coordinates");
- VERIFY(coords[19], coord1[9][1], "Element Coordinates");
- HDfree(coords);
- ret = H5Sget_select_bounds(sid2, low, high);
- CHECK(ret, FAIL, "H5Sget_select_bounds");
- VERIFY(low[0], 0, "Selection Bounds");
- VERIFY(low[1], 0, "Selection Bounds");
- VERIFY(high[0], 9, "Selection Bounds");
- VERIFY(high[1], 9, "Selection Bounds");
+ /* Get the element selection */
+ sid2 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region");
+
+ /* Verify correct elements selected */
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, SPACE2_DIM2, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_elem_npoints(sid2);
+ VERIFY(ret, SPACE2_DIM2, "H5Sget_select_elem_npoints");
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
+ VERIFY(coords[0], coord1[0][0], "Element Coordinates");
+ VERIFY(coords[1], coord1[0][1], "Element Coordinates");
+ VERIFY(coords[2], coord1[1][0], "Element Coordinates");
+ VERIFY(coords[3], coord1[1][1], "Element Coordinates");
+ VERIFY(coords[4], coord1[2][0], "Element Coordinates");
+ VERIFY(coords[5], coord1[2][1], "Element Coordinates");
+ VERIFY(coords[6], coord1[3][0], "Element Coordinates");
+ VERIFY(coords[7], coord1[3][1], "Element Coordinates");
+ VERIFY(coords[8], coord1[4][0], "Element Coordinates");
+ VERIFY(coords[9], coord1[4][1], "Element Coordinates");
+ VERIFY(coords[10], coord1[5][0], "Element Coordinates");
+ VERIFY(coords[11], coord1[5][1], "Element Coordinates");
+ VERIFY(coords[12], coord1[6][0], "Element Coordinates");
+ VERIFY(coords[13], coord1[6][1], "Element Coordinates");
+ VERIFY(coords[14], coord1[7][0], "Element Coordinates");
+ VERIFY(coords[15], coord1[7][1], "Element Coordinates");
+ VERIFY(coords[16], coord1[8][0], "Element Coordinates");
+ VERIFY(coords[17], coord1[8][1], "Element Coordinates");
+ VERIFY(coords[18], coord1[9][0], "Element Coordinates");
+ VERIFY(coords[19], coord1[9][1], "Element Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid2, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 0, "Selection Bounds");
+ VERIFY(low[1], 0, "Selection Bounds");
+ VERIFY(high[0], 9, "Selection Bounds");
+ VERIFY(high[1], 9, "Selection Bounds");
- /* Close region space */
- ret = H5Sclose(sid2);
- CHECK(ret, FAIL, "H5Sclose");
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
- if(libver_high >= H5F_LIBVER_V110) {
/* Get the unlimited selection */
- sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
- CHECK(sid2, FAIL, "H5Rget_region");
+ sid2 = H5Ropen_region(&rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid2, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct hyperslab selected */
hssize_ret = H5Sget_select_npoints(sid2);
@@ -867,23 +919,23 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Close region space */
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
- }
-
- /* Close first space */
- ret = H5Sclose(sid1);
- CHECK(ret, FAIL, "H5Sclose");
- /* Close dereferenced Dataset */
- ret = H5Dclose(dset2);
- CHECK(ret, FAIL, "H5Dclose");
+ /* Close first space */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
- /* Attempting to retrieve type of object using non-valid refs */
- for(j = 0; j < 3; j++) {
- H5E_BEGIN_TRY {
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type);
- } H5E_END_TRY;
- VERIFY(ret, FAIL, "H5Rget_obj_type2");
- } /* end for */
+ /* Close dereferenced Dataset */
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Attempting to retrieve type of object using non-valid refs */
+ for(j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY {
+ ret = H5Rget_obj_type3(&nvrbuf[j], H5P_DEFAULT, &obj_type);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Rget_obj_type3");
+ } /* end for */
+ }
/* Close Dataset */
ret = H5Dclose(dset1);
@@ -897,6 +949,16 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+ /* Destroy references */
+ for(j = 0; j < SPACE1_DIM1; j++) {
+ ret = H5Rdestroy(&wbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ if(libver_high >= H5F_LIBVER_V110) {
+ ret = H5Rdestroy(&rbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ }
+
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
@@ -917,14 +979,14 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
static void
test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t fapl = -1; /* File access property list */
- hid_t dset1, /* Dataset ID */
- dset3; /* Dereferenced dataset ID */
- hid_t sid1, /* Dataspace ID #1 */
- sid3; /* Dataspace ID #3 */
- hid_t dapl_id; /* Dataset access property list */
- hsize_t dims1[] = {SPACE1_DIM1},
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {2}, /* Must be 2 */
dims3[] = {SPACE3_DIM1};
hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
@@ -934,50 +996,50 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
hsize_t *coords; /* Coordinate buffer */
hsize_t low[SPACE3_RANK]; /* Selection bounds */
hsize_t high[SPACE3_RANK]; /* Selection bounds */
- hdset_reg_ref_t *wbuf, /* buffer to write to disk */
- *rbuf; /* buffer read from disk */
- uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
- *drbuf; /* Buffer for reading numeric data from disk */
- uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
H5O_type_t obj_type; /* Object type */
- int i; /* counting variables */
- herr_t ret; /* Generic return value */
+ int i; /* Counter */
+ herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
/* Allocate write & read buffers */
- wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
- rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
- dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
+ wbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = HDcalloc(sizeof(H5R_ref_t), (size_t)SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
+ for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
+ *tu8++ = (uint8_t)(i * 3);
+
/* Create the file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
- CHECK(fapl, FAIL, "H5Pcreate");
+ CHECK(fapl, H5I_INVALID_HID, "H5Pcreate");
/* Set the low/high version bounds in fapl */
ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
/* Create file with the fapl */
- fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid1 = H5Fcreate(FILE_REF_REG_1D, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for datasets */
sid3 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
- CHECK(sid3, FAIL, "H5Screate_simple");
+ CHECK(sid3, H5I_INVALID_HID, "H5Screate_simple");
/* Create dataset access property list */
dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
- CHECK(dapl_id, FAIL, "H5Pcreate");
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
/* Create a dataset */
dset3 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dset3, FAIL, "H5Dcreate2");
-
- for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
- *tu8++ = (uint8_t)(i * 3);
+ CHECK(dset3, H5I_INVALID_HID, "H5Dcreate2");
/* Write selection to disk */
ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
@@ -989,31 +1051,31 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
/* Create dataspace for the reference dataset */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset */
- dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Dcreate2");
/* Create references */
/* Select 15 2x1 hyperslabs for first reference */
- start[0] = 2;
+ start[0] = 2;
stride[0] = 5;
- count[0] = 15;
- block[0] = 2;
+ count[0] = 15;
+ block[0] = 2;
ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
ret = (int)H5Sget_select_npoints(sid3);
- VERIFY(ret, 30, "H5Sget_select_npoints");
+ VERIFY(ret, (block[0] * count[0]), "H5Sget_select_npoints");
/* Store first dataset region */
- ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Select sequence of ten points for second reference */
coord1[0][0] = 16;
@@ -1030,14 +1092,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Sselect_elements");
ret = (int)H5Sget_select_npoints(sid3);
- VERIFY(ret, 10, "H5Sget_select_npoints");
+ VERIFY(ret, POINT1_NPOINTS, "H5Sget_select_npoints");
/* Store second dataset region */
- ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
- CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rcreate_region(fid1, "/Dataset2", sid3, H5P_DEFAULT, &wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
/* Write selection to disk */
- ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ ret = H5Dwrite(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
CHECK(ret, FAIL, "H5Dwrite");
/* Close disk dataspace */
@@ -1057,32 +1119,32 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Fclose");
/* Re-open the file */
- fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
- CHECK(fid1, FAIL, "H5Fopen");
+ fid1 = H5Fopen(FILE_REF_REG_1D, H5F_ACC_RDWR, fapl);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
/* Open the dataset */
dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
- CHECK(dset1, FAIL, "H5Dopen2");
+ CHECK(dset1, H5I_INVALID_HID, "H5Dopen2");
/* Read selection from disk */
- ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ ret = H5Dread(dset1, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
CHECK(ret, FAIL, "H5Dread");
/* Try to open objects */
- dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
- CHECK(dset3, FAIL, "H5Rdereference2");
+ dset3 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
+ CHECK(dset3, H5I_INVALID_HID, "H5Ropen_object");
- /* Check what H5Rget_obj_type2 function returns */
- ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ /* Check what H5Rget_obj_type3 function returns */
+ ret = H5Rget_obj_type3(&rbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Check information in referenced dataset */
sid1 = H5Dget_space(dset3);
- CHECK(sid1, FAIL, "H5Dget_space");
+ CHECK(sid1, H5I_INVALID_HID, "H5Dget_space");
ret = (int)H5Sget_simple_extent_npoints(sid1);
- VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
+ VERIFY(ret, SPACE3_DIM1, "H5Sget_simple_extent_npoints");
/* Read from disk */
ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
@@ -1092,8 +1154,8 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
VERIFY(*tu8, (uint8_t)(i * 3), "Data");
/* Get the hyperslab selection */
- sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
- CHECK(sid3, FAIL, "H5Rget_region");
+ sid3 = H5Ropen_region(&rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct hyperslab selected */
ret = (int)H5Sget_select_npoints(sid3);
@@ -1144,8 +1206,8 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Sclose");
/* Get the element selection */
- sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
- CHECK(sid3, FAIL, "H5Rget_region");
+ sid3 = H5Ropen_region(&rbuf[1], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(sid3, H5I_INVALID_HID, "H5Ropen_region");
/* Verify correct elements selected */
ret = (int)H5Sget_select_npoints(sid3);
@@ -1199,6 +1261,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+ /* Destroy references */
+ for(i = 0; i < 2; i++) {
+ ret = H5Rdestroy(&wbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&rbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+
/* Free memory buffers */
HDfree(wbuf);
HDfree(rbuf);
@@ -1215,44 +1285,43 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
static void
test_reference_obj_deleted(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, /* Dataset ID */
- dset2; /* Dereferenced dataset ID */
- hid_t sid1; /* Dataspace ID */
- hobj_ref_t oref; /* Object Reference to test */
- H5O_type_t obj_type; /* Object type */
- haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ H5R_ref_t oref; /* Object Reference to test */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
/* Create file */
- fid1 = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid1 = H5Fcreate(FILE_REF_OBJ_DEL, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
/* Create scalar dataspace for datasets */
sid1 = H5Screate_simple(0, NULL, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create a dataset to reference (deleted later) */
dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, "Dataset2", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ dataset = H5Dcreate2(fid1, "Dataset2", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Create reference to dataset */
- ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
- ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &oref, &obj_type);
- CHECK(ret, FAIL, "H5Rget_obj_type2");
- VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+ ret = H5Rcreate_object(fid1, "/Dataset1", H5P_DEFAULT, &oref);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ ret = H5Rget_obj_type3(&oref, H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Write selection to disk */
- ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
+ ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
CHECK(ret, FAIL, "H5Dwrite");
/* Close Dataset */
@@ -1271,31 +1340,25 @@ test_reference_obj_deleted(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+ /* Destroy reference */
+ ret = H5Rdestroy(&oref);
+ CHECK(ret, FAIL, "H5Rdestroy");
+
/* Re-open the file */
- fid1 = H5Fopen(FILE3, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(fid1, FAIL, "H5Fopen");
+ fid1 = H5Fopen(FILE_REF_OBJ_DEL, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
/* Open the dataset */
dataset = H5Dopen2(fid1, "/Dataset2", H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dopen2");
-
- /* Open undefined reference */
- dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &addr);
- VERIFY(dset2, FAIL, "H5Rdereference2");
+ CHECK(ret, H5I_INVALID_HID, "H5Dopen2");
/* Read selection from disk */
- HDmemset(&oref, 0, sizeof(hobj_ref_t));
- ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
CHECK(ret, FAIL, "H5Dread");
/* Open deleted dataset object */
- dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref);
- VERIFY(dset2, FAIL, "H5Rdereference2");
-
- /* Open nonsense reference */
- HDmemset(&oref, 0, sizeof(hobj_ref_t));
- dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref);
- VERIFY(dset2, FAIL, "H5Rdereference2");
+ dset2 = H5Ropen_object(&oref, H5P_DEFAULT, H5P_DEFAULT);
+ VERIFY(dset2, H5I_INVALID_HID, "H5Ropen_object");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1304,6 +1367,10 @@ test_reference_obj_deleted(void)
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+
+ /* Destroy reference */
+ ret = H5Rdestroy(&oref);
+ CHECK(ret, FAIL, "H5Rdestroy");
} /* test_reference_obj_deleted() */
/****************************************************************
@@ -1313,7 +1380,7 @@ test_reference_obj_deleted(void)
**
****************************************************************/
static herr_t
-test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info_t H5_ATTR_UNUSED *info,
+test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info,
void *op_data)
{
int *count = (int *)op_data; /* Pointer to name counter */
@@ -1359,57 +1426,57 @@ test_reference_group(void)
hid_t gid = -1, gid2 = -1; /* Group IDs */
hid_t did; /* Dataset ID */
hid_t sid; /* Dataspace ID */
- hobj_ref_t wref; /* Reference to write */
- hobj_ref_t rref; /* Reference to read */
+ H5R_ref_t wref; /* Reference to write */
+ H5R_ref_t rref; /* Reference to read */
H5G_info_t ginfo; /* Group info struct */
char objname[NAME_SIZE]; /* Buffer to store name */
- H5O_info_t oinfo; /* Object info struct */
+ H5O_info2_t oinfo; /* Object info struct */
int count = 0; /* Count within iterated group */
ssize_t size; /* Name length */
herr_t ret;
/* Create file with a group and a dataset containing an object reference to the group */
- fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid, FAIL, "H5Fcreate");
+ fid = H5Fcreate(FILE_REF_GRP, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace to use for dataset */
sid = H5Screate(H5S_SCALAR);
- CHECK(sid, FAIL, "H5Screate");
+ CHECK(sid, H5I_INVALID_HID, "H5Screate");
/* Create group to refer to */
gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(gid, FAIL, "H5Gcreate2");
+ CHECK(gid, H5I_INVALID_HID, "H5Gcreate2");
/* Create nested groups */
gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(gid2, FAIL, "H5Gcreate2");
+ CHECK(gid2, H5I_INVALID_HID, "H5Gcreate2");
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(gid2, FAIL, "H5Gcreate2");
+ CHECK(gid2, H5I_INVALID_HID, "H5Gcreate2");
ret = H5Gclose(gid2);
CHECK(ret, FAIL, "H5Gclose");
/* Create bottom dataset */
did = H5Dcreate2(gid, DSETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(did > 0);
+ CHECK(did, H5I_INVALID_HID, "H5Dcreate2");
ret = H5Dclose(did);
- assert(ret >= 0);
+ CHECK(ret, FAIL, "H5Dclose");
ret = H5Gclose(gid);
CHECK(ret, FAIL, "H5Gclose");
/* Create dataset */
- did = H5Dcreate2(fid, DSETNAME, H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dcreate2");
+ did = H5Dcreate2(fid, DSETNAME, H5T_STD_REF, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(did, H5I_INVALID_HID, "H5Dcreate2");
/* Create reference to group */
- ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, (hid_t)-1);
- CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rcreate_object(fid, GROUPNAME, H5P_DEFAULT, &wref);
+ CHECK(ret, FAIL, "H5Rcreate_object");
/* Write reference to disk */
- ret = H5Dwrite(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wref);
+ ret = H5Dwrite(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wref);
CHECK(ret, FAIL, "H5Dwrite");
/* Close objects */
@@ -1420,25 +1487,28 @@ test_reference_group(void)
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
+ /* Destroy reference */
+ ret = H5Rdestroy(&wref);
+ CHECK(ret, FAIL, "H5Rdestroy");
/* Re-open file */
- fid = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK(fid, FAIL, "H5Fopen");
+ fid = H5Fopen(FILE_REF_GRP, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, H5I_INVALID_HID, "H5Fopen");
/* Re-open dataset */
did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
- CHECK(did, FAIL, "H5Dopen2");
+ CHECK(did, H5I_INVALID_HID, "H5Dopen2");
/* Read in the reference */
- ret = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rref);
+ ret = H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rref);
CHECK(ret, FAIL, "H5Dread");
/* Dereference to get the group */
- gid = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &rref);
- CHECK(gid, FAIL, "H5Rdereference2");
+ gid = H5Ropen_object(&rref, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, H5I_INVALID_HID, "H5Ropen_object");
/* Iterate through objects in dereferenced group */
- ret = H5Literate(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count);
+ ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count);
CHECK(ret, FAIL, "H5Literate");
/* Various queries on the group opened */
@@ -1447,12 +1517,12 @@ test_reference_group(void)
VERIFY(ginfo.nlinks, 3, "H5Gget_info");
size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
- CHECK(size, FAIL, "H5Lget_name_by_idx");
+ CHECK(size, (-1), "H5Lget_name_by_idx");
VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
- ret = H5Oget_info_by_idx2(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_idx");
- VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx");
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_idx3");
+ VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3");
/* Unlink one of the objects in the dereferenced group */
ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT);
@@ -1469,66 +1539,616 @@ test_reference_group(void)
CHECK(ret, FAIL, "H5Gclose");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
+
+ /* Destroy reference */
+ ret = H5Rdestroy(&rref);
+ CHECK(ret, FAIL, "H5Rdestroy");
} /* test_reference_group() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
/****************************************************************
**
-** test_reference_compat(): Test basic H5R (reference) object reference code.
-** Tests deprecated API routines
+** test_reference_attr(): Test basic H5R (reference) attribute reference code.
+** Tests references to attributes on various kinds of objects
+**
+****************************************************************/
+static void
+test_reference_attr(void)
+{
+ hid_t fid; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
+ ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
+ unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
+ unsigned i; /* Local index variables */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Attribute Reference Functions\n"));
+
+ /* Create file */
+ fid = H5Fcreate(FILE_REF_ATTR, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
+ CHECK(sid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
+
+ /* Create a group */
+ group = H5Gcreate2(fid, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
+
+ /* Create an attribute for the dataset */
+ attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 1;
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Create an attribute for the dataset */
+ attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = i * 3;
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a datatype to refer to */
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(tid, H5I_INVALID_HID, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Save datatype for later */
+ ret = H5Tcommit2(group, "Datatype1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Create an attribute for the datatype */
+ attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 2;
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid, "Dataset3", H5T_STD_REF, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Create reference to dataset1 attribute */
+ ret = H5Rcreate_attr(fid, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+
+ /* Create reference to dataset2 attribute */
+ ret = H5Rcreate_attr(fid, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+
+ /* Create reference to group attribute */
+ ret = H5Rcreate_attr(fid, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
+
+ /* Create reference to named datatype attribute */
+ ret = H5Rcreate_attr(fid, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid = H5Fopen(FILE_REF_ATTR, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid, "/Dataset3", H5P_DEFAULT);
+ CHECK(ret, H5I_INVALID_HID, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Open attribute on dataset object */
+ attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
+
+ /* Check information in referenced dataset */
+ sid = H5Aget_space(attr);
+ CHECK(sid, H5I_INVALID_HID, "H5Aget_space");
+
+ ret = (int)H5Sget_simple_extent_npoints(sid);
+ VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints");
+
+ /* Read from disk */
+ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
+ CHECK(ret, FAIL, "H5Aread");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], i * 3, "Data");
+
+ /* Close dereferenced Dataset */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Open attribute on group object */
+ attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
+
+ /* Read from disk */
+ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
+ CHECK(ret, FAIL, "H5Aread");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 1, "Data");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Open attribute on named datatype object */
+ attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
+
+ /* Read from disk */
+ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
+ CHECK(ret, FAIL, "H5Aread");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 2, "Data");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ ret = H5Rdestroy(&ref_wbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&ref_rbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+} /* test_reference_attr() */
+
+/****************************************************************
+**
+** test_reference_external():
+** Tests external references on various kinds of objects
+**
+****************************************************************/
+static void
+test_reference_external(void)
+{
+ hid_t fid1, fid2; /* HDF5 File ID */
+ hid_t dataset; /* Dataset ID */
+ hid_t group; /* Group ID */
+ hid_t attr; /* Attribute ID */
+ hid_t sid; /* Dataspace ID */
+ hid_t tid; /* Datatype ID */
+ hsize_t dims[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t ref_wbuf[SPACE1_DIM1], /* Buffer to write to disk */
+ ref_rbuf[SPACE1_DIM1]; /* Buffer read from disk */
+ unsigned wbuf[SPACE1_DIM1], rbuf[SPACE1_DIM1];
+ unsigned i; /* Local index variables */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing External References Functions\n"));
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE_REF_EXT1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
+ CHECK(sid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
+
+ /* Create a group */
+ group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
+
+ /* Create an attribute for the dataset */
+ attr = H5Acreate2(group, "Attr2", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 1;
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Create an attribute for the dataset */
+ attr = H5Acreate2(dataset, "Attr1", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = i * 3;
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a datatype to refer to */
+ tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(tid, H5I_INVALID_HID, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Save datatype for later */
+ ret = H5Tcommit2(group, "Datatype1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Create an attribute for the datatype */
+ attr = H5Acreate2(tid, "Attr3", H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Acreate2");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ wbuf[i] = (i * 3) + 2;
+
+ /* Write attribute to disk */
+ ret = H5Awrite(attr, H5T_NATIVE_UINT, wbuf);
+ CHECK(ret, FAIL, "H5Awrite");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close datatype */
+ ret = H5Tclose(tid);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create reference to dataset1 attribute */
+ ret = H5Rcreate_attr(fid1, "/Group1/Dataset1", "Attr1", H5P_DEFAULT, &ref_wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+
+ /* Create reference to dataset2 attribute */
+ ret = H5Rcreate_attr(fid1, "/Group1/Dataset2", "Attr1", H5P_DEFAULT, &ref_wbuf[1]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[1], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+
+ /* Create reference to group attribute */
+ ret = H5Rcreate_attr(fid1, "/Group1", "Attr2", H5P_DEFAULT, &ref_wbuf[2]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[2], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
+
+ /* Create reference to named datatype attribute */
+ ret = H5Rcreate_attr(fid1, "/Group1/Datatype1", "Attr3", H5P_DEFAULT, &ref_wbuf[3]);
+ CHECK(ret, FAIL, "H5Rcreate_attr");
+ ret = H5Rget_obj_type3(&ref_wbuf[3], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Create file */
+ fid2 = H5Fcreate(FILE_REF_EXT2, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid2, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid = H5Screate_simple(SPACE1_RANK, dims, NULL);
+ CHECK(sid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid2, "Dataset3", H5T_STD_REF, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid2);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid2 = H5Fopen(FILE_REF_EXT2, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid2, FAIL, "H5Fopen");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid2, "/Dataset3", H5P_DEFAULT);
+ CHECK(ret, H5I_INVALID_HID, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, ref_rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Open attribute on dataset object */
+ attr = H5Ropen_attr(&ref_rbuf[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
+
+ /* Check information in referenced dataset */
+ sid = H5Aget_space(attr);
+ CHECK(sid, H5I_INVALID_HID, "H5Aget_space");
+
+ ret = (int)H5Sget_simple_extent_npoints(sid);
+ VERIFY(ret, SPACE1_DIM1, "H5Sget_simple_extent_npoints");
+
+ /* Read from disk */
+ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
+ CHECK(ret, FAIL, "H5Aread");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], i * 3, "Data");
+
+ /* Close dereferenced Dataset */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Open attribute on group object */
+ attr = H5Ropen_attr(&ref_rbuf[2], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
+
+ /* Read from disk */
+ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
+ CHECK(ret, FAIL, "H5Aread");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 1, "Data");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Open attribute on named datatype object */
+ attr = H5Ropen_attr(&ref_rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(attr, H5I_INVALID_HID, "H5Ropen_attr");
+
+ /* Read from disk */
+ ret = H5Aread(attr, H5T_NATIVE_UINT, rbuf);
+ CHECK(ret, FAIL, "H5Aread");
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ VERIFY(rbuf[i], (i * 3) + 2, "Data");
+
+ /* Close attribute */
+ ret = H5Aclose(attr);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Close dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid2);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ for (i = 0; i < SPACE1_DIM1; i++) {
+ ret = H5Rdestroy(&ref_wbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&ref_rbuf[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+} /* test_reference_external() */
+
+/****************************************************************
+**
+** test_reference_compat_conv(): Test basic H5R (reference) object reference code.
+** Tests deprecated API routines and type conversion.
**
****************************************************************/
static void
-test_reference_compat(void)
+test_reference_compat_conv(void)
{
- hid_t fid1; /* HDF5 File IDs */
- hid_t dataset, dset2; /* Dataset ID */
- hid_t group, group2; /* Group ID */
- hid_t sid1, /* Dataspace IDs */
- sid2;
- hid_t tid1, tid2; /* Datatype ID */
- hsize_t dims1[] = {SPACE1_DIM1},
- dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
- hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
- hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
- hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
- hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
- hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
- hobj_ref_t *wbuf_obj, /* Buffer to write to disk */
- *rbuf_obj; /* Buffer read from disk */
- hdset_reg_ref_t *wbuf_reg, /* Buffer to write to disk */
- *rbuf_reg; /* Buffer read from disk */
- H5G_obj_t obj_type; /* Object type */
- herr_t ret; /* Generic return value */
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t group, group2; /* Group ID */
+ hid_t sid1, sid2, sid3; /* Dataspace IDs */
+ hid_t tid1, tid2; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2},
+ dims3[] = {SPACE1_DIM1}; /* Purposedly set dimension larger to test NULL references */
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK];/* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hobj_ref_t *wbuf_obj; /* Buffer to write to disk */
+ H5R_ref_t *rbuf_obj; /* Buffer read from disk */
+ hdset_reg_ref_t *wbuf_reg; /* Buffer to write to disk */
+ H5R_ref_t *rbuf_reg; /* Buffer read from disk */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+ unsigned int i; /* Counter */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
/* Allocate write & read buffers */
wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
- rbuf_obj = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
- wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
- rbuf_reg = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ rbuf_obj = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf_reg = HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf_reg = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
/* Create file */
- fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(fid1, FAIL, "H5Fcreate");
+ fid1 = H5Fcreate(FILE_REF_COMPAT, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
/* Create dataspace for datasets */
sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
- CHECK(sid1, FAIL, "H5Screate_simple");
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
/* Create another dataspace for datasets */
sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
- CHECK(sid2, FAIL, "H5Screate_simple");
+ CHECK(sid2, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create another dataspace for datasets */
+ sid3 = H5Screate_simple(SPACE1_RANK, dims3, NULL);
+ CHECK(sid3, H5I_INVALID_HID, "H5Screate_simple");
/* Create a group */
group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(group, FAIL, "H5Gcreate2");
+ CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
/* Create a dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1536,7 +2156,7 @@ test_reference_compat(void)
/* Create another dataset (inside Group1) */
dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(dataset, FAIL, "H5Dcreate2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1544,7 +2164,7 @@ test_reference_compat(void)
/* Create a datatype to refer to */
tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
- CHECK(tid1, FAIL, "H5Tcreate");
+ CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
/* Insert fields */
ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
@@ -1568,25 +2188,24 @@ test_reference_compat(void)
ret = H5Gclose(group);
CHECK(ret, FAIL, "H5Gclose");
-
/* Create a dataset with object reference datatype */
dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
/* Create reference to dataset */
- ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
+ ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, H5I_INVALID_HID);
CHECK(ret, FAIL, "H5Rcreate");
/* Create reference to dataset */
- ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
+ ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, H5I_INVALID_HID);
CHECK(ret, FAIL, "H5Rcreate");
/* Create reference to group */
- ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
+ ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, H5I_INVALID_HID);
CHECK(ret, FAIL, "H5Rcreate");
/* Create reference to named datatype */
- ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
+ ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, H5I_INVALID_HID);
CHECK(ret, FAIL, "H5Rcreate");
/* Write references to disk */
@@ -1597,16 +2216,19 @@ test_reference_compat(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Create a dataset with region reference datatype */
- dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dcreate2");
+ dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_DSETREG, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
/* Select 6x6 hyperslab for first reference */
- start[0] = 2; start[1] = 2;
- stride[0] = 1; stride[1] = 1;
- count[0] = 1; count[1] = 1;
- block[0] = 6; block[1] = 6;
+ start[0] = 2;
+ start[1] = 2;
+ stride[0] = 1;
+ stride[1] = 1;
+ count[0] = 1;
+ count[1] = 1;
+ block[0] = 6;
+ block[1] = 6;
ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
@@ -1640,69 +2262,69 @@ test_reference_compat(void)
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
-
/* Close disk dataspaces */
ret = H5Sclose(sid1);
CHECK(ret, FAIL, "H5Sclose");
ret = H5Sclose(sid2);
CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
/* Close file */
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
-
/* Re-open the file */
- fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
+ fid1 = H5Fopen(FILE_REF_COMPAT, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK(fid1, FAIL, "H5Fopen");
/* Open the object reference dataset */
dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dopen2");
+ CHECK(dataset, FAIL, "H5Dopen2");
/* Read selection from disk */
- ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_obj);
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_obj);
CHECK(ret, FAIL, "H5Dread");
/* Verify type of objects pointed at */
- obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[0]);
- CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
- VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+ ret = H5Rget_obj_type3(&rbuf_obj[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[1]);
- CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
- VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+ ret = H5Rget_obj_type3(&rbuf_obj[1], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[2]);
- CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
- VERIFY(obj_type, H5G_GROUP, "H5Rget_obj_type1");
+ ret = H5Rget_obj_type3(&rbuf_obj[2], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type3");
- obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[3]);
- CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
- VERIFY(obj_type, H5G_TYPE, "H5Rget_obj_type1");
+ ret = H5Rget_obj_type3(&rbuf_obj[3], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type3");
/* Make sure the referenced objects can be opened */
- dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[0]);
- CHECK(dset2, FAIL, "H5Rdereference1");
+ dset2 = H5Ropen_object(&rbuf_obj[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[1]);
- CHECK(dset2, FAIL, "H5Rdereference1");
+ dset2 = H5Ropen_object(&rbuf_obj[1], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- group2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[2]);
- CHECK(group2, FAIL, "H5Rdereference1");
+ group2 = H5Ropen_object(&rbuf_obj[2], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Gclose(group2);
CHECK(ret, FAIL, "H5Gclose");
- tid2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[3]);
- CHECK(tid2, FAIL, "H5Rdereference1");
+ tid2 = H5Ropen_object(&rbuf_obj[3], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(tid2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Tclose(tid2);
CHECK(ret, FAIL, "H5Tclose");
@@ -1714,36 +2336,30 @@ test_reference_compat(void)
/* Open the dataset region reference dataset */
dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Dopen2");
+ CHECK(ret, H5I_INVALID_HID, "H5Dopen2");
/* Read selection from disk */
- ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
CHECK(ret, FAIL, "H5Dread");
/* Verify type of objects pointed at */
- obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
- CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
- VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
-
- obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
- CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
- VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+ ret = H5Rget_obj_type3(&rbuf_reg[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
- obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[2]);
- VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
-
- obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]);
- VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ ret = H5Rget_obj_type3(&rbuf_reg[1], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
/* Make sure the referenced objects can be opened */
- dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
- CHECK(dset2, FAIL, "H5Rdereference1");
+ dset2 = H5Ropen_object(&rbuf_reg[0], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
- dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
- CHECK(dset2, FAIL, "H5Rdereference1");
+ dset2 = H5Ropen_object(&rbuf_reg[1], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
@@ -1756,13 +2372,440 @@ test_reference_compat(void)
ret = H5Fclose(fid1);
CHECK(ret, FAIL, "H5Fclose");
+ /* Destroy references */
+ for(i = 0; i < dims1[0]; i++) {
+ ret = H5Rdestroy(&rbuf_obj[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ for(i = 0; i < dims3[0]; i++) {
+ ret = H5Rdestroy(&rbuf_reg[i]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+
/* Free memory buffers */
HDfree(wbuf_obj);
HDfree(rbuf_obj);
HDfree(wbuf_reg);
HDfree(rbuf_reg);
} /* test_reference_compat() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/****************************************************************
+**
+** test_reference_perf(): Test basic H5R (reference) object reference
+** performance.
+**
+****************************************************************/
+static void
+test_reference_perf(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {1};
+ hid_t dapl_id; /* Dataset access property list */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ H5R_ref_t *wbuf_reg, /* buffer to write to disk */
+ *rbuf_reg; /* buffer read from disk */
+ hobj_ref_t *wbuf_deprec,/* deprecated references */
+ *rbuf_deprec;/* deprecated references */
+ hdset_reg_ref_t *wbuf_reg_deprec, /* deprecated references*/
+ *rbuf_reg_deprec; /* deprecated references*/
+ unsigned *ibuf, *obuf;
+ unsigned i, j; /* Counters */
+ H5O_type_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+ double t1, t2, t; /* Timers */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Object Reference Performance\n"));
+
+ /* Allocate write & read buffers */
+ wbuf = HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ obuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ ibuf = HDcalloc(sizeof(unsigned), SPACE1_DIM1);
+ wbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ rbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_deprec = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ tbuf = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ rbuf_reg = (H5R_ref_t *)HDcalloc(sizeof(H5R_ref_t), SPACE1_DIM1);
+ wbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf_reg_deprec = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+
+ for(i = 0; i < SPACE1_DIM1; i++)
+ obuf[i] = i * 3;
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE_REF_OBJ, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, H5I_INVALID_HID, "H5Pcreate");
+
+ /* Create a group */
+ group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, H5I_INVALID_HID, "H5Gcreate2");
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, obuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Save datatype for later */
+ ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
+ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ ret = H5Rdestroy(&wbuf[0]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Object reference create time: %lfs\n", t / MAX_ITER_CREATE);
+
+ /* Create reference to dataset */
+ ret = H5Rcreate_object(fid1, "/Group1/Dataset1", H5P_DEFAULT, &wbuf[0]);
+ CHECK(ret, FAIL, "H5Rcreate_object");
+ ret = H5Rget_obj_type3(&wbuf[0], H5P_DEFAULT, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type3");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type3");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_WRITE; i++) {
+ t1 = H5_get_time();
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Object reference write time: %lfs\n", t / MAX_ITER_WRITE);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
+ ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID);
+ CHECK(ret, FAIL, "H5Rcreate");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Deprecated object reference create time: %lfs\n", t / MAX_ITER_CREATE);
+
+ /* Create reference to dataset */
+ ret = H5Rcreate(&wbuf_deprec[0], fid1, "/Group1/Dataset1", H5R_OBJECT1, H5I_INVALID_HID);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_WRITE; i++) {
+ t1 = H5_get_time();
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_deprec);
+ CHECK(ret, FAIL, "H5Dwrite");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Deprecated object reference write time: %lfs\n", t / MAX_ITER_WRITE);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset5", H5T_STD_REF, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
+ /* Store first dataset region */
+ ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ ret = H5Rdestroy(&wbuf_reg[0]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Region reference create time: %lfs\n", t / MAX_ITER_CREATE);
+
+ /* Store first dataset region */
+ ret = H5Rcreate_region(fid1, "/Group1/Dataset1", sid1, H5P_DEFAULT, &wbuf_reg[0]);
+ CHECK(ret, FAIL, "H5Rcreate_region");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_WRITE; i++) {
+ t1 = H5_get_time();
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg);
+ CHECK(ret, FAIL, "H5Dwrite");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Region reference write time: %lfs\n", t / MAX_ITER_WRITE);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset6", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_CREATE; i++) {
+ t1 = H5_get_time();
+ /* Store first dataset region */
+ ret = H5Rcreate(&wbuf_reg_deprec[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION1, sid1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Deprecated region reference create time: %lfs\n", t / MAX_ITER_CREATE);
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_WRITE; i++) {
+ t1 = H5_get_time();
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg_deprec);
+ CHECK(ret, FAIL, "H5Dwrite");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Deprecated region reference write time: %lfs\n", t / MAX_ITER_WRITE);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE_REF_OBJ, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid1, H5I_INVALID_HID, "H5Fopen");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_READ; i++) {
+ t1 = H5_get_time();
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ ret = H5Rdestroy(&rbuf[0]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Object reference read time: %lfs\n", t / MAX_ITER_READ);
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Open dataset object */
+ dset2 = H5Ropen_object(&rbuf[0], H5P_DEFAULT, dapl_id);
+ CHECK(dset2, H5I_INVALID_HID, "H5Ropen_object");
+
+ /* Check information in referenced dataset */
+ sid1 = H5Dget_space(dset2);
+ CHECK(sid1, H5I_INVALID_HID, "H5Dget_space");
+
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
+ VERIFY(ret, dims1[0], "H5Sget_simple_extent_npoints");
+
+ /* Read from disk */
+ ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, ibuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ for(i = 0; i < dims1[0]; i++)
+ VERIFY(ibuf[i], i * 3, "Data");
+
+ /* Close dereferenced Dataset */
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_READ; i++) {
+ t1 = H5_get_time();
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_deprec);
+ CHECK(ret, FAIL, "H5Dread");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Deprecated object reference read time: %lfs\n", t / MAX_ITER_READ);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset5", H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_READ; i++) {
+ t1 = H5_get_time();
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
+ CHECK(ret, FAIL, "H5Dread");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ ret = H5Rdestroy(&rbuf_reg[0]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Region reference read time: %lfs\n", t / MAX_ITER_READ);
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset6", H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dopen2");
+
+ t = 0;
+ for(i = 0; i < MAX_ITER_READ; i++) {
+ t1 = H5_get_time();
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg_deprec);
+ CHECK(ret, FAIL, "H5Dread");
+ t2 = H5_get_time();
+ t += t2 - t1;
+ }
+ if(VERBOSE_MED)
+ HDprintf("--- Deprecated region reference read time: %lfs\n", t / MAX_ITER_READ);
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Destroy references */
+ for(j = 0; j < dims1[0]; j++) {
+ ret = H5Rdestroy(&wbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&wbuf_reg[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&rbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ ret = H5Rdestroy(&rbuf_reg[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(wbuf_reg);
+ HDfree(rbuf_reg);
+ HDfree(wbuf_deprec);
+ HDfree(rbuf_deprec);
+ HDfree(wbuf_reg_deprec);
+ HDfree(rbuf_reg_deprec);
+ HDfree(tbuf);
+ HDfree(ibuf);
+ HDfree(obuf);
+} /* test_reference_perf() */
/****************************************************************
**
@@ -1781,11 +2824,11 @@ test_reference(void)
test_reference_obj(); /* Test basic H5R object reference code */
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
/* Invalid combinations, just continue */
- if(high == H5F_LIBVER_EARLIEST || high < low)
+ if(high <= H5F_LIBVER_V110 || high < low)
continue;
test_reference_region(low, high); /* Test basic H5R dataset region reference code */
@@ -1794,11 +2837,13 @@ test_reference(void)
} /* end high bound */
} /* end low bound */
- test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
- test_reference_group(); /* Test operations on dereferenced groups */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_reference_compat(); /* Test operations with old API routines */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
+ test_reference_group(); /* Test operations on dereferenced groups */
+ test_reference_attr(); /* Test attribute references */
+ test_reference_external(); /* Test external references */
+ test_reference_compat_conv(); /* Test operations with old types */
+
+ test_reference_perf();
} /* test_reference() */
@@ -1820,8 +2865,14 @@ test_reference(void)
void
cleanup_reference(void)
{
- remove(FILE1);
- remove(FILE2);
- remove(FILE3);
+ HDremove(FILE_REF_PARAM);
+ HDremove(FILE_REF_OBJ);
+ HDremove(FILE_REF_REG);
+ HDremove(FILE_REF_REG_1D);
+ HDremove(FILE_REF_OBJ_DEL);
+ HDremove(FILE_REF_GRP);
+ HDremove(FILE_REF_ATTR);
+ HDremove(FILE_REF_EXT1);
+ HDremove(FILE_REF_EXT2);
+ HDremove(FILE_REF_COMPAT);
}
-
diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c
new file mode 100644
index 0000000..a830314
--- /dev/null
+++ b/test/trefer_deprec.c
@@ -0,0 +1,1827 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/***********************************************************
+*
+* Test program: trefer_deprec
+*
+* Test the Reference functionality
+*
+*************************************************************/
+
+#include "testhdf5.h"
+
+#define FILE1 "trefer1.h5"
+#define FILE2 "trefer2.h5"
+#define FILE3 "trefer3.h5"
+
+/* 1-D dataset with fixed dimensions */
+#define SPACE1_RANK 1
+#define SPACE1_DIM1 4
+
+/* 2-D dataset with fixed dimensions */
+#define SPACE2_RANK 2
+#define SPACE2_DIM1 10
+#define SPACE2_DIM2 10
+
+/* Larger 1-D dataset with fixed dimensions */
+#define SPACE3_RANK 1
+#define SPACE3_DIM1 100
+
+/* Element selection information */
+#define POINT1_NPOINTS 10
+
+/* Compound datatype */
+typedef struct s1_t {
+ unsigned int a;
+ unsigned int b;
+ float c;
+} s1_t;
+
+#define GROUPNAME "/group"
+#define GROUPNAME2 "group2"
+#define GROUPNAME3 "group3"
+#define DSETNAME "/dset"
+#define DSETNAME2 "dset2"
+#define NAME_SIZE 16
+
+
+/****************************************************************
+**
+** test_reference_params(): Test basic H5R (reference) parameters
+** for correct processing
+**
+****************************************************************/
+static void
+test_reference_params(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ unsigned *tu32; /* Temporary pointer to uint32 data */
+ int i; /* counting variables */
+ const char *write_comment = "Foo!"; /* Comments for group */
+ hid_t ret_id; /* Generic hid_t return value */
+ ssize_t name_size; /* Size of reference name */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Reference Parameters\n"));
+
+ /* Allocate write & read buffers */
+ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
+ /* Create a group */
+ group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, FAIL, "H5Gcreate2");
+
+ /* Set group's comment */
+ ret = H5Oset_comment(group, write_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ *tu32++ = (unsigned)i * 3;
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(tid1, FAIL, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Save datatype for later */
+ ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Dcreate2");
+
+ /* Test parameters to H5Rcreate */
+ ret = H5Rcreate(NULL, fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
+ VERIFY(ret, FAIL, "H5Rcreate ref");
+ ret = H5Rcreate(&wbuf[0], (hid_t)-1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
+ VERIFY(ret, FAIL, "H5Rcreate loc_id");
+ ret = H5Rcreate(&wbuf[0], fid1, NULL, H5R_OBJECT, (hid_t)-1);
+ VERIFY(ret, FAIL, "H5Rcreate name");
+ ret = H5Rcreate(&wbuf[0], fid1, "", H5R_OBJECT, (hid_t)-1);
+ VERIFY(ret, FAIL, "H5Rcreate null name");
+ ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)-1);
+ VERIFY(ret, FAIL, "H5Rcreate type");
+ ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, (hid_t)-1);
+ VERIFY(ret, FAIL, "H5Rcreate region space");
+ ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_MAXTYPE, (hid_t)0);
+ VERIFY(ret, FAIL, "H5Rcreate space");
+
+ /* Test parameters to H5Rdereference */
+ dset2 = H5Rdereference2((hid_t)-1, H5P_DEFAULT, H5R_OBJECT, &rbuf[0]);
+ VERIFY(dset2, FAIL, "H5Rdereference2 loc_id");
+ dset2 = H5Rdereference2(dataset, (hid_t)-1, H5R_OBJECT, &rbuf[0]);
+ VERIFY(dset2, FAIL, "H5Rdereference2 oapl_id");
+ dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, NULL);
+ VERIFY(dset2, FAIL, "H5Rdereference2 ref");
+ dset2 = H5Rdereference2(dataset, dapl_id, H5R_MAXTYPE, &rbuf[0]);
+ VERIFY(dset2, FAIL, "H5Rdereference2 type");
+
+ /* Test parameters to H5Rget_obj_type2 */
+ ret = H5Rget_obj_type2((hid_t)-1, H5R_OBJECT, &rbuf[0], NULL);
+ VERIFY(ret, FAIL, "H5Rget_obj_type2 loc_id");
+ ret = H5Rget_obj_type2(fid1, H5R_OBJECT, NULL, NULL);
+ VERIFY(ret, FAIL, "H5Rget_obj_type2 ref");
+ ret = H5Rget_obj_type2(fid1, H5R_MAXTYPE, &rbuf[0], NULL);
+ VERIFY(ret, FAIL, "H5Rget_obj_type2 type");
+
+ /* Test parameters to H5Rget_name */
+ name_size = H5Rget_name((hid_t)-1, H5R_DATASET_REGION, &rbuf[0], NULL, 0);
+ VERIFY(name_size, FAIL, "H5Rget_name loc_id");
+ name_size = H5Rget_name(fid1, H5R_DATASET_REGION, NULL, NULL, 0);
+ VERIFY(name_size, FAIL, "H5Rget_name ref");
+ name_size = H5Rget_name(fid1, H5R_MAXTYPE, &rbuf[0], NULL, 0);
+ VERIFY(name_size, FAIL, "H5Rget_name type");
+
+ /* Test parameters to H5Rget_region */
+ ret_id = H5Rget_region((hid_t)-1, H5R_OBJECT, &rbuf[0]);
+ VERIFY(ret_id, FAIL, "H5Rget_region loc_id");
+ ret_id = H5Rget_region(fid1, H5R_OBJECT, NULL);
+ VERIFY(ret_id, FAIL, "H5Rget_region ref");
+ ret_id = H5Rget_region(fid1, H5R_OBJECT, &rbuf[0]);
+ VERIFY(ret_id, FAIL, "H5Rget_region type");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
+} /* test_reference_obj() */
+
+/****************************************************************
+**
+** test_reference_obj(): Test basic H5R (reference) object reference code.
+** Tests references to various kinds of objects
+**
+****************************************************************/
+static void
+test_reference_obj(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t group; /* Group ID */
+ hid_t sid1; /* Dataspace ID */
+ hid_t tid1; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1};
+ hid_t dapl_id; /* Dataset access property list */
+ hobj_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf, /* buffer read from disk */
+ *tbuf; /* temp. buffer read from disk */
+ hobj_ref_t nvrbuf[3]={0,101,1000000000}; /* buffer with non-valid refs */
+ unsigned *tu32; /* Temporary pointer to uint32 data */
+ int i, j; /* counting variables */
+ const char *write_comment="Foo!"; /* Comments for group */
+ char read_comment[10];
+ H5O_type_t obj_type; /* Object type */
+ ssize_t size; /* Comment length */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Object Reference Functions\n"));
+
+ /* Allocate write & read buffers */
+ wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
+ /* Create a group */
+ group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, FAIL, "H5Gcreate2");
+
+ /* Set group's comment */
+ ret = H5Oset_comment(group, write_comment);
+ CHECK(ret, FAIL, "H5Oset_comment");
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ for(tu32 = (unsigned *)wbuf, i = 0; i < SPACE1_DIM1; i++)
+ *tu32++ = (unsigned)i * 3;
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(tid1, FAIL, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Save datatype for later */
+ ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Create reference to dataset */
+ ret = H5Rcreate(&wbuf[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Create reference to dataset */
+ ret = H5Rcreate(&wbuf[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[1], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Create reference to group */
+ ret = H5Rcreate(&wbuf[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[2], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_GROUP, "H5Rget_obj_type2");
+
+ /* Create reference to named datatype */
+ ret = H5Rcreate(&wbuf[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &wbuf[3], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_NAMED_DATATYPE, "H5Rget_obj_type2");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fopen");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Open dataset object */
+ dset2 = H5Rdereference2(dataset, dapl_id, H5R_OBJECT, &rbuf[0]);
+ CHECK(dset2, FAIL, "H5Rdereference2");
+
+ /* Check information in referenced dataset */
+ sid1 = H5Dget_space(dset2);
+ CHECK(sid1, FAIL, "H5Dget_space");
+
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
+ VERIFY(ret, 4, "H5Sget_simple_extent_npoints");
+
+ /* Read from disk */
+ ret = H5Dread(dset2, H5T_NATIVE_UINT, H5S_ALL, H5S_ALL, H5P_DEFAULT, tbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ for(tu32 = (unsigned *)tbuf, i = 0; i < SPACE1_DIM1; i++, tu32++)
+ VERIFY(*tu32, (uint32_t)(i*3), "Data");
+
+ /* Close dereferenced Dataset */
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Open group object. GAPL isn't supported yet. But it's harmless to pass in */
+ group = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &rbuf[2]);
+ CHECK(group, FAIL, "H5Rdereference2");
+
+ /* Get group's comment */
+ size = H5Oget_comment(group, read_comment, (size_t)10);
+ CHECK(size, FAIL, "H5Oget_comment");
+
+ /* Check for correct comment value */
+ if(HDstrcmp(write_comment, read_comment) != 0)
+ TestErrPrintf("Error! Incorrect group comment, wanted: %s, got: %s\n",write_comment,read_comment);
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Open datatype object. TAPL isn't supported yet. But it's harmless to pass in */
+ tid1 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &rbuf[3]);
+ CHECK(tid1, FAIL, "H5Rdereference2");
+
+ /* Verify correct datatype */
+ {
+ H5T_class_t tclass;
+
+ tclass = H5Tget_class(tid1);
+ VERIFY(tclass, H5T_COMPOUND, "H5Tget_class");
+
+ ret= H5Tget_nmembers(tid1);
+ VERIFY(ret, 3, "H5Tget_nmembers");
+ }
+
+ /* Attempting to retrieve type of object using non-valid refs */
+ for(j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY {
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &nvrbuf[j], &obj_type);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Rget_obj_type2");
+ } /* end for */
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(tbuf);
+} /* test_reference_obj() */
+
+/****************************************************************
+**
+** test_reference_region(): Test basic H5R (reference) object reference code.
+** Tests references to various kinds of objects
+**
+** Note: The libver_low/libver_high parameters are added to create the file
+** with the low and high bounds setting in fapl.
+** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
+**
+****************************************************************/
+static void
+test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid2; /* Dataspace ID #2 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE2_RANK]; /* Selection bounds */
+ hsize_t high[SPACE2_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ hdset_reg_ref_t nvrbuf[3]={{{0}},{{101}},{{255}}}; /* buffer with non-valid refs */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Type of object */
+ int i, j; /* counting variables */
+ hssize_t hssize_ret; /* hssize_t return value */
+ htri_t tri_ret; /* htri_t return value */
+ herr_t ret; /* Generic return value */
+ hdset_reg_ref_t undef_reg[1]; /* test for undefined reference */
+ hid_t dset_NA; /* Dataset id for undefined reference */
+ hid_t space_NA; /* Dataspace id for undefined reference */
+ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */
+ hdset_reg_ref_t wdata_NA[1], /* Write buffer */
+ rdata_NA[1]; /* Read buffer */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Dataset Region Reference Functions\n"));
+
+ /* Allocate write & read buffers */
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE2_DIM1 * SPACE2_DIM2);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)(SPACE2_DIM1 * SPACE2_DIM2));
+
+ /* Create file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
+ CHECK(sid2, FAIL, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
+ /* Create a dataset */
+ dset2 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset2, FAIL, "H5Dcreate2");
+
+ for(tu8 = dwbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++)
+ *tu8++ = (uint8_t)(i * 3);
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create dataspace for the reference dataset */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create a dataset */
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset1, FAIL, "H5Dcreate2");
+
+ /* Create references */
+
+ /* Select 6x6 hyperslab for first reference */
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 1; count[1] = 1;
+ block[0] = 6; block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, 36, "H5Sget_select_npoints");
+
+ /* Store first dataset region */
+ ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Select sequence of ten points for second reference */
+ coord1[0][0] = 6; coord1[0][1] = 9;
+ coord1[1][0] = 2; coord1[1][1] = 2;
+ coord1[2][0] = 8; coord1[2][1] = 4;
+ coord1[3][0] = 1; coord1[3][1] = 6;
+ coord1[4][0] = 2; coord1[4][1] = 8;
+ coord1[5][0] = 3; coord1[5][1] = 2;
+ coord1[6][0] = 0; coord1[6][1] = 4;
+ coord1[7][0] = 9; coord1[7][1] = 0;
+ coord1[8][0] = 7; coord1[8][1] = 1;
+ coord1[9][0] = 3; coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, 10, "H5Sget_select_npoints");
+
+ /* Store second dataset region */
+ ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Select unlimited hyperslab for third reference */
+ start[0] = 1; start[1] = 8;
+ stride[0] = 4; stride[1] = 1;
+ count[0] = H5S_UNLIMITED; count[1] = 1;
+ block[0] = 2; block[1] = 2;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+
+ /* Store third dataset region */
+ H5E_BEGIN_TRY {
+ ret = H5Rcreate(&wbuf[2], fid1, "/Dataset2", H5R_DATASET_REGION, sid2);
+ } H5E_END_TRY;
+
+ if(libver_high < H5F_LIBVER_V110)
+ VERIFY(ret, FAIL, "H5Rcreate");
+ else
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /*
+ * Store a dataset region reference which will not get written to disk
+ */
+
+ /* Create reference to an element in dset1 */
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+ ret = H5Rcreate(&wdata_NA[0], fid1, "/Dataset1", H5R_DATASET_REGION, sid2);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Create the dataspace of the region references */
+ space_NA = H5Screate_simple(1, dims_NA, NULL);
+ CHECK(space_NA, FAIL, "H5Screate_simple");
+
+ /* Create the dataset and write the region references to it */
+ dset_NA = H5Dcreate2(fid1, "DS_NA", H5T_STD_REF_DSETREG, space_NA, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset_NA, FAIL, "H5Dcreate");
+
+ /* Close and release resources for undefined region reference tests */
+ ret = H5Dclose(dset_NA);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(space_NA);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close uint8 dataset dataspace */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
+ CHECK(fid1, FAIL, "H5Fopen");
+
+ /*
+ * Start the test of an undefined reference
+ */
+
+ /* Open the dataset of the undefined references */
+ dset_NA = H5Dopen2(fid1, "DS_NA", H5P_DEFAULT);
+ CHECK(dset_NA, FAIL, "H5Dopen2");
+
+ /* Read the data */
+ ret = H5Dread(dset_NA, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_NA);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /*
+ * Dereference an undefined reference (should fail)
+ */
+ H5E_BEGIN_TRY {
+ dset2 = H5Rdereference2(dset_NA, H5P_DEFAULT, H5R_DATASET_REGION, &rdata_NA[0]);
+ } H5E_END_TRY;
+ VERIFY(dset2, FAIL, "H5Rdereference2");
+
+ /* Close and release resources. */
+ ret = H5Dclose(dset_NA);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* This close should fail since H5Rdereference2 never created
+ * the id of the referenced object. */
+ H5E_BEGIN_TRY {
+ ret = H5Dclose(dset2);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Dclose");
+
+ /*
+ * End the test of an undefined reference
+ */
+
+ /* Open the dataset */
+ dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
+ CHECK(dset1, FAIL, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Try to read an unaddressed dataset */
+ dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, undef_reg);
+ VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef");
+
+ /* Try to open objects */
+ dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
+ CHECK(dset2, FAIL, "H5Rdereference2");
+
+ /* Check what H5Rget_obj_type2 function returns */
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Check information in referenced dataset */
+ sid1 = H5Dget_space(dset2);
+ CHECK(sid1, FAIL, "H5Dget_space");
+
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
+ VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
+
+ /* Read from disk */
+ ret = H5Dread(dset2, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < (SPACE2_DIM1 * SPACE2_DIM2); i++, tu8++)
+ VERIFY(*tu8, (uint8_t)(i * 3), "Data");
+
+ /* Get the hyperslab selection */
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, 36, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_hyper_nblocks(sid2);
+ VERIFY(ret, 1, "H5Sget_select_hyper_nblocks");
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid2, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 2, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 7, "Hyperslab Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid2, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 2, "Selection Bounds");
+ VERIFY(low[1], 2, "Selection Bounds");
+ VERIFY(high[0], 7, "Selection Bounds");
+ VERIFY(high[1], 7, "Selection Bounds");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Get the element selection */
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct elements selected */
+ ret = (int)H5Sget_select_npoints(sid2);
+ VERIFY(ret, 10, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_elem_npoints(sid2);
+ VERIFY(ret, 10, "H5Sget_select_elem_npoints");
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE2_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid2, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
+ VERIFY(coords[0], coord1[0][0], "Element Coordinates");
+ VERIFY(coords[1], coord1[0][1], "Element Coordinates");
+ VERIFY(coords[2], coord1[1][0], "Element Coordinates");
+ VERIFY(coords[3], coord1[1][1], "Element Coordinates");
+ VERIFY(coords[4], coord1[2][0], "Element Coordinates");
+ VERIFY(coords[5], coord1[2][1], "Element Coordinates");
+ VERIFY(coords[6], coord1[3][0], "Element Coordinates");
+ VERIFY(coords[7], coord1[3][1], "Element Coordinates");
+ VERIFY(coords[8], coord1[4][0], "Element Coordinates");
+ VERIFY(coords[9], coord1[4][1], "Element Coordinates");
+ VERIFY(coords[10], coord1[5][0], "Element Coordinates");
+ VERIFY(coords[11], coord1[5][1], "Element Coordinates");
+ VERIFY(coords[12], coord1[6][0], "Element Coordinates");
+ VERIFY(coords[13], coord1[6][1], "Element Coordinates");
+ VERIFY(coords[14], coord1[7][0], "Element Coordinates");
+ VERIFY(coords[15], coord1[7][1], "Element Coordinates");
+ VERIFY(coords[16], coord1[8][0], "Element Coordinates");
+ VERIFY(coords[17], coord1[8][1], "Element Coordinates");
+ VERIFY(coords[18], coord1[9][0], "Element Coordinates");
+ VERIFY(coords[19], coord1[9][1], "Element Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid2, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 0, "Selection Bounds");
+ VERIFY(low[1], 0, "Selection Bounds");
+ VERIFY(high[0], 9, "Selection Bounds");
+ VERIFY(high[1], 9, "Selection Bounds");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ if(libver_high >= H5F_LIBVER_V110) {
+ /* Get the unlimited selection */
+ sid2 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[2]);
+ CHECK(sid2, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ hssize_ret = H5Sget_select_npoints(sid2);
+ VERIFY(hssize_ret, (hssize_t)H5S_UNLIMITED, "H5Sget_select_npoints");
+ tri_ret = H5Sis_regular_hyperslab(sid2);
+ CHECK(tri_ret, FAIL, "H5Sis_regular_hyperslab");
+ VERIFY(tri_ret, TRUE, "H5Sis_regular_hyperslab Result");
+ ret = H5Sget_regular_hyperslab(sid2, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sget_regular_hyperslab");
+ VERIFY(start[0], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(start[1], (hsize_t)8, "Hyperslab Coordinates");
+ VERIFY(stride[0], (hsize_t)4, "Hyperslab Coordinates");
+ VERIFY(stride[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(count[0], H5S_UNLIMITED, "Hyperslab Coordinates");
+ VERIFY(count[1], (hsize_t)1, "Hyperslab Coordinates");
+ VERIFY(block[0], (hsize_t)2, "Hyperslab Coordinates");
+ VERIFY(block[1], (hsize_t)2, "Hyperslab Coordinates");
+
+ /* Close region space */
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+ }
+
+ /* Close first space */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close dereferenced Dataset */
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Attempting to retrieve type of object using non-valid refs */
+ for(j = 0; j < 3; j++) {
+ H5E_BEGIN_TRY {
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &nvrbuf[j], &obj_type);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Rget_obj_type2");
+ } /* end for */
+
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+} /* test_reference_region() */
+
+/****************************************************************
+**
+** test_reference_region_1D(): Test H5R (reference) object reference code.
+** Tests 1-D references to various kinds of objects
+**
+** Note: The libver_low/libver_high parameters are added to create the file
+** with the low and high bounds setting in fapl.
+** Please see the RFC for "H5Sencode/H5Sdecode Format Change".
+**
+****************************************************************/
+static void
+test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t fapl = -1; /* File access property list */
+ hid_t dset1, /* Dataset ID */
+ dset3; /* Dereferenced dataset ID */
+ hid_t sid1, /* Dataspace ID #1 */
+ sid3; /* Dataspace ID #3 */
+ hid_t dapl_id; /* Dataset access property list */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims3[] = {SPACE3_DIM1};
+ hsize_t start[SPACE3_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE3_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE3_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE3_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE3_RANK]; /* Coordinates for point selection */
+ hsize_t *coords; /* Coordinate buffer */
+ hsize_t low[SPACE3_RANK]; /* Selection bounds */
+ hsize_t high[SPACE3_RANK]; /* Selection bounds */
+ hdset_reg_ref_t *wbuf, /* buffer to write to disk */
+ *rbuf; /* buffer read from disk */
+ uint8_t *dwbuf, /* Buffer for writing numeric data to disk */
+ *drbuf; /* Buffer for reading numeric data from disk */
+ uint8_t *tu8; /* Temporary pointer to uint8 data */
+ H5O_type_t obj_type; /* Object type */
+ int i; /* counting variables */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing 1-D Dataset Region Reference Functions\n"));
+
+ /* Allocate write & read buffers */
+ wbuf = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), (size_t)SPACE1_DIM1);
+ rbuf = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+ dwbuf = (uint8_t *)HDmalloc(sizeof(uint8_t) * SPACE3_DIM1);
+ drbuf = (uint8_t *)HDcalloc(sizeof(uint8_t), (size_t)SPACE3_DIM1);
+
+ /* Create the file access property list */
+ fapl = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK(fapl, FAIL, "H5Pcreate");
+
+ /* Set the low/high version bounds in fapl */
+ ret = H5Pset_libver_bounds(fapl, libver_low, libver_high);
+ CHECK(ret, FAIL, "H5Pset_libver_bounds");
+
+ /* Create file with the fapl */
+ fid1 = H5Fcreate(FILE2, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid3 = H5Screate_simple(SPACE3_RANK, dims3, NULL);
+ CHECK(sid3, FAIL, "H5Screate_simple");
+
+ /* Create dataset access property list */
+ dapl_id = H5Pcreate(H5P_DATASET_ACCESS);
+ CHECK(dapl_id, FAIL, "H5Pcreate");
+
+ /* Create a dataset */
+ dset3 = H5Dcreate2(fid1, "Dataset2", H5T_STD_U8LE, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dset3, FAIL, "H5Dcreate2");
+
+ for(tu8 = dwbuf, i = 0; i < SPACE3_DIM1; i++)
+ *tu8++ = (uint8_t)(i * 3);
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, dwbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset3);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create dataspace for the reference dataset */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create a dataset */
+ dset1 = H5Dcreate2(fid1, "Dataset1", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Dcreate2");
+
+ /* Create references */
+
+ /* Select 15 2x1 hyperslabs for first reference */
+ start[0] = 2;
+ stride[0] = 5;
+ count[0] = 15;
+ block[0] = 2;
+ ret = H5Sselect_hyperslab(sid3, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, 30, "H5Sget_select_npoints");
+
+ /* Store first dataset region */
+ ret = H5Rcreate(&wbuf[0], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &wbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Select sequence of ten points for second reference */
+ coord1[0][0] = 16;
+ coord1[1][0] = 22;
+ coord1[2][0] = 38;
+ coord1[3][0] = 41;
+ coord1[4][0] = 52;
+ coord1[5][0] = 63;
+ coord1[6][0] = 70;
+ coord1[7][0] = 89;
+ coord1[8][0] = 97;
+ coord1[9][0] = 03;
+ ret = H5Sselect_elements(sid3, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, 10, "H5Sget_select_npoints");
+
+ /* Store second dataset region */
+ ret = H5Rcreate(&wbuf[1], fid1, "/Dataset2", H5R_DATASET_REGION, sid3);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close uint8 dataset dataspace */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE2, H5F_ACC_RDWR, fapl);
+ CHECK(fid1, FAIL, "H5Fopen");
+
+ /* Open the dataset */
+ dset1 = H5Dopen2(fid1, "/Dataset1", H5P_DEFAULT);
+ CHECK(dset1, FAIL, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dset1, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Try to open objects */
+ dset3 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &rbuf[0]);
+ CHECK(dset3, FAIL, "H5Rdereference2");
+
+ /* Check what H5Rget_obj_type2 function returns */
+ ret = H5Rget_obj_type2(dset1, H5R_DATASET_REGION, &rbuf[0], &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Check information in referenced dataset */
+ sid1 = H5Dget_space(dset3);
+ CHECK(sid1, FAIL, "H5Dget_space");
+
+ ret = (int)H5Sget_simple_extent_npoints(sid1);
+ VERIFY(ret, 100, "H5Sget_simple_extent_npoints");
+
+ /* Read from disk */
+ ret = H5Dread(dset3, H5T_STD_U8LE, H5S_ALL, H5S_ALL, H5P_DEFAULT, drbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ for(tu8 = (uint8_t *)drbuf, i = 0; i < SPACE3_DIM1; i++, tu8++)
+ VERIFY(*tu8, (uint8_t)(i * 3), "Data");
+
+ /* Get the hyperslab selection */
+ sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[0]);
+ CHECK(sid3, FAIL, "H5Rget_region");
+
+ /* Verify correct hyperslab selected */
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, 30, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_hyper_nblocks(sid3);
+ VERIFY(ret, 15, "H5Sget_select_hyper_nblocks");
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t) * 2); /* allocate space for the hyperslab blocks */
+ ret = H5Sget_select_hyper_blocklist(sid3, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_hyper_blocklist");
+ VERIFY(coords[0], 2, "Hyperslab Coordinates");
+ VERIFY(coords[1], 3, "Hyperslab Coordinates");
+ VERIFY(coords[2], 7, "Hyperslab Coordinates");
+ VERIFY(coords[3], 8, "Hyperslab Coordinates");
+ VERIFY(coords[4], 12, "Hyperslab Coordinates");
+ VERIFY(coords[5], 13, "Hyperslab Coordinates");
+ VERIFY(coords[6], 17, "Hyperslab Coordinates");
+ VERIFY(coords[7], 18, "Hyperslab Coordinates");
+ VERIFY(coords[8], 22, "Hyperslab Coordinates");
+ VERIFY(coords[9], 23, "Hyperslab Coordinates");
+ VERIFY(coords[10], 27, "Hyperslab Coordinates");
+ VERIFY(coords[11], 28, "Hyperslab Coordinates");
+ VERIFY(coords[12], 32, "Hyperslab Coordinates");
+ VERIFY(coords[13], 33, "Hyperslab Coordinates");
+ VERIFY(coords[14], 37, "Hyperslab Coordinates");
+ VERIFY(coords[15], 38, "Hyperslab Coordinates");
+ VERIFY(coords[16], 42, "Hyperslab Coordinates");
+ VERIFY(coords[17], 43, "Hyperslab Coordinates");
+ VERIFY(coords[18], 47, "Hyperslab Coordinates");
+ VERIFY(coords[19], 48, "Hyperslab Coordinates");
+ VERIFY(coords[20], 52, "Hyperslab Coordinates");
+ VERIFY(coords[21], 53, "Hyperslab Coordinates");
+ VERIFY(coords[22], 57, "Hyperslab Coordinates");
+ VERIFY(coords[23], 58, "Hyperslab Coordinates");
+ VERIFY(coords[24], 62, "Hyperslab Coordinates");
+ VERIFY(coords[25], 63, "Hyperslab Coordinates");
+ VERIFY(coords[26], 67, "Hyperslab Coordinates");
+ VERIFY(coords[27], 68, "Hyperslab Coordinates");
+ VERIFY(coords[28], 72, "Hyperslab Coordinates");
+ VERIFY(coords[29], 73, "Hyperslab Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid3, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 2, "Selection Bounds");
+ VERIFY(high[0], 73, "Selection Bounds");
+
+ /* Close region space */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Get the element selection */
+ sid3 = H5Rget_region(dset1, H5R_DATASET_REGION, &rbuf[1]);
+ CHECK(sid3, FAIL, "H5Rget_region");
+
+ /* Verify correct elements selected */
+ ret = (int)H5Sget_select_npoints(sid3);
+ VERIFY(ret, 10, "H5Sget_select_npoints");
+ ret = (int)H5Sget_select_elem_npoints(sid3);
+ VERIFY(ret, 10, "H5Sget_select_elem_npoints");
+ coords = (hsize_t *)HDmalloc((size_t)ret * SPACE3_RANK * sizeof(hsize_t)); /* allocate space for the element points */
+ ret = H5Sget_select_elem_pointlist(sid3, (hsize_t)0, (hsize_t)ret, coords);
+ CHECK(ret, FAIL, "H5Sget_select_elem_pointlist");
+ VERIFY(coords[0], coord1[0][0], "Element Coordinates");
+ VERIFY(coords[1], coord1[1][0], "Element Coordinates");
+ VERIFY(coords[2], coord1[2][0], "Element Coordinates");
+ VERIFY(coords[3], coord1[3][0], "Element Coordinates");
+ VERIFY(coords[4], coord1[4][0], "Element Coordinates");
+ VERIFY(coords[5], coord1[5][0], "Element Coordinates");
+ VERIFY(coords[6], coord1[6][0], "Element Coordinates");
+ VERIFY(coords[7], coord1[7][0], "Element Coordinates");
+ VERIFY(coords[8], coord1[8][0], "Element Coordinates");
+ VERIFY(coords[9], coord1[9][0], "Element Coordinates");
+ HDfree(coords);
+ ret = H5Sget_select_bounds(sid3, low, high);
+ CHECK(ret, FAIL, "H5Sget_select_bounds");
+ VERIFY(low[0], 3, "Selection Bounds");
+ VERIFY(high[0], 97, "Selection Bounds");
+
+ /* Close region space */
+ ret = H5Sclose(sid3);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close first space */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close dereferenced Dataset */
+ ret = H5Dclose(dset3);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close dataset access property list */
+ ret = H5Pclose(dapl_id);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file access property list */
+ ret = H5Pclose(fapl);
+ CHECK(ret, FAIL, "H5Pclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+} /* test_reference_region_1D() */
+
+/****************************************************************
+**
+** test_reference_obj_deleted(): Test H5R (reference) object reference code.
+** Tests for correct failures for deleted and non-existent objects
+**
+****************************************************************/
+static void
+test_reference_obj_deleted(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, /* Dataset ID */
+ dset2; /* Dereferenced dataset ID */
+ hid_t sid1; /* Dataspace ID */
+ hobj_ref_t oref; /* Object Reference to test */
+ H5O_type_t obj_type; /* Object type */
+ haddr_t addr = HADDR_UNDEF; /* test for undefined reference */
+ herr_t ret; /* Generic return value */
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create scalar dataspace for datasets */
+ sid1 = H5Screate_simple(0, NULL, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create a dataset to reference (deleted later) */
+ dataset = H5Dcreate2(fid1, "Dataset1", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset2", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Create reference to dataset */
+ ret = H5Rcreate(&oref, fid1, "/Dataset1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+ ret = H5Rget_obj_type2(dataset, H5R_OBJECT, &oref, &obj_type);
+ CHECK(ret, FAIL, "H5Rget_obj_type2");
+ VERIFY(obj_type, H5O_TYPE_DATASET, "H5Rget_obj_type2");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Delete referenced dataset */
+ ret = H5Ldelete(fid1, "/Dataset1", H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE3, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fopen");
+
+ /* Open the dataset */
+ dataset = H5Dopen2(fid1, "/Dataset2", H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Dopen2");
+
+ /* Open undefined reference */
+ dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &addr);
+ VERIFY(dset2, FAIL, "H5Rdereference2");
+
+ /* Read selection from disk */
+ HDmemset(&oref, 0, sizeof(hobj_ref_t));
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &oref);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Open deleted dataset object */
+ dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref);
+ VERIFY(dset2, FAIL, "H5Rdereference2");
+
+ /* Open nonsense reference */
+ HDmemset(&oref, 0, sizeof(hobj_ref_t));
+ dset2 = H5Rdereference2(dataset, H5P_DEFAULT, H5R_OBJECT, &oref);
+ VERIFY(dset2, FAIL, "H5Rdereference2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* test_reference_obj_deleted() */
+
+/****************************************************************
+**
+** test_deref_iter_op(): Iterator callback for test_reference_group_iterate()
+** test.
+**
+****************************************************************/
+static herr_t
+test_deref_iter_op(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR_UNUSED *info,
+ void *op_data)
+{
+ int *count = (int *)op_data; /* Pointer to name counter */
+ herr_t ret_value;
+
+ /* Simple check for correct names */
+ if(*count == 0) {
+ if(HDstrcmp(name, DSETNAME2) == 0)
+ ret_value = 0;
+ else
+ ret_value = -1;
+ } /* end if */
+ else if(*count == 1) {
+ if(HDstrcmp(name, GROUPNAME2) == 0)
+ ret_value = 0;
+ else
+ ret_value = -1;
+ } /* end if */
+ else if(*count == 2) {
+ if(HDstrcmp(name, GROUPNAME3) == 0)
+ ret_value = 0;
+ else
+ ret_value = -1;
+ } /* end if */
+ else
+ ret_value = -1;
+
+ (*count)++;
+
+ return(ret_value);
+} /* end test_deref_iter_op() */
+
+/****************************************************************
+**
+** test_reference_group(): Test H5R (reference) object reference code.
+** Tests for correct behavior of various routines on dereferenced group
+**
+****************************************************************/
+static void
+test_reference_group(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t gid = -1, gid2 = -1; /* Group IDs */
+ hid_t did; /* Dataset ID */
+ hid_t sid; /* Dataspace ID */
+ hobj_ref_t wref; /* Reference to write */
+ hobj_ref_t rref; /* Reference to read */
+ H5G_info_t ginfo; /* Group info struct */
+ char objname[NAME_SIZE]; /* Buffer to store name */
+ H5O_info2_t oinfo; /* Object info struct */
+ int count = 0; /* Count within iterated group */
+ ssize_t size; /* Name length */
+ herr_t ret;
+
+ /* Create file with a group and a dataset containing an object reference to the group */
+ fid = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fcreate");
+
+ /* Create dataspace to use for dataset */
+ sid = H5Screate(H5S_SCALAR);
+ CHECK(sid, FAIL, "H5Screate");
+
+ /* Create group to refer to */
+ gid = H5Gcreate2(fid, GROUPNAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid, FAIL, "H5Gcreate2");
+
+ /* Create nested groups */
+ gid2 = H5Gcreate2(gid, GROUPNAME2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid2, FAIL, "H5Gcreate2");
+ ret = H5Gclose(gid2);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ gid2 = H5Gcreate2(gid, GROUPNAME3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(gid2, FAIL, "H5Gcreate2");
+ ret = H5Gclose(gid2);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create bottom dataset */
+ did = H5Dcreate2(gid, DSETNAME2, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ assert(did > 0);
+ ret = H5Dclose(did);
+ assert(ret >= 0);
+
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ /* Create dataset */
+ did = H5Dcreate2(fid, DSETNAME, H5T_STD_REF_OBJ, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dcreate2");
+
+ /* Create reference to group */
+ ret = H5Rcreate(&wref, fid, GROUPNAME, H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Write reference to disk */
+ ret = H5Dwrite(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wref);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close objects */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+
+ /* Re-open file */
+ fid = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Re-open dataset */
+ did = H5Dopen2(fid, DSETNAME, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen2");
+
+ /* Read in the reference */
+ ret = H5Dread(did, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rref);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Dereference to get the group */
+ gid = H5Rdereference2(did, H5P_DEFAULT, H5R_OBJECT, &rref);
+ CHECK(gid, FAIL, "H5Rdereference2");
+
+ /* Iterate through objects in dereferenced group */
+ ret = H5Literate2(gid, H5_INDEX_NAME, H5_ITER_INC, NULL, test_deref_iter_op, &count);
+ CHECK(ret, FAIL, "H5Literate");
+
+ /* Various queries on the group opened */
+ ret = H5Gget_info(gid, &ginfo);
+ CHECK(ret, FAIL, "H5Gget_info");
+ VERIFY(ginfo.nlinks, 3, "H5Gget_info");
+
+ size = H5Lget_name_by_idx(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, objname, (size_t)NAME_SIZE, H5P_DEFAULT);
+ CHECK(size, FAIL, "H5Lget_name_by_idx");
+ VERIFY_STR(objname, DSETNAME2, "H5Lget_name_by_idx");
+
+ ret = H5Oget_info_by_idx3(gid, ".", H5_INDEX_NAME, H5_ITER_INC, (hsize_t)0, &oinfo, H5O_INFO_BASIC, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_info_by_idx3");
+ VERIFY(oinfo.type, H5O_TYPE_DATASET, "H5Oget_info_by_idx3");
+
+ /* Unlink one of the objects in the dereferenced group */
+ ret = H5Ldelete(gid, GROUPNAME2, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Delete dataset object in dereferenced group (with other dataset still open) */
+ ret = H5Ldelete(gid, DSETNAME2, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Ldelete");
+
+ /* Close objects */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Gclose");
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* test_reference_group() */
+
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/****************************************************************
+**
+** test_reference_compat(): Test basic H5R (reference) object reference code.
+** Tests deprecated API routines
+**
+****************************************************************/
+static void
+test_reference_compat(void)
+{
+ hid_t fid1; /* HDF5 File IDs */
+ hid_t dataset, dset2; /* Dataset ID */
+ hid_t group, group2; /* Group ID */
+ hid_t sid1, /* Dataspace IDs */
+ sid2;
+ hid_t tid1, tid2; /* Datatype ID */
+ hsize_t dims1[] = {SPACE1_DIM1},
+ dims2[] = {SPACE2_DIM1, SPACE2_DIM2};
+ hsize_t start[SPACE2_RANK]; /* Starting location of hyperslab */
+ hsize_t stride[SPACE2_RANK]; /* Stride of hyperslab */
+ hsize_t count[SPACE2_RANK]; /* Element count of hyperslab */
+ hsize_t block[SPACE2_RANK]; /* Block size of hyperslab */
+ hsize_t coord1[POINT1_NPOINTS][SPACE2_RANK]; /* Coordinates for point selection */
+ hobj_ref_t *wbuf_obj, /* Buffer to write to disk */
+ *rbuf_obj; /* Buffer read from disk */
+ hdset_reg_ref_t *wbuf_reg, /* Buffer to write to disk */
+ *rbuf_reg; /* Buffer read from disk */
+ H5G_obj_t obj_type; /* Object type */
+ herr_t ret; /* Generic return value */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Deprecated Object Reference Functions\n"));
+
+ /* Allocate write & read buffers */
+ wbuf_obj = (hobj_ref_t *)HDcalloc(sizeof(hobj_ref_t), SPACE1_DIM1);
+ rbuf_obj = (hobj_ref_t *)HDmalloc(sizeof(hobj_ref_t) * SPACE1_DIM1);
+ wbuf_reg = (hdset_reg_ref_t *)HDcalloc(sizeof(hdset_reg_ref_t), SPACE1_DIM1);
+ rbuf_reg = (hdset_reg_ref_t *)HDmalloc(sizeof(hdset_reg_ref_t) * SPACE1_DIM1);
+
+ /* Create file */
+ fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fcreate");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL);
+ CHECK(sid1, FAIL, "H5Screate_simple");
+
+ /* Create another dataspace for datasets */
+ sid2 = H5Screate_simple(SPACE2_RANK, dims2, NULL);
+ CHECK(sid2, FAIL, "H5Screate_simple");
+
+ /* Create a group */
+ group = H5Gcreate2(fid1, "Group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(group, FAIL, "H5Gcreate2");
+
+ /* Create a dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset1", H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create another dataset (inside Group1) */
+ dataset = H5Dcreate2(group, "Dataset2", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Create a datatype to refer to */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
+ CHECK(tid1, FAIL, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid1, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "c", HOFFSET(s1_t,c), H5T_NATIVE_FLOAT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Save datatype for later */
+ ret = H5Tcommit2(group, "Datatype1", tid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Tcommit2");
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close group */
+ ret = H5Gclose(group);
+ CHECK(ret, FAIL, "H5Gclose");
+
+
+ /* Create a dataset with object reference datatype */
+ dataset = H5Dcreate2(fid1, "Dataset3", H5T_STD_REF_OBJ, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Create reference to dataset */
+ ret = H5Rcreate(&wbuf_obj[0], fid1, "/Group1/Dataset1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Create reference to dataset */
+ ret = H5Rcreate(&wbuf_obj[1], fid1, "/Group1/Dataset2", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Create reference to group */
+ ret = H5Rcreate(&wbuf_obj[2], fid1, "/Group1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Create reference to named datatype */
+ ret = H5Rcreate(&wbuf_obj[3], fid1, "/Group1/Datatype1", H5R_OBJECT, (hid_t)-1);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Write references to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_obj);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+
+ /* Create a dataset with region reference datatype */
+ dataset = H5Dcreate2(fid1, "Dataset4", H5T_STD_REF_DSETREG, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dcreate2");
+
+ /* Select 6x6 hyperslab for first reference */
+ start[0] = 2; start[1] = 2;
+ stride[0] = 1; stride[1] = 1;
+ count[0] = 1; count[1] = 1;
+ block[0] = 6; block[1] = 6;
+ ret = H5Sselect_hyperslab(sid2, H5S_SELECT_SET, start, stride, count, block);
+ CHECK(ret, FAIL, "H5Sselect_hyperslab");
+
+ /* Create first dataset region */
+ ret = H5Rcreate(&wbuf_reg[0], fid1, "/Group1/Dataset1", H5R_DATASET_REGION, sid2);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Select sequence of ten points for second reference */
+ coord1[0][0] = 6; coord1[0][1] = 9;
+ coord1[1][0] = 2; coord1[1][1] = 2;
+ coord1[2][0] = 8; coord1[2][1] = 4;
+ coord1[3][0] = 1; coord1[3][1] = 6;
+ coord1[4][0] = 2; coord1[4][1] = 8;
+ coord1[5][0] = 3; coord1[5][1] = 2;
+ coord1[6][0] = 0; coord1[6][1] = 4;
+ coord1[7][0] = 9; coord1[7][1] = 0;
+ coord1[8][0] = 7; coord1[8][1] = 1;
+ coord1[9][0] = 3; coord1[9][1] = 3;
+ ret = H5Sselect_elements(sid2, H5S_SELECT_SET, (size_t)POINT1_NPOINTS, (const hsize_t *)coord1);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ /* Create second dataset region */
+ ret = H5Rcreate(&wbuf_reg[1], fid1, "/Group1/Dataset2", H5R_DATASET_REGION, sid2);
+ CHECK(ret, FAIL, "H5Rcreate");
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, wbuf_reg);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+
+ /* Close disk dataspaces */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(sid2);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE1, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(fid1, FAIL, "H5Fopen");
+
+ /* Open the object reference dataset */
+ dataset = H5Dopen2(fid1, "/Dataset3", H5P_DEFAULT);
+ CHECK(dataset, FAIL, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_OBJ, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_obj);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify type of objects pointed at */
+ obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[0]);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+
+ obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[1]);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+
+ obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[2]);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ VERIFY(obj_type, H5G_GROUP, "H5Rget_obj_type1");
+
+ obj_type = H5Rget_obj_type1(dataset, H5R_OBJECT, &rbuf_obj[3]);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ VERIFY(obj_type, H5G_TYPE, "H5Rget_obj_type1");
+
+
+ /* Make sure the referenced objects can be opened */
+ dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[0]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ dset2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[1]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ group2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[2]);
+ CHECK(group2, FAIL, "H5Rdereference1");
+
+ ret = H5Gclose(group2);
+ CHECK(ret, FAIL, "H5Gclose");
+
+ tid2 = H5Rdereference1(dataset, H5R_OBJECT, &rbuf_obj[3]);
+ CHECK(tid2, FAIL, "H5Rdereference1");
+
+ ret = H5Tclose(tid2);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+
+ /* Open the dataset region reference dataset */
+ dataset = H5Dopen2(fid1, "/Dataset4", H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Dopen2");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, H5T_STD_REF_DSETREG, H5S_ALL, H5S_ALL, H5P_DEFAULT, rbuf_reg);
+ CHECK(ret, FAIL, "H5Dread");
+
+ /* Verify type of objects pointed at */
+ obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+
+ obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
+ CHECK(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+ VERIFY(obj_type, H5G_DATASET, "H5Rget_obj_type1");
+
+ obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[2]);
+ VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+
+ obj_type = H5Rget_obj_type1(dataset, H5R_DATASET_REGION, &rbuf_reg[3]);
+ VERIFY(obj_type, H5G_UNKNOWN, "H5Rget_obj_type1");
+
+ /* Make sure the referenced objects can be opened */
+ dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[0]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ dset2 = H5Rdereference1(dataset, H5R_DATASET_REGION, &rbuf_reg[1]);
+ CHECK(dset2, FAIL, "H5Rdereference1");
+
+ ret = H5Dclose(dset2);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close Dataset */
+ ret = H5Dclose(dataset);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Free memory buffers */
+ HDfree(wbuf_obj);
+ HDfree(rbuf_obj);
+ HDfree(wbuf_reg);
+ HDfree(rbuf_reg);
+} /* test_reference_compat() */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+/****************************************************************
+**
+** test_reference_deprec(): Main H5R reference testing routine.
+**
+****************************************************************/
+void
+test_reference_deprec(void)
+{
+ H5F_libver_t low, high; /* Low and high bounds */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Deprecated References\n"));
+
+ test_reference_params(); /* Test for correct parameter checking */
+ test_reference_obj(); /* Test basic H5R object reference code */
+
+ /* Loop through all the combinations of low/high version bounds */
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
+
+ /* Invalid combinations, just continue */
+ if(high == H5F_LIBVER_EARLIEST || high < low)
+ continue;
+
+ test_reference_region(low, high); /* Test basic H5R dataset region reference code */
+ test_reference_region_1D(low, high); /* Test H5R dataset region reference code for 1-D datasets */
+
+ } /* end high bound */
+ } /* end low bound */
+
+ test_reference_obj_deleted(); /* Test H5R object reference code for deleted objects */
+ test_reference_group(); /* Test operations on dereferenced groups */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ test_reference_compat(); /* Test operations with old API routines */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
+} /* test_reference() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: cleanup_reference
+ *
+ * Purpose: Cleanup temporary test files
+ *
+ * Return: none
+ *
+ * Programmer: Quincey Koziol
+ * September 8, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+cleanup_reference_deprec(void)
+{
+ HDremove(FILE1);
+ HDremove(FILE2);
+ HDremove(FILE3);
+}
+
diff --git a/test/trefer_shutdown.c b/test/trefer_shutdown.c
new file mode 100644
index 0000000..89a44b3
--- /dev/null
+++ b/test/trefer_shutdown.c
@@ -0,0 +1,83 @@
+#include "h5test.h"
+
+int
+main(int argc, char **argv)
+{
+ H5R_ref_t write_ref, read_ref;
+ hid_t fid;
+ hid_t did;
+ hid_t sid;
+ int i;
+
+ if ((fid = H5Fcreate("HDFFV-10992.h5", H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "H5Fcreate failed\n");
+ return 1;
+ }
+
+ if ((sid = H5Screate(H5S_SCALAR)) < 0) {
+ HDfprintf(stderr, "H5Screate failed\n");
+ return 1;
+ }
+
+ /* Create a dataset of object references */
+ if ((did = H5Dcreate2(fid, "dset", H5T_STD_REF, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ HDfprintf(stderr, "H5Dcreate failed\n");
+ return 1;
+ }
+
+ for (i = 0; i < 100; i++) {
+ /* Create reference to the root group */
+ if (H5Rcreate_object(fid, "/dset", H5P_DEFAULT, &write_ref) < 0) {
+ HDfprintf(stderr, "H5Rcreate_object failed\n");
+ return 1;
+ }
+ }
+
+ /* Write reference to dataset */
+ if (H5Dwrite(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &write_ref) < 0) {
+ HDfprintf(stderr, "H5Dwrite failed\n");
+ return 1;
+ }
+
+ for (i = 0; i < 500; i++) {
+ /* Read reference back into different reference buffer */
+ if (H5Dread(did, H5T_STD_REF, H5S_ALL, H5S_ALL, H5P_DEFAULT, &read_ref) < 0) {
+ HDfprintf(stderr, "H5Dread failed\n");
+ return 1;
+ }
+ }
+
+ /*
+ * "Forget" to call H5Rdestroy on reference objects. If H5Rdestroy
+ * is called at least once on either reference object, or both
+ * objects, the infinite loop goes away. If H5Rdestroy is never
+ * called, the infinite loop will appear.
+ */
+#if 0
+ if (H5Rdestroy(&write_ref) < 0) {
+ HDfprintf(stderr, "H5Rdestroy on reference write buffer failed\n");
+ return 1;
+ }
+ if (H5Rdestroy(&read_ref) < 0) {
+ HDfprintf(stderr, "H5Rdestroy on reference read buffer failed\n");
+ return 1;
+ }
+#endif
+
+ if (H5Sclose(sid) < 0) {
+ HDfprintf(stderr, "H5Sclose failed\n");
+ return 1;
+ }
+
+ if (H5Dclose(did) < 0) {
+ HDfprintf(stderr, "H5Dclose failed\n");
+ return 1;
+ }
+
+ if (H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "H5Fclose failed\n");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/test/tselect.c b/test/tselect.c
index 27bc36b..390f61f 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -25,7 +25,6 @@
#define H5S_TESTING
#include "testhdf5.h"
-#include "hdf5.h"
#include "H5Spkg.h" /* Dataspaces */
#define FILENAME "tselect.h5"
@@ -1613,7 +1612,7 @@ test_select_hyper_contig3(hid_t dset_type, hid_t xfer_plist)
****************************************************************/
static void
verify_select_hyper_contig_dr__run_test(const uint16_t *cube_buf,
- size_t cube_size, unsigned edge_size, unsigned cube_rank)
+ size_t H5_ATTR_NDEBUG_UNUSED cube_size, unsigned edge_size, unsigned cube_rank)
{
const uint16_t *cube_ptr; /* Pointer into the cube buffer */
uint16_t expected_value; /* Expected value in dataset */
diff --git a/test/tsohm.c b/test/tsohm.c
index a064940..f39b5e5 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -743,7 +743,7 @@ size1_helper(hid_t file, const char *filename, hid_t fapl_id, hbool_t test_file_
*/
static h5_stat_size_t
getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id,
- hbool_t test_file_closing, H5O_info_t *oinfo)
+ hbool_t test_file_closing, H5O_native_info_t *ninfo)
{
hid_t fid = H5I_INVALID_HID;
herr_t ret;
@@ -758,8 +758,8 @@ getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id,
fid = size1_helper(fid, filename, fapl_id, test_file_closing);
CHECK(fid, H5I_INVALID_HID, "size1_helper");
- ret = H5Oget_info_by_name2(fid, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK(ret, FAIL, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(fid, DSETNAME[0], ninfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK(ret, FAIL, "H5Oget_native_info_by_name");
ret = H5Fclose(fid);
CHECK(ret, FAIL, "H5Fclose");
@@ -807,7 +807,7 @@ test_sohm_size1(void)
h5_stat_size_t sohm_final_filesize2;
h5_stat_size_t sohm_btree_final_filesize2;
- H5O_info_t oinfo;
+ H5O_native_info_t ninfo;
unsigned num_indexes = 1;
unsigned index_flags = H5O_SHMESG_DTYPE_FLAG;
unsigned min_mesg_size = 50;
@@ -866,10 +866,10 @@ test_sohm_size1(void)
/* size of populated file, with different populating behaviors */
test_open_close = TRUE;
- file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo);
+ file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo);
test_open_close = FALSE;
- file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &oinfo);
- oh_sizes[oh_size_index++] = oinfo.hdr.space.total;
+ file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, test_open_close, &ninfo);
+ oh_sizes[oh_size_index++] = ninfo.hdr.space.total;
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
@@ -974,7 +974,7 @@ test_sohm_size_consistency_open_create(void)
unsigned use_btree;
hsize_t oh_size_open;
hsize_t oh_size_create;
- H5O_info_t oinfo;
+ H5O_native_info_t oinfo;
unsigned num_indexes = 1;
unsigned index_flags = H5O_SHMESG_DTYPE_FLAG;
unsigned min_mesg_size = 50;
@@ -1024,8 +1024,8 @@ test_sohm_size_consistency_open_create(void)
CHECK_I(file, "size1_helper");
/* Get the size of a dataset object header */
- ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK_I(ret, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK_I(ret, "H5Oget_native_info_by_name");
oh_size_open = oinfo.hdr.space.total;
ret = H5Fclose(file);
@@ -1039,8 +1039,8 @@ test_sohm_size_consistency_open_create(void)
CHECK_I(file, "size1_helper");
/* Get the size of a dataset object header */
- ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK_I(ret, "H5Oget_info_by_name");
+ ret = H5Oget_native_info_by_name(file, DSETNAME[0], &oinfo, H5O_NATIVE_INFO_HDR, H5P_DEFAULT);
+ CHECK_I(ret, "H5Oget_native_info_by_name");
oh_size_create = oinfo.hdr.space.total;
ret = H5Fclose(file);
@@ -3342,11 +3342,11 @@ test_sohm_extlink(void)
static int
verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
{
- hid_t file_id = -1;
- hid_t orig_space_id = -1;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t orig_space_id = H5I_INVALID_HID;
hid_t space1_id, space2_id, space3_id;
- hid_t dcpl_id = -1;
- hid_t dset1_id, dset2_id, dset3_id;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dset1_id, dset2_id = H5I_INVALID_HID, dset3_id = H5I_INVALID_HID;
hsize_t dims1[] = {1, 2};
hsize_t max_dims[] = {H5S_UNLIMITED, 2};
hsize_t dims2[] = {5, 2};
diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c
index dd52232..f6bcd0d 100644
--- a/test/ttsafe_cancel.c
+++ b/test/ttsafe_cancel.c
@@ -61,7 +61,7 @@ tts_cancel(void)
pthread_attr_t attribute;
hid_t dataset;
int buffer;
- int ret;
+ int H5_ATTR_NDEBUG_UNUSED ret;
/* make thread scheduling global */
ret=pthread_attr_init(&attribute);
diff --git a/test/tunicode.c b/test/tunicode.c
index b3fa237..6f7431b 100644
--- a/test/tunicode.c
+++ b/test/tunicode.c
@@ -352,8 +352,8 @@ void test_vl_string(hid_t fid, const char *string)
VERIFY(HDstrcmp(string, read_buf[0]), 0, "strcmp");
/* Reclaim the read VL data */
- ret = H5Dvlen_reclaim(type_id, space_id, H5P_DEFAULT, read_buf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(type_id, space_id, H5P_DEFAULT, read_buf);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close all */
ret = H5Dclose(dset_id);
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 5f715ce..b93d646 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -208,11 +208,11 @@ test_vlstrings_basic(void)
} /* end for */
/* Reclaim the read VL data */
- ret = H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -314,8 +314,8 @@ test_vlstrings_special(void)
} /* end for */
/* Reclaim the read VL data */
- ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -537,8 +537,8 @@ test_compact_vlstring(void)
} /* end for */
/* Reclaim the read VL data */
- ret = H5Dvlen_reclaim(tid1, sid1, H5P_DEFAULT, rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid1, sid1, H5P_DEFAULT, rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -762,8 +762,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch
if(HDstrcmp(data, data_read))
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
- ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_read);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(type, space, H5P_DEFAULT, &data_read);
+ CHECK(ret, FAIL, "H5Treclaim");
}
/****************************************************************
@@ -861,13 +861,12 @@ static void test_write_same_element(void)
hid_t file1, dataset1;
hid_t mspace, fspace, dtype;
hsize_t fdim[] = {SPACE1_DIM1};
- char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
+ const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."};
+ const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
hsize_t marray[] = {NUMP};
hsize_t coord[SPACE1_RANK][NUMP];
herr_t ret;
- char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."};
-
file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
CHECK(file1, FAIL, "H5Fcreate");
diff --git a/test/tvltypes.c b/test/tvltypes.c
index ffa2aff..e8c69b4 100644
--- a/test/tvltypes.c
+++ b/test/tvltypes.c
@@ -415,11 +415,11 @@ test_vltypes_vlen_atomic(void)
} /* end for */
/* Reclaim the read VL data */
- ret = H5Dvlen_reclaim(tid1, sid1, xfer_pid, rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid1, sid1, xfer_pid, rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used, 0, "H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -465,15 +465,15 @@ test_vltypes_vlen_atomic(void)
ret = H5Dvlen_get_buf_size(dataset, tid1, sid1, &size);
CHECK(ret, FAIL, "H5Dvlen_get_buf_size");
+ /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
+ VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size");
+
/* Try to call H5Dvlen_get_buf with bad dataspace */
H5E_BEGIN_TRY {
ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
} H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_get_buf_size");
- /* 10 elements allocated = 1 + 2 + 3 + 4 elements for each array position */
- VERIFY(size,((SPACE1_DIM1*(SPACE1_DIM1+1))/2)*sizeof(unsigned int),"H5Dvlen_get_buf_size");
-
/* Read dataset from disk */
ret=H5Dread(dataset,tid1,H5S_ALL,H5S_ALL,xfer_pid,rdata);
CHECK(ret, FAIL, "H5Dread");
@@ -499,24 +499,24 @@ test_vltypes_vlen_atomic(void)
/* Try to reclaim read data using "bad" dataspace with no extent
* Should fail */
H5E_BEGIN_TRY {
- ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata);
+ ret=H5Treclaim(tid1,sid2,xfer_pid,rdata);
} H5E_END_TRY
- VERIFY(ret, FAIL, "H5Dvlen_reclaim");
+ VERIFY(ret, FAIL, "H5Treclaim");
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close datatype */
ret = H5Tclose(tid1);
@@ -659,15 +659,15 @@ rewrite_vltypes_vlen_atomic(void)
} /* end for */
/* Reclaim the read VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -803,15 +803,15 @@ test_vltypes_vlen_compound(void)
} /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -948,15 +948,15 @@ rewrite_vltypes_vlen_compound(void)
} /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid1,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid1,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1118,12 +1118,12 @@ test_vltypes_compound_vlen_vlen(void)
} /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1360,12 +1360,12 @@ test_vltypes_compound_vlstr(void)
} /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Use this part for new data */
HDstrcpy(str, "bbbbbbbb\0");
@@ -1418,12 +1418,12 @@ test_vltypes_compound_vlstr(void)
} /* end for */
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata2);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata2);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata2);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata2);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Dclose(dset2);
CHECK(ret, FAIL, "H5Dclose");
@@ -1568,11 +1568,11 @@ test_vltypes_compound_vlen_atomic(void)
} /* end for */
/* Reclaim the VL data */
- ret = H5Dvlen_reclaim(tid2, sid1, xfer_pid, rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(tid2, sid1, xfer_pid, rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used, 0, "H5Dvlen_reclaim");
+ VERIFY(mem_used, 0, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1634,16 +1634,16 @@ test_vltypes_compound_vlen_atomic(void)
} /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
CHECK(ret, FAIL, "H5Dclose");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close datatype */
ret = H5Tclose(tid2);
@@ -1786,15 +1786,15 @@ rewrite_vltypes_compound_vlen_atomic(void)
} /* end for */
/* Reclaim the VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -1997,15 +1997,15 @@ test_vltypes_vlen_vlen_atomic(void)
} /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -2177,15 +2177,15 @@ rewrite_longer_vltypes_vlen_vlen_atomic(void)
} /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -2353,15 +2353,15 @@ rewrite_shorter_vltypes_vlen_vlen_atomic(void)
} /* end for */
/* Reclaim all the (nested) VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,xfer_pid,rdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,xfer_pid,rdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Make certain the VL memory has been freed */
- VERIFY(mem_used,0,"H5Dvlen_reclaim");
+ VERIFY(mem_used,0,"H5Treclaim");
/* Reclaim the write VL data */
- ret=H5Dvlen_reclaim(tid2,sid1,H5P_DEFAULT,wdata);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret=H5Treclaim(tid2,sid1,H5P_DEFAULT,wdata);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Close Dataset */
ret = H5Dclose(dataset);
@@ -2398,17 +2398,17 @@ test_vltypes_fill_value(void)
typedef struct dtype1_struct {
unsigned int gui;
unsigned int pgui;
- char *str_id;
- char *str_name;
- char *str_desc;
- char *str_orig;
- char *str_stat;
+ const char *str_id;
+ const char *str_name;
+ const char *str_desc;
+ const char *str_orig;
+ const char *str_stat;
unsigned int ver;
double val;
double ma;
double mi;
- char *str_form;
- char *str_unit;
+ const char *str_form;
+ const char *str_unit;
} dtype1_struct;
herr_t ret;
@@ -2543,7 +2543,7 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fcreate");
/* Create datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
+ for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
unsigned test_loop; /* Loop over datasets */
@@ -2659,7 +2659,7 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fopen");
/* Read empty datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
+ for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
unsigned test_loop; /* Loop over datasets */
@@ -2743,8 +2743,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Clear the read buffer */
HDmemset(rbuf, 0, dset_elmts * sizeof(dtype1_struct));
@@ -2778,8 +2778,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
@@ -2808,8 +2808,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Clear the read buffer */
HDmemset(rbuf, 0, dset_elmts * sizeof(dtype1_struct));
@@ -2843,8 +2843,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
@@ -2860,7 +2860,7 @@ test_vltypes_fill_value(void)
CHECK(file_id, FAIL, "H5Fopen");
/* Write one element & fill values to datasets with different storage layouts */
- for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) {
+ for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) {
unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */
unsigned test_loop; /* Loop over datasets */
@@ -2970,8 +2970,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Clear the read buffer */
HDmemset(rbuf, 0, dset_elmts * sizeof(dtype1_struct));
@@ -3019,8 +3019,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
@@ -3066,8 +3066,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
/* Clear the read buffer */
HDmemset(rbuf, 0, dset_elmts * sizeof(dtype1_struct));
@@ -3115,8 +3115,8 @@ test_vltypes_fill_value(void)
} /* end for */
/* Release the space */
- ret = H5Dvlen_reclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
- CHECK(ret, FAIL, "H5Dvlen_reclaim");
+ ret = H5Treclaim(dtype1_id, dset_select_dspace_id, xfer_pid, rbuf);
+ CHECK(ret, FAIL, "H5Treclaim");
ret = H5Dclose(dset_id);
CHECK(ret, FAIL, "H5Dclose");
diff --git a/test/unlink.c b/test/unlink.c
index 6825dec..48dd79d 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -433,32 +433,35 @@ test_new_move(hid_t fapl)
static int
check_new_move(hid_t fapl)
{
- hid_t file;
- H5O_info_t oi_hard1, oi_hard2;
- char filename[1024];
- char linkval[1024];
+ H5O_info2_t oi_hard1, oi_hard2;
+ hid_t file;
+ char filename[1024];
+ char linkval[1024];
+ int token_cmp;
TESTING("check new move function");
/* Open file */
- h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Get hard link info */
- if(H5Oget_info_by_name2(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(file, "/group2/group_new_name", &oi_hard1, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
- if(H5Oget_info_by_name2(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
+ if(H5Oget_info_by_name3(file, "/group1/hard", &oi_hard2, H5O_INFO_BASIC, H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
/* Check hard links */
if(H5O_TYPE_GROUP != oi_hard1.type || H5O_TYPE_GROUP != oi_hard2.type)
FAIL_PUTS_ERROR(" Unexpected object type, should have been a group")
- if(H5F_addr_ne(oi_hard1.addr, oi_hard2.addr))
+ if(H5Otoken_cmp(file, &oi_hard1.token, &oi_hard2.token, &token_cmp) < 0)
+ FAIL_PUTS_ERROR(" H5Otoken_cmp failed")
+ if(token_cmp)
FAIL_PUTS_ERROR(" Hard link test failed. Link seems not to point to the expected file location.")
/* Check soft links */
- if(H5Lget_val(file, "group2/soft", linkval, sizeof linkval, H5P_DEFAULT) < 0)
+ if(H5Lget_val(file, "group2/soft", linkval, sizeof(linkval), H5P_DEFAULT) < 0)
FAIL_STACK_ERROR
if(HDstrcmp(linkval, "/group1/group_move"))
FAIL_PUTS_ERROR(" Soft link test failed. Wrong link value")
@@ -2156,7 +2159,7 @@ test_full_group_compact(hid_t fapl)
{
hid_t file_id = -1;
hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5O_info_t oi; /* Stat buffer for object */
+ H5O_info2_t oi; /* Stat buffer for object */
char objname[128]; /* Buffer for name of objects to create */
char objname2[128]; /* Buffer for name of objects to create */
char filename[1024]; /* Buffer for filename */
@@ -2228,7 +2231,7 @@ test_full_group_compact(hid_t fapl)
/* Check reference count on objects to keep */
for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(oi.rc != 2) TEST_ERROR
} /* end for */
@@ -2245,7 +2248,7 @@ test_full_group_compact(hid_t fapl)
/* Check reference count on objects to keep */
for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(oi.rc != 1) TEST_ERROR
} /* end for */
@@ -2290,7 +2293,7 @@ test_full_group_dense(hid_t fapl)
hid_t file_id = -1;
hid_t gcpl = (-1); /* Group creation property list ID */
hid_t gid = -1, gid2 = -1; /* Group IDs */
- H5O_info_t oi; /* Stat buffer for object */
+ H5O_info2_t oi; /* Stat buffer for object */
char objname[128]; /* Buffer for name of objects to create */
char objname2[128]; /* Buffer for name of objects to create */
char filename[1024]; /* Buffer for filename */
@@ -2374,7 +2377,7 @@ test_full_group_dense(hid_t fapl)
/* Check reference count on objects to keep */
for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(oi.rc != 2) TEST_ERROR
} /* end for */
@@ -2391,7 +2394,7 @@ test_full_group_dense(hid_t fapl)
/* Check reference count on objects to keep */
for(u = 0; u < FULL_GROUP_NUM_KEEP; u++) {
HDsprintf(objname, "/keep/keep %u\n", u);
- if(H5Oget_info_by_name2(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
+ if(H5Oget_info_by_name3(file_id, objname, &oi, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(oi.rc != 1) TEST_ERROR
} /* end for */
diff --git a/test/unregister.c b/test/unregister.c
index ff116cf..db37f3e 100644
--- a/test/unregister.c
+++ b/test/unregister.c
@@ -95,11 +95,20 @@ test_unregister_filters(hid_t fapl_id)
char filename[FILENAME_BUF_SIZE];
const hsize_t chunk_dims[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
hsize_t dims[2];
- int data[DSET_DIM1][DSET_DIM2];
+ int **buf = NULL;
+ int *buf_data = NULL;
herr_t ret;
TESTING("Unregistering filter");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(DSET_DIM1 * DSET_DIM2, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(DSET_DIM1, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < DSET_DIM1; i++)
+ buf[i] = buf_data + (i * DSET_DIM2);
+
/* Create first file */
h5_fixname(FILENAME[0], fapl_id, filename, sizeof(filename));
if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
@@ -176,7 +185,7 @@ test_unregister_filters(hid_t fapl_id)
/* Initialize the data for writing */
for(i = n = 0; i < DSET_DIM1; i++)
for(j = 0; j < DSET_DIM2; j++)
- data[i][j] = n++;
+ buf[i][j] = n++;
/* Create the dataspace */
dims[0] = DSET_DIM1;
@@ -189,7 +198,7 @@ test_unregister_filters(hid_t fapl_id)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
goto error;
/* Unregister the filter before closing the dataset. It should fail */
@@ -211,7 +220,7 @@ test_unregister_filters(hid_t fapl_id)
goto error;
/* Write the data to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0)
+ if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
goto error;
/* Close the dataset in the second file */
@@ -232,6 +241,9 @@ test_unregister_filters(hid_t fapl_id)
if(H5Fclose(fid2) < 0)
goto error;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return SUCCEED;
@@ -247,6 +259,9 @@ error:
H5Sclose(sid);
} H5E_END_TRY;
+ HDfree(buf);
+ HDfree(buf_data);
+
return FAIL;
}
diff --git a/test/use_common.c b/test/use_common.c
index 9effa06..4111b24 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -343,44 +343,45 @@ int write_uc_file(hbool_t tosend, hid_t fid)
count[1]=dims[1];
count[2]=dims[2];
for (i=0; i<UC_opts.nplanes; i++){
- /* fill buffer with value i+1 */
- bufptr = buffer;
- for (j=0; j<dims[1]; j++)
- for (k=0; k<dims[2]; k++)
- *bufptr++ = (UC_CTYPE)i;
+ /* fill buffer with value i+1 */
+ bufptr = buffer;
+ for (j=0; j<dims[1]; j++)
+ for (k=0; k<dims[2]; k++)
+ *bufptr++ = (UC_CTYPE)i;
/* Cork the dataset's metadata in the cache, if SWMR is enabled */
- if(UC_opts.use_swmr)
+ if(UC_opts.use_swmr) {
if(H5Odisable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n");
return -1;
}
+ }
- /* extend the dataset by one for new plane */
- dims[0]=i+1;
+ /* extend the dataset by one for new plane */
+ dims[0]=i+1;
if(H5Dset_extent(dsid, dims) < 0){
HDfprintf(stderr, "H5Dset_extent failed\n");
return -1;
- }
+ }
/* Get the dataset's dataspace */
if((f_sid = H5Dget_space(dsid)) < 0){
HDfprintf(stderr, "H5Dset_extent failed\n");
return -1;
- }
+ }
- start[0]=i;
+ start[0]=i;
/* Choose the next plane to write */
if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){
HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
return -1;
- }
+ }
/* Write plane to the dataset */
if(H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){
HDfprintf(stderr, "Failed H5Dwrite\n");
return -1;
- }
+ }
/* Uncork the dataset's metadata from the cache, if SWMR is enabled */
if(UC_opts.use_swmr)
@@ -389,12 +390,11 @@ int write_uc_file(hbool_t tosend, hid_t fid)
return -1;
}
- /* flush file to make the just written plane available. */
- if(H5Dflush(dsid) < 0)
- {
- HDfprintf(stderr, "Failed to H5Fflush file\n");
- return -1;
- }
+ /* flush file to make the just written plane available. */
+ if(H5Dflush(dsid) < 0) {
+ HDfprintf(stderr, "Failed to H5Fflush file\n");
+ return -1;
+ }
}
/* Done writing. Free/Close all resources including data file */
diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c
index 9cd202c..32a8244 100644
--- a/test/use_disable_mdc_flushes.c
+++ b/test/use_disable_mdc_flushes.c
@@ -108,7 +108,7 @@ parse_option(int argc, char * const argv[])
filename_g = optarg;
break;
case 'n': /* number of planes to write/read */
- if ((nplanes_g = HDatoi(optarg)) <= 0){
+ if ((nplanes_g = (hsize_t)HDatoi(optarg)) <= 0){
HDfprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
@@ -193,17 +193,17 @@ setup_parameters(int argc, char * const argv[])
return(-1);
}
/* set chunk dims */
- chunkdims_g[0] = chunkplanes_g;
- chunkdims_g[1]= chunkdims_g[2] = chunksize_g;
+ chunkdims_g[0] = (hsize_t)chunkplanes_g;
+ chunkdims_g[1]= chunkdims_g[2] = (hsize_t)chunksize_g;
/* set dataset initial and max dims */
dims_g[0] = 0;
max_dims_g[0] = H5S_UNLIMITED;
- dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = chunksize_g;
+ dims_g[1] = dims_g[2] = max_dims_g[1] = max_dims_g[2] = (hsize_t)chunksize_g;
/* set nplanes */
if (nplanes_g == 0)
- nplanes_g = chunksize_g;
+ nplanes_g = (hsize_t)chunksize_g;
/* show parameters and return */
show_parameters();
@@ -299,7 +299,7 @@ write_file(void)
hid_t dcpl; /* Dataset creation property list */
char *name;
UC_CTYPE *buffer, *bufptr; /* data buffer */
- hsize_t cz=chunksize_g; /* Chunk size */
+ hsize_t cz=(hsize_t)chunksize_g; /* Chunk size */
hid_t f_sid; /* dataset file space id */
hid_t m_sid; /* memory space id */
int rank; /* rank */
@@ -413,8 +413,13 @@ write_file(void)
/* fill buffer with value i+1 */
bufptr = buffer;
for (j=0; j<dims[1]; j++)
- for (k=0; k<dims[2]; k++)
- *bufptr++ = i;
+ for (k=0; k<dims[2]; k++) {
+ if(i > SHRT_MAX) {
+ HDfprintf(stderr, "rank(%d) of dataset overflow\n", rank);
+ return -1;
+ }
+ *bufptr++ = (short)i;
+ }
/* extend the dataset by one for new plane */
dims[0]=i+1;
diff --git a/test/vds.c b/test/vds.c
index c98bc12..c6b88eb 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -317,7 +317,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
hid_t dset = -1; /* Virtual dataset */
H5D_space_status_t space_status; /* Dataset space status */
void *plist_buf = NULL; /* Serialized property list buffer */
- H5O_info_t oinfo; /* Object info struct */
+ H5O_native_info_t ninfo; /* Object info struct */
htri_t tri_ret;
HDassert((config >= TEST_API_BASIC) && (config < TEST_API_NTESTS));
@@ -372,23 +372,23 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl,
TEST_ERROR
/* Test H5Oget_info returns correct metadata size */
- if(H5Oget_info2(dset, &oinfo, H5O_INFO_META_SIZE) < 0)
+ if(H5Oget_native_info(dset, &ninfo, H5O_NATIVE_INFO_META_SIZE) < 0)
TEST_ERROR
- if(oinfo.meta_size.obj.index_size != (hsize_t)0)
+ if(ninfo.meta_size.obj.index_size != (hsize_t)0)
TEST_ERROR
if(config == TEST_API_REOPEN_FILE) {
- if(oinfo.meta_size.obj.heap_size != exp_meta_size) {
- HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)oinfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size);
+ if(ninfo.meta_size.obj.heap_size != exp_meta_size) {
+ HDprintf("VDS metadata size: %llu Expected: %llu\n", (long long unsigned)ninfo.meta_size.obj.heap_size, (long long unsigned)exp_meta_size);
TEST_ERROR
}
}
else
- if((oinfo.meta_size.obj.heap_size != exp_meta_size)
- && (oinfo.meta_size.obj.heap_size != (hsize_t)0))
+ if((ninfo.meta_size.obj.heap_size != exp_meta_size)
+ && (ninfo.meta_size.obj.heap_size != (hsize_t)0))
TEST_ERROR
- if(oinfo.meta_size.attr.index_size != (hsize_t)0)
+ if(ninfo.meta_size.attr.index_size != (hsize_t)0)
TEST_ERROR
- if(oinfo.meta_size.attr.index_size != (hsize_t)0)
+ if(ninfo.meta_size.attr.index_size != (hsize_t)0)
TEST_ERROR
/* Test H5Dget_space_status */
@@ -1134,11 +1134,11 @@ error:
static int
test_vds_prefix_first(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- char srcfilenamepct[FILENAME_BUF_SIZE];
- char srcfilenamepct_map[FILENAME_BUF_SIZE];
+ char *srcfilename = NULL;
+ char *srcfilename_map = NULL;
+ char *vfilename = NULL;
+ char *srcfilenamepct = NULL;
+ char *srcfilenamepct_map = NULL;
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
@@ -1158,11 +1158,22 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
TESTING("basic virtual dataset I/O via H5Pset_vds_prefix(): all selection")
- h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[8], fapl, srcfilename, sizeof srcfilename);
- h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, sizeof srcfilename_map);
- h5_fixname(FILENAME[10], fapl, srcfilenamepct, sizeof srcfilenamepct);
- h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+ if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[8], fapl, srcfilename, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[8], fapl, srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[10], fapl, srcfilenamepct, FILENAME_BUF_SIZE);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* create tmp directory and get current working directory path */
if (HDmkdir(TMPDIR, (mode_t)0755) < 0 && errno != EEXIST)
@@ -1346,6 +1357,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
TEST_ERROR
dcpl = -1;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
PASSED();
return 0;
@@ -1369,6 +1386,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
if(HDsetenv("HDF5_VDS_PREFIX", "", 1) < 0)
TEST_ERROR
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
return 1;
} /* end test_vds_prefix */
@@ -1386,12 +1409,12 @@ test_vds_prefix_first(unsigned config, hid_t fapl)
static int
test_basic_io(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- char vfilename2[FILENAME_BUF_SIZE];
- char srcfilenamepct[FILENAME_BUF_SIZE];
- char srcfilenamepct_map[FILENAME_BUF_SIZE];
+ char *srcfilename = NULL;
+ char *srcfilename_map = NULL;
+ char *vfilename = NULL;
+ char *vfilename2 = NULL;
+ char *srcfilenamepct = NULL;
+ char *srcfilenamepct_map = NULL;
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
@@ -1419,12 +1442,25 @@ test_basic_io(unsigned config, hid_t fapl)
TESTING("basic virtual dataset I/O")
- h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[1], fapl, vfilename2, sizeof vfilename2);
- h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename);
- h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
- h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct);
- h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+ if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[1], fapl, vfilename2, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* Create DCPL */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -4227,6 +4263,13 @@ test_basic_io(unsigned config, hid_t fapl)
TEST_ERROR
dcpl = -1;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(vfilename2);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
PASSED();
return 0;
@@ -4247,6 +4290,13 @@ error:
H5Pclose(dcpl);
} H5E_END_TRY;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(vfilename);
+ HDfree(vfilename2);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
return 1;
} /* end test_basic_io() */
@@ -7286,15 +7336,15 @@ error:
static int
test_printf(unsigned config, hid_t fapl)
{
- char srcfilename[FILENAME_BUF_SIZE];
- char srcfilename_map[FILENAME_BUF_SIZE];
- char srcfilename2[FILENAME_BUF_SIZE];
- char srcfilename2_map[FILENAME_BUF_SIZE];
- char vfilename[FILENAME_BUF_SIZE];
- char printf_srcfilename_map[FILENAME_BUF_SIZE];
+ char *srcfilename = NULL;
+ char *srcfilename_map = NULL;
+ char *srcfilename2 = NULL;
+ char *srcfilename2_map = NULL;
+ char *vfilename = NULL;
+ char *printf_srcfilename_map = NULL;
+ char *srcfilenamepct = NULL;
+ char *srcfilenamepct_map = NULL;
const char *printf_srcfilename_map_orig = "vds_src_%b";
- char srcfilenamepct[FILENAME_BUF_SIZE];
- char srcfilenamepct_map[FILENAME_BUF_SIZE];
const char *srcfilenamepct_map_orig = "vds%%%%_src";
hid_t srcfile[4] = {-1, -1, -1, -1}; /* Files with source dsets */
hid_t vfile = -1; /* File with virtual dset */
@@ -7322,14 +7372,31 @@ test_printf(unsigned config, hid_t fapl)
TESTING("virtual dataset I/O with printf source")
- h5_fixname(FILENAME[0], fapl, vfilename, sizeof vfilename);
- h5_fixname(FILENAME[2], fapl, srcfilename, sizeof srcfilename);
- h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, sizeof srcfilename_map);
- h5_fixname(FILENAME[3], fapl, srcfilename2, sizeof srcfilename2);
- h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, sizeof srcfilename2_map);
- h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, sizeof printf_srcfilename_map);
- h5_fixname(FILENAME[4], fapl, srcfilenamepct, sizeof srcfilenamepct);
- h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, sizeof srcfilenamepct_map);
+ if((srcfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename2 = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilename2_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((vfilename = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((printf_srcfilename_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+ if((srcfilenamepct_map = (char *)HDcalloc(FILENAME_BUF_SIZE, sizeof(char))) == NULL)
+ TEST_ERROR;
+
+ h5_fixname(FILENAME[0], fapl, vfilename, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[2], fapl, srcfilename, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[3], fapl, srcfilename2, FILENAME_BUF_SIZE);
+ h5_fixname_printf(FILENAME[2], fapl, srcfilename2_map, FILENAME_BUF_SIZE);
+ h5_fixname_printf(printf_srcfilename_map_orig, fapl, printf_srcfilename_map, FILENAME_BUF_SIZE);
+ h5_fixname(FILENAME[4], fapl, srcfilenamepct, FILENAME_BUF_SIZE);
+ h5_fixname_printf(srcfilenamepct_map_orig, fapl, srcfilenamepct_map, FILENAME_BUF_SIZE);
/* Create DCPL */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -10940,6 +11007,15 @@ test_printf(unsigned config, hid_t fapl)
TEST_ERROR
memspace = -1;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(srcfilename2);
+ HDfree(srcfilename2_map);
+ HDfree(vfilename);
+ HDfree(printf_srcfilename_map);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
PASSED();
return 0;
@@ -10960,6 +11036,15 @@ error:
H5Pclose(dapl);
} H5E_END_TRY;
+ HDfree(srcfilename);
+ HDfree(srcfilename_map);
+ HDfree(srcfilename2);
+ HDfree(srcfilename2_map);
+ HDfree(vfilename);
+ HDfree(printf_srcfilename_map);
+ HDfree(srcfilenamepct);
+ HDfree(srcfilenamepct_map);
+
return 1;
} /* end test_printf() */
@@ -12165,8 +12250,8 @@ main(void)
if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
char msg[80]; /* Message for file version bounds */
const char *low_string; /* The low bound string */
const char *high_string; /* The high bound string */
diff --git a/test/vds_env.c b/test/vds_env.c
index 19b2d96..3d5b5dd 100644
--- a/test/vds_env.c
+++ b/test/vds_env.c
@@ -312,8 +312,8 @@ main(void)
if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR
/* Loop through all the combinations of low/high version bounds */
- for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) {
- for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) {
+ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
+ for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) {
char msg[80]; /* Message for file version bounds */
const char *low_string; /* The low bound string */
const char *high_string; /* The high bound string */
diff --git a/test/vds_swmr.h b/test/vds_swmr.h
index eb2dcf4..edb01bc 100644
--- a/test/vds_swmr.h
+++ b/test/vds_swmr.h
@@ -84,31 +84,17 @@
#define N_PLANES_TO_WRITE 25
/* Planes */
-static hsize_t PLANES[N_SOURCES][RANK] = {
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH},
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH},
- {1, SM_HEIGHT, WIDTH},
- {1, LG_HEIGHT, WIDTH}
-};
+H5TEST_DLLVAR hsize_t PLANES[N_SOURCES][RANK];
/* File names for source datasets */
-static char FILE_NAMES[N_SOURCES][NAME_LEN] = {
- {"vds_swmr_src_a.h5"},
- {"vds_swmr_src_b.h5"},
- {"vds_swmr_src_c.h5"},
- {"vds_swmr_src_d.h5"},
- {"vds_swmr_src_e.h5"},
- {"vds_swmr_src_f.h5"}
-};
+H5TEST_DLLVAR char FILE_NAMES[N_SOURCES][NAME_LEN];
/* VDS file name */
-static char VDS_FILE_NAME[NAME_LEN] = "vds_swmr.h5";
+H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN];
/* Dataset names */
-static char SOURCE_DSET_PATH[NAME_LEN] = "/source_dset";
-static char VDS_DSET_NAME[NAME_LEN] = "vds_dset";
+H5TEST_DLLVAR char SOURCE_DSET_PATH[NAME_LEN];
+H5TEST_DLLVAR char VDS_DSET_NAME[NAME_LEN];
/* Fill values */
#endif /* VDS_SWMR_H */
diff --git a/test/vds_swmr_gen.c b/test/vds_swmr_gen.c
index 2589653..b14ecc2 100644
--- a/test/vds_swmr_gen.c
+++ b/test/vds_swmr_gen.c
@@ -145,11 +145,13 @@ main(void)
if(H5Sselect_hyperslab(src_sid, H5S_SELECT_SET, start, NULL,
MAX_DIMS[i], NULL) < 0)
TEST_ERROR
- start[1] = map_start;
+ start[1] = (hsize_t)map_start;
if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, start, NULL,
MAX_DIMS[i], NULL) < 0)
TEST_ERROR
- map_start += PLANES[i][1];
+ if(PLANES[i][1] > INT_MAX)
+ TEST_ERROR
+ map_start += (int)PLANES[i][1];
/* Add VDS mapping */
if(H5Pset_virtual(vds_dcplid, vds_sid, FILE_NAMES[i],
diff --git a/test/vds_swmr_reader.c b/test/vds_swmr_reader.c
index eb9a82b..1ee65a0 100644
--- a/test/vds_swmr_reader.c
+++ b/test/vds_swmr_reader.c
@@ -45,8 +45,10 @@ main(void)
TEST_ERROR
/* Create the read buffer */
- n_elements = VDS_PLANE[1] * VDS_PLANE[2];
- size = n_elements * sizeof(int);
+ if(VDS_PLANE[1] * VDS_PLANE[2] > INT_MAX)
+ TEST_ERROR
+ n_elements = (int)(VDS_PLANE[1] * VDS_PLANE[2]);
+ size = (size_t)n_elements * sizeof(int);
if(NULL == (buffer = (int *)HDmalloc(size)))
TEST_ERROR
diff --git a/test/vfd.c b/test/vfd.c
index 1de7fd5..e88d9bb 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -562,6 +562,7 @@ test_direct(void)
size_t mbound;
size_t fbsize;
size_t cbsize;
+ void *proto_points = NULL, *proto_check = NULL;
int *points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
int wdata2[DSET2_DIM] = {11,12,13,14};
int rdata2[DSET2_DIM];
@@ -633,10 +634,12 @@ test_direct(void)
/* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
* memory address, size of data, and file address. */
- if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ if(0 != HDposix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
- if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
+ points = proto_points;
+ if(0 != HDposix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
+ check = proto_check;
/* Initialize the dset1 */
p1 = points;
@@ -746,10 +749,10 @@ error:
H5Fclose(file);
} H5E_END_TRY;
- if(points)
- HDfree(points);
- if(check)
- HDfree(check);
+ if(proto_points)
+ HDfree(proto_points);
+ if(proto_check)
+ HDfree(proto_check);
return -1;
#endif /*H5_HAVE_DIRECT*/
@@ -776,8 +779,7 @@ error:
* 'first_name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
@@ -834,7 +836,7 @@ test_family_opens(char *fname, hid_t fa_pl)
error:
return -1;
} /* end test_family_opens() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -842,8 +844,7 @@ error:
*
* Purpose: Tests the file handle interface for FAMILY driver
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Raymond Lu
* Tuesday, Sept 24, 2002
@@ -861,12 +862,21 @@ test_family(void)
char dname[]="dataset";
unsigned int i, j;
int *fhandle=NULL, *fhandle2=NULL;
- int buf[FAMILY_NUMBER][FAMILY_SIZE];
+ int **buf = NULL;
+ int *buf_data = NULL;
hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE};
hsize_t file_size;
TESTING("FAMILY file driver");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ buf[i] = buf_data + (i * FAMILY_SIZE);
+
/* Set property list and file name for FAMILY driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
@@ -890,7 +900,7 @@ test_family(void)
| H5FD_FEAT_AGGREGATE_SMALLDATA))
TEST_ERROR
- if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
TEST_ERROR;
if(H5Fclose(file) < 0)
@@ -905,7 +915,7 @@ test_family(void)
if(H5Pset_fapl_family(fapl, (hsize_t)H5F_FAMILY_DEFAULT, H5P_DEFAULT) < 0)
TEST_ERROR;
- if((file=H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
/* Check file size API */
@@ -917,7 +927,7 @@ test_family(void)
TEST_ERROR;
/* Create and write dataset */
- if((space=H5Screate_simple(2, dims, NULL)) < 0)
+ if((space = H5Screate_simple(2, dims, NULL)) < 0)
TEST_ERROR;
/* Retrieve the access property list... */
@@ -932,14 +942,14 @@ test_family(void)
if (H5Pclose(access_fapl) < 0)
TEST_ERROR;
- if((dset=H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR;
for(i = 0; i < FAMILY_NUMBER; i++)
for(j = 0; j < FAMILY_SIZE; j++)
buf[i][j] = (int)((i * 10000) + j);
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
/* check file handle API */
@@ -1004,8 +1014,11 @@ test_family(void)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1015,8 +1028,12 @@ error:
H5Pclose(fapl2);
H5Fclose(file);
} H5E_END_TRY;
- return -1;
-}
+
+ HDfree(buf);
+ HDfree(buf_data);
+
+ return FAIL;
+} /* end test_family() */
/*-------------------------------------------------------------------------
@@ -1043,8 +1060,7 @@ error:
* 'newname_individual', etc. in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static herr_t
test_family_compat(void)
{
@@ -1128,7 +1144,7 @@ error:
return -1;
} /* end test_family_compat() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -1136,8 +1152,7 @@ error:
*
* Purpose: Actually use the member fapl input to the member vfd.
*
- * Return: Success: 0
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Jacob Smith
* 21 May 2019
@@ -1147,108 +1162,91 @@ error:
static herr_t
test_family_member_fapl(void)
{
- hid_t file = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- hid_t memb_fapl_id = H5I_INVALID_HID;
- hid_t space = H5I_INVALID_HID;
- hid_t dset = H5I_INVALID_HID;
+ hid_t file = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t memb_fapl_id = H5I_INVALID_HID;
+ hid_t space = H5I_INVALID_HID;
+ hid_t dset = H5I_INVALID_HID;
char filename[1024];
- char dname[] = "dataset";
- unsigned i = 0;
- unsigned j = 0;
- int buf[FAMILY_NUMBER][FAMILY_SIZE];
- hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
+ char dname[] = "dataset";
+ unsigned i = 0;
+ unsigned j = 0;
+ int **buf = NULL;
+ int *buf_data = NULL;
+ hsize_t dims[2] = {FAMILY_NUMBER, FAMILY_SIZE};
TESTING("Family member FAPL");
- fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == fapl_id) {
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(FAMILY_NUMBER * FAMILY_SIZE, sizeof(int))))
TEST_ERROR;
- }
- memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == memb_fapl_id) {
+ if(NULL == (buf = (int **)HDcalloc(FAMILY_NUMBER, sizeof(buf_data))))
TEST_ERROR;
- }
- if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL) {
+ for (i = 0; i < FAMILY_NUMBER; i++)
+ buf[i] = buf_data + (i * FAMILY_SIZE);
+
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
TEST_ERROR;
- }
- if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL) {
+
+ if((memb_fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID)
TEST_ERROR;
- }
+
+ if (H5Pset_fapl_sec2(memb_fapl_id) == FAIL)
+ TEST_ERROR;
+ if (H5Pset_fapl_family(fapl_id, (hsize_t)FAMILY_SIZE, memb_fapl_id) == FAIL)
+ TEST_ERROR;
+
h5_fixname(FILENAME[2], fapl_id, filename, sizeof(filename));
- file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
- if (H5I_INVALID_HID == file) {
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) == H5I_INVALID_HID)
TEST_ERROR;
- }
- space = H5Screate_simple(2, dims, NULL);
- if (H5I_INVALID_HID == space) {
+ if((space = H5Screate_simple(2, dims, NULL)) == H5I_INVALID_HID)
TEST_ERROR;
- }
/* Create and write to dataset, then close file.
*/
- dset = H5Dcreate2(
- file,
- dname,
- H5T_NATIVE_INT,
- space,
- H5P_DEFAULT,
- H5P_DEFAULT,
- H5P_DEFAULT);
- if (H5I_INVALID_HID == dset) {
+ if((dset = H5Dcreate2(file, dname, H5T_NATIVE_INT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) == H5I_INVALID_HID)
TEST_ERROR;
- }
+
for (i = 0; i < FAMILY_NUMBER; i++) {
for (j = 0; j < FAMILY_SIZE; j++) {
buf[i][j] = (int)((i * 10000) + j);
}
}
- if (H5Dwrite(dset,
- H5T_NATIVE_INT,
- H5S_ALL,
- H5S_ALL,
- H5P_DEFAULT,
- buf)
- == FAIL)
- {
+
+ if (H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) == FAIL)
TEST_ERROR;
- }
- if (H5Dclose(dset) == FAIL) {
+
+ if (H5Dclose(dset) == FAIL)
TEST_ERROR;
- }
- if (H5Sclose(space) == FAIL) {
+ if (H5Sclose(space) == FAIL)
TEST_ERROR;
- }
- if (H5Fclose(file) == FAIL) {
+ if (H5Fclose(file) == FAIL)
TEST_ERROR;
- }
/* "Close" member FAPL at top level and re-open file.
* Should succeed, with library managing reference count properly
*/
- if (H5Pclose(memb_fapl_id) == FAIL) {
+ if (H5Pclose(memb_fapl_id) == FAIL)
TEST_ERROR;
- }
- file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
- if (H5I_INVALID_HID == file) {
+ if ((file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) == H5I_INVALID_HID)
TEST_ERROR;
- }
- if (H5Fclose(file) == FAIL) {
+ if (H5Fclose(file) == FAIL)
TEST_ERROR;
- }
h5_delete_test_file(FILENAME[2], fapl_id);
- if (H5Pclose(fapl_id) == FAIL) {
+ if (H5Pclose(fapl_id) == FAIL)
TEST_ERROR;
- }
+
+ HDfree(buf);
+ HDfree(buf_data);
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1259,7 +1257,10 @@ error:
H5Fclose(file);
} H5E_END_TRY;
- return -1;
+ HDfree(buf);
+ HDfree(buf_data);
+
+ return FAIL;
} /* end test_family_member_fapl() */
@@ -1282,8 +1283,7 @@ error:
* 'sf_name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+H5_GCC_DIAG_OFF(format-nonliteral)
static herr_t
test_multi_opens(char *fname)
{
@@ -1301,7 +1301,7 @@ test_multi_opens(char *fname)
return(fid >= 0 ? FAIL : SUCCEED);
} /* end test_multi_opens() */
-#pragma GCC diagnostic pop
+H5_GCC_DIAG_ON(format-nonliteral)
/*-------------------------------------------------------------------------
@@ -1337,10 +1337,19 @@ test_multi(void)
char dname[]="dataset";
char meta[] = "this is some metadata on this file";
int i, j;
- int buf[MULTI_SIZE][MULTI_SIZE];
+ int **buf = NULL;
+ int *buf_data = NULL;
TESTING("MULTI file driver");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < MULTI_SIZE; i++)
+ buf[i] = buf_data + (i * MULTI_SIZE);
+
/* Set file access property list for MULTI driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
@@ -1351,7 +1360,7 @@ test_multi(void)
HDmemset(memb_addr, 0, sizeof(memb_addr));
HDmemset(sv, 0, sizeof(sv));
- for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) {
+ for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++) {
memb_fapl[mt] = H5P_DEFAULT;
memb_map[mt] = H5FD_MEM_SUPER;
}
@@ -1443,7 +1452,7 @@ test_multi(void)
for(i=0; i<MULTI_SIZE; i++)
for(j=0; j<MULTI_SIZE; j++)
buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
if((fapl2=H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -1521,6 +1530,9 @@ test_multi(void)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
return SUCCEED;
@@ -1534,6 +1546,10 @@ error:
H5Fclose(file);
H5Aclose(attr);
} H5E_END_TRY;
+
+ HDfree(buf);
+ HDfree(buf_data);
+
return FAIL;
} /* end test_multi() */
@@ -1572,10 +1588,19 @@ test_multi_compat(void)
char sv[H5FD_MEM_NTYPES][32];
hsize_t dims[2]={MULTI_SIZE, MULTI_SIZE};
int i, j;
- int buf[MULTI_SIZE][MULTI_SIZE];
+ int **buf = NULL;
+ int *buf_data = NULL;
TESTING("MULTI file driver backward compatibility");
+ /* Set up data array */
+ if(NULL == (buf_data = (int *)HDcalloc(MULTI_SIZE * MULTI_SIZE, sizeof(int))))
+ TEST_ERROR;
+ if(NULL == (buf = (int **)HDcalloc(MULTI_SIZE, sizeof(buf_data))))
+ TEST_ERROR;
+ for (i = 0; i < MULTI_SIZE; i++)
+ buf[i] = buf_data + (i * MULTI_SIZE);
+
/* Set file access property list for MULTI driver */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
TEST_ERROR;
@@ -1586,7 +1611,7 @@ test_multi_compat(void)
HDmemset(memb_addr, 0, sizeof memb_addr);
HDmemset(sv, 0, sizeof sv);
- for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt))
+ for(mt=H5FD_MEM_DEFAULT; mt<H5FD_MEM_NTYPES; mt++)
memb_map[mt] = H5FD_MEM_SUPER;
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
@@ -1659,7 +1684,7 @@ test_multi_compat(void)
for(i=0; i<MULTI_SIZE; i++)
for(j=0; j<MULTI_SIZE; j++)
buf[i][j] = i*10000+j;
- if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_data) < 0)
TEST_ERROR;
if(H5Dclose(dset) < 0)
@@ -1697,9 +1722,12 @@ test_multi_compat(void)
if(H5Pclose(fapl) < 0)
TEST_ERROR;
+ HDfree(buf);
+ HDfree(buf_data);
+
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -1708,8 +1736,12 @@ error:
H5Pclose(fapl);
H5Fclose(file);
} H5E_END_TRY;
- return -1;
-}
+
+ HDfree(buf);
+ HDfree(buf_data);
+
+ return FAIL;
+} /* end test_multi_compat() */
/*-------------------------------------------------------------------------
diff --git a/test/vol.c b/test/vol.c
index 5ff0af0..88354e1 100644
--- a/test/vol.c
+++ b/test/vol.c
@@ -38,13 +38,14 @@ const char *FILENAME[] = {
#define N_ELEMENTS 10
#define FAKE_VOL_NAME "fake"
+#define FAKE_VOL_VALUE ((H5VL_class_value_t)501)
/* A VOL class struct that describes a VOL class with no
* functionality.
*/
static const H5VL_class_t fake_vol_g = {
0, /* version */
- (H5VL_class_value_t)501, /* value */
+ FAKE_VOL_VALUE, /* value */
FAKE_VOL_NAME, /* name */
0, /* capability flags */
NULL, /* initialize */
@@ -123,6 +124,10 @@ static const H5VL_class_t fake_vol_g = {
NULL, /* specific */
NULL /* optional */
},
+ { /* introspect_cls */
+ NULL, /* get_conn_cls */
+ NULL, /* opt_query */
+ },
{ /* request_cls */
NULL, /* wait */
NULL, /* notify */
@@ -131,6 +136,17 @@ static const H5VL_class_t fake_vol_g = {
NULL, /* optional */
NULL /* free */
},
+ { /* blob_cls */
+ NULL, /* put */
+ NULL, /* get */
+ NULL, /* specific */
+ NULL /* optional */
+ },
+ { /* token_cls */
+ NULL, /* cmp */
+ NULL, /* to_str */
+ NULL /* from_str */
+ },
NULL /* optional */
};
@@ -159,7 +175,11 @@ test_vol_registration(void)
TESTING("VOL registration");
/* The test/fake VOL connector should not be registered at the start of the test */
- if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0)
+ TEST_ERROR;
+ if (is_registered > 0)
+ FAIL_PUTS_ERROR("VOL connector is inappropriately registered");
+ if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0)
TEST_ERROR;
if (is_registered > 0)
FAIL_PUTS_ERROR("VOL connector is inappropriately registered");
@@ -188,7 +208,11 @@ test_vol_registration(void)
TEST_ERROR;
/* The test/fake VOL connector should be registered now */
- if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0)
+ TEST_ERROR;
+ if (0 == is_registered)
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
+ if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0)
TEST_ERROR;
if (0 == is_registered)
FAIL_PUTS_ERROR("VOL connector is un-registered");
@@ -198,7 +222,11 @@ test_vol_registration(void)
TEST_ERROR;
/* The test/fake VOL connector should still be registered now */
- if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0)
+ TEST_ERROR;
+ if (0 == is_registered)
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
+ if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0)
TEST_ERROR;
if (0 == is_registered)
FAIL_PUTS_ERROR("VOL connector is un-registered");
@@ -208,7 +236,11 @@ test_vol_registration(void)
TEST_ERROR;
/* The test/fake VOL connector should still be registered now */
- if ((is_registered = H5VLis_connector_registered(FAKE_VOL_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(FAKE_VOL_NAME)) < 0)
+ TEST_ERROR;
+ if (0 == is_registered)
+ FAIL_PUTS_ERROR("VOL connector is un-registered");
+ if ((is_registered = H5VLis_connector_registered_by_value(FAKE_VOL_VALUE)) < 0)
TEST_ERROR;
if (0 == is_registered)
FAIL_PUTS_ERROR("VOL connector is un-registered");
@@ -218,7 +250,7 @@ test_vol_registration(void)
TEST_ERROR;
/* Try to unregister the native VOL connector (should fail) */
- if (H5I_INVALID_HID == (native_id = H5VLget_connector_id(H5VL_NATIVE_NAME)))
+ if (H5I_INVALID_HID == (native_id = H5VLget_connector_id_by_name(H5VL_NATIVE_NAME)))
TEST_ERROR;
H5E_BEGIN_TRY {
ret = H5VLunregister_connector(native_id);
@@ -257,7 +289,12 @@ test_native_vol_init(void)
TESTING("Native VOL connector initialization");
/* The native VOL connector should always be registered */
- if ((is_registered = H5VLis_connector_registered(H5VL_NATIVE_NAME)) < 0)
+ if ((is_registered = H5VLis_connector_registered_by_name(H5VL_NATIVE_NAME)) < 0)
+ TEST_ERROR;
+ if (0 == is_registered)
+ FAIL_PUTS_ERROR("native VOL connector is un-registered");
+
+ if ((is_registered = H5VLis_connector_registered_by_value(H5VL_NATIVE_VALUE)) < 0)
TEST_ERROR;
if (0 == is_registered)
FAIL_PUTS_ERROR("native VOL connector is un-registered");
@@ -860,7 +897,7 @@ test_basic_object_operation(void)
hid_t oid = H5I_INVALID_HID;
char filename[1024];
- H5O_info_t object_info;
+ H5O_info2_t object_info;
TESTING("Basic VOL object operations");
@@ -874,11 +911,11 @@ test_basic_object_operation(void)
TEST_ERROR;
/* H5Oget_info */
- if (H5Oget_info2(fid, &object_info, H5O_INFO_ALL) < 0)
+ if (H5Oget_info3(fid, &object_info, H5O_INFO_ALL) < 0)
TEST_ERROR;
/* H5Oget_info_by_name */
- if (H5Oget_info_by_name2(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0)
+ if (H5Oget_info_by_name3(fid, NATIVE_VOL_TEST_GROUP_NAME, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0)
TEST_ERROR;
/* H5Oexists_by_name */
diff --git a/test/vol_plugin.c b/test/vol_plugin.c
index 236a67e..565c847 100644
--- a/test/vol_plugin.c
+++ b/test/vol_plugin.c
@@ -43,7 +43,7 @@ test_registration_by_value(void)
TESTING("VOL registration by value");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -53,7 +53,7 @@ test_registration_by_value(void)
TEST_ERROR;
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
if(FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
@@ -63,7 +63,7 @@ test_registration_by_value(void)
TEST_ERROR;
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -99,7 +99,7 @@ test_registration_by_name(void)
TESTING("VOL registration by name");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -109,7 +109,7 @@ test_registration_by_name(void)
TEST_ERROR;
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
if(FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
@@ -119,7 +119,7 @@ test_registration_by_name(void)
TEST_ERROR;
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -156,7 +156,7 @@ test_multiple_registration(void)
TESTING("registering a VOL connector multiple times");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -168,7 +168,7 @@ test_multiple_registration(void)
}
/* The connector should be registered now */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
if(FALSE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector was not registered");
@@ -186,7 +186,43 @@ test_multiple_registration(void)
}
/* The connector should not be registered now */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ TEST_ERROR;
+ if(TRUE == is_registered)
+ FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
+
+ /* Repeat testing with the _by_value routines */
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ TEST_ERROR;
+ if(TRUE == is_registered)
+ FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
+
+ /* Register the connector multiple times */
+ for(i = 0; i < N_REGISTRATIONS; i++) {
+ if((vol_ids[i] = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+ }
+
+ /* The connector should be registered now */
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ TEST_ERROR;
+ if(FALSE == is_registered)
+ FAIL_PUTS_ERROR("NULL VOL connector was not registered");
+
+ /* Unregister the connector */
+ for(i = 0; i < N_REGISTRATIONS; i++) {
+ if(H5VLunregister_connector(vol_ids[i]) < 0)
+ TEST_ERROR;
+ /* Also test close on some of the IDs. This call currently works
+ * identically to unregister.
+ */
+ i++;
+ if(H5VLclose(vol_ids[i]) < 0)
+ TEST_ERROR;
+ }
+
+ /* The connector should not be registered now */
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -223,7 +259,7 @@ test_getters(void)
TESTING("VOL getters");
/* The null VOL connector should not be registered at the start of the test */
- if((is_registered = H5VLis_connector_registered(NULL_VOL_CONNECTOR_NAME)) < 0)
+ if((is_registered = H5VLis_connector_registered_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
TEST_ERROR;
if(TRUE == is_registered)
FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
@@ -232,11 +268,35 @@ test_getters(void)
if((vol_id = H5VLregister_connector_by_name(NULL_VOL_CONNECTOR_NAME, H5P_DEFAULT)) < 0)
TEST_ERROR;
- /* Get the connector's ID */
- if((vol_id_out = H5VLget_connector_id(NULL_VOL_CONNECTOR_NAME)) < 0)
+ /* Get the connector's ID by name */
+ if((vol_id_out = H5VLget_connector_id_by_name(NULL_VOL_CONNECTOR_NAME)) < 0)
+ TEST_ERROR;
+ if(vol_id != vol_id_out)
+ FAIL_PUTS_ERROR("VOL connector IDs don't match");
+ if(H5VLclose(vol_id_out) < 0)
+ TEST_ERROR;
+
+ /* Unregister the connector */
+ if(H5VLunregister_connector(vol_id) < 0)
+ TEST_ERROR;
+
+ /* Repeat testing with the _by_value routines */
+ if((is_registered = H5VLis_connector_registered_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
+ TEST_ERROR;
+ if(TRUE == is_registered)
+ FAIL_PUTS_ERROR("NULL VOL connector is inappropriately registered");
+
+ /* Register the connector by value */
+ if((vol_id = H5VLregister_connector_by_value(NULL_VOL_CONNECTOR_VALUE, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Get the connector's ID by value */
+ if((vol_id_out = H5VLget_connector_id_by_value(NULL_VOL_CONNECTOR_VALUE)) < 0)
TEST_ERROR;
if(vol_id != vol_id_out)
FAIL_PUTS_ERROR("VOL connector IDs don't match");
+ if(H5VLclose(vol_id_out) < 0)
+ TEST_ERROR;
/* Unregister the connector */
if(H5VLunregister_connector(vol_id) < 0)
@@ -247,6 +307,7 @@ test_getters(void)
error:
H5E_BEGIN_TRY {
+ H5VLclose(vol_id_out);
H5VLunregister_connector(vol_id);
} H5E_END_TRY;
return FAIL;