summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorRichard Warren <Richard.Warren@hdfgroup.org>2020-09-25 11:44:33 (GMT)
committerRichard Warren <Richard.Warren@hdfgroup.org>2020-09-25 11:44:33 (GMT)
commitd612a249afe1eb4799ccbf725d8309452446dee7 (patch)
tree0fc5efc8f31546bf3513f939e6d2a9abd5fe42b7 /test
parentbeee2bdb648a6a223a64ba8733d8518e5ee79b66 (diff)
downloadhdf5-d612a249afe1eb4799ccbf725d8309452446dee7.zip
hdf5-d612a249afe1eb4799ccbf725d8309452446dee7.tar.gz
hdf5-d612a249afe1eb4799ccbf725d8309452446dee7.tar.bz2
Create a new branch for the September Subfiling deliverable
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/H5srcdir.h4
-rw-r--r--test/Makefile.am4
-rw-r--r--test/SWMR_UseCase_UG.txt4
-rw-r--r--test/accum.c4
-rw-r--r--test/app_ref.c2
-rw-r--r--test/big.c8
-rw-r--r--test/bittests.c2
-rw-r--r--test/btree2.c14
-rw-r--r--test/cache.c2108
-rw-r--r--test/cache_common.c171
-rw-r--r--test/cache_common.h59
-rw-r--r--test/cache_image.c2
-rw-r--r--test/cache_tagging.c29
-rw-r--r--test/chunk_info.c28
-rw-r--r--test/cmpd_dset.c2
-rw-r--r--test/cross_read.c2
-rw-r--r--test/dangle.c2
-rw-r--r--test/dsets.c117
-rw-r--r--test/dt_arith.c36
-rw-r--r--test/dtypes.c600
-rw-r--r--test/earray.c40
-rw-r--r--test/enum.c2
-rw-r--r--test/extend.c2
-rw-r--r--test/external.c2
-rw-r--r--test/external_common.c2
-rw-r--r--test/external_common.h2
-rw-r--r--test/external_fname.h2
-rw-r--r--test/fheap.c137
-rw-r--r--test/fillval.c2
-rw-r--r--test/filter_fail.c2
-rw-r--r--test/flush1.c2
-rw-r--r--test/flush2.c2
-rw-r--r--test/gen_bad_compound.c2
-rw-r--r--test/gen_bad_ohdr.c2
-rw-r--r--test/gen_bogus.c2
-rw-r--r--test/gen_cross.c2
-rw-r--r--test/gen_filters.c2
-rw-r--r--test/gen_mergemsg.c2
-rw-r--r--test/gen_new_array.c2
-rw-r--r--test/gen_new_fill.c2
-rw-r--r--test/gen_new_group.c2
-rw-r--r--test/gen_new_mtime.c2
-rw-r--r--test/gen_new_super.c36
-rw-r--r--test/gen_nullspace.c27
-rw-r--r--test/gen_old_array.c2
-rw-r--r--test/gen_old_group.c2
-rw-r--r--test/gen_old_layout.c2
-rw-r--r--test/gen_old_mtime.c2
-rw-r--r--test/gen_sizes_lheap.c2
-rw-r--r--test/gen_specmetaread.c5
-rw-r--r--test/gen_udlinks.c2
-rw-r--r--test/getname.c2
-rw-r--r--test/gheap.c2
-rw-r--r--test/h5subfiling_vol.c3641
-rw-r--r--test/h5subfiling_vol.h115
-rw-r--r--test/h5test.c184
-rw-r--r--test/h5test.h4
-rw-r--r--test/hdfs.c31
-rw-r--r--test/hyperslab.c2
-rw-r--r--test/istore.c2
-rw-r--r--test/lheap.c2
-rw-r--r--test/links.c19
-rw-r--r--test/mf.c8
-rw-r--r--test/mirror_vfd.c2
-rw-r--r--test/mount.c2
-rw-r--r--test/mtime.c2
-rw-r--r--test/ntypes.c2
-rw-r--r--test/ohdr.c26
-rw-r--r--test/page_buffer.c1
-rw-r--r--test/pool.c6
-rw-r--r--test/ros3.c2
-rw-r--r--test/s3comms.c2
-rw-r--r--test/set_extent.c2
-rw-r--r--test/space_overflow.c2
-rw-r--r--test/stab.c4
-rw-r--r--test/swmr.c278
-rw-r--r--test/swmr_addrem_writer.c20
-rw-r--r--test/swmr_generator.c28
-rw-r--r--test/swmr_remove_writer.c20
-rw-r--r--test/swmr_sparse_writer.c20
-rw-r--r--test/swmr_start_write.c10
-rw-r--r--test/swmr_writer.c16
-rw-r--r--test/tattr.c11
-rw-r--r--test/tchecksum.c2
-rw-r--r--test/testframe.c2
-rw-r--r--test/tfile.c3
-rw-r--r--test/th5o.c22
-rw-r--r--test/thread_id.c4
-rw-r--r--test/timer.c414
-rw-r--r--test/trefer.c631
-rw-r--r--test/tselect.c80
-rw-r--r--test/ttsafe.c1
-rw-r--r--test/ttsafe.h2
-rw-r--r--test/ttsafe_attr_vlen.c177
-rw-r--r--test/unlink.c2
-rw-r--r--test/vds.c2
-rw-r--r--test/vds_env.c2
-rw-r--r--test/vds_swmr.h2
-rw-r--r--test/vfd.c334
100 files changed, 7497 insertions, 2148 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e3bfeb3..311d753 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -222,6 +222,7 @@ set (ttsafe_SOURCES
${HDF5_TEST_SOURCE_DIR}/ttsafe_error.c
${HDF5_TEST_SOURCE_DIR}/ttsafe_cancel.c
${HDF5_TEST_SOURCE_DIR}/ttsafe_acreate.c
+ ${HDF5_TEST_SOURCE_DIR}/ttsafe_attr_vlen.c
)
set (H5_TESTS
@@ -295,6 +296,7 @@ set (H5_TESTS
swmr
thread_id # special link
vol
+ timer
)
macro (ADD_H5_EXE file)
diff --git a/test/H5srcdir.h b/test/H5srcdir.h
index b02d432..019cfda 100644
--- a/test/H5srcdir.h
+++ b/test/H5srcdir.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Wednesday, March 17, 2010
*
* Purpose: srcdir querying support.
@@ -20,8 +20,6 @@
#ifndef _H5SRCDIR_H
#define _H5SRCDIR_H
-/* Include the header file with the correct relative path for the srcdir string */
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/test/Makefile.am b/test/Makefile.am
index 805b482..7ebeae7 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -65,7 +65,7 @@ TEST_PROG= testhdf5 \
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 thread_id vol
+ unregister cache_logging cork swmr thread_id vol timer
# 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.
@@ -146,7 +146,7 @@ LDADD=libh5test.la $(LIBHDF5)
# List the source files for tests that have more than one
ttsafe_SOURCES=ttsafe.c ttsafe_dcreate.c ttsafe_error.c ttsafe_cancel.c \
- ttsafe_acreate.c
+ ttsafe_acreate.c ttsafe_attr_vlen.c
cache_image_SOURCES=cache_image.c genall5.c
mirror_vfd_SOURCES=mirror_vfd.c genall5.c
diff --git a/test/SWMR_UseCase_UG.txt b/test/SWMR_UseCase_UG.txt
index 18d4927..1e3d1e6 100644
--- a/test/SWMR_UseCase_UG.txt
+++ b/test/SWMR_UseCase_UG.txt
@@ -6,8 +6,8 @@
case program and explain how to run them.
2.1. Author and Dates:
- Version 2: By Albert Cheng (acheng@hdfgroup.org), 2013/06/18.
- Version 1: By Albert Cheng (acheng@hdfgroup.org), 2013/06/01.
+ Version 2: By Albert Cheng, 2013/06/18.
+ Version 1: By Albert Cheng, 2013/06/01.
%%%%Use Case 1.7%%%%
diff --git a/test/accum.c b/test/accum.c
index 548a04d..3947aff 100644
--- a/test/accum.c
+++ b/test/accum.c
@@ -1708,10 +1708,10 @@ test_random_write(H5F_t *f)
/* Choose random # seed */
seed = (unsigned)HDtime(NULL);
-#ifdef QAK
+#if 0
/* seed = (unsigned)1155438845; */
HDfprintf(stderr, "Random # seed was: %u\n", seed);
-#endif /* QAK */
+#endif
HDsrandom(seed);
/* Allocate space for the segment length buffer */
diff --git a/test/app_ref.c b/test/app_ref.c
index a4853fa..c1735fa 100644
--- a/test/app_ref.c
+++ b/test/app_ref.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Programmer: Neil Fortner
* Thursday, August 14, 2008
*
* Purpose: Tests closing the library after reference counts have been
diff --git a/test/big.c b/test/big.c
index a2f07af..fee7813 100644
--- a/test/big.c
+++ b/test/big.c
@@ -12,9 +12,9 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Wednesday, April 8, 1998
- * Modified: Albert Cheng <acheng@hdfgroup.org>
+ * Modified: Albert Cheng
* September 11, 2010
*/
/*
@@ -803,10 +803,10 @@ main (int ac, char **av)
/* Choose random # seed */
seed = (unsigned long)HDtime(NULL);
-#ifdef QAK
+#if 0
/* seed = (unsigned long)1155438845; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)seed);
/* run VFD-specific test */
diff --git a/test/bittests.c b/test/bittests.c
index 046528a..6f236d6 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, June 16, 1998
*
* Purpose: Tests functions in H5Tbit.c
diff --git a/test/btree2.c b/test/btree2.c
index c4c5530..b85f033 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Tuesday, February 1, 2005
*/
#include "h5test.h"
@@ -2982,10 +2982,10 @@ test_insert_lots(hid_t fapl, const H5B2_create_t *cparam,
/* Initialize random number seed */
curr_time=HDtime(NULL);
-#ifdef QAK
+#if 0
curr_time=1109170019;
HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)curr_time);
/*
@@ -4975,10 +4975,10 @@ test_update_lots(hid_t fapl, const H5B2_create_t *cparam,
/* Initialize random number seed */
curr_time = HDtime(NULL);
-#ifdef QAK
+#if 0
curr_time = 1451342093;
HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)curr_time);
/*
@@ -8652,10 +8652,10 @@ test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cpara
/* Initialize random number seed */
curr_time = HDtime(NULL);
-#ifdef QAK
+#if 0
curr_time = 1163537969;
HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)curr_time);
/*
diff --git a/test/cache.c b/test/cache.c
index bb18728..46d8481 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -2933,21 +2933,25 @@ express_test, unsigned paged)
/*-------------------------------------------------------------------------
* Function: check_insert_entry()
*
- * Purpose: Verify that H5C_insert_entry behaves as expected.
- * Test the behaviour with different flags.
+ * Purpose: Verify that H5C_insert_entry behaves as expected.
+ * Test the behaviour with different flags.
*
- * This test was added primarily to test basic insert
- * pinned entry functionallity, but I through in explicit
- * tests for other functionallity that is tested implicitly
- * elsewhere.
+ * This test was added primarily to test basic insert
+ * pinned entry functionallity, but I through in explicit
+ * tests for other functionallity that is tested implicitly
+ * elsewhere.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 8/10/06
*
* Modifications:
*
+ * Updated tests to accommodate the case in which the
+ * slist is disabled.
+ * JRM -- 5/14/20
+ *
*-------------------------------------------------------------------------
*/
@@ -3063,15 +3067,15 @@ check_insert_entry(unsigned paged)
/* Verify that the flush marker got set correctly */
if((i == 1) || (i == 3)) {
- if(!((entry_ptr->header).flush_marker)) {
+ if(!((entry_ptr->header).flush_marker)) {
pass = FALSE;
failure_mssg = "Unexpected insert results 5.";
- }
+ }
} else if((entry_ptr->header).flush_marker) {
- pass = FALSE;
- failure_mssg = "Unexpected insert results 6.";
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 6.";
}
}
@@ -3154,52 +3158,59 @@ check_insert_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 4 * entry_sizes[entry_type]) ||
- (cache_ptr->slist_len != 4) ||
- (cache_ptr->slist_size != 4 * entry_sizes[entry_type]) ||
- (cache_ptr->pl_len != 0) ||
- (cache_ptr->pl_size != (size_t)0) ||
- (cache_ptr->pel_len != 2) ||
- (cache_ptr->pel_size != 2 * entry_sizes[entry_type]) ||
- (cache_ptr->LRU_list_len != 2) ||
- (cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type])
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size != 4 * entry_sizes[entry_type] ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 4 ) ||
+ ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] )
+ )
+ ) ||
+ ( cache_ptr->pl_len != 0 ) ||
+ ( cache_ptr->pl_size != (size_t)0 ) ||
+ ( cache_ptr->pel_len != 2 ) ||
+ ( cache_ptr->pel_size != 2 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->LRU_list_len != 2 ) ||
+ ( cache_ptr->LRU_list_size != 2 * entry_sizes[entry_type] )
#if H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS
- || (cache_ptr->dLRU_list_len != 2) ||
- (cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type]) ||
- (cache_ptr->cLRU_list_len != 0) ||
- (cache_ptr->cLRU_list_size != (size_t)0)
+ ||
+ ( cache_ptr->dLRU_list_len != 2 ) ||
+ ( cache_ptr->dLRU_list_size != 2 * entry_sizes[entry_type] ) ||
+ ( cache_ptr->cLRU_list_len != 0 ) ||
+ ( cache_ptr->cLRU_list_size != (size_t)0 )
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
- ) {
+ ) {
- pass = FALSE;
- failure_mssg = "Unexpected insert results 10.";
- }
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 10.";
+ }
}
/* Finally, if stats collection is enabled, verify that the expected
* stats are collected.
*/
#if H5C_COLLECT_CACHE_STATS
- if(pass) {
-
- if((cache_ptr->insertions[entry_type] != 4) ||
- (cache_ptr->pinned_insertions[entry_type] != 2) ||
- (cache_ptr->pins[entry_type] != 2) ||
- (cache_ptr->unpins[entry_type] != 0) ||
- (cache_ptr->dirty_pins[entry_type] != 0) ||
- (cache_ptr->max_index_len != 4) ||
- (cache_ptr->max_index_size != 4 * entry_sizes[entry_type]) ||
- (cache_ptr->max_slist_len != 4) ||
- (cache_ptr->max_slist_size != 4 * entry_sizes[entry_type]) ||
- (cache_ptr->max_pl_len != 0) ||
- (cache_ptr->max_pl_size != (size_t)0) ||
- (cache_ptr->max_pel_len != 2) ||
- (cache_ptr->max_pel_size != 2 * entry_sizes[entry_type])) {
-
- pass = FALSE;
- failure_mssg = "Unexpected insert results 11.";
- }
+ if ( pass ) {
+
+ if ( ( cache_ptr->insertions[entry_type] != 4 ) ||
+ ( cache_ptr->pinned_insertions[entry_type] != 2 ) ||
+ ( cache_ptr->pins[entry_type] != 2 ) ||
+ ( cache_ptr->unpins[entry_type] != 0 ) ||
+ ( cache_ptr->dirty_pins[entry_type] != 0 ) ||
+ ( cache_ptr->max_index_len != 4 ) ||
+ ( cache_ptr->max_index_size != 4 * entry_sizes[entry_type] ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 4 ) ||
+ ( cache_ptr->slist_size != 4 * entry_sizes[entry_type] )
+ )
+ ) ||
+ ( cache_ptr->max_pl_len != 0 ) ||
+ ( cache_ptr->max_pl_size != (size_t)0 ) ||
+ ( cache_ptr->max_pel_len != 2 ) ||
+ ( cache_ptr->max_pel_size != 2 * entry_sizes[entry_type] ) ) {
+
+ pass = FALSE;
+ failure_mssg = "Unexpected insert results 11.";
+ }
}
#endif /* H5C_COLLECT_CACHE_STATS */
@@ -3208,7 +3219,7 @@ check_insert_entry(unsigned paged)
if(pass) {
unpin_entry(entry_type, 2);
- unpin_entry(entry_type, 3);
+ unpin_entry(entry_type, 3);
}
if(pass) {
@@ -3316,18 +3327,25 @@ check_flush_cache(unsigned paged)
/*-------------------------------------------------------------------------
+ *
* Function: check_flush_cache__empty_cache()
*
- * Purpose: Verify that flush_cache behaves as expected with an empty
+ * Purpose : Verify that flush_cache behaves as expected with an empty
* cache.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 1/12/05
*
* Modifications:
*
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
+ *
*-------------------------------------------------------------------------
*/
@@ -3335,7 +3353,6 @@ static void
check_flush_cache__empty_cache(H5F_t * file_ptr)
{
H5C_t * cache_ptr = file_ptr->shared->cache;
- herr_t result;
if(cache_ptr == NULL) {
@@ -3352,53 +3369,37 @@ check_flush_cache__empty_cache(H5F_t * file_ptr)
/* Test behaviour on an empty cache. Can't do much sanity
* checking in this case, so simply check the return values.
+ *
+ * Check of return values is done in the H5C_FLUSH_CACHE() macro.
*/
- if(pass) {
-
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
-
- if(result < 0) {
+ if ( pass ) {
- pass = FALSE;
- failure_mssg = "flush with flags = 0x00 failed on empty cache.\n";
- }
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \
+ "flush with flags = 0x00 failed on empty cache.\n")
}
- if(pass) {
+ if ( pass ) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
-
- if(result < 0) {
-
- pass = FALSE;
- failure_mssg = "flush with flags = 0x04 failed on empty cache.\n";
- }
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "flush with flags = 0x04 failed on empty cache.\n")
}
- if(pass) {
+ if ( pass ) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG);
-
- if(result < 0) {
-
- pass = FALSE;
- failure_mssg = "flush with flags = 0x08 failed on empty cache.\n";
- }
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, \
+ "flush with flags = 0x08 failed on empty cache.\n")
}
- if(pass) {
-
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG);
-
- if(result < 0) {
+ if ( pass ) {
- pass = FALSE;
- failure_mssg = "flush with flags = 0x10 failed on empty cache.\n";
- }
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_MARKED_ENTRIES_FLAG, \
+ "flush with flags = 0x10 failed on empty cache.\n")
}
+ return;
+
} /* check_flush_cache__empty_cache() */
@@ -4959,15 +4960,21 @@ check_flush_cache__multi_entry(H5F_t * file_ptr)
/*-------------------------------------------------------------------------
* Function: check_flush_cache__multi_entry_test()
*
- * Purpose: Run a multi entry flush cache test.
+ * Purpose : Run a multi entry flush cache test.
*
- * Return: void
- *
- * Programmer: John Mainzer
+ * Return: void
+ *
+ * Programmer: John Mainzer
* 1/13/05
*
* Modifications:
*
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
+ *
*-------------------------------------------------------------------------
*/
@@ -4980,7 +4987,6 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
{
H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
- herr_t result;
unsigned u;
size_t total_entry_size = 0;
test_entry_t * base_addr;
@@ -4989,8 +4995,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
#if 0 /* JRM */
/* This gets used a lot, so lets leave it in. */
- HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n",
- test_num);
+ HDfprintf(stdout, "check_flush_cache__multi_entry_test: test %d\n",
+ test_num);
#endif /* JRM */
if(cache_ptr == NULL) {
@@ -5001,8 +5007,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
@@ -5021,13 +5027,13 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
}
u = 0;
- while(pass && (u < spec_size))
- {
- if(((unsigned)spec[u].entry_num != u) ||
- (spec[u].entry_type < 0) ||
- (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- (spec[u].entry_index < 0) ||
- (spec[u].entry_index > max_indices[spec[u].entry_type])) {
+ while ( pass && ( u < spec_size ) ) {
+
+ if ( ( (unsigned)spec[u].entry_num != u ) ||
+ ( spec[u].entry_type < 0 ) ||
+ ( spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
+ ( spec[u].entry_index < 0 ) ||
+ ( spec[u].entry_index > max_indices[spec[u].entry_type] ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5039,8 +5045,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
}
u = 0;
- while(pass && (u < spec_size))
- {
+ while ( pass && (u < spec_size) ) {
+
if(spec[u].insert_flag) {
insert_entry(file_ptr, spec[u].entry_type, spec[u].entry_index,
@@ -5061,11 +5067,10 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
if(pass) {
- result = H5C_flush_cache(file_ptr, flush_flags);
+ H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n")
- if(result < 0) {
+ if ( ! pass ) {
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"flush with flags 0x%x failed in multi entry test #%d.",
flush_flags, test_num);
@@ -5107,22 +5112,22 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
if(pass) {
- if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
+ if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
&&
- ((cache_ptr->index_len != spec_size)
+ ( ( cache_ptr->index_len != spec_size )
||
- (cache_ptr->index_size != total_entry_size)
- )
- )
+ ( cache_ptr->index_size != total_entry_size )
+ )
+ )
||
- (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
+ ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
&&
- ((cache_ptr->index_len != 0)
+ ( ( cache_ptr->index_len != 0 )
||
- (cache_ptr->index_size != 0)
- )
- )
- ) {
+ ( cache_ptr->index_size != 0 )
+ )
+ )
+ ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5135,9 +5140,9 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
/* clean up the cache to prep for the next test */
if(pass) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n")
- if(result < 0) {
+ if ( ! pass ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5145,8 +5150,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5158,8 +5163,8 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
}
u = 0;
- while(pass && (u < spec_size))
- {
+ while ( pass && ( u < spec_size ) ) {
+
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
@@ -5176,17 +5181,24 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr,
/*-------------------------------------------------------------------------
+ *
* Function: check_flush_cache__pe_multi_entry_test()
*
- * Purpose: Run a multi entry flush cache test.
+ * Purpose: Run a multi entry flush cache test.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/5/06
*
* Modifications:
*
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/16/20
+ *
*-------------------------------------------------------------------------
*/
@@ -5199,7 +5211,6 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
{
H5C_t *cache_ptr = file_ptr->shared->cache;
static char msg[128];
- herr_t result;
unsigned u;
int j;
size_t total_entry_size = 0;
@@ -5221,8 +5232,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
@@ -5241,15 +5252,15 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
}
u = 0;
- while(pass && (u < spec_size))
- {
- if(((unsigned)spec[u].entry_num != u) ||
- (spec[u].entry_type < 0) ||
- (spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- (spec[u].entry_index < 0) ||
- (spec[u].entry_index > max_indices[spec[u].entry_type]) ||
- (spec[u].num_pins < 0) ||
- (spec[u].num_pins > MAX_PINS)) {
+ while ( pass && ( u < spec_size ) ) {
+
+ if ( ( (unsigned)spec[u].entry_num != u ) ||
+ ( spec[u].entry_type < 0 ) ||
+ ( spec[u].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
+ ( spec[u].entry_index < 0 ) ||
+ ( spec[u].entry_index > max_indices[spec[u].entry_type] ) ||
+ ( spec[u].num_pins < 0 ) ||
+ ( spec[u].num_pins > MAX_PINS ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5278,25 +5289,24 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
total_entry_size += entry_sizes[spec[u].entry_type];
- for (j = 0; j < spec[u].num_pins; j++)
- {
+ for (j = 0; j < spec[u].num_pins; j++) {
+
create_pinned_entry_dependency(file_ptr,
- spec[u].entry_type,
- spec[u].entry_index,
- spec[u].pin_type[j],
- spec[u].pin_idx[j]);
- }
+ spec[u].entry_type,
+ spec[u].entry_index,
+ spec[u].pin_type[j],
+ spec[u].pin_idx[j]);
+ }
u++;
}
if(pass) {
- result = H5C_flush_cache(file_ptr, flush_flags);
+ H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message.\n")
- if(result < 0) {
+ if ( ! pass ) {
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"flush with flags 0x%x failed in pe multi entry test #%d.",
flush_flags, test_num);
@@ -5305,14 +5315,14 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
}
u = 0;
- while(pass && (u < spec_size))
- {
+ while ( pass && ( u < spec_size ) ) {
+
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
- if((entry_ptr->deserialized != spec[u].expected_deserialized) ||
- (entry_ptr->serialized != spec[u].expected_serialized) ||
- (entry_ptr->destroyed != spec[u].expected_destroyed)) {
+ if ( ( entry_ptr->deserialized != spec[u].expected_deserialized ) ||
+ ( entry_ptr->serialized != spec[u].expected_serialized ) ||
+ ( entry_ptr->destroyed != spec[u].expected_destroyed ) ) {
#if 0 /* This is useful debugging code. Lets keep it around. */
@@ -5338,22 +5348,22 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
if(pass) {
- if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
+ if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
&&
- ((cache_ptr->index_len != spec_size)
+ ( ( cache_ptr->index_len != spec_size )
||
- (cache_ptr->index_size != total_entry_size)
- )
- )
+ ( cache_ptr->index_size != total_entry_size )
+ )
+ )
||
- (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
+ ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
&&
- ((cache_ptr->index_len != 0)
+ ( ( cache_ptr->index_len != 0 )
||
- (cache_ptr->index_size != 0)
- )
- )
- ) {
+ ( cache_ptr->index_size != 0 )
+ )
+ )
+ ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5364,11 +5374,11 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
}
/* clean up the cache to prep for the next test */
- if(pass) {
+ if ( pass ) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.\n")
- if(result < 0) {
+ if ( ! pass ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5376,8 +5386,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -5389,8 +5399,8 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr,
}
u = 0;
- while(pass && (u < spec_size))
- {
+ while ( pass && ( u < spec_size ) ) {
+
base_addr = entries[spec[u].entry_type];
entry_ptr = &(base_addr[spec[u].entry_index]);
@@ -9181,16 +9191,22 @@ check_flush_cache__flush_ops(H5F_t * file_ptr)
/*-------------------------------------------------------------------------
* Function: check_flush_cache__flush_op_test()
*
- * Purpose: Run a flush op flush cache test. Of the nature of
- * flush operations, this is a multi-entry test.
+ * Purpose: Run a flush op flush cache test. Of the nature of
+ * flush operations, this is a multi-entry test.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 9/3/06
*
* Modifications:
*
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/16/20
+ *
*-------------------------------------------------------------------------
*/
@@ -9200,16 +9216,15 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
unsigned int flush_flags,
int spec_size,
const struct fo_flush_cache_test_spec spec[],
- unsigned init_expected_index_len,
- size_t init_expected_index_size,
- unsigned expected_index_len,
- size_t expected_index_size,
- int check_size,
- struct fo_flush_entry_check check[])
+ unsigned init_expected_index_len,
+ size_t init_expected_index_size,
+ unsigned expected_index_len,
+ size_t expected_index_size,
+ int check_size,
+ struct fo_flush_entry_check check[])
{
H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
- herr_t result;
int i;
int j;
test_entry_t * base_addr;
@@ -9228,8 +9243,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
@@ -9248,17 +9263,17 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
i = 0;
- while(pass && (i < spec_size))
- {
- if((spec[i].entry_num != i) ||
- (spec[i].entry_type < 0) ||
- (spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- (spec[i].entry_index < 0) ||
- (spec[i].entry_index > max_indices[spec[i].entry_type]) ||
- (spec[i].num_pins < 0) ||
- (spec[i].num_pins > MAX_PINS) ||
- (spec[i].num_flush_ops < 0) ||
- (spec[i].num_flush_ops > MAX_FLUSH_OPS)) {
+ while ( pass && ( i < spec_size ) ) {
+
+ if ( ( spec[i].entry_num != i ) ||
+ ( spec[i].entry_type < 0 ) ||
+ ( spec[i].entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
+ ( spec[i].entry_index < 0 ) ||
+ ( spec[i].entry_index > max_indices[spec[i].entry_type] ) ||
+ ( spec[i].num_pins < 0 ) ||
+ ( spec[i].num_pins > MAX_PINS ) ||
+ ( spec[i].num_flush_ops < 0 ) ||
+ ( spec[i].num_flush_ops > MAX_FLUSH_OPS ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -9270,36 +9285,36 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
i = 0;
- while(pass && (i < check_size))
- {
- if((check[i].entry_num != i) ||
- (check[i].entry_type < 0) ||
- (check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- (check[i].entry_index < 0) ||
- (check[i].entry_index > max_indices[check[i].entry_type]) ||
+ while ( pass && ( i < check_size ) ) {
+
+ if ( ( check[i].entry_num != i) ||
+ ( check[i].entry_type < 0) ||
+ ( check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) ||
+ ( check[i].entry_index < 0) ||
+ ( check[i].entry_index > max_indices[check[i].entry_type]) ||
#ifndef H5_HAVE_STDBOOL_H
/* Check for nonsense values if hbool_t is an integral
* type instead of a real Boolean.
*/
- ((check[i].in_cache != TRUE) &&
- (check[i].in_cache != FALSE)) ||
- ((check[i].at_main_addr != TRUE) &&
- (check[i].at_main_addr != FALSE)) ||
- ((check[i].is_dirty != TRUE) &&
- (check[i].is_dirty != FALSE)) ||
- ((check[i].is_protected != TRUE) &&
- (check[i].is_protected != FALSE)) ||
- ((check[i].is_pinned != TRUE) &&
- (check[i].is_pinned != FALSE)) ||
- ((check[i].expected_deserialized != TRUE) &&
- (check[i].expected_deserialized != FALSE)) ||
- ((check[i].expected_serialized != TRUE) &&
- (check[i].expected_serialized != FALSE)) ||
- ((check[i].expected_destroyed != TRUE) &&
- (check[i].expected_destroyed != FALSE)) ||
+ ( ( check[i].in_cache != TRUE ) &&
+ ( check[i].in_cache != FALSE ) ) ||
+ ( ( check[i].at_main_addr != TRUE ) &&
+ ( check[i].at_main_addr != FALSE ) ) ||
+ ( ( check[i].is_dirty != TRUE ) &&
+ ( check[i].is_dirty != FALSE ) ) ||
+ ( ( check[i].is_protected != TRUE ) &&
+ ( check[i].is_protected != FALSE ) ) ||
+ ( ( check[i].is_pinned != TRUE ) &&
+ ( check[i].is_pinned != FALSE ) ) ||
+ ( ( check[i].expected_deserialized != TRUE ) &&
+ ( check[i].expected_deserialized != FALSE ) ) ||
+ ( ( check[i].expected_serialized != TRUE ) &&
+ ( check[i].expected_serialized != FALSE ) ) ||
+ ( ( check[i].expected_destroyed != TRUE ) &&
+ ( check[i].expected_destroyed != FALSE ) ) ||
#endif /* H5_HAVE_STDBOOL_H */
- (check[i].expected_size <= (size_t)0)
- ) {
+ ( check[i].expected_size <= (size_t)0 )
+ ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -9311,8 +9326,8 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
i = 0;
- while(pass && (i < spec_size))
- {
+ while ( pass && ( i < spec_size ) ) {
+
if(spec[i].insert_flag) {
insert_entry(file_ptr, spec[i].entry_type, spec[i].entry_index,
@@ -9330,34 +9345,34 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
spec[i].flags);
}
- for (j = 0; j < spec[i].num_pins; j++)
- {
+ for (j = 0; j < spec[i].num_pins; j++)
+ {
create_pinned_entry_dependency(file_ptr,
spec[i].entry_type,
spec[i].entry_index,
spec[i].pin_type[j],
spec[i].pin_idx[j]);
- }
+ }
- for (j = 0; j < spec[i].num_flush_ops; j++)
- {
- add_flush_op(spec[i].entry_type,
- spec[i].entry_index,
- spec[i].flush_ops[j].op_code,
- spec[i].flush_ops[j].type,
- spec[i].flush_ops[j].idx,
- spec[i].flush_ops[j].flag,
- spec[i].flush_ops[j].size,
+ for (j = 0; j < spec[i].num_flush_ops; j++) {
+
+ add_flush_op(spec[i].entry_type,
+ spec[i].entry_index,
+ spec[i].flush_ops[j].op_code,
+ spec[i].flush_ops[j].type,
+ spec[i].flush_ops[j].idx,
+ spec[i].flush_ops[j].flag,
+ spec[i].flush_ops[j].size,
spec[i].flush_ops[j].order_ptr);
- }
+ }
i++;
}
- if(pass) {
+ if ( pass ) {
- if((cache_ptr->index_len != init_expected_index_len) ||
- (cache_ptr->index_size != init_expected_index_size)) {
+ if ( ( cache_ptr->index_len != init_expected_index_len ) ||
+ ( cache_ptr->index_size != init_expected_index_size ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -9369,9 +9384,9 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if(pass) {
- result = H5C_flush_cache(file_ptr, flush_flags);
+ H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message")
- if(result < 0) {
+ if ( ! pass ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -9383,14 +9398,14 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
i = 0;
- while(pass && (i < spec_size))
- {
+ while ( pass && ( i < spec_size ) ) {
+
base_addr = entries[spec[i].entry_type];
entry_ptr = &(base_addr[spec[i].entry_index]);
- if((entry_ptr->deserialized != spec[i].expected_deserialized) ||
- (entry_ptr->serialized != spec[i].expected_serialized) ||
- (entry_ptr->destroyed != spec[i].expected_destroyed)) {
+ if ( ( entry_ptr->deserialized != spec[i].expected_deserialized ) ||
+ ( entry_ptr->serialized != spec[i].expected_serialized ) ||
+ ( entry_ptr->destroyed != spec[i].expected_destroyed ) ) {
#if 0 /* This is useful debugging code. Lets keep it around. */
@@ -9419,136 +9434,166 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
if(pass) {
i = 0;
- while(pass && (i < check_size))
- {
- if(check[i].in_cache != entry_in_cache(cache_ptr,
- check[i].entry_type,
- check[i].entry_index)) {
+ while ( pass && (i < check_size ) ) {
+
+ if ( check[i].in_cache != entry_in_cache(cache_ptr,
+ check[i].entry_type,
+ check[i].entry_index) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Check1 failed on entry %d after flush op test #%d.",
i, test_num);
failure_mssg = msg;
- }
+ }
base_addr = entries[check[i].entry_type];
entry_ptr = &(base_addr[check[i].entry_index]);
- if((entry_ptr->size != check[i].expected_size) ||
- ((!entry_ptr->header.destroy_in_progress) &&
- (check[i].in_cache) &&
- (entry_ptr->header.size != check[i].expected_size)) ||
- (entry_ptr->at_main_addr != check[i].at_main_addr) ||
- (entry_ptr->is_dirty != check[i].is_dirty) ||
- (entry_ptr->header.is_dirty != check[i].is_dirty) ||
- (entry_ptr->is_protected != check[i].is_protected) ||
- (entry_ptr->header.is_protected != check[i].is_protected) ||
- (entry_ptr->is_pinned != check[i].is_pinned) ||
- (entry_ptr->header.is_pinned != check[i].is_pinned) ||
- (entry_ptr->deserialized != check[i].expected_deserialized) ||
- (entry_ptr->serialized != check[i].expected_serialized) ||
- (entry_ptr->destroyed != check[i].expected_destroyed)) {
+ if ( ( entry_ptr->size != check[i].expected_size) ||
+ ( ( !entry_ptr->header.destroy_in_progress) &&
+ ( check[i].in_cache ) &&
+ ( entry_ptr->header.size != check[i].expected_size ) ) ||
+ ( entry_ptr->at_main_addr != check[i].at_main_addr ) ||
+ ( entry_ptr->is_dirty != check[i].is_dirty ) ||
+ ( entry_ptr->header.is_dirty != check[i].is_dirty ) ||
+ ( entry_ptr->is_protected != check[i].is_protected ) ||
+ ( entry_ptr->header.is_protected != check[i].is_protected ) ||
+ ( entry_ptr->is_pinned != check[i].is_pinned ) ||
+ ( entry_ptr->header.is_pinned != check[i].is_pinned ) ||
+ ( entry_ptr->deserialized != check[i].expected_deserialized ) ||
+ ( entry_ptr->serialized != check[i].expected_serialized ) ||
+ ( entry_ptr->destroyed != check[i].expected_destroyed ) ) {
#if 0 /* This is useful debugging code. Lets keep it around for a while. */
- if(entry_ptr->size != check[i].expected_size) {
- HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n",
- (int)(entry_ptr->size),
- (int)(check[i].expected_size));
- }
- if((!entry_ptr->header.destroy_in_progress) &&
- (check[i].in_cache) &&
- (entry_ptr->header.size != check[i].expected_size)) {
- HDfprintf(stdout,
+ if ( entry_ptr->size != check[i].expected_size ) {
+
+ HDfprintf(stdout, "entry_ptr->size (expected) = %d (%d).\n",
+ (int)(entry_ptr->size),
+ (int)(check[i].expected_size));
+ }
+
+ if ( ( ! entry_ptr->header.destroy_in_progress ) &&
+ ( check[i].in_cache ) &&
+ ( entry_ptr->header.size != check[i].expected_size ) ) {
+
+ HDfprintf(stdout,
"(!destroy in progress and in cache and size (expected) = %d (%d).\n",
(int)(entry_ptr->header.size),
- (int)(check[i].expected_size));
- }
- if(entry_ptr->at_main_addr != check[i].at_main_addr) {
- HDfprintf(stdout, "(%d,%d) at main addr (expected) = %d (%d).\n",
- (int)(check[i].entry_type),
- (int)(check[i].entry_index),
+ (int)(check[i].expected_size));
+ }
+
+ if ( entry_ptr->at_main_addr != check[i].at_main_addr ) {
+
+ HDfprintf(stdout,
+ "(%d,%d) at main addr (expected) = %d (%d).\n",
+ (int)(check[i].entry_type),
+ (int)(check[i].entry_index),
(int)(entry_ptr->at_main_addr),
- (int)(check[i].at_main_addr));
+ (int)(check[i].at_main_addr));
+ }
+
+ if ( entry_ptr->is_dirty != check[i].is_dirty ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->is_dirty (expected) = %d (%d).\n",
+ (int)(entry_ptr->is_dirty),
+ (int)(check[i].is_dirty));
+ }
+
+ if ( entry_ptr->header.is_dirty != check[i].is_dirty ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->header.is_dirty (expected) = %d (%d).\n",
+ (int)(entry_ptr->header.is_dirty),
+ (int)(check[i].is_dirty));
+ }
+
+ if ( entry_ptr->is_protected != check[i].is_protected ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->is_protected (expected) = %d (%d).\n",
+ (int)(entry_ptr->is_protected),
+ (int)(check[i].is_protected));
+ }
+
+ if ( entry_ptr->header.is_protected != check[i].is_protected ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->header.is_protected (expected) = %d (%d).\n",
+ (int)(entry_ptr->is_protected),
+ (int)(check[i].is_protected));
+ }
+
+ if ( entry_ptr->is_pinned != check[i].is_pinned ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->is_pinned (expected) = %d (%d).\n",
+ (int)(entry_ptr->is_pinned),
+ (int)(check[i].is_pinned));
+ }
+
+ if ( entry_ptr->header.is_pinned != check[i].is_pinned ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->header.is_pinned (expected) = %d (%d).\n",
+ (int)(entry_ptr->header.is_pinned),
+ (int)(check[i].is_pinned));
+ }
+
+ if ( entry_ptr->deserialized != check[i].expected_deserialized ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->deserialized (expected) = %d (%d).\n",
+ (int)(entry_ptr->deserialized),
+ (int)(check[i].expected_deserialized));
+ }
+
+ if ( entry_ptr->serialized != check[i].expected_serialized ) {
+
+ HDfprintf(stdout,
+ "entry_ptr->serialized (expected) = %d (%d).\n",
+ (int)(entry_ptr->serialized),
+ (int)(check[i].expected_serialized));
+ }
+
+ if ( entry_ptr->destroyed != check[i].expected_destroyed ) {
+
+ HDfprintf(stdout, \
+ "entry_ptr->destroyed (expected) = %d (%d).\n",
+ (int)(entry_ptr->destroyed),
+ (int)(check[i].expected_destroyed));
}
- if(entry_ptr->is_dirty != check[i].is_dirty) {
- HDfprintf(stdout, "entry_ptr->is_dirty (expected) = %d (%d).\n",
- (int)(entry_ptr->is_dirty),
- (int)(check[i].is_dirty));
- }
- if(entry_ptr->header.is_dirty != check[i].is_dirty) {
- HDfprintf(stdout, "entry_ptr->header.is_dirty (expected) = %d (%d).\n",
- (int)(entry_ptr->header.is_dirty),
- (int)(check[i].is_dirty));
- }
- if(entry_ptr->is_protected != check[i].is_protected) {
- HDfprintf(stdout, "entry_ptr->is_protected (expected) = %d (%d).\n",
- (int)(entry_ptr->is_protected),
- (int)(check[i].is_protected));
- }
- if(entry_ptr->header.is_protected != check[i].is_protected) {
- HDfprintf(stdout, "entry_ptr->header.is_protected (expected) = %d (%d).\n",
- (int)(entry_ptr->is_protected),
- (int)(check[i].is_protected));
- }
- if(entry_ptr->is_pinned != check[i].is_pinned) {
- HDfprintf(stdout, "entry_ptr->is_pinned (expected) = %d (%d).\n",
- (int)(entry_ptr->is_pinned),
- (int)(check[i].is_pinned));
- }
- if(entry_ptr->header.is_pinned != check[i].is_pinned) {
- HDfprintf(stdout, "entry_ptr->header.is_pinned (expected) = %d (%d).\n",
- (int)(entry_ptr->header.is_pinned),
- (int)(check[i].is_pinned));
- }
- if(entry_ptr->deserialized !=
- check[i].expected_deserialized) {
- HDfprintf(stdout,
- "entry_ptr->deserialized (expected) = %d (%d).\n",
- (int)(entry_ptr->deserialized),
- (int)(check[i].expected_deserialized));
- }
- if(entry_ptr->serialized != check[i].expected_serialized) {
- HDfprintf(stdout,
- "entry_ptr->serialized (expected) = %d (%d).\n",
- (int)(entry_ptr->serialized),
- (int)(check[i].expected_serialized));
- }
- if(entry_ptr->destroyed != check[i].expected_destroyed) {
- HDfprintf(stdout, "entry_ptr->destroyed (expected) = %d (%d).\n",
- (int)(entry_ptr->destroyed),
- (int)(check[i].expected_destroyed));
- }
#endif
pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Check2 failed on entry %d after flush op test #%d.",
i, test_num);
failure_mssg = msg;
- }
- i++;
+ }
+ i++;
}
}
- if(pass) {
+ if ( pass ) {
- if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
+ if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 )
&&
- ((cache_ptr->index_len != expected_index_len)
+ ( ( cache_ptr->index_len != expected_index_len )
||
- (cache_ptr->index_size != expected_index_size)
- )
- )
+ ( cache_ptr->index_size != expected_index_size )
+ )
+ )
||
- (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
+ ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
&&
- ((cache_ptr->index_len != 0)
+ ( ( cache_ptr->index_len != 0 )
||
- (cache_ptr->index_size != 0)
- )
- )
- ) {
+ ( cache_ptr->index_size != 0 )
+ )
+ )
+ ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -9561,20 +9606,19 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
/* clean up the cache to prep for the next test */
if(pass) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg.")
- if(result < 0) {
+ if ( ! pass ) {
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Flush failed on cleanup in flush op test #%d.",
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->clean_index_size != 0) ||
- (cache_ptr->dirty_index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( cache_ptr->clean_index_size != 0 ) ||
+ ( cache_ptr->dirty_index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -9586,12 +9630,12 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
i = 0;
- while(pass && (i < spec_size))
- {
- base_addr = entries[spec[i].entry_type];
- entry_ptr = &(base_addr[spec[i].entry_index]);
+ while ( pass && ( i < spec_size ) ) {
+
+ base_addr = entries[spec[i].entry_type];
+ entry_ptr = &(base_addr[spec[i].entry_index]);
- entry_ptr->size = entry_sizes[spec[i].entry_type];
+ entry_ptr->size = entry_sizes[spec[i].entry_type];
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
@@ -9601,12 +9645,12 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
}
i = 0;
- while(pass && (i < check_size))
- {
- base_addr = entries[check[i].entry_type];
- entry_ptr = &(base_addr[check[i].entry_index]);
+ while ( pass && ( i < check_size ) ) {
+
+ base_addr = entries[check[i].entry_type];
+ entry_ptr = &(base_addr[check[i].entry_index]);
- entry_ptr->size = entry_sizes[check[i].entry_type];
+ entry_ptr->size = entry_sizes[check[i].entry_type];
entry_ptr->deserialized = FALSE;
entry_ptr->serialized = FALSE;
@@ -9623,22 +9667,28 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr,
/*-------------------------------------------------------------------------
* Function: check_flush_cache__flush_op_eviction_test()
*
- * Purpose: Verify that flush operations work as expected when an
+ * Purpose: Verify that flush operations work as expected when an
* entry is evicted.
*
* Do nothing if pass is FALSE on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 10/3/06
*
* Modifications:
*
- * Updated test for minor changes in the behaviour
- * of H5C__flush_single_entry().
+ * Updated test for minor changes in the behaviour
+ * of H5C__flush_single_entry().
+ *
+ * JRM -- 2/16/15
*
- * JRM -- 2/16/15
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/16/20
*
*-------------------------------------------------------------------------
*/
@@ -9651,7 +9701,6 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
int num_variable_entries = 10;
int num_monster_entries = 31;
int num_large_entries = 0;
- herr_t result;
test_entry_t * entry_ptr;
test_entry_t * base_addr;
struct expected_entry_status expected[10 + 31 + 14] =
@@ -10840,15 +10889,12 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr)
if(pass) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "Cache flush invalidate failed after flush op eviction test")
- if(result < 0) {
-
- pass = FALSE;
- failure_mssg = "Cache flush invalidate failed after flush op eviction test";
- }
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ if ( ( pass ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
@@ -12493,15 +12539,21 @@ check_flush_cache__single_entry(H5F_t * file_ptr)
/*-------------------------------------------------------------------------
* Function: check_flush_cache__single_entry_test()
*
- * Purpose: Run a single entry flush cache test.
+ * Purpose: Run a single entry flush cache test.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 1/12/05
*
* Modifications:
*
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
+ *
*-------------------------------------------------------------------------
*/
@@ -12519,7 +12571,6 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
{
H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
- herr_t result;
test_entry_t * base_addr;
test_entry_t * entry_ptr = NULL;
@@ -12531,8 +12582,8 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -12540,8 +12591,10 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) ||
- (entry_idx < 0) || (entry_idx > max_indices[entry_type])) {
+ else if ( ( entry_type < 0 ) ||
+ ( entry_type >= NUMBER_OF_ENTRY_TYPES ) ||
+ ( entry_idx < 0 ) ||
+ ( entry_idx > max_indices[entry_type] ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -12569,19 +12622,20 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
if(pass) {
- result = H5C_flush_cache(file_ptr, flush_flags);
+ H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure mssg.")
- if(result < 0) {
+ if ( ! pass ) { /* construct and set actual failure message */
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"flush with flags 0x%x failed in single entry test #%d.",
flush_flags, test_num);
+
failure_mssg = msg;
}
- else if((entry_ptr->deserialized != expected_deserialized) ||
- (entry_ptr->serialized != expected_serialized) ||
- (entry_ptr->destroyed != expected_destroyed)) {
+ else if ( ( entry_ptr->deserialized != expected_deserialized ) ||
+ ( entry_ptr->serialized != expected_serialized ) ||
+ ( entry_ptr->destroyed != expected_destroyed ) ) {
+
#if 0 /* This is useful debugging code -- lets keep it for a while */
HDfprintf(stdout,
@@ -12599,22 +12653,22 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
+ else if ( ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
&&
- ((cache_ptr->index_len != 1)
+ ( ( cache_ptr->index_len != 1 )
||
- (cache_ptr->index_size != entry_sizes[entry_type])
- )
- )
+ ( cache_ptr->index_size != entry_sizes[entry_type] )
+ )
+ )
||
- (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
+ ( ( (flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
&&
- ((cache_ptr->index_len != 0)
+ ( ( cache_ptr->index_len != 0 )
||
- (cache_ptr->index_size != 0)
- )
- )
- ) {
+ ( cache_ptr->index_size != 0 )
+ )
+ )
+ ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -12628,18 +12682,18 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
/* clean up the cache to prep for the next test */
if(pass) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "dummy failure mssg.")
- if(result < 0) {
+ if ( ! pass ) { /* construct and set actual failure message */
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Flush failed on cleanup in single entry test #%d.",
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -12663,22 +12717,27 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr,
/*-------------------------------------------------------------------------
* Function: check_flush_cache__pinned_single_entry_test()
*
- * Purpose: Run a pinned single entry flush cache test.
+ * Purpose: Run a pinned single entry flush cache test.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 3/28/06
*
* Modifications:
*
- * JRM -- 5/17/06
- * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned
- * flags and supporting code to allow us to test the
- * H5C_mark_entry_dirty() call. Use the
- * call to mark the entry dirty while the entry is protected
- * if pop_mark_dirty_prot is TRUE, and to mark the entry
- * dirty while it is pinned if pop_mark_dirty_pinned is TRUE.
+ * JRM -- 5/17/06
+ * Added the pop_mark_dirty_prot and pop_mark_dirty_pinned
+ * flags and supporting code to allow us to test the
+ * H5C_mark_entry_dirty() call. Use the
+ * call to mark the entry dirty while the entry is protected
+ * if pop_mark_dirty_prot is TRUE, and to mark the entry
+ * dirty while it is pinned if pop_mark_dirty_pinned is TRUE.
+ *
+ * JRM -- 5/14/20
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
*
*-------------------------------------------------------------------------
*/
@@ -12689,10 +12748,10 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
int entry_type,
int entry_idx,
hbool_t unprot_dirty_flag,
- hbool_t mark_dirty,
- hbool_t pop_mark_dirty_prot,
- hbool_t pop_mark_dirty_pinned,
- hbool_t unprotect_unpin,
+ hbool_t mark_dirty,
+ hbool_t pop_mark_dirty_prot,
+ hbool_t pop_mark_dirty_pinned,
+ hbool_t unprotect_unpin,
unsigned int flags,
unsigned int flush_flags,
hbool_t expected_serialized,
@@ -12701,7 +12760,6 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
H5C_t * cache_ptr = file_ptr->shared->cache;
static char msg[128];
hbool_t expected_deserialized = TRUE;
- herr_t result;
test_entry_t * base_addr;
test_entry_t * entry_ptr = NULL;
@@ -12713,8 +12771,8 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -12722,7 +12780,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) ||
+ else if ( (entry_type < 0) || (entry_type >= NUMBER_OF_ENTRY_TYPES) ||
(entry_idx < 0) || (entry_idx > max_indices[entry_type])) {
pass = FALSE;
@@ -12739,41 +12797,41 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
protect_entry(file_ptr, entry_type, entry_idx);
- if(pop_mark_dirty_prot) {
+ if(pop_mark_dirty_prot) {
- mark_entry_dirty(entry_type, entry_idx);
- }
+ mark_entry_dirty(entry_type, entry_idx);
+ }
unprotect_entry(file_ptr, entry_type, entry_idx,
(unprot_dirty_flag ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) |
(flags | H5C__PIN_ENTRY_FLAG));
- if(mark_dirty) {
+ if(mark_dirty) {
mark_entry_dirty(entry_type, entry_idx);
- }
+ }
- if(pop_mark_dirty_pinned) {
+ if(pop_mark_dirty_pinned) {
- mark_entry_dirty(entry_type, entry_idx);
- }
+ mark_entry_dirty(entry_type, entry_idx);
+ }
}
if(pass) {
- result = H5C_flush_cache(file_ptr, flush_flags);
+ H5C_FLUSH_CACHE(file_ptr, flush_flags, "dummy failure message\n")
- if(result < 0) {
+ if ( ! pass ) { /* construct and set the correct failure message */
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"flush with flags 0x%x failed in pinned single entry test #%d.",
- flush_flags, test_num);
+ flush_flags, test_num);
failure_mssg = msg;
}
- else if((entry_ptr->deserialized != expected_deserialized) ||
- (entry_ptr->serialized != expected_serialized) ||
- (entry_ptr->destroyed != expected_destroyed)) {
+ else if ( ( entry_ptr->deserialized != expected_deserialized ) ||
+ ( entry_ptr->serialized != expected_serialized ) ||
+ ( entry_ptr->destroyed != expected_destroyed ) ) {
+
#if 0 /* this is useful debugging code -- keep it around */
HDfprintf(stdout,
"desrlzd = %d(%d), srlzd = %d(%d), dest = %d(%d)\n",
@@ -12790,22 +12848,22 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
test_num);
failure_mssg = msg;
}
- else if((((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0)
+ else if ( ( ( ( flush_flags & H5C__FLUSH_INVALIDATE_FLAG) == 0 )
&&
- ((cache_ptr->index_len != 1)
+ ( ( cache_ptr->index_len != 1 )
||
- (cache_ptr->index_size != entry_sizes[entry_type])
- )
- )
+ ( cache_ptr->index_size != entry_sizes[entry_type] )
+ )
+ )
||
- (((flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0)
+ ( ( ( flush_flags & H5C__FLUSH_INVALIDATE_FLAG) != 0 )
&&
- ((cache_ptr->index_len != 0)
+ ( ( cache_ptr->index_len != 0 )
||
- (cache_ptr->index_size != 0)
- )
- )
- ) {
+ ( cache_ptr->index_size != 0 )
+ )
+ )
+ ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -12836,18 +12894,17 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr,
if(pass) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, "dummy mssg\n")
- if(result < 0) {
+ if ( ! pass ) {
- pass = FALSE;
HDsnprintf(msg, (size_t)128,
"Flush failed on cleanup in pinned single entry test #%d.",
test_num);
failure_mssg = msg;
}
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ else if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128,
@@ -14233,14 +14290,20 @@ check_pin_protected_entry(unsigned paged)
/*-------------------------------------------------------------------------
* Function: check_resize_entry()
*
- * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize
- * entries as expected.
- *
- * Return: void
+ * Purpose: Verify that H5C_resize_entry() and H5C_unprotect() resize
+ * entries as expected.
+ *
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 7/7/06
*
+ * Modifications:
+ *
+ * Updated function to allow for disabling of the slist.
+ *
+ * JRM -- 5/18/20
+ *
*-------------------------------------------------------------------------
*/
@@ -14421,16 +14484,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2)) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2))) {
+ if ( ( cache_ptr->index_len != 1 ) ||
+ ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 2) ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 2) ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 3.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -14506,16 +14569,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) {
+ if ( ( cache_ptr->index_len != 1 ) ||
+ ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != LARGE_ENTRY_SIZE ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 4.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -14574,16 +14637,17 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4)) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4))) {
+ if ( ( cache_ptr->index_len != 1 ) ||
+ ( cache_ptr->index_size != (LARGE_ENTRY_SIZE / 4) ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != (LARGE_ENTRY_SIZE / 4) ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 5.");
failure_mssg = msg;
- }
+ }
}
if(pass) {
@@ -14634,16 +14698,17 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 1) ||
- (cache_ptr->index_size != LARGE_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) {
+ if ( ( cache_ptr->index_len != 1 ) ||
+ ( cache_ptr->index_size != LARGE_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 6.");
failure_mssg = msg;
- }
+ }
}
if(pass) {
@@ -14719,16 +14784,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0)) {
+ if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 0 ) ||
+ ( cache_ptr->slist_size != 0) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 7.");
failure_mssg = msg;
-
- }
+ }
}
@@ -14736,19 +14801,20 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0)) {
+ if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 0 ) ||
+ ( cache_ptr->slist_size != 0) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 8.");
failure_mssg = msg;
+ }
- }
base_addr = entries[LARGE_ENTRY_TYPE];
entry_ptr = &(base_addr[3]);
- entry_size = LARGE_ENTRY_SIZE;
+ entry_size = LARGE_ENTRY_SIZE;
}
if(pass) {
@@ -14766,17 +14832,17 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 3) ||
- (cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) {
-
+ if ( ( cache_ptr->index_len != 3 ) ||
+ ( cache_ptr->index_size != 3 * LARGE_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 9.");
failure_mssg = msg;
- }
+ }
}
if(pass) {
@@ -14787,10 +14853,11 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) {
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1) ||
+ ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
pass = FALSE;
@@ -14866,18 +14933,18 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size !=
- ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2))) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size !=
- (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)))) {
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size !=
+ ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 2)) ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size !=
+ (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 2)) ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 11.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -14953,16 +15020,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE)) {
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size != 4 * LARGE_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size != 2 * LARGE_ENTRY_SIZE ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 12.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -15021,18 +15088,18 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size !=
- ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4))) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size !=
- (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)))) {
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size !=
+ ((3 * LARGE_ENTRY_SIZE) + (LARGE_ENTRY_SIZE / 4)) ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size !=
+ (LARGE_ENTRY_SIZE + (LARGE_ENTRY_SIZE / 4)) ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 13.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -15083,16 +15150,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 4) ||
- (cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE))) {
+ if ( ( cache_ptr->index_len != 4 ) ||
+ ( cache_ptr->index_size != (4 * LARGE_ENTRY_SIZE) ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size != (2 * LARGE_ENTRY_SIZE)) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 14.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -15168,16 +15235,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 3) ||
- (cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE)) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != LARGE_ENTRY_SIZE)) {
+ if ( ( cache_ptr->index_len != 3 ) ||
+ ( cache_ptr->index_size != (3 * LARGE_ENTRY_SIZE) ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != LARGE_ENTRY_SIZE) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 15.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -15195,16 +15262,16 @@ check_resize_entry(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0)) {
+ if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 0 ) ||
+ ( cache_ptr->slist_size != 0 ) ) ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 16.");
failure_mssg = msg;
-
- }
+ }
}
if(pass) {
@@ -15228,16 +15295,19 @@ check_resize_entry(unsigned paged)
/*-------------------------------------------------------------------------
* Function: check_evictions_enabled()
*
- * Purpose: Verify that H5C_get_evictions_enabled() and
- * H5C_set_evictions_enabled() functions perform as expected.
+ * Purpose: Verify that H5C_get_evictions_enabled() and
+ * H5C_set_evictions_enabled() functions perform as expected.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 8/2/07
*
* Modifications:
*
+ * Updated function to allow for disabling of the slist.
+ *
+ * JRM -- 5/18/20
*
*-------------------------------------------------------------------------
*/
@@ -15331,17 +15401,17 @@ check_evictions_enabled(unsigned paged)
/* verify that it is empty */
if(pass) {
- if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0) ||
- (cache_ptr->evictions_enabled != TRUE)) {
+ if ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 0 ) ||
+ ( cache_ptr->slist_size != 0 ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 1.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 3 */
@@ -15383,18 +15453,17 @@ check_evictions_enabled(unsigned paged)
/* verify that the cache is full */
if(pass) {
- if((cache_ptr->index_len != 16) ||
- (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0) ||
- (cache_ptr->evictions_enabled != TRUE)) {
-
+ if ( ( cache_ptr->index_len != 16 ) ||
+ ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 0 ) ||
+ ( cache_ptr->slist_size != 0 ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 2.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 6 */
@@ -15416,17 +15485,17 @@ check_evictions_enabled(unsigned paged)
/* verify that an entry has been evicted */
if(pass) {
- if((cache_ptr->index_len != 16) ||
- (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 0) ||
- (cache_ptr->slist_size != 0) ||
- (cache_ptr->evictions_enabled != TRUE)) {
+ if ( ( cache_ptr->index_len != 16 ) ||
+ ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 0 ) ||
+ ( cache_ptr->slist_size != 0 ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 3.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 8 */
@@ -15483,17 +15552,17 @@ check_evictions_enabled(unsigned paged)
/* verify that another entry has been evicted */
if(pass) {
- if((cache_ptr->index_len != 16) ||
- (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != TRUE)) {
+ if ( ( cache_ptr->index_len != 16 ) ||
+ ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 4.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 11 */
@@ -15555,17 +15624,17 @@ check_evictions_enabled(unsigned paged)
/* verify that evictions are disabled */
if(pass) {
- if((cache_ptr->index_len != 16) ||
- (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != FALSE)) {
+ if ( ( cache_ptr->index_len != 16 ) ||
+ ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != FALSE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 5.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 14 */
@@ -15587,17 +15656,17 @@ check_evictions_enabled(unsigned paged)
/* verify that no entry has been evicted */
if(pass) {
- if((cache_ptr->index_len != 17) ||
- (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 1) ||
- (cache_ptr->slist_size != MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != FALSE)) {
+ if ( ( cache_ptr->index_len != 17 ) ||
+ ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 1 ) ||
+ ( cache_ptr->slist_size != MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != FALSE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 6.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 16 */
@@ -15618,17 +15687,17 @@ check_evictions_enabled(unsigned paged)
/* verify that no entry has been evicted */
if(pass) {
- if((cache_ptr->index_len != 18) ||
- (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != FALSE)) {
+ if ( ( cache_ptr->index_len != 18 ) ||
+ ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != FALSE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 7.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 18 */
@@ -15667,17 +15736,17 @@ check_evictions_enabled(unsigned paged)
/* verify that no entries have been evicted */
if(pass) {
- if((cache_ptr->index_len != 18) ||
- (cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != TRUE)) {
+ if ( ( cache_ptr->index_len != 18 ) ||
+ ( cache_ptr->index_size != 18 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 8.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 21 */
@@ -15702,17 +15771,17 @@ check_evictions_enabled(unsigned paged)
if(pass) {
- if((cache_ptr->index_len != 16) ||
- (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != TRUE)) {
+ if ( ( cache_ptr->index_len != 16 ) ||
+ ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 9.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 23 */
@@ -15823,17 +15892,17 @@ check_evictions_enabled(unsigned paged)
/* verify that the cache has grown */
if(pass) {
- if((cache_ptr->index_len != 17) ||
- (cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 2) ||
- (cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != FALSE)) {
+ if ( ( cache_ptr->index_len != 17 ) ||
+ ( cache_ptr->index_size != 17 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 2 ) ||
+ ( cache_ptr->slist_size != 2 * MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != FALSE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 10.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 28 */
@@ -15871,17 +15940,17 @@ check_evictions_enabled(unsigned paged)
/* verify that the cache has returned to its maximum size */
if(pass) {
- if((cache_ptr->index_len != 16) ||
- (cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->slist_len != 3) ||
- (cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE) ||
- (cache_ptr->evictions_enabled != TRUE)) {
+ if ( ( cache_ptr->index_len != 16 ) ||
+ ( cache_ptr->index_size != 16 * MONSTER_ENTRY_SIZE ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->slist_len != 3 ) ||
+ ( cache_ptr->slist_size != 3 * MONSTER_ENTRY_SIZE ) ) ) ||
+ ( cache_ptr->evictions_enabled != TRUE ) ) {
pass = FALSE;
HDsnprintf(msg, (size_t)128, "Unexpected cache status 11.");
failure_mssg = msg;
-
- }
+ }
}
if(show_progress) /* 31 */
@@ -15964,17 +16033,22 @@ check_evictions_enabled(unsigned paged)
/*-------------------------------------------------------------------------
* Function: check_flush_protected_err()
+ *
+ * Purpose: Verify that an attempt to flush the cache when it contains
+ * a protected entry will generate an error.
*
- * Purpose: Verify that an attempt to flush the cache when it contains
- * a protected entry will generate an error.
- *
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 6/24/04
*
* Modifications:
*
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache().
+ *
+ * JRM -- 5/14/20
+ *
*-------------------------------------------------------------------------
*/
@@ -15982,6 +16056,7 @@ static unsigned
check_flush_protected_err(unsigned paged)
{
H5F_t * file_ptr = NULL;
+ H5C_t * cache_ptr = NULL;
if(paged)
TESTING("flush cache with protected entry error (paged aggregation)")
@@ -16001,27 +16076,45 @@ check_flush_protected_err(unsigned paged)
file_ptr = setup_cache((size_t)(2 * 1024), (size_t)(1 * 1024), paged);
+ if ( pass ) {
+
+ cache_ptr = file_ptr->shared->cache;
+ }
+
protect_entry(file_ptr, 0, 0);
- if(H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0) {
+ /* enable slist prior to flush */
+ if ( ( pass ) &&
+ ( H5C_set_slist_enabled(cache_ptr, TRUE, FALSE) < 0 ) ) {
pass = FALSE;
- failure_mssg = "flush succeeded on cache with protected entry.\n";
+ failure_mssg = "unable to enable slist prior to flush.\n";
+ }
- } else {
+ if ( ( pass ) &&
+ ( H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) >= 0 ) ) {
- unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG);
+ pass = FALSE;
+ failure_mssg = "flush succeeded on cache with protected entry.\n";
+ }
- if(H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET) < 0) {
+ /* disable the slist after the flush */
+ if ( ( pass ) &&
+ ( H5C_set_slist_enabled(cache_ptr, FALSE, FALSE) < 0 ) ) {
- pass = FALSE;
- failure_mssg = "flush failed after unprotect.\n";
+ pass = FALSE;
+ failure_mssg = "unable to disable slist after flush.\n";
+ }
- } else {
+ unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG);
- takedown_cache(file_ptr, FALSE, FALSE);
- }
+ if ( pass ) {
+
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \
+ "flush failed after unprotect.\n")
}
+
+ takedown_cache(file_ptr, FALSE, FALSE);
}
if(pass) { PASSED(); } else { H5_FAILED(); }
@@ -17075,12 +17168,12 @@ check_move_entry_errs(unsigned paged)
/*-------------------------------------------------------------------------
* Function: check_resize_entry_errs()
*
- * Purpose: Verify that invalid calls to H5C_resize_entry()
- * generates errors as expected.
+ * Purpose: Verify that invalid calls to H5C_resize_entry()
+ * generates errors as expected.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 7/7/06
*
*-------------------------------------------------------------------------
@@ -17135,9 +17228,9 @@ check_resize_entry_errs(unsigned paged)
} else {
- unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
+ unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG);
- }
+ }
}
if(pass) {
@@ -17152,9 +17245,9 @@ check_resize_entry_errs(unsigned paged)
} else {
- unpin_entry(0, 0);
+ unpin_entry(0, 0);
- }
+ }
}
if(pass) {
@@ -28146,7 +28239,6 @@ check_auto_cache_resize_aux_fcns(unsigned paged)
* Return: void
*
* Programmer: Mike McGreevy
- * <mamcgree@hdfgroup.org>
* 12/16/08
*
* Modifications:
@@ -30952,13 +31044,21 @@ done:
/*-------------------------------------------------------------------------
* Function: check_flush_deps_order()
*
- * Purpose: Verify that the order that entries with flush dependencies
+ * Purpose: Verify that the order that entries with flush dependencies
* is correct
*
- * Return: 0 on success, non-zero on failure
+ * Return: 0 on success, non-zero on failure
+ *
+ * Programmer: Quincey Koziol
+ * 3/17/09
*
- * Programmer: Quincey Koziol
- * 3/17/09
+ * Modifications:
+ *
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
*
*-------------------------------------------------------------------------
*/
@@ -31049,8 +31149,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31065,8 +31163,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -31144,8 +31242,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31171,8 +31267,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -31251,8 +31347,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31283,8 +31377,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -31370,8 +31464,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31402,8 +31494,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -31529,8 +31621,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31578,8 +31668,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -31739,8 +31829,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31788,8 +31876,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -31904,8 +31992,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -31946,8 +32032,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -32038,8 +32124,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -32080,8 +32164,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -32221,8 +32305,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -32273,8 +32355,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -32458,8 +32540,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -32512,8 +32592,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -32715,8 +32795,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -32769,8 +32847,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -33007,8 +33085,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -33056,8 +33132,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -33323,8 +33399,6 @@ check_flush_deps_order(unsigned paged)
/* Flush the cache and verify that the entries were flushed in correct order */
{
- herr_t result; /* Generic return value */
-
add_flush_op(entry_type, 0, FLUSH_OP__ORDER,
entry_type, 0, FALSE, (size_t)0, &flush_order);
add_flush_op(entry_type, 1, FLUSH_OP__ORDER,
@@ -33372,8 +33446,8 @@ check_flush_deps_order(unsigned paged)
/* Reset index for tracking flush order */
flush_order = 0;
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
- if(result < 0) CACHE_ERROR("flushing entries with flush dependendices")
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, "dummy mssg")
+ if(!pass) CACHE_ERROR("flushing entries with flush dependendices")
/* Change expected values, and verify the status of the entries
* after destroy flush dependency
@@ -34551,30 +34625,35 @@ check_entry_deletions_during_scans(unsigned paged)
/*-------------------------------------------------------------------------
+ *
* Function: cedds__expunge_dirty_entry_in_flush_test()
*
- * Purpose: Verify that H5C_flush_cache() can handle the removal of
- * a dirty entry from the cache during its scan of the
- * skip list.
+ * Purpose: Verify that H5C_flush_cache() can handle the removal of
+ * a dirty entry from the cache during its scan of the
+ * skip list.
*
- * Do this by setting up a full cache, with the last entry
- * on the LRU being both dirty and having a flush operation
- * that deletes the second to last entry on the LRU. Then
- * flush the cache, triggering the flush of the last
- * item, and thereby the deletion of the second to last item.
+ * Do this by setting up a full cache, with the last entry
+ * on the LRU being both dirty and having a flush operation
+ * that deletes the second to last entry on the LRU. Then
+ * flush the cache, triggering the flush of the last
+ * item, and thereby the deletion of the second to last item.
*
- * H5C_flush_cache() should handle this deletion gracefully.
+ * H5C_flush_cache() should handle this deletion gracefully.
*
* Do nothing if pass is FALSE on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/4/15
*
* Modifications:
*
- * None.
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
*
*-------------------------------------------------------------------------
*/
@@ -34584,7 +34663,6 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
{
H5C_t * cache_ptr = file_ptr->shared->cache;
int i;
- herr_t result;
struct expected_entry_status expected[36] =
{
/* the expected array is used to maintain a table of the expected status of every
@@ -34681,44 +34759,41 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
}
- if(pass) {
+ if ( pass ) {
- /* to summarize, at present the following entries
- * are in cache with the following characteristics:
- *
- * in
- * entry: cache? size: dirty? pinned? pins: flush operations:
- *
- * (HET, 0) Y 16 KB Y N - expunge (HET 1)
- *
- * (HET, 1) Y 16 KB Y N - -
+ /* to summarize, at present the following entries
+ * are in cache with the following characteristics:
*
- * (HET, 2) Y 16 KB Y N - -
+ * in
+ * entry: cache? size: dirty? pinned? pins: flush operations:
*
- * (HET, 3) Y 16 KB Y N - -
- *
- * Recall that in this test bed, flush operations are excuted the
- * first time the associated entry is flushed, and are then
- * deleted.
- */
+ * (HET, 0) Y 16 KB Y N - expunge (HET 1)
+ *
+ * (HET, 1) Y 16 KB Y N - -
+ *
+ * (HET, 2) Y 16 KB Y N - -
+ *
+ * (HET, 3) Y 16 KB Y N - -
+ *
+ * Recall that in this test bed, flush operations are excuted the
+ * first time the associated entry is flushed, and are then
+ * deleted.
+ */
- /* verify the expected status of all entries we have loaded to date: */
- verify_entry_status(cache_ptr, 0, 4, expected);
+ /* verify the expected status of all entries we have loaded to date: */
+ verify_entry_status(cache_ptr, 0, 4, expected);
}
/* flush the cache to run the test. In the process, clean up after test. */
- if(pass) {
-
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ if ( pass ) {
- if(result < 0) {
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "Cache flush inval failed in cedds expunge dirty entry in flush test")
- pass = FALSE;
- failure_mssg = "Cache flush invalidate failed in cedds expunge dirty entry in flush test";
- }
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ if ( ( pass ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache len/size after cedds expunge dirty entry in flush test";
@@ -34730,7 +34805,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
/* If we are collecting stats, check to see if we get the expected
* values.
*/
- if(pass)
+ if(pass)
if((cache_ptr->insertions[HUGE_ENTRY_TYPE] != 0) ||
(cache_ptr->pinned_insertions[HUGE_ENTRY_TYPE] != 0) ||
(cache_ptr->clears[HUGE_ENTRY_TYPE] != 1) ||
@@ -34778,30 +34853,34 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr)
/*-------------------------------------------------------------------------
* Function: cedds__H5C_make_space_in_cache()
*
- * Purpose: Verify that H5C__make_space_in_cache() can handle the
- * removal from the cache of the next item in its reverse scan
- * of the LRU list.
+ * Purpose: Verify that H5C__make_space_in_cache() can handle the
+ * removal from the cache of the next item in its reverse scan
+ * of the LRU list.
*
- * Do this by setting up a full cache, with the last entry
- * on the LRU being both dirty and having a flush operation
- * that deleted the second to last entry on the LRU. Then
- * load an additional entry, triggering the flush of the last
- * item, and thereby the deletion of the second to last item.
+ * Do this by setting up a full cache, with the last entry
+ * on the LRU being both dirty and having a flush operation
+ * that deleted the second to last entry on the LRU. Then
+ * load an additional entry, triggering the flush of the last
+ * item, and thereby the deletion of the second to last item.
*
- * H5C__make_space_in_cache() should detect this deletion, and
- * restart its scan of the LRU from the tail, instead of
- * examining the now deleted next item up on the LRU.
+ * H5C__make_space_in_cache() should detect this deletion, and
+ * restart its scan of the LRU from the tail, instead of
+ * examining the now deleted next item up on the LRU.
*
* Do nothing if pass is FALSE on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/4/15
*
* Modifications:
*
- * None.
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
*
*-------------------------------------------------------------------------
*/
@@ -34813,7 +34892,6 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
int i;
const int num_huge_entries = 4;
const int num_monster_entries = 32;
- herr_t result;
struct expected_entry_status expected[36] =
{
/* the expected array is used to maintain a table of the expected status of every
@@ -35060,17 +35138,14 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
/* flush the cache and end the test. */
- if(pass) {
+ if ( pass ) {
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "Cache flush invalidate failed after flush op eviction test")
- if(result < 0) {
-
- pass = FALSE;
- failure_mssg = "Cache flush invalidate failed after flush op eviction test";
- }
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ if ( ( pass ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
@@ -35159,30 +35234,34 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr)
/*-------------------------------------------------------------------------
* Function: cedds__H5C__autoadjust__ageout__evict_aged_out_entries()
*
- * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries()
- * can handle the removal from the cache of the next item in
- * its reverse scan of the LRU list.
+ * Purpose: Verify that H5C__autoadjust__ageout__evict_aged_out_entries()
+ * can handle the removal from the cache of the next item in
+ * its reverse scan of the LRU list.
*
- * Do this by setting up a full cache, with the last entry
- * on the LRU being both dirty and having a flush operation
- * that deletes the second to last entry on the LRU. Then
- * access the first item in the LRU repeatedly until the
- * item, and thereby the deletion of the second to last item.
+ * Do this by setting up a full cache, with the last entry
+ * on the LRU being both dirty and having a flush operation
+ * that deletes the second to last entry on the LRU. Then
+ * access the first item in the LRU repeatedly until the
+ * item, and thereby the deletion of the second to last item.
*
- * H5C__make_space_in_cache() should detect this deletion, and
- * restart its scan of the LRU from the tail, instead of
- * examining the now deleted next item up on the LRU.
+ * H5C__make_space_in_cache() should detect this deletion, and
+ * restart its scan of the LRU from the tail, instead of
+ * examining the now deleted next item up on the LRU.
*
* Do nothing if pass is FALSE on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/4/15
*
* Modifications:
*
- * None.
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
*
*-------------------------------------------------------------------------
*/
@@ -35496,17 +35575,14 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
/* flush the cache and end the test. */
- if(pass) {
-
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ if ( pass ) {
- if(result < 0) {
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "Cache flush invalidate failed after flush op eviction test")
- pass = FALSE;
- failure_mssg = "Cache flush invalidate failed after flush op eviction test";
- }
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ if ( ( pass ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
@@ -35569,91 +35645,95 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr)
/*-------------------------------------------------------------------------
* Function: cedds__H5C_flush_invalidate_cache__bucket_scan()
*
- * Purpose: Note: We now use the index list when we scan the
- * contents of the metadata cache, so in principal,
- * this test is obsolete. However, even using the
- * index list, restarts are possible, and must be
- * handled gracefully.
- *
- * As it turns out, this test triggers index list
- * scan restarts, and thus with minor changes is
- * still a useful test.
- *
- * For this reason, with the exception of changing
- * to check the index_scan_restart stat instead of
- * hash bucket restarts, I'm leaving the test
- * alone. If and when it starts to fail due to
- * other changes, we can re-work it to test
- * index list scan restarts explicitly.
- *
- * JRM -- 11/2/16
- *
- * Verify that H5C_flush_invalidate_cache() can handle
- * the removal from the cache of the next item in
- * its scans of hash buckets.
- *
- * !!!!!!!!!!WARNING !!!!!!!!!!
- *
- * This test may fail to function correctly if the hash
- * table size or hash function is altered.
- *
- * To setup the test, this function depends on the fact that
- * H5C_flush_invalidate_cache() does alternating scans of the
- * slist and the index. If this changes, the test will likely
- * also cease to function correctly.
- *
- * The test relies on a known hash function and hash table
- * size to select a set of test entries that will all hash
- * to the same hash bucket -- call it the test hash bucket.
- * It also relies on known behavior of the cache to place
- * the entries in the test bucket in a known order.
- *
- * To avoid pre-mature flushes of the entries in the
- * test hash bucket, all entries are initially clean,
- * with the exception of the first entry which is dirty.
- * It avoids premature flushing by being the parent in
- * a flush dependency. The first entry in the test bucket
- * also has a flush op which expunges the second entry --
- * setting up the failure.
- *
- * An additional dirty entry is added (which must hash
- * to a different bucket, and must have a higher address
- * than at least the first entry in the test hash bucket.
- * This entry is the child in a flush dependency with the
- * first entry in the above hash bucket, and contains
- * a flush op to destroy this flush dependency.
- *
- * Since the first entry in the test hash bucket has a lower
- * address that the other dirty entry, the scan of the
- * slist encounters it first, and passes over it because
- * it has a flush dependency height of 1.
- *
- * The scan then encounters the second dirty entry and flushes
- * it -- causing it to destroy the flush dependency and thus
- * reducing the flush dependency height of the first entry in
- * the test hash bucket to zero.
- *
- * After completing a scan of the slist,
- * H5C_flush_invalidate_cache() then scans the index,
- * flushing all entries of flush dependency height zero.
- *
- * This sets up the potential error when the first entry
- * in the test hash bucket is flushed -- expunging the
- * second entry as a side effect. If
- * H5C_flush_invalidate_cache() fails to detect this,
- * it will attempt to continue its scan of the bucket with
- * an entry that has been deleted from the cache.
+ * Purpose: Note: We now use the index list when we scan the
+ * contents of the metadata cache, so in principal,
+ * this test is obsolete. However, even using the
+ * index list, restarts are possible, and must be
+ * handled gracefully.
+ *
+ * As it turns out, this test triggers index list
+ * scan restarts, and thus with minor changes is
+ * still a useful test.
+ *
+ * For this reason, with the exception of changing
+ * to check the index_scan_restart stat instead of
+ * hash bucket restarts, I'm leaving the test
+ * alone. If and when it starts to fail due to
+ * other changes, we can re-work it to test
+ * index list scan restarts explicitly.
+ *
+ * JRM -- 11/2/16
+ *
+ * Verify that H5C_flush_invalidate_cache() can handle
+ * the removal from the cache of the next item in
+ * its scans of hash buckets.
+ *
+ * !!!!!!!!!!WARNING !!!!!!!!!!
+ *
+ * This test may fail to function correctly if the hash
+ * table size or hash function is altered.
+ *
+ * To setup the test, this function depends on the fact that
+ * H5C_flush_invalidate_cache() does alternating scans of the
+ * slist and the index. If this changes, the test will likely
+ * also cease to function correctly.
+ *
+ * The test relies on a known hash function and hash table
+ * size to select a set of test entries that will all hash
+ * to the same hash bucket -- call it the test hash bucket.
+ * It also relies on known behavior of the cache to place
+ * the entries in the test bucket in a known order.
+ *
+ * To avoid pre-mature flushes of the entries in the
+ * test hash bucket, all entries are initially clean,
+ * with the exception of the first entry which is dirty.
+ * It avoids premature flushing by being the parent in
+ * a flush dependency. The first entry in the test bucket
+ * also has a flush op which expunges the second entry --
+ * setting up the failure.
+ *
+ * An additional dirty entry is added (which must hash
+ * to a different bucket, and must have a higher address
+ * than at least the first entry in the test hash bucket.
+ * This entry is the child in a flush dependency with the
+ * first entry in the above hash bucket, and contains
+ * a flush op to destroy this flush dependency.
+ *
+ * Since the first entry in the test hash bucket has a lower
+ * address that the other dirty entry, the scan of the
+ * slist encounters it first, and passes over it because
+ * it has a flush dependency height of 1.
+ *
+ * The scan then encounters the second dirty entry and flushes
+ * it -- causing it to destroy the flush dependency and thus
+ * reducing the flush dependency height of the first entry in
+ * the test hash bucket to zero.
+ *
+ * After completing a scan of the slist,
+ * H5C_flush_invalidate_cache() then scans the index,
+ * flushing all entries of flush dependency height zero.
+ *
+ * This sets up the potential error when the first entry
+ * in the test hash bucket is flushed -- expunging the
+ * second entry as a side effect. If
+ * H5C_flush_invalidate_cache() fails to detect this,
+ * it will attempt to continue its scan of the bucket with
+ * an entry that has been deleted from the cache.
*
* Do nothing if pass is FALSE on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/9/15
*
* Modifications:
*
- * None.
+ * Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
*
*-------------------------------------------------------------------------
*/
@@ -35664,7 +35744,6 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
H5C_t * cache_ptr = file_ptr->shared->cache;
int i;
int expected_hash_bucket = 0;
- herr_t result;
haddr_t entry_addr;
test_entry_t * entry_ptr;
test_entry_t * base_addr = NULL;
@@ -35883,17 +35962,14 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr)
/* test setup complete -- flush the cache to run and end the test. */
- if(pass) {
-
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ if ( pass ) {
- if(result < 0) {
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "Cache flush invalidate failed after flush op eviction test")
- pass = FALSE;
- failure_mssg = "Cache flush invalidate failed after flush op eviction test";
- }
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ if ( ( pass ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache len/size after cleanup of flush op eviction test";
@@ -36036,26 +36112,34 @@ check_stats(unsigned paged)
/*-------------------------------------------------------------------------
* Function: check_stats__smoke_check_1()
*
- * Purpose: Test to see if the statistics collection code is working
- * more or less as expected. Do this by performing a number
- * of operations in the cache, and checking to verify that
- * they result in the expected statistics.
+ * Purpose: Test to see if the statistics collection code is working
+ * more or less as expected. Do this by performing a number
+ * of operations in the cache, and checking to verify that
+ * they result in the expected statistics.
*
- * Note that this function is not intended to be a full test
- * of the statistics collection facility -- only a cursory
- * check that will serve as a place holder until more complete
- * tests are implemented.
+ * Note that this function is not intended to be a full test
+ * of the statistics collection facility -- only a cursory
+ * check that will serve as a place holder until more complete
+ * tests are implemented.
*
* Do nothing if pass is FALSE on entry.
*
- * Return: void
+ * Return: void
*
- * Programmer: John Mainzer
+ * Programmer: John Mainzer
* 4/22/15
*
* Modifications:
*
- * None.
+ * Modified slist stats checks to allow for the case that
+ * the slist is disabled.
+ *
+ * Also added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via the
+ * H5C_FLUSH_CACHE macro.
+ *
+ * JRM -- 5/14/20
+ *
*
*-------------------------------------------------------------------------
*/
@@ -36063,9 +36147,8 @@ check_stats(unsigned paged)
static void
check_stats__smoke_check_1(H5F_t * file_ptr)
{
- H5C_t * cache_ptr = file_ptr->shared->cache;
+ H5C_t * cache_ptr = file_ptr->shared->cache;
int i;
- herr_t result;
if(pass) {
if(cache_ptr == NULL) {
@@ -36129,36 +36212,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(1).";
} /* end if */
- if(pass)
- if((cache_ptr->total_ht_insertions != 32) ||
- (cache_ptr->total_ht_deletions != 0) ||
- (cache_ptr->successful_ht_searches != 0) ||
- (cache_ptr->total_successful_ht_search_depth != 0) ||
- (cache_ptr->failed_ht_searches != 32) ||
- (cache_ptr->total_failed_ht_search_depth != 48) ||
- (cache_ptr->max_index_len != 32) ||
- (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_clean_index_size != 0) ||
- (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_slist_len != 32) ||
- (cache_ptr->max_slist_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_pl_len != 0) ||
- (cache_ptr->max_pl_size != 0) ||
- (cache_ptr->max_pel_len != 0) ||
- (cache_ptr->max_pel_size != 0) ||
- (cache_ptr->calls_to_msic != 0) ||
- (cache_ptr->total_entries_skipped_in_msic != 0) ||
- (cache_ptr->total_entries_scanned_in_msic != 0) ||
- (cache_ptr->max_entries_skipped_in_msic != 0) ||
- (cache_ptr->max_entries_scanned_in_msic != 0) ||
- (cache_ptr->entries_scanned_to_make_space != 0) ||
- (cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 0) ||
- (cache_ptr->index_scan_restarts != 0)) {
+ if ( pass ) {
+
+ if ( ( cache_ptr->total_ht_insertions != 32 ) ||
+ ( cache_ptr->total_ht_deletions != 0 ) ||
+ ( cache_ptr->successful_ht_searches != 0 ) ||
+ ( cache_ptr->total_successful_ht_search_depth != 0 ) ||
+ ( cache_ptr->failed_ht_searches != 32 ) ||
+ ( cache_ptr->total_failed_ht_search_depth != 48 ) ||
+ ( cache_ptr->max_index_len != 32 ) ||
+ ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
+ ( cache_ptr->max_clean_index_size != 0 ) ||
+ ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->max_slist_len != 32 ) ||
+ ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
+ ( cache_ptr->max_pl_len != 0 ) ||
+ ( cache_ptr->max_pl_size != 0 ) ||
+ ( cache_ptr->max_pel_len != 0 ) ||
+ ( cache_ptr->max_pel_size != 0 ) ||
+ ( cache_ptr->calls_to_msic != 0 ) ||
+ ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->total_entries_scanned_in_msic != 0 ) ||
+ ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->max_entries_scanned_in_msic != 0 ) ||
+ ( cache_ptr->entries_scanned_to_make_space != 0 ) ||
+ ( cache_ptr->slist_scan_restarts != 0 ) ||
+ ( cache_ptr->LRU_scan_restarts != 0 ) ||
+ ( cache_ptr->index_scan_restarts != 0 ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(1).";
} /* end if */
+ }
#if H5C_COLLECT_CACHE_ENTRY_STATS
if(pass)
@@ -36214,36 +36300,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(2).";
} /* end if */
- if(pass)
- if((cache_ptr->total_ht_insertions != 32) ||
- (cache_ptr->total_ht_deletions != 0) ||
- (cache_ptr->successful_ht_searches != 32) ||
- (cache_ptr->total_successful_ht_search_depth != 96) ||
- (cache_ptr->failed_ht_searches != 32) ||
- (cache_ptr->total_failed_ht_search_depth != 48) ||
- (cache_ptr->max_index_len != 32) ||
- (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_clean_index_size != 0) ||
- (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_slist_len != 32) ||
- (cache_ptr->max_slist_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_pl_len != 1) ||
- (cache_ptr->max_pl_size != 64 * 1024) ||
- (cache_ptr->max_pel_len != 0) ||
- (cache_ptr->max_pel_size != 0) ||
- (cache_ptr->calls_to_msic != 0) ||
- (cache_ptr->total_entries_skipped_in_msic != 0) ||
- (cache_ptr->total_entries_scanned_in_msic != 0) ||
- (cache_ptr->max_entries_skipped_in_msic != 0) ||
- (cache_ptr->max_entries_scanned_in_msic != 0) ||
- (cache_ptr->entries_scanned_to_make_space != 0) ||
- (cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 0) ||
- (cache_ptr->index_scan_restarts != 0)) {
+ if ( pass ) {
+
+ if ( ( cache_ptr->total_ht_insertions != 32 ) ||
+ ( cache_ptr->total_ht_deletions != 0 ) ||
+ ( cache_ptr->successful_ht_searches != 32 ) ||
+ ( cache_ptr->total_successful_ht_search_depth != 96 ) ||
+ ( cache_ptr->failed_ht_searches != 32 ) ||
+ ( cache_ptr->total_failed_ht_search_depth != 48 ) ||
+ ( cache_ptr->max_index_len != 32 ) ||
+ ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
+ ( cache_ptr->max_clean_index_size != 0 ) ||
+ ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->max_slist_len != 32 ) ||
+ ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
+ ( cache_ptr->max_pl_len != 1 ) ||
+ ( cache_ptr->max_pl_size != 64 * 1024 ) ||
+ ( cache_ptr->max_pel_len != 0 ) ||
+ ( cache_ptr->max_pel_size != 0 ) ||
+ ( cache_ptr->calls_to_msic != 0 ) ||
+ ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->total_entries_scanned_in_msic != 0 ) ||
+ ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->max_entries_scanned_in_msic != 0 ) ||
+ ( cache_ptr->entries_scanned_to_make_space != 0 ) ||
+ ( cache_ptr->slist_scan_restarts != 0 ) ||
+ ( cache_ptr->LRU_scan_restarts != 0 ) ||
+ ( cache_ptr->index_scan_restarts != 0 ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(2).";
} /* end if */
+ }
#if H5C_COLLECT_CACHE_ENTRY_STATS
if(pass)
@@ -36299,36 +36388,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(3).";
} /* end if */
- if(pass)
- if((cache_ptr->total_ht_insertions != 33) ||
- (cache_ptr->total_ht_deletions != 1) ||
- (cache_ptr->successful_ht_searches != 32) ||
- (cache_ptr->total_successful_ht_search_depth != 96) ||
- (cache_ptr->failed_ht_searches != 33) ||
- (cache_ptr->total_failed_ht_search_depth != 52) ||
- (cache_ptr->max_index_len != 32) ||
- (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_slist_len != 32) ||
- (cache_ptr->max_slist_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_pl_len != 1) ||
- (cache_ptr->max_pl_size != 64 * 1024) ||
- (cache_ptr->max_pel_len != 0) ||
- (cache_ptr->max_pel_size != 0) ||
- (cache_ptr->calls_to_msic != 1) ||
- (cache_ptr->total_entries_skipped_in_msic != 0) ||
- (cache_ptr->total_entries_scanned_in_msic != 33) ||
- (cache_ptr->max_entries_skipped_in_msic != 0) ||
- (cache_ptr->max_entries_scanned_in_msic != 33) ||
- (cache_ptr->entries_scanned_to_make_space != 33) ||
- (cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 0) ||
- (cache_ptr->index_scan_restarts != 0)) {
+ if ( pass ) {
+
+ if ( ( cache_ptr->total_ht_insertions != 33 ) ||
+ ( cache_ptr->total_ht_deletions != 1 ) ||
+ ( cache_ptr->successful_ht_searches != 32 ) ||
+ ( cache_ptr->total_successful_ht_search_depth != 96 ) ||
+ ( cache_ptr->failed_ht_searches != 33 ) ||
+ ( cache_ptr->total_failed_ht_search_depth != 52 ) ||
+ ( cache_ptr->max_index_len != 32 ) ||
+ ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
+ ( cache_ptr->max_clean_index_size != 2 * 1024 * 1024 ) ||
+ ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->max_slist_len != 32 ) ||
+ ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
+ ( cache_ptr->max_pl_len != 1 ) ||
+ ( cache_ptr->max_pl_size != 64 * 1024 ) ||
+ ( cache_ptr->max_pel_len != 0 ) ||
+ ( cache_ptr->max_pel_size != 0 ) ||
+ ( cache_ptr->calls_to_msic != 1 ) ||
+ ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->total_entries_scanned_in_msic != 33 ) ||
+ ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->max_entries_scanned_in_msic != 33 ) ||
+ ( cache_ptr->entries_scanned_to_make_space != 33 ) ||
+ ( cache_ptr->slist_scan_restarts != 0 ) ||
+ ( cache_ptr->LRU_scan_restarts != 0 ) ||
+ ( cache_ptr->index_scan_restarts != 0 ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(3).";
} /* end if */
+ }
#if H5C_COLLECT_CACHE_ENTRY_STATS
if(pass)
@@ -36356,17 +36448,14 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
/* flush the cache to end the test and collect all entry stats */
- if(pass) {
-
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ if ( pass ) {
- if(result < 0) {
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "Cache flush invalidate failed in check_stats__smoke_check_1()")
- pass = FALSE;
- failure_mssg = "Cache flush invalidate failed in check_stats__smoke_check_1()";
- } /* end if */
- else if((cache_ptr->index_len != 0) ||
- (cache_ptr->index_size != 0)) {
+ if ( ( pass ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache len/size after check_stats__smoke_check_1()";
@@ -36403,36 +36492,39 @@ check_stats__smoke_check_1(H5F_t * file_ptr)
failure_mssg = "Unexpected monster size entry stats in check_stats__smoke_check_1(4).";
} /* end if */
- if(pass)
- if((cache_ptr->total_ht_insertions != 33) ||
- (cache_ptr->total_ht_deletions != 33) ||
- (cache_ptr->successful_ht_searches != 33) ||
- (cache_ptr->total_successful_ht_search_depth != 99) ||
- (cache_ptr->failed_ht_searches != 33) ||
- (cache_ptr->total_failed_ht_search_depth != 52) ||
- (cache_ptr->max_index_len != 32) ||
- (cache_ptr->max_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_clean_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_dirty_index_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_slist_len != 32) ||
- (cache_ptr->max_slist_size != 2 * 1024 * 1024) ||
- (cache_ptr->max_pl_len != 1) ||
- (cache_ptr->max_pl_size != 64 * 1024) ||
- (cache_ptr->max_pel_len != 0) ||
- (cache_ptr->max_pel_size != 0) ||
- (cache_ptr->calls_to_msic != 1) ||
- (cache_ptr->total_entries_skipped_in_msic != 0) ||
- (cache_ptr->total_entries_scanned_in_msic != 33) ||
- (cache_ptr->max_entries_skipped_in_msic != 0) ||
- (cache_ptr->max_entries_scanned_in_msic != 33) ||
- (cache_ptr->entries_scanned_to_make_space != 33) ||
- (cache_ptr->slist_scan_restarts != 0) ||
- (cache_ptr->LRU_scan_restarts != 0) ||
- (cache_ptr->index_scan_restarts != 0)) {
+ if ( pass ) {
+
+ if ( ( cache_ptr->total_ht_insertions != 33 ) ||
+ ( cache_ptr->total_ht_deletions != 33 ) ||
+ ( cache_ptr->successful_ht_searches != 33 ) ||
+ ( cache_ptr->total_successful_ht_search_depth != 99 ) ||
+ ( cache_ptr->failed_ht_searches != 33 ) ||
+ ( cache_ptr->total_failed_ht_search_depth != 52 ) ||
+ ( cache_ptr->max_index_len != 32 ) ||
+ ( cache_ptr->max_index_size != 2 * 1024 * 1024 ) ||
+ ( cache_ptr->max_clean_index_size != 2 * 1024 * 1024 ) ||
+ ( cache_ptr->max_dirty_index_size != 2 * 1024 * 1024 ) ||
+ ( ( cache_ptr->slist_enabled ) &&
+ ( ( cache_ptr->max_slist_len != 32 ) ||
+ ( cache_ptr->max_slist_size != 2 * 1024 * 1024 ) ) ) ||
+ ( cache_ptr->max_pl_len != 1 ) ||
+ ( cache_ptr->max_pl_size != 64 * 1024 ) ||
+ ( cache_ptr->max_pel_len != 0 ) ||
+ ( cache_ptr->max_pel_size != 0 ) ||
+ ( cache_ptr->calls_to_msic != 1 ) ||
+ ( cache_ptr->total_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->total_entries_scanned_in_msic != 33 ) ||
+ ( cache_ptr->max_entries_skipped_in_msic != 0 ) ||
+ ( cache_ptr->max_entries_scanned_in_msic != 33 ) ||
+ ( cache_ptr->entries_scanned_to_make_space != 33 ) ||
+ ( cache_ptr->slist_scan_restarts != 0 ) ||
+ ( cache_ptr->LRU_scan_restarts != 0 ) ||
+ ( cache_ptr->index_scan_restarts != 0 ) ) {
pass = FALSE;
failure_mssg = "Unexpected cache stats in check_stats__smoke_check_1(4).";
} /* end if */
+ }
#if H5C_COLLECT_CACHE_ENTRY_STATS
if(pass)
diff --git a/test/cache_common.c b/test/cache_common.c
index 1dc13a1..52ff33e 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -3111,12 +3111,25 @@ expunge_entry(H5F_t * file_ptr,
* Function: flush_cache()
*
* Purpose: Flush the specified cache, destroying all entries if
- requested. If requested, dump stats first.
+ * requested. If requested, dump stats first.
*
* Return: void
*
* Programmer: John Mainzer
- * 6/23/04
+ * 6/23/04
+ *
+ * Changes: Added code to setup and take down the skip list before
+ * and after calls to H5C_flush_cache(). Do this via calls
+ * to the H5C_FLUSH_CACHE macro.
+ *
+ * This is necessary, as H5C_flush() is called repeatedly
+ * during file flush. If we setup and took down the
+ * skip list on H5C_flush_cache(), we would find ourselves
+ * doing this repeatedly -- which is contrary to the
+ * objective of the exercise (avoiding as many skip list
+ * operations as possible).
+ *
+ * JRM -- 5/14/20
*
*-------------------------------------------------------------------------
*/
@@ -3139,25 +3152,30 @@ flush_cache(H5F_t * file_ptr,
cache_ptr = file_ptr->shared->cache;
- if(destroy_entries)
- result = H5C_flush_cache(file_ptr, H5C__FLUSH_INVALIDATE_FLAG);
+ if ( destroy_entries ) {
- else
- result = H5C_flush_cache(file_ptr, H5C__NO_FLAGS_SET);
+ H5C_FLUSH_CACHE(file_ptr, H5C__FLUSH_INVALIDATE_FLAG, \
+ "error in H5C_flush_cache().")
- if(dump_stats)
- H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
+ } else {
- if(result < 0) {
- pass = FALSE;
- failure_mssg = "error in H5C_flush_cache().";
+ H5C_FLUSH_CACHE(file_ptr, H5C__NO_FLAGS_SET, \
+ "error in H5C_flush_cache().")
+ }
+
+ if ( dump_stats ) {
+
+ H5C_stats(cache_ptr, "test cache", dump_detailed_stats);
}
- else if((destroy_entries) && ((cache_ptr->index_len != 0)
- || (cache_ptr->index_size != 0)
- || (cache_ptr->clean_index_size != 0)
- || (cache_ptr->dirty_index_size != 0))) {
- if(verbose) {
+ if ( ( pass ) && ( destroy_entries ) &&
+ ( ( cache_ptr->index_len != 0 ) ||
+ ( cache_ptr->index_size != 0 ) ||
+ ( cache_ptr->clean_index_size != 0 ) ||
+ ( cache_ptr->dirty_index_size != 0 ) ) ) {
+
+ if ( verbose ) {
+
HDfprintf(stdout,
"%s: unexpected il/is/cis/dis = %lld/%lld/%lld/%lld.\n",
FUNC,
@@ -3961,14 +3979,19 @@ unprotect_entry(H5F_t * file_ptr,
* Function: row_major_scan_forward()
*
* Purpose: Do a sequence of inserts, protects, unprotects, moves,
- * destroys while scanning through the set of entries. If
- * pass is false on entry, do nothing.
+ * destroys while scanning through the set of entries. If
+ * pass is false on entry, do nothing.
*
* Return: void
*
* Programmer: John Mainzer
* 6/12/04
*
+ * Changes: Updated slist size == dirty index size checks to
+ * bypass the test if cache_ptr->slist_enabled is FALSE.
+ *
+ * JRM -- 5/8/20
+ *
*-------------------------------------------------------------------------
*/
void
@@ -3983,7 +4006,7 @@ row_major_scan_forward(H5F_t * file_ptr,
hbool_t do_moves,
hbool_t move_to_main_addr,
hbool_t do_destroys,
- hbool_t do_mult_ro_protects,
+ hbool_t do_mult_ro_protects,
int dirty_destroys,
int dirty_unprotects)
{
@@ -4022,7 +4045,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "1(i, %d, %d) ", type, tmp_idx);
insert_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4033,7 +4059,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "2(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4044,7 +4073,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "3(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
/* (don't decrement tmp_idx) */
@@ -4055,7 +4087,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "4(r, %d, %d, %d) ", type, tmp_idx, (int)move_to_main_addr);
move_entry(cache_ptr, type, tmp_idx, move_to_main_addr);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4066,7 +4101,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "5(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx -= 2;
@@ -4077,7 +4115,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "6(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
if(do_mult_ro_protects) {
@@ -4089,7 +4130,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "7(p-ro, %d, %d) ", type, tmp_idx);
protect_entry_ro(file_ptr, type, tmp_idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4100,7 +4144,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "8(p-ro, %d, %d) ", type, tmp_idx);
protect_entry_ro(file_ptr, type, tmp_idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4111,7 +4158,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "9(p-ro, %d, %d) ", type, tmp_idx);
protect_entry_ro(file_ptr, type, tmp_idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
/* (don't decrement tmp_idx) */
@@ -4122,7 +4172,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "10(u-ro, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4133,7 +4186,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "11(u-ro, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4144,7 +4200,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "12(u-ro, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
} /* if ( do_mult_ro_protects ) */
@@ -4153,7 +4212,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "13(p, %d, %d) ", type, idx);
protect_entry(file_ptr, type, idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx = idx - lag + 2;
@@ -4164,7 +4226,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "14(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
tmp_idx--;
@@ -4175,7 +4240,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "15(p, %d, %d) ", type, tmp_idx);
protect_entry(file_ptr, type, tmp_idx);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
if(do_destroys) {
@@ -4187,7 +4255,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "16(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
break;
case 1:
@@ -4196,14 +4267,20 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "17(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__NO_FLAGS_SET);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
else {
if(verbose)
HDfprintf(stdout, "18(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end else */
break;
@@ -4212,7 +4289,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "19(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
break;
case 3:
@@ -4221,14 +4301,20 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "20(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, H5C__DELETED_FLAG);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
else {
if(verbose)
HDfprintf(stdout, "21(u-del, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, (dirty_destroys ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET) | H5C__DELETED_FLAG);
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end else */
break;
@@ -4245,7 +4331,10 @@ row_major_scan_forward(H5F_t * file_ptr,
HDfprintf(stdout, "22(u, %d, %d) ", type, tmp_idx);
unprotect_entry(file_ptr, type, tmp_idx, (dirty_unprotects ? H5C__DIRTIED_FLAG : H5C__NO_FLAGS_SET));
- HDassert(cache_ptr->slist_size == cache_ptr->dirty_index_size);
+
+ HDassert( ( ! cache_ptr->slist_enabled ) || \
+ ( cache_ptr->slist_size == \
+ cache_ptr->dirty_index_size ) );
} /* end if */
} /* end elsef */
diff --git a/test/cache_common.h b/test/cache_common.h
index 785dc21..807ba35 100644
--- a/test/cache_common.h
+++ b/test/cache_common.h
@@ -134,6 +134,65 @@
(NOTIFY_ENTRY_SIZE * NUM_NOTIFY_ENTRIES))
#define ADDR_SPACE_SIZE (haddr_t)(MAX_ADDR - BASE_ADDR)
+
+/***********************************************************************
+ *
+ * Macro: H5C_FLUSH_CACHE
+ *
+ * Purpose: Wrap a call to H5C_flush_cache() in calls to
+ * H5C_set_slist_enabled() to setup and take down the slist.
+ *
+ * This is necessary, as H5C_flush_cache() needs the
+ * slist to be active. Further, since it is called
+ * repeatedly during file flush, it would be inefficient
+ * for it to setup the slist on entry, and take it down
+ * on exit.
+ *
+ * Note that the slist need not be empty if the flags
+ * indicate a partial flush (i.e.
+ * H5C__FLUSH_MARKED_ENTRIES_FLAG). Compute clear_slist
+ * and pass it into H5C_set_slist_enabled as appropriate.
+ *
+ * On error, set pass to FALSE, and set failure_mssg
+ * to the supplied error message.
+ *
+ * Return: N/A
+ *
+ * Programmer: John Mainzer
+ * 5/14/20
+ *
+ * Changes: None.
+ *
+ ***********************************************************************/
+
+#define H5C_FLUSH_CACHE(file, flags, fail_mssg) \
+{ \
+ hbool_t clear_slist; \
+ herr_t rslt; \
+ \
+ clear_slist = ( (flags & H5C__FLUSH_MARKED_ENTRIES_FLAG) != 0 ); \
+ \
+ rslt = H5C_set_slist_enabled((file)->shared->cache, TRUE, FALSE); \
+ \
+ if ( rslt >= 0 ) { \
+ \
+ rslt = H5C_flush_cache((file), (flags)); \
+ } \
+ \
+ if ( rslt >= 0 ) { \
+ \
+ rslt = H5C_set_slist_enabled((file)->shared->cache, FALSE, \
+ clear_slist); \
+ } \
+ \
+ if( rslt < 0 ) { \
+ \
+ pass = FALSE; \
+ failure_mssg = (fail_mssg); \
+ } \
+} /* H5C_FLUSH_CACHE */
+
+
#define MAX_PINS 8 /* Maximum number of entries that can be
* directly pinned by a single entry.
*/
diff --git a/test/cache_image.c b/test/cache_image.c
index 59689a9..9f8c4c5 100644
--- a/test/cache_image.c
+++ b/test/cache_image.c
@@ -15,7 +15,7 @@
* 7/13/15
*
* This file contains tests specific to the cache image
- * feature implemented in H5C.c
+ * feature implemented in H5C.c
*/
#include "cache_common.h"
#include "genall5.h"
diff --git a/test/cache_tagging.c b/test/cache_tagging.c
index cf0cd8d..e1187fb 100644
--- a/test/cache_tagging.c
+++ b/test/cache_tagging.c
@@ -30,16 +30,16 @@
/* Test Defines */
/* ============ */
-#define FILENAME "tagging_test.h5"
-#define FILENAME2 "tagging_ext_test.h5"
-#define GROUPNAME "Group"
+#define FILENAME "tagging_test.h5"
+#define FILENAME2 "tagging_ext_test.h5"
+#define GROUPNAME "Group"
#define GROUPNAMEPATH "/Group"
#define GROUPNAMECOPY "GroupCopy"
-#define ATTRNAME "Attribute 1"
-#define ATTRNAME3 "Attribute 3"
-#define DATASETNAME "Dataset"
-#define DATASETNAME2 "Dataset2"
-#define LINKNAME "Link"
+#define ATTRNAME "Attribute 1"
+#define ATTRNAME3 "Attribute 3"
+#define DATASETNAME "Dataset"
+#define DATASETNAME2 "Dataset2"
+#define LINKNAME "Link"
#define RANK 2
#define DIMS 32
@@ -348,11 +348,20 @@ evict_entries(hid_t fid)
/* Mark all entries investigated */
mark_all_entries_investigated(fid);
+ /* setup the skip list prior to calling H5C_flush_cache() */
+ if ( H5C_set_slist_enabled(f->shared->cache, TRUE, FALSE) < 0 )
+ TEST_ERROR;
+
/* Evict all we can from the cache to examine full tag creation tree */
- /* This function will likely return failure since the root group
- * is still protected. Thus, don't check its return value. */
+ /* This function will likely return failure since the root group
+ * is still protected. Thus, don't check its return value.
+ */
H5C_flush_cache(f, H5C__FLUSH_INVALIDATE_FLAG);
+ /* shutdown the slist -- allow it to be non-empty */
+ if ( H5C_set_slist_enabled(f->shared->cache, FALSE, TRUE) < 0 )
+ TEST_ERROR;
+
return 0;
error:
diff --git a/test/chunk_info.c b/test/chunk_info.c
index 0afff66..3ed1d56 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -685,7 +685,7 @@ test_get_chunk_info_highest_v18(hid_t fapl)
/* Verify that the number of chunks is NUM_CHUNKS */
if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- VERIFY(nchunks, NUM_CHUNKS, "H5Dget_num_chunks, number of chunks");
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
/* Attempt to get info of a chunk from an empty dataset, verify the
returned address and size in the case of H5D_ALLOC_TIME_EARLY */
@@ -693,11 +693,12 @@ test_get_chunk_info_highest_v18(hid_t fapl)
reinit_vars(&read_flt_msk, &addr, &size);
ret = H5Dget_chunk_info(dset, dspace, chk_index, out_offset, &read_flt_msk, &addr, &size);
if(ret < 0) TEST_ERROR
+
/* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
if(addr == HADDR_UNDEF)
- FAIL_PUTS_ERROR(MSG_CHK_ADDR);
+ TEST_ERROR
if(size == EMPTY_CHK_SIZE)
- FAIL_PUTS_ERROR(MSG_CHK_SIZE);
+ TEST_ERROR
chk_index = 10;
reinit_vars(&read_flt_msk, &addr, &size);
@@ -705,9 +706,9 @@ test_get_chunk_info_highest_v18(hid_t fapl)
if(ret < 0) TEST_ERROR
/* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
if(addr == HADDR_UNDEF)
- FAIL_PUTS_ERROR(MSG_CHK_ADDR);
+ TEST_ERROR
if(size == EMPTY_CHK_SIZE)
- FAIL_PUTS_ERROR(MSG_CHK_SIZE);
+ TEST_ERROR
/* Attempt to get info of a chunk given its coords from an empty dataset,
verify the returned address and size */
@@ -717,9 +718,9 @@ test_get_chunk_info_highest_v18(hid_t fapl)
TEST_ERROR
/* Because of H5D_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
if(addr == HADDR_UNDEF)
- FAIL_PUTS_ERROR(MSG_CHK_ADDR);
+ TEST_ERROR
if(size == 0)
- FAIL_PUTS_ERROR(MSG_CHK_SIZE);
+ TEST_ERROR
if(H5Dclose(dset) < 0) TEST_ERROR
@@ -819,7 +820,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl)
/* Get the number of chunks and verify that no chunk has been written */
if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- VERIFY(nchunks, NO_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
+ if(nchunks != NO_CHUNK_WRITTEN) TEST_ERROR
/* Initialize the array of chunk data for the single chunk */
for(ii = 0; ii < NX; ii++)
@@ -832,7 +833,7 @@ test_chunk_info_single_chunk(const char *filename, hid_t fapl)
/* Get and verify that one chunk had been written */
if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
- VERIFY(nchunks, ONE_CHUNK_WRITTEN, "H5Dget_num_chunks, number of chunks");
+ if(nchunks != ONE_CHUNK_WRITTEN) TEST_ERROR
/* Offset of the only chunk */
offset[0] = 0;
@@ -1937,8 +1938,7 @@ error:
*
* Purpose: Tests functions related to chunk information
*
- * Return: Success: SUCCEED
- * Failure: FAIL
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
* Programmer: Binh-Minh Ribler
* November 5, 2018
@@ -1969,19 +1969,19 @@ main(void)
nerrors += test_flt_msk_with_skip_compress(fapl) < 0 ? 1 : 0;
if(nerrors)
- TEST_ERROR
+ goto error;
HDprintf("All chunk query tests passed.\n");
h5_cleanup(FILENAME, fapl);
- return SUCCEED;
+ return EXIT_SUCCESS;
error:
nerrors = MAX(1, nerrors);
HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
- return FAIL;
+ return EXIT_FAILURE;
}
/****************************************************************************
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index ff3767c..c8ef1e4 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, January 23, 1998
*/
diff --git a/test/cross_read.c b/test/cross_read.c
index c16ddbc..dabd3ab 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Thursday, March 23, 2006
*
* Purpose: Check if floating-point data created on big-endian and
diff --git a/test/dangle.c b/test/dangle.c
index 9f30f10..8300792 100644
--- a/test/dangle.c
+++ b/test/dangle.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, May 13, 2003
*
* Purpose: Test dangling IDs
diff --git a/test/dsets.c b/test/dsets.c
index 4ab3efa..ae917cc 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
* Purpose: Tests the dataset interface (H5D)
@@ -112,6 +112,8 @@ const char *FILENAME[] = {
#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
+#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
+#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
@@ -1888,7 +1890,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
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_data);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
@@ -1934,7 +1936,7 @@ 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_data);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
@@ -1947,7 +1949,7 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
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_data);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
}
@@ -2048,7 +2050,7 @@ 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_data);
+ status = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, check_data);
} H5E_END_TRY;
if(status>=0) TEST_ERROR;
@@ -2061,12 +2063,12 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl, int if_fletcher32,
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_data);
+ 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_data) < 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 */
@@ -5770,6 +5772,101 @@ error:
} /* end test_can_apply2() */
+/*-------------------------------------------------------------------------
+ * Function: test_optional_filters
+ *
+ * Purpose: Tests that H5Dcreate2 will not fail when a combination of
+ * type, space, etc... doesn't work for a filter and filter is
+ * optional.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Binh-Minh Ribler
+ * 24 July 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_optional_filters(hid_t file)
+{
+ unsigned int level = 9;
+ unsigned int cd_values[1] = {level};
+ size_t cd_nelmts = 1;
+ hsize_t dim1d[1]; /* Dataspace dimensions */
+ hid_t dsid = H5I_INVALID_HID; /* Dataset ID */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t strtid = H5I_INVALID_HID; /* Datatype ID for string */
+ hid_t vlentid = H5I_INVALID_HID; /* Datatype ID for vlen */
+ hid_t dcplid = H5I_INVALID_HID; /* Dataspace creation property list ID */
+
+ TESTING("dataset with optional filters");
+
+ /* Create dcpl with special filter */
+ if((dcplid = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+
+ /* Create the datatype */
+ if((strtid = H5Tcreate(H5T_STRING, H5T_VARIABLE)) < 0) TEST_ERROR;
+
+ /* Create the data space */
+ if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR;
+
+ /* The filter is optional. */
+ if(H5Pset_filter(dcplid, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, cd_nelmts, cd_values) < 0)
+ TEST_ERROR;
+
+ /* Create dataset with optional filter */
+ if((dsid = H5Dcreate2(file, DSET_OPTIONAL_SCALAR, strtid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Close dataset */
+ if(H5Dclose(dsid) < 0) TEST_ERROR;
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR;
+
+ /* Close datatype */
+ if(H5Tclose(strtid) < 0) TEST_ERROR;
+
+ /* Set dataspace dimensions */
+ dim1d[0]=DIM1;
+
+ /* Create a non-scalar dataspace */
+ if((sid = H5Screate_simple(1, dim1d, NULL)) < 0) TEST_ERROR;
+
+ /* Create a vlen datatype */
+ if((vlentid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) TEST_ERROR;
+
+ /* Create dataset with optional filter */
+ if((dsid = H5Dcreate2(file, DSET_OPTIONAL_VLEN, vlentid, sid, H5P_DEFAULT, dcplid, H5P_DEFAULT)) < 0)
+ TEST_ERROR;
+
+ /* Close dataset */
+ if(H5Dclose(dsid) < 0) TEST_ERROR;
+
+ /* Close dataspace */
+ if(H5Sclose(sid) < 0) TEST_ERROR;
+
+ /* Close datatype */
+ if(H5Tclose(vlentid) < 0) TEST_ERROR;
+
+ /* Close dataset creation property list */
+ if(H5Pclose(dcplid) < 0) TEST_ERROR;
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dsid);
+ H5Sclose(sid);
+ H5Pclose(dcplid);
+ H5Tclose(strtid);
+ H5Tclose(vlentid);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end test_optional_filters() */
+
/*-------------------------------------------------------------------------
* Function: test_can_apply_szip
@@ -11237,6 +11334,9 @@ test_bt2_hdr_fd(const char *env_h5_driver, hid_t fapl)
TESTING("Version 2 B-tree chunk index header flush dependencies handled correctly");
+ /* Initialize struct */
+ HDmemset(&info, 0, sizeof(info));
+
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
*/
@@ -13366,7 +13466,7 @@ test_versionbounds(void)
return FAIL;
} /* end test_versionbounds() */
-
+
/*-----------------------------------------------------------------------------
* Function: test_object_header_minimization_dcpl
*
@@ -13862,6 +13962,7 @@ main(void)
nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
nerrors += (test_can_apply(file) < 0 ? 1 : 0);
nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
+ nerrors += (test_optional_filters(file) < 0 ? 1 : 0);
nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
diff --git a/test/dt_arith.c b/test/dt_arith.c
index 8d04770..9b89225 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
* Purpose: Tests the data type interface (H5T)
@@ -770,7 +770,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_c != SCHAR_MAX) {
- double x = 0.;
+ double x = 0.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 = 0.;
+ float x = 0.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 = 0.;
+ float x = 0.0;
HDmemcpy(&x, val, sizeof(float));
retval = (x!=x);
} else if (FLT_DOUBLE==type) {
- double x = 0.;
+ double x = 0.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 = 0.;
+ long double x = 0.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 = 0.;
+ float x = 0.0;
HDmemcpy(&x, val, sizeof(float));
HDsnprintf(s, sizeof(s), "%g", (double)x);
} else if (FLT_DOUBLE==type) {
- double x = 0.;
+ double x = 0.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 = 0.;
+ long double x = 0.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 = 0.;
+ float x = 0.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 = 0.;
+ double x = 0.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 = 0.;
+ long double x = 0.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 = 0.;
+ float x = 0.0;
HDmemcpy(&x, &saved[j*src_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==src_type) {
- double x = 0.;
+ double x = 0.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 = 0.;
+ long double x = 0.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 = 0.;
+ float x = 0.0;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==dst_type) {
- double x = 0.;
+ double x = 0.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 = 0.;
+ long double x = 0.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 0f95830..e96e826 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, December 9, 1997
*
* Purpose: Tests the datatype interface (H5T)
@@ -134,10 +134,8 @@ typedef enum {
static int num_opaque_conversions_g = 0;
static int opaque_check(int tag_it);
-static herr_t convert_opaque(hid_t st, hid_t dt,
- H5T_cdata_t *cdata,
- size_t nelmts, size_t buf_stride,
- size_t bkg_stride, void *_buf,
+static herr_t convert_opaque(hid_t st, hid_t dt, H5T_cdata_t *cdata,
+ size_t nelmts, size_t buf_stride, size_t bkg_stride, void *_buf,
void *bkg, hid_t dset_xfer_plid);
static int opaque_long(void);
static int opaque_funcs(void);
@@ -146,16 +144,13 @@ static int opaque_funcs(void);
/*-------------------------------------------------------------------------
* Function: reset_hdf5
*
- * Purpose: Reset the hdf5 library. This causes statistics to be printed
- * and counters to be reset.
+ * Purpose: Reset the hdf5 library. This causes statistics to be printed
+ * and counters to be reset.
*
- * Return: void
+ * Return: void
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Monday, November 16, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
@@ -189,14 +184,10 @@ reset_hdf5(void)
* Purpose: Test type classes
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -290,20 +281,16 @@ test_classes(void)
* Purpose: Are we able to copy a datatype?
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_copy(void)
{
- hid_t a_copy;
+ hid_t a_copy;
herr_t status;
TESTING("H5Tcopy()");
@@ -313,12 +300,12 @@ test_copy(void)
/* We should not be able to close a built-in byte */
H5E_BEGIN_TRY {
- status = H5Tclose (H5T_NATIVE_SCHAR);
+ status = H5Tclose (H5T_NATIVE_SCHAR);
} H5E_END_TRY;
if (status>=0) {
- H5_FAILED();
- HDputs (" Should not be able to close a predefined type!");
- goto error;
+ H5_FAILED();
+ HDputs (" Should not be able to close a predefined type!");
+ goto error;
}
PASSED();
@@ -336,7 +323,6 @@ test_copy(void)
* in nested types)
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Quincey Koziol
@@ -512,14 +498,10 @@ error:
* Purpose: Tests various things about compound datatypes.
*
* Return: Success: 0
- *
* Failure: number of errors
*
* Programmer: Robb Matzke
* Wednesday, January 7, 1998
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -673,38 +655,34 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_2
*
- * Purpose: Tests a compound type conversion where the source and
- * destination are the same except for the order of the
- * elements.
- *
- * Return: Success: 0
+ * Purpose: Tests a compound type conversion where the source and
+ * destination are the same except for the order of the
+ * elements.
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_compound_2(void)
{
struct st {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} *s_ptr;
struct dt {
- int e, d, c[4], b, a;
+ int e, d, c[4], b, a;
} *d_ptr;
const size_t nelmts = NTESTELEM;
- const hsize_t four = 4;
- unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
- hid_t st=-1, dt=-1;
- hid_t array_dt;
- int64_t nmembs;
- int i;
+ const hsize_t four = 4;
+ unsigned char *buf=NULL, *orig=NULL, *bkg=NULL;
+ hid_t st=-1, dt=-1;
+ hid_t array_dt;
+ int64_t nmembs;
+ int i;
TESTING("compound element reordering");
@@ -716,15 +694,15 @@ test_compound_2(void)
bkg = (unsigned char*)HDmalloc(nelmts * sizeof(struct dt));
orig = (unsigned char*)HDmalloc(nelmts * sizeof(struct st));
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- s_ptr->a = i*8+0;
- s_ptr->b = i*8+1;
- s_ptr->c[0] = i*8+2;
- s_ptr->c[1] = i*8+3;
- s_ptr->c[2] = i*8+4;
- s_ptr->c[3] = i*8+5;
- s_ptr->d = i*8+6;
- s_ptr->e = i*8+7;
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ s_ptr->a = i*8+0;
+ s_ptr->b = i*8+1;
+ s_ptr->c[0] = i*8+2;
+ s_ptr->c[1] = i*8+3;
+ s_ptr->c[2] = i*8+4;
+ s_ptr->c[3] = i*8+5;
+ s_ptr->d = i*8+6;
+ s_ptr->e = i*8+7;
}
HDmemcpy(buf, orig, nelmts*sizeof(struct st));
@@ -754,26 +732,26 @@ test_compound_2(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->d, d_ptr->e);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->b != d_ptr->b ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
+ s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
+ d_ptr->c[3], d_ptr->d, d_ptr->e);
+ goto error;
+ }
}
/* Release resources */
@@ -804,29 +782,25 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_3
*
- * Purpose: Tests compound conversions where the source and destination
- * are the same except the destination is missing a couple
- * members which appear in the source.
+ * Purpose: Tests compound conversions where the source and destination
+ * are the same except the destination is missing a couple
+ * members which appear in the source.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
test_compound_3(void)
{
struct st {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} *s_ptr;
- struct dt {
- int a, c[4], e;
+ struct dt {
+ int a, c[4], e;
} *d_ptr;
const size_t nelmts = NTESTELEM;
@@ -884,24 +858,24 @@ test_compound_3(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->e);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
+ s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
+ d_ptr->a, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
+ d_ptr->c[3], d_ptr->e);
+ goto error;
+ }
}
/* Release resources */
@@ -931,19 +905,15 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_4
*
- * Purpose: Tests compound conversions when the destination has the same
- * fields as the source but one or more of the fields are
- * smaller.
+ * Purpose: Tests compound conversions when the destination has the same
+ * fields as the source but one or more of the fields are
+ * smaller.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -951,13 +921,13 @@ test_compound_4(void)
{
struct st {
- int a, b, c[4], d, e;
+ int a, b, c[4], d, e;
} *s_ptr;
struct dt {
- short b;
- int a, c[4];
- short d;
- int e;
+ short b;
+ int a, c[4];
+ short d;
+ int e;
} *d_ptr;
const size_t nelmts = NTESTELEM;
@@ -1017,26 +987,26 @@ test_compound_4(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->a != d_ptr->a ||
- s_ptr->b != d_ptr->b ||
- s_ptr->c[0] != d_ptr->c[0] ||
- s_ptr->c[1] != d_ptr->c[1] ||
- s_ptr->c[2] != d_ptr->c[2] ||
- s_ptr->c[3] != d_ptr->c[3] ||
- s_ptr->d != d_ptr->d ||
- s_ptr->e != d_ptr->e) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
- s_ptr->c[3], s_ptr->d, s_ptr->e);
- HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
- d_ptr->c[3], d_ptr->d, d_ptr->e);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->a != d_ptr->a ||
+ s_ptr->b != d_ptr->b ||
+ s_ptr->c[0] != d_ptr->c[0] ||
+ s_ptr->c[1] != d_ptr->c[1] ||
+ s_ptr->c[2] != d_ptr->c[2] ||
+ s_ptr->c[3] != d_ptr->c[3] ||
+ s_ptr->d != d_ptr->d ||
+ s_ptr->e != d_ptr->e) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ s_ptr->a, s_ptr->b, s_ptr->c[0], s_ptr->c[1], s_ptr->c[2],
+ s_ptr->c[3], s_ptr->d, s_ptr->e);
+ HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
+ d_ptr->a, d_ptr->b, d_ptr->c[0], d_ptr->c[1], d_ptr->c[2],
+ d_ptr->c[3], d_ptr->d, d_ptr->e);
+ goto error;
+ }
}
/* Release resources */
@@ -1066,20 +1036,16 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_5
*
- * Purpose: Many versions of HDF5 have a bug in the optimized compound
+ * Purpose: Many versions of HDF5 have a bug in the optimized compound
* datatype conversion function, H5T_conv_struct_opt(), which
* is triggered when the top-level type contains a struct
* which must undergo a conversion.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, June 17, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1156,7 +1122,8 @@ test_compound_5(void)
src[1].coll_ids[2]!=dst[1].coll_ids[2] ||
src[1].coll_ids[3]!=dst[1].coll_ids[3]) {
H5_FAILED();
- } else {
+ }
+ else {
PASSED();
retval = 0;
}
@@ -1171,19 +1138,15 @@ test_compound_5(void)
/*-------------------------------------------------------------------------
* Function: test_compound_6
*
- * Purpose: Tests compound conversions when the destination has the same
- * fields as the source but one or more of the fields are
- * larger.
+ * Purpose: Tests compound conversions when the destination has the same
+ * fields as the source but one or more of the fields are
+ * larger.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Wednesday, December 13, 2000
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -1244,18 +1207,18 @@ test_compound_6(void)
/* Compare results */
for (i=0; i<(int)nelmts; i++) {
- s_ptr = ((struct st*)((void *)orig)) + i;
- d_ptr = ((struct dt*)((void *)buf)) + i;
- if (s_ptr->b != d_ptr->b ||
- s_ptr->d != d_ptr->d) {
- H5_FAILED();
- HDprintf(" i=%d\n", i);
- HDprintf(" src={b=%d, d=%d\n",
- (int)s_ptr->b, (int)s_ptr->d);
- HDprintf(" dst={b=%ld, d=%ld\n",
- d_ptr->b, d_ptr->d);
- goto error;
- }
+ s_ptr = ((struct st*)((void *)orig)) + i;
+ d_ptr = ((struct dt*)((void *)buf)) + i;
+ if (s_ptr->b != d_ptr->b ||
+ s_ptr->d != d_ptr->d) {
+ H5_FAILED();
+ HDprintf(" i=%d\n", i);
+ HDprintf(" src={b=%d, d=%d\n",
+ (int)s_ptr->b, (int)s_ptr->d);
+ HDprintf(" dst={b=%ld, d=%ld\n",
+ d_ptr->b, d_ptr->d);
+ goto error;
+ }
}
/* Release resources */
@@ -1284,15 +1247,14 @@ error:
/*-------------------------------------------------------------------------
* Function: test_compound_7
*
- * Purpose: Tests inserting fields into compound datatypes when the field
+ * Purpose: Tests inserting fields into compound datatypes when the field
* overlaps the end of the compound datatype. Also, tests
* increasing compound type size.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, December 18, 2001
*
* Modifications:
@@ -1686,9 +1648,6 @@ test_compound_8(void)
*
* Programmer: Raymond Lu
* Wednesday, June 9, 2004
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4758,17 +4717,13 @@ test_conv_enum_2(void)
/*-------------------------------------------------------------------------
* Function: test_conv_bitfield
*
- * Purpose: Test bitfield conversions.
- *
- * Return: Success: 0
+ * Purpose: Test bitfield conversions.
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 20, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4790,10 +4745,9 @@ test_conv_bitfield(void)
buf[2] = buf[3] = 0x55; /*irrelevant*/
if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xAA || buf[1]!=0xAA || buf[2]!=0 || buf[3]!=0) {
- H5_FAILED();
- printf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n",
- buf[3], buf[2], buf[1], buf[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" s=0xaaaa, d=0x%02x%02x%02x%02x (test 1)\n", buf[3], buf[2], buf[1], buf[0]);
+ goto error;
}
/*
@@ -4809,10 +4763,9 @@ test_conv_bitfield(void)
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0 || buf[1]!=0xA8 || buf[2]!=0x2A || buf[3]!=0) {
- H5_FAILED();
- printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n",
- buf[3], buf[2], buf[1], buf[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 2)\n", buf[3], buf[2], buf[1], buf[0]);
+ goto error;
}
/*
@@ -4823,10 +4776,9 @@ test_conv_bitfield(void)
buf[0] = 0xA8; buf[1] = 0x2A; buf[2] = buf[3] = 0;
if (H5Tconvert(st, dt, (size_t)1, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (buf[0]!=0xff || buf[1]!=0xAB || buf[2]!=0xEA || buf[3]!=0xff) {
- H5_FAILED();
- printf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n",
- buf[3], buf[2], buf[1], buf[0]);
- goto error;
+ H5_FAILED();
+ HDprintf(" s=0x2AA8 d=0x%02x%02x%02x%02x (test 3)\n", buf[3], buf[2], buf[1], buf[0]);
+ goto error;
}
H5Tclose(st);
@@ -4855,18 +4807,14 @@ error:
/*-------------------------------------------------------------------------
* Function: test_bitfield_funcs
*
- * Purpose: Test some datatype functions that are and aren't supposed
+ * Purpose: Test some datatype functions that are and aren't supposed
* work for bitfield type.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Wednesday, April 5, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -4984,17 +4932,13 @@ error:
/*-------------------------------------------------------------------------
* Function: convert_opaque
*
- * Purpose: A fake opaque conversion functions
- *
- * Return: Success: 0
+ * Purpose: A fake opaque conversion functions
*
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, June 4, 1999
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static herr_t
@@ -5003,7 +4947,8 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd
size_t H5_ATTR_UNUSED bkg_stride, void H5_ATTR_UNUSED *_buf,
void H5_ATTR_UNUSED *bkg, hid_t H5_ATTR_UNUSED dset_xfer_plid)
{
- if (H5T_CONV_CONV==cdata->command) num_opaque_conversions_g++;
+ if (H5T_CONV_CONV==cdata->command)
+ num_opaque_conversions_g++;
return 0;
}
@@ -5011,17 +4956,13 @@ convert_opaque(hid_t H5_ATTR_UNUSED st, hid_t H5_ATTR_UNUSED dt, H5T_cdata_t *cd
/*-------------------------------------------------------------------------
* Function: test_opaque
*
- * Purpose: Driver function to test opaque datatypes
- *
- * Return: Success: 0
+ * Purpose: Driver function to test opaque datatypes
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* June 2, 2004
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -5054,25 +4995,23 @@ test_opaque(void)
/*-------------------------------------------------------------------------
* Function: opaque_check
*
- * Purpose: Test opaque datatypes
- *
- * Return: Success: 0
+ * Purpose: Test opaque datatypes
*
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Thursday, May 20, 1999
- *
*-------------------------------------------------------------------------
*/
static int
opaque_check(int tag_it)
{
#define OPAQUE_NELMTS 1000
- hid_t st=-1, dt=-1;
+ hid_t st=-1, dt=-1;
herr_t status;
- char buf[1]; /*not really used*/
- int saved;
+ char buf[1]; /*not really used*/
+ int saved;
saved = num_opaque_conversions_g = 0;
@@ -5088,29 +5027,29 @@ opaque_check(int tag_it)
/* Make sure that we can't convert between the types yet */
H5E_BEGIN_TRY {
- status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
+ status = H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT);
} H5E_END_TRY;
if (status>=0) {
- H5_FAILED();
- printf(" opaque conversion should have failed but succeeded\n");
- goto error;
+ H5_FAILED();
+ HDprintf(" opaque conversion should have failed but succeeded\n");
+ goto error;
}
/* Register a conversion function */
if (H5Tregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0)
- goto error;
+ goto error;
/* Try the conversion again, this time it should work */
if (H5Tconvert(st, dt, (size_t)OPAQUE_NELMTS, buf, NULL, H5P_DEFAULT) < 0) goto error;
if (saved+1 != num_opaque_conversions_g) {
- H5_FAILED();
- printf(" unexpected number of opaque conversions\n");
- goto error;
+ H5_FAILED();
+ HDprintf(" unexpected number of opaque conversions\n");
+ goto error;
}
/* Unregister conversion function */
if (H5Tunregister(H5T_PERS_HARD, "o_test", st, dt, convert_opaque) < 0)
- goto error;
+ goto error;
H5Tclose(st);
H5Tclose(dt);
@@ -5127,12 +5066,12 @@ opaque_check(int tag_it)
/*-------------------------------------------------------------------------
* Function: opaque_long
*
- * Purpose: Test named (committed) opaque datatypes w/very long tags
+ * Purpose: Test named (committed) opaque datatypes w/very long tags
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, June 14, 2005
*
*-------------------------------------------------------------------------
@@ -5142,7 +5081,7 @@ opaque_long(void)
{
char *long_tag = NULL;
hid_t dt = -1;
- herr_t ret;
+ herr_t ret;
/* Build opaque type */
if((dt=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR
@@ -5154,7 +5093,7 @@ opaque_long(void)
/* Set opaque type's tag */
H5E_BEGIN_TRY {
- ret = H5Tset_tag(dt, long_tag);
+ ret = H5Tset_tag(dt, long_tag);
} H5E_END_TRY;
if(ret != FAIL) TEST_ERROR
@@ -5179,24 +5118,20 @@ error:
/*-------------------------------------------------------------------------
* Function: opaque_funcs
*
- * Purpose: Test some type functions that are and aren't supposed to
+ * Purpose: Test some type functions that are and aren't supposed to
* work with opaque type.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* Wednesday, April 5, 2006
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
opaque_funcs(void)
{
- hid_t type = -1, super=-1;
+ hid_t type = -1, super=-1;
size_t size;
H5T_pad_t inpad;
H5T_cset_t cset;
@@ -5803,7 +5738,7 @@ test_encode(void)
}
H5E_BEGIN_TRY {
- ret = H5Tclose(decoded_tid3);
+ ret = H5Tclose(decoded_tid3);
} H5E_END_TRY;
if(ret!=FAIL) {
H5_FAILED();
@@ -6102,14 +6037,13 @@ static int
test_int_float_except(void)
{
#if H5_SIZEOF_INT==4 && H5_SIZEOF_FLOAT==4
- float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f,
- (float)INT_MAX - 68.0f, (float)4.5f};
- int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4};
+ float buf[CONVERT_SIZE] = {(float)INT_MIN - 172.0f, (float)INT_MAX - 32.0f, (float)INT_MAX - 68.0f, (float)4.5f};
+ int buf_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX-127, 4};
float buf_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX + 1.0f, (float)INT_MAX - 127.0f, 4};
- int *intp; /* Pointer to buffer, as integers */
- int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
+ int *intp; /* Pointer to buffer, as integers */
+ int buf2[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 72, 0};
float buf2_float[CONVERT_SIZE] = {(float)INT_MIN, (float)INT_MAX, (float)INT_MAX - 127.0f, (float)0.0f};
- int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
+ int buf2_int[CONVERT_SIZE] = {INT_MIN, INT_MAX, INT_MAX - 127, 0};
float *floatp; /* Pointer to buffer #2, as floats */
hid_t dxpl; /* Dataset transfer property list */
except_info_t e; /* Exception information */
@@ -6165,8 +6099,8 @@ test_int_float_except(void)
/* Convert second buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE,
- buf2, NULL, dxpl) < 0) TEST_ERROR
+ if(H5Tconvert(H5T_NATIVE_INT, H5T_NATIVE_FLOAT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
+ TEST_ERROR
/* Check the buffer after conversion, as floats */
for(u = 0; u < CONVERT_SIZE; u++) {
@@ -6183,8 +6117,8 @@ test_int_float_except(void)
/* Convert buffer */
HDmemset(&e, 0, sizeof(except_info_t));
- if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE,
- buf2, NULL, dxpl) < 0) TEST_ERROR
+ if(H5Tconvert(H5T_NATIVE_FLOAT, H5T_NATIVE_INT, (size_t)CONVERT_SIZE, buf2, NULL, dxpl) < 0)
+ TEST_ERROR
/* Check the buffer after conversion, as integers */
for(u = 0; u < CONVERT_SIZE; u++) {
@@ -6415,7 +6349,7 @@ test_set_order_compound(hid_t fapl)
hid_t cmpd = -1, memb_cmpd = -1, memb_array1 = -1, memb_array2 = -1, cmpd_array = -1;
hid_t vl_id = -1;
hsize_t dims[2] = {3, 4}; /* Array dimenstions */
- char filename[1024];
+ char filename[1024];
herr_t ret; /* Generic return value */
TESTING("H5Tset/get_order for compound type");
@@ -6521,18 +6455,14 @@ error:
/*-------------------------------------------------------------------------
* Function: test_named_indirect_reopen
*
- * Purpose: Tests that open named datatypes can be reopened indirectly
+ * Purpose: Tests that open named datatypes can be reopened indirectly
* through H5Dget_type without causing problems.
*
- * Return: Success: 0
- *
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Neil Fortner
+ * Programmer: Neil Fortner
* Thursday, June 4, 2009
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static int
@@ -6540,11 +6470,11 @@ test_named_indirect_reopen(hid_t fapl)
{
hid_t file=-1, type=-1, reopened_type=-1, strtype=-1, dset=-1, space=-1;
static hsize_t dims[1] = {3};
- size_t dt_size;
- int enum_value;
- const char *tag = "opaque_tag";
- char *tag_ret = NULL;
- char filename[1024];
+ size_t dt_size;
+ int enum_value;
+ const char *tag = "opaque_tag";
+ char *tag_ret = NULL;
+ char filename[1024];
TESTING("indirectly reopening committed datatypes");
@@ -6708,11 +6638,11 @@ test_named_indirect_reopen(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Tclose(strtype);
- H5Tclose(reopened_type);
- H5Sclose(space);
- H5Dclose(dset);
+ H5Tclose(type);
+ H5Tclose(strtype);
+ H5Tclose(reopened_type);
+ H5Sclose(space);
+ H5Dclose(dset);
H5Fclose(file);
} H5E_END_TRY;
if(tag_ret)
@@ -6912,12 +6842,12 @@ test_delete_obj_named(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(attr);
- H5Dclose(dset);
- H5Pclose(fapl2);
- H5Fclose(filea1);
- H5Fclose(filea2);
- H5Fclose(fileb);
+ H5Tclose(attr);
+ H5Dclose(dset);
+ H5Pclose(fapl2);
+ H5Fclose(filea1);
+ H5Fclose(filea2);
+ H5Fclose(fileb);
} H5E_END_TRY;
return 1;
} /* end test_delete_obj_named() */
@@ -7075,15 +7005,15 @@ test_delete_obj_named_fileid(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Aclose(attr);
- H5Tclose(type);
- H5Dclose(dset);
- H5Pclose(fapl2);
- H5Fclose(filea1);
- H5Fclose(filea2);
- H5Fclose(fileb);
- H5Fclose(attr_fid);
- H5Fclose(type_fid);
+ H5Aclose(attr);
+ H5Tclose(type);
+ H5Dclose(dset);
+ H5Pclose(fapl2);
+ H5Fclose(filea1);
+ H5Fclose(filea2);
+ H5Fclose(fileb);
+ H5Fclose(attr_fid);
+ H5Fclose(type_fid);
} H5E_END_TRY;
return 1;
} /* end test_delete_obj_named_fileid() */
@@ -7092,12 +7022,12 @@ error:
/*-------------------------------------------------------------------------
* Function: test_deprec
*
- * Purpose: Tests deprecated API routines for datatypes.
+ * Purpose: Tests deprecated API routines for datatypes.
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Thursday, September 27, 2007
*
*-------------------------------------------------------------------------
@@ -7167,31 +7097,31 @@ test_deprec(hid_t fapl)
/* Predefined types cannot be committed */
H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT);
+ status = H5Tcommit1(file, "test_named_1 (should not exist)", H5T_NATIVE_INT);
} H5E_END_TRY;
if(status >= 0)
- FAIL_PUTS_ERROR(" Predefined types should not be committable!")
+ FAIL_PUTS_ERROR(" Predefined types should not be committable!")
/* Copy a predefined datatype and commit the copy */
if((type = H5Tcopy(H5T_NATIVE_INT)) < 0) FAIL_STACK_ERROR
if(H5Tcommit1(file, "native-int", type) < 0) FAIL_STACK_ERROR
if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR
if(0 == status)
- FAIL_PUTS_ERROR(" H5Tcommitted() returned false!")
+ FAIL_PUTS_ERROR(" H5Tcommitted() returned false!")
/* We should not be able to modify a type after it has been committed. */
H5E_BEGIN_TRY {
- status = H5Tset_precision(type, (size_t)256);
+ status = H5Tset_precision(type, (size_t)256);
} H5E_END_TRY;
if(status >= 0)
- FAIL_PUTS_ERROR(" Committed type is not constant!")
+ FAIL_PUTS_ERROR(" Committed type is not constant!")
/* We should not be able to re-commit a committed type */
H5E_BEGIN_TRY {
- status = H5Tcommit1(file, "test_named_2 (should not exist)", type);
+ status = H5Tcommit1(file, "test_named_2 (should not exist)", type);
} H5E_END_TRY;
if(status >= 0)
- FAIL_PUTS_ERROR(" Committed types should not be recommitted!")
+ FAIL_PUTS_ERROR(" Committed types should not be recommitted!")
/*
* Close the committed type and reopen it. It should return a named type.
@@ -7200,7 +7130,7 @@ test_deprec(hid_t fapl)
if((type = H5Topen1(file, "native-int")) < 0) FAIL_STACK_ERROR
if((status = H5Tcommitted(type)) < 0) FAIL_STACK_ERROR
if(!status)
- FAIL_PUTS_ERROR(" Opened named types should be named types!")
+ FAIL_PUTS_ERROR(" Opened named types should be named types!")
/* Close */
if(H5Tclose(type) < 0) FAIL_STACK_ERROR
@@ -7230,8 +7160,8 @@ test_deprec(hid_t fapl)
error:
H5E_BEGIN_TRY {
- H5Tclose(type);
- H5Fclose(file);
+ H5Tclose(type);
+ H5Fclose(file);
} H5E_END_TRY;
return 1;
} /* end test_deprec() */
@@ -7241,13 +7171,13 @@ error:
/*-------------------------------------------------------------------------
* Function: test_utf_ascii_conv
*
- * Purpose: Make sure the library doesn't conversion strings between
+ * Purpose: Make sure the library doesn't conversion strings between
* ASCII and UTF8.
*
- * Return: Success: 0
- * Failure: number of errors
+ * Return: Success: 0
+ * Failure: number of errors
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 10 November 2011
*-------------------------------------------------------------------------
*/
@@ -7437,13 +7367,13 @@ test_utf_ascii_conv(void)
error:
H5E_BEGIN_TRY {
- H5Tclose(utf8_vtid);
- H5Tclose(ascii_vtid);
- H5Tclose(utf8_tid);
- H5Tclose(ascii_tid);
- H5Dclose(did);
- H5Sclose(sid);
- H5Fclose(fid);
+ H5Tclose(utf8_vtid);
+ H5Tclose(ascii_vtid);
+ H5Tclose(utf8_tid);
+ H5Tclose(ascii_tid);
+ H5Dclose(did);
+ H5Sclose(sid);
+ H5Fclose(fid);
} H5E_END_TRY;
return 1;
}
@@ -7827,16 +7757,13 @@ error:
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
main(void)
{
long nerrors = 0;
- hid_t fapl = -1;
+ hid_t fapl = H5I_INVALID_HID;
/* Set the random # seed */
HDsrandom((unsigned)HDtime(NULL));
@@ -7845,7 +7772,7 @@ main(void)
fapl = h5_fileaccess();
if(ALIGNMENT)
- printf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
+ HDprintf("Testing non-aligned conversions (ALIGNMENT=%d)....\n", ALIGNMENT);
/* Do the tests */
nerrors += test_classes();
@@ -7900,8 +7827,7 @@ main(void)
nerrors += test_versionbounds();
if(nerrors) {
- HDprintf("***** %lu FAILURE%s! *****\n",
- nerrors, 1==nerrors?"":"S");
+ HDprintf("***** %lu FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S");
HDexit(EXIT_FAILURE);
}
diff --git a/test/earray.c b/test/earray.c
index 6597afd..f593212 100644
--- a/test/earray.c
+++ b/test/earray.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@hdfgroup.org>
+/* Programmer: Quincey Koziol
* Tuesday, June 17, 2008
*/
#include "h5test.h"
@@ -381,10 +381,6 @@ check_stats(const H5EA_t *ea, const earray_state_t *state)
TEST_ERROR
} /* end if */
#endif /* NOT_YET */
-#ifdef QAK
-HDfprintf(stderr, "nelmts = %Hu, total EA size = %Hu\n", earray_stats.stored.nelmts,
- (earray_stats.computed.hdr_size + earray_stats.computed.index_blk_size + earray_stats.stored.super_blk_size + earray_stats.stored.data_blk_size));
-#endif /* QAK */
/* All tests passed */
return(0);
@@ -560,12 +556,6 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5EA_t *ea, haddr_t ea_addr)
if(H5EA_close(ea) < 0)
FAIL_STACK_ERROR
-#ifdef QAK
-HDfprintf(stderr, "ea_addr = %a\n", ea_addr);
-H5Fflush(file, H5F_SCOPE_GLOBAL);
-HDsystem("cp earray.h5 earray.h5.save");
-#endif /* QAK */
-
/* Delete array */
if(H5EA_delete(f, ea_addr, NULL) < 0)
FAIL_STACK_ERROR
@@ -1384,19 +1374,8 @@ eiter_fw_state(void *_eiter, const H5EA_create_t *cparam,
/* Compute super block index for element index */
/* (same eqn. as in H5EA__dblock_sblk_idx()) */
sblk_idx = H5VM_log2_gen((uint64_t)(((idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
-#ifdef QAK
-HDfprintf(stderr, "idx = %Hu, tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", idx, sblk_idx, tparam->sblk_info[sblk_idx].ndblks, tparam->sblk_info[sblk_idx].dblk_nelmts, tparam->sblk_info[sblk_idx].start_idx, tparam->sblk_info[sblk_idx].start_dblk);
-#endif /* QAK */
-
state->nelmts = EA_NELMTS(cparam, tparam, idx, sblk_idx);
-#ifdef QAK
-HDfprintf(stderr, "state->nelmts = %Hu\n", state->nelmts);
-#endif /* QAK */
-
state->ndata_blks = EA_NDATA_BLKS(cparam, tparam, idx, sblk_idx);
-#ifdef QAK
-HDfprintf(stderr, "state->ndata_blks = %Hu\n", state->ndata_blks);
-#endif /* QAK */
/* Check if we have any super blocks yet */
if(tparam->sblk_info[sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) {
@@ -1405,9 +1384,6 @@ HDfprintf(stderr, "state->ndata_blks = %Hu\n", state->ndata_blks);
eiter->base_sblk_idx = sblk_idx;
state->nsuper_blks = (sblk_idx - eiter->base_sblk_idx) + 1;
-#ifdef QAK
-HDfprintf(stderr, "state->nsuper_blks = %Hu\n", state->nsuper_blks);
-#endif /* QAK */
} /* end if */
else
state->nsuper_blks = 0;
@@ -1619,29 +1595,18 @@ eiter_rv_state(void *_eiter, const H5EA_create_t *cparam,
loc_idx = cparam->idx_blk_elmts + tparam->sblk_info[idx_sblk_idx].start_idx - 1;
loc_sblk_idx = H5VM_log2_gen((uint64_t)(((loc_idx - cparam->idx_blk_elmts) / cparam->data_blk_min_elmts) + 1));
} /* end else */
-#ifdef QAK
-HDfprintf(stderr, "idx = %Hu, loc_idx = %Hu, eiter->max_sblk_idx = %u, idx_sblk_idx = %u, loc_sblk_idx = %u\n", idx, loc_idx, eiter->max_sblk_idx, idx_sblk_idx, loc_sblk_idx);
-HDfprintf(stderr, "tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", idx_sblk_idx, tparam->sblk_info[idx_sblk_idx].ndblks, tparam->sblk_info[idx_sblk_idx].dblk_nelmts, tparam->sblk_info[idx_sblk_idx].start_idx, tparam->sblk_info[idx_sblk_idx].start_dblk);
-HDfprintf(stderr, "tparam->sblk_info[%u] = {%Zu, %Zu, %Hu, %Hu}\n", eiter->max_sblk_idx, tparam->sblk_info[eiter->max_sblk_idx].ndblks, tparam->sblk_info[eiter->max_sblk_idx].dblk_nelmts, tparam->sblk_info[eiter->max_sblk_idx].start_idx, tparam->sblk_info[eiter->max_sblk_idx].start_dblk);
-#endif /* QAK */
if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
idx_nelmts = (hsize_t)cparam->idx_blk_elmts;
else
idx_nelmts = EA_NELMTS(cparam, tparam, loc_idx, loc_sblk_idx);
state->nelmts = (eiter->max_nelmts - idx_nelmts) + cparam->idx_blk_elmts;
-#ifdef QAK
-HDfprintf(stderr, "eiter->max_nelmts = %Hu, idx_nelmts = %Hu, state->nelmts = %Hu\n", eiter->max_nelmts, idx_nelmts, state->nelmts);
-#endif /* QAK */
if(idx < cparam->idx_blk_elmts + cparam->data_blk_min_elmts)
idx_ndata_blks = 0;
else
idx_ndata_blks = EA_NDATA_BLKS(cparam, tparam, loc_idx, loc_sblk_idx);
state->ndata_blks = eiter->max_ndata_blks - idx_ndata_blks;
-#ifdef QAK
-HDfprintf(stderr, "eiter->max_ndata_blks = %Hu, idx_ndata_blks = %Hu, state->ndata_blks = %Hu\n", eiter->max_ndata_blks, idx_ndata_blks, state->ndata_blks);
-#endif /* QAK */
/* Check if we have any super blocks yet */
if(tparam->sblk_info[eiter->max_sblk_idx].ndblks >= cparam->sup_blk_min_data_ptrs) {
@@ -1649,9 +1614,6 @@ HDfprintf(stderr, "eiter->max_ndata_blks = %Hu, idx_ndata_blks = %Hu, state->nda
state->nsuper_blks = (eiter->max_sblk_idx - idx_sblk_idx) + 1;
else
state->nsuper_blks = (eiter->max_sblk_idx - eiter->idx_blk_nsblks) + 1;
-#ifdef QAK
-HDfprintf(stderr, "eiter->idx_blk_nsblks = %Hu, state->nsuper_blks = %Hu\n", eiter->idx_blk_nsblks, state->nsuper_blks);
-#endif /* QAK */
} /* end if */
} /* end else */
diff --git a/test/enum.c b/test/enum.c
index 109f7c3..1933ce1 100644
--- a/test/enum.c
+++ b/test/enum.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, December 22, 1998
*/
#include "h5test.h"
diff --git a/test/extend.c b/test/extend.c
index 1e2b5b5..369ad32 100644
--- a/test/extend.c
+++ b/test/extend.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, January 30, 1998
*
* Purpose: Tests extendible datasets.
diff --git a/test/external.c b/test/external.c
index d29fb6b..c98c228 100644
--- a/test/external.c
+++ b/test/external.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, March 3, 1998
*
* Purpose: Tests datasets stored in external raw files.
diff --git a/test/external_common.c b/test/external_common.c
index a9e600b..85fdfa0 100644
--- a/test/external_common.c
+++ b/test/external_common.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * Programmer: Raymond Lu
* April, 2019
*
* Purpose: Private function for external.c and external_env.c
diff --git a/test/external_common.h b/test/external_common.h
index f02652b..3633ea3 100644
--- a/test/external_common.h
+++ b/test/external_common.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * Programmer: Raymond Lu
* April, 2019
*
* Purpose: Private function for external.c and external_env.c
diff --git a/test/external_fname.h b/test/external_fname.h
index c5111b6..f5aca6d 100644
--- a/test/external_fname.h
+++ b/test/external_fname.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@lbl.gov>
+ * Programmer: Quincey Koziol
* July, 2019
*
* Purpose: Private declaration for external.c and external_env.c
diff --git a/test/fheap.c b/test/fheap.c
index b1a0db0..ed82ce3 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Friday, February 24, 2006
*/
#include "h5test.h"
@@ -3195,7 +3195,6 @@ error:
return(1);
} /* test_reopen_hdr() */
-#ifndef QAK2
/*-------------------------------------------------------------------------
* Function: test_man_insert_weird
@@ -6237,7 +6236,6 @@ error:
} /* test_man_fill_all_4th_recursive_indirect() */
#endif /* ALL_INSERT_TESTS */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_man_start_5th_recursive_indirect
@@ -6369,9 +6367,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_man_start_5th_recursive_indirect() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_man_remove_bogus
@@ -6448,10 +6444,10 @@ test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpa
/* Choose random # seed */
seed = (unsigned long)HDtime(NULL);
-#ifdef QAK
+#if 0
/* seed = (unsigned long)1155438845; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)seed);
/* Set heap ID to random (non-null) value */
@@ -7270,10 +7266,6 @@ test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t
TEST_ERROR
/* Verify the file is correct size */
-#ifdef QAK
-HDfprintf(stderr, "empty_size = %lu\n", (unsigned long)empty_size);
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
if(file_size != empty_size)
TEST_ERROR
@@ -7573,10 +7565,6 @@ test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param
TEST_ERROR
/* Verify the file is correct size */
-#ifdef QAK
-HDfprintf(stderr, "empty_size = %lu\n", (unsigned long)empty_size);
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
if(file_size != empty_size)
TEST_ERROR
@@ -7720,9 +7708,7 @@ error:
return 1;
} /* test_man_incr_insert_remove() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_man_remove_root_direct
@@ -8323,9 +8309,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_man_remove_3rd_indirect() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_man_skip_start_block
@@ -9589,9 +9573,6 @@ test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -9725,9 +9706,6 @@ test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -9747,9 +9725,6 @@ HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
/* Insert object too large for initial block size in skipped indirect blocks */
obj_size = (size_t)DBLOCK_SIZE(fh, 3) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, 4);
if(add_obj(fh, (size_t)10, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -9760,9 +9735,6 @@ HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
/* Insert object to fill space in (medium) block just created */
obj_size = (size_t)DBLOCK_FREE(fh, 4) - obj_size;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -10506,9 +10478,6 @@ test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(h
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -10627,9 +10596,6 @@ test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(
/* Retrieve info about heap */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
-#ifdef QAK
-HDfprintf(stderr, "num_first_indirect_rows = %u\n", num_first_indirect_rows);
-#endif /* QAK */
/* Fill direct blocks in root indirect block */
if(fill_root_direct(fh, fill_size, &state, &keep_ids))
@@ -10660,9 +10626,6 @@ HDfprintf(stderr, "num_first_indirect_rows = %u\n", num_first_indirect_rows);
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows + 1);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -10673,9 +10636,6 @@ HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
/* Insert object to fill space in (large) block created */
obj_size = (size_t)DBLOCK_FREE(fh, num_first_indirect_rows + 1) - obj_size;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -10829,9 +10789,6 @@ test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -10998,9 +10955,6 @@ test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_s
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -11155,9 +11109,6 @@ test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -11332,9 +11283,6 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_blo
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -11544,9 +11492,6 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -11740,9 +11685,6 @@ test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_star
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -11972,9 +11914,6 @@ test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_
* object
*/
obj_size = (size_t)DBLOCK_SIZE(fh, num_first_indirect_rows - 1) + 1;
-#ifdef QAK
-HDfprintf(stderr, "obj_size = %Zu\n", obj_size);
-#endif /* QAK */
state.man_alloc_size += DBLOCK_SIZE(fh, num_first_indirect_rows);
if(add_obj(fh, (size_t)20, obj_size, &state, &keep_ids))
TEST_ERROR
@@ -12043,9 +11982,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_man_frag_simple
@@ -12396,9 +12333,6 @@ test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *
/* Compute # of bits used in first row */
num_first_indirect_rows = IBLOCK_MAX_DROWS(fh, 1);
-#ifdef QAK
-HDfprintf(stderr, "num_first_indirect_rows = %u\n", num_first_indirect_rows);
-#endif /* QAK */
/* Fill direct blocks in root indirect block */
if(fill_root_direct(fh, fill_size, &state, &keep_ids))
@@ -12576,9 +12510,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_man_frag_3rd_direct() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_huge_insert_one
@@ -12699,9 +12631,6 @@ test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -12929,9 +12858,6 @@ test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -13234,9 +13160,6 @@ test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tp
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -13657,9 +13580,6 @@ test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -13879,9 +13799,6 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "empty_size = %lu, file_size = %lu\n", (unsigned long)empty_size, (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -13911,9 +13828,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_filtered_huge() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_tiny_insert_one
@@ -14034,9 +13949,6 @@ test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -14264,9 +14176,6 @@ test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -14864,9 +14773,6 @@ test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tpar
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -14907,10 +14813,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_tiny_insert_mix() */
-#endif /* QAK */
-#endif /* QAK2 */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_filtered_man_root_direct
@@ -15060,9 +14963,6 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "empty_size = %lu, file_size = %lu\n", (unsigned long)empty_size, (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -15388,9 +15288,6 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "empty_size = %lu, file_size = %lu\n", (unsigned long)empty_size, (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -15413,9 +15310,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_filtered_man_root_indirect() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_random
@@ -15498,10 +15393,10 @@ test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_pa
/* Choose random # seed */
seed = (unsigned long)HDtime(NULL);
-#ifdef QAK
+#if 0
/* seed = (unsigned long)1156158635; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)seed);
/* Loop over adding objects to the heap, until the size limit is reached */
@@ -15522,9 +15417,6 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Increment the amount of objects added */
total_obj_added += obj_size;
} /* end while */
-#ifdef QAK
-HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = %Hu\n", keep_ids.num_ids, total_obj_added, size_limit);
-#endif /* QAK */
/* Randomize the order of the IDs kept */
for(u = 0; u < keep_ids.num_ids; u++) {
@@ -15583,9 +15475,6 @@ HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = %
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -15704,10 +15593,10 @@ test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_te
/* Choose random # seed */
seed = (unsigned long)HDtime(NULL);
-#ifdef QAK
+#if 0
/* seed = (unsigned long)1155181717; */
HDfprintf(stderr, "Random # seed was: %lu\n", seed);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)seed);
/* Loop over adding objects to the heap, until the size limit is reached */
@@ -15740,9 +15629,6 @@ HDfprintf(stderr, "Random # seed was: %lu\n", seed);
/* Increment the amount of objects added */
total_obj_added += obj_size;
} /* end while */
-#ifdef QAK
-HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = %Hu\n", keep_ids.num_ids, total_obj_added, size_limit);
-#endif /* QAK */
/* Randomize the order of the IDs kept */
for(u = 0; u < keep_ids.num_ids; u++) {
@@ -15801,10 +15687,6 @@ HDfprintf(stderr, "keep_ids.num_ids = %Zu, total_obj_added = %Hu, size_limit = %
/* Get the size of the file */
if((file_size = h5_get_file_size(filename, fapl)) < 0)
TEST_ERROR
-#ifdef QAK
-HDfprintf(stderr, "empty_size = %lu\n", (unsigned long)empty_size);
-HDfprintf(stderr, "file_size = %lu\n", (unsigned long)file_size);
-#endif /* QAK */
/* Verify the file is correct size */
if(file_size != empty_size)
@@ -15838,9 +15720,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_random_pow2() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_write
@@ -16124,9 +16004,7 @@ error:
} H5E_END_TRY;
return(1);
} /* test_write() */
-#endif /* QAK */
-#ifndef QAK
/*-------------------------------------------------------------------------
* Function: test_bug1
@@ -16301,7 +16179,6 @@ error:
} H5E_END_TRY;
return(1);
} /* test_bug1() */
-#endif /* QAK */
/*-------------------------------------------------------------------------
diff --git a/test/fillval.c b/test/fillval.c
index 72b8dcb..3fbbbbb 100644
--- a/test/fillval.c
+++ b/test/fillval.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <robb@arborea.spizella.com>
+ * Programmer: Robb Matzke
* Thursday, October 1, 1998
*
* Purpose: Tests dataset fill values.
diff --git a/test/filter_fail.c b/test/filter_fail.c
index e5187be..b3e5c8a 100644
--- a/test/filter_fail.c
+++ b/test/filter_fail.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <songyulu@hdfgroup.org>
+ * Programmer: Raymond Lu
* 7 September 2010
*
* Purpose: Make sure dataset, file, and library can close properly when a
diff --git a/test/flush1.c b/test/flush1.c
index 04f24f7..e01f4a5 100644
--- a/test/flush1.c
+++ b/test/flush1.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, October 23, 1998
*
* Purpose: This is the first half of a two-part test that makes sure
diff --git a/test/flush2.c b/test/flush2.c
index 5fc716b..c3103d9 100644
--- a/test/flush2.c
+++ b/test/flush2.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, October 23, 1998
*
* Purpose: This is the second half of a two-part test that makes sure
diff --git a/test/gen_bad_compound.c b/test/gen_bad_compound.c
index 292659c..bd857b4 100644
--- a/test/gen_bad_compound.c
+++ b/test/gen_bad_compound.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* April 14, 2011
*
* Purpose: This program is run to generate an HDF5 data file with objects
diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c
index 36ba64a..0f85cfe 100644
--- a/test/gen_bad_ohdr.c
+++ b/test/gen_bad_ohdr.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Jan 5, 2008
*
* Purpose: This program is run to generate an HDF5 data file with a
diff --git a/test/gen_bogus.c b/test/gen_bogus.c
index 1ab18a4..ab2620f 100644
--- a/test/gen_bogus.c
+++ b/test/gen_bogus.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Apr 17, 2007
*
* Purpose: This program is run to generate an HDF5 data file with several
diff --git a/test/gen_cross.c b/test/gen_cross.c
index 105895d..2c1ff4d 100644
--- a/test/gen_cross.c
+++ b/test/gen_cross.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Thursday, March 23, 2006
*
* This program writes floating-point data to the HDF5 file. It generates
diff --git a/test/gen_filters.c b/test/gen_filters.c
index 9764830..ace86ba 100644
--- a/test/gen_filters.c
+++ b/test/gen_filters.c
@@ -38,7 +38,7 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
*
* Failure: -1
*
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+ * Programmer: Pedro Vicente
* Thursday, March 25, 2004
*
*-------------------------------------------------------------------------
diff --git a/test/gen_mergemsg.c b/test/gen_mergemsg.c
index f158d57..6633eb0 100644
--- a/test/gen_mergemsg.c
+++ b/test/gen_mergemsg.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, June 30, 2006
*
* This program creates an object with fragmented object header messages
diff --git a/test/gen_new_array.c b/test/gen_new_array.c
index 27f162c..041b691 100644
--- a/test/gen_new_array.c
+++ b/test/gen_new_array.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, November 09, 2000
*
* Purpose: Create a two datasets, one with a compound datatypes with array
diff --git a/test/gen_new_fill.c b/test/gen_new_fill.c
index 5bdbf73..c012d8b 100644
--- a/test/gen_new_fill.c
+++ b/test/gen_new_fill.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu <slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Feb 27, 2002
*
* Purpose: This program is run to generate a HDF5 data file with fill
diff --git a/test/gen_new_group.c b/test/gen_new_group.c
index 6924291..42a751f 100644
--- a/test/gen_new_group.c
+++ b/test/gen_new_group.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Oct 24, 2005
*
* Purpose: This program is run to generate an HDF5 data file with both
diff --git a/test/gen_new_mtime.c b/test/gen_new_mtime.c
index b44d567..90259c7 100644
--- a/test/gen_new_mtime.c
+++ b/test/gen_new_mtime.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, January 3, 2003
*
* Purpose: Create a dataset, which should have the newer mtime information
diff --git a/test/gen_new_super.c b/test/gen_new_super.c
index ed43a39..36f2187 100644
--- a/test/gen_new_super.c
+++ b/test/gen_new_super.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, July 15, 2003
*
* Purpose: Create a file which will have the newer superblock format.
@@ -23,26 +23,22 @@
* put into the 'test' directory in the 1.4+ branch of the library.
*/
-#include <assert.h>
-#include "testhdf5.h"
+#include "h5test.h"
#define TESTFILE "tsupern.h5"
#define ISTORE_IK 64
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Create a file with a new version (>0) of the superblock
+ * Purpose: Create a file with a new version (>0) of the superblock
*
- * Return: Success:
- * Failure:
+ * Return: EXIT_SUCCESS
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* Tuesday, July 15, 2003
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -54,27 +50,27 @@ main(void)
/* Create a file creation property list */
fcpl = H5Pcreate(H5P_FILE_CREATE);
- assert(fcpl>=0);
+ HDassert(fcpl >= 0);
- ret=H5Pset_istore_k(fcpl,ISTORE_IK);
- assert(ret>=0);
+ ret = H5Pset_istore_k(fcpl,ISTORE_IK);
+ HDassert(ret >= 0);
/* Creating a file with the non-default file creation property list should
* create a version 1 superblock
*/
/* Create file with custom file creation property list */
- file= H5Fcreate(TESTFILE, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
- assert(file>=0);
+ file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC , fcpl, H5P_DEFAULT);
+ HDassert(file >= 0);
/* Close FCPL */
- ret=H5Pclose(fcpl);
- assert(ret>=0);
+ ret = H5Pclose(fcpl);
+ HDassert(ret >= 0);
/* Close file */
- ret=H5Fclose(file);
- assert(ret>=0);
+ ret = H5Fclose(file);
+ HDassert(ret >= 0);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/test/gen_nullspace.c b/test/gen_nullspace.c
index e4e75ac..26df3f1 100644
--- a/test/gen_nullspace.c
+++ b/test/gen_nullspace.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Saturday, April 17, 2004
*
* Purpose: Create a dataset with a null dataspace and an attribute
@@ -24,8 +24,7 @@
* put into the 'test' directory in the 1.6.x branch of the library.
*/
-#include <assert.h>
-#include "testhdf5.h"
+#include "h5test.h"
#define NULLFILE "tnullspace.h5"
#define NULLDATASET "null_dataset"
@@ -43,44 +42,44 @@ main(void)
/* Create the file */
fid = H5Fcreate(NULLFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
- assert(fid>0);
+ HDassert(fid > 0);
sid = H5Screate(H5S_NULL);
- assert(sid>0);
+ HDassert(sid > 0);
/* Create dataset */
did = H5Dcreate2(fid, NULLDATASET, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- assert(did>0);
+ HDassert(did > 0);
/* Close the dataset */
ret = H5Dclose(did);
- assert(ret>=0);
+ HDassert(ret >= 0);
/* Open the root group */
gid = H5Gopen2(fid, "/", H5P_DEFAULT);
- assert(gid > 0);
+ HDassert(gid > 0);
/* Create an attribute for the group */
attr = H5Acreate2(gid, NULLATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT);
- assert(attr > 0);
+ HDassert(attr > 0);
/* Close attribute */
ret = H5Aclose(attr);
- assert(ret>=0);
+ HDassert(ret >= 0);
/* Close the group */
ret = H5Gclose(gid);
- assert(ret>=0);
+ HDassert(ret >= 0);
/* Close the dataspace */
ret = H5Sclose(sid);
- assert(ret>=0);
+ HDassert(ret >= 0);
/* Close the file */
ret = H5Fclose(fid);
- assert(ret>=0);
+ HDassert(ret >= 0);
- return 0;
+ return EXIT_SUCCESS;
}
diff --git a/test/gen_old_array.c b/test/gen_old_array.c
index 3fab657..402fd40 100644
--- a/test/gen_old_array.c
+++ b/test/gen_old_array.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, November 09, 2000
*
* Purpose: Create a two datasets with compound datatypes, one with no array
diff --git a/test/gen_old_group.c b/test/gen_old_group.c
index d109329..55dbde3 100644
--- a/test/gen_old_group.c
+++ b/test/gen_old_group.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Oct 24, 2005
*
* Purpose: This program is run to generate an HDF5 data file with an
diff --git a/test/gen_old_layout.c b/test/gen_old_layout.c
index 56c3e4e..0210786 100644
--- a/test/gen_old_layout.c
+++ b/test/gen_old_layout.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Thursday, May 27, 2004
*
* Purpose: Create two datasets (one for version 1 and one for version 2 of
diff --git a/test/gen_old_mtime.c b/test/gen_old_mtime.c
index cbe3bdc..e72c9b1 100644
--- a/test/gen_old_mtime.c
+++ b/test/gen_old_mtime.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Friday, January 3, 2003
*
* Purpose: Create a dataset, which should have the older mtime information
diff --git a/test/gen_sizes_lheap.c b/test/gen_sizes_lheap.c
index 81742df..0e62019 100644
--- a/test/gen_sizes_lheap.c
+++ b/test/gen_sizes_lheap.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Programmer: Neil Fortner
* Thursday, July 15, 2010
*
* Purpose: Creates a file with non-default sizes of lengths and addresses.
diff --git a/test/gen_specmetaread.c b/test/gen_specmetaread.c
index fd484d1..ca44f9a 100644
--- a/test/gen_specmetaread.c
+++ b/test/gen_specmetaread.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@hdfgroup.org>
+ * Programmer: Quincey Koziol
* Thursday, October 8, 2009
*
* Purpose: Create a file with a dataset who's raw data immediately follows
@@ -23,9 +23,8 @@
* the library on the trunk as of when this file is checked in.
*/
-#include <assert.h>
-#include "testhdf5.h"
+#include "h5test.h"
#define FILENAME "specmetaread.h5"
#define DIM 10
diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c
index e48d0e8..456cb5c 100644
--- a/test/gen_udlinks.c
+++ b/test/gen_udlinks.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: James Laird <jlaird@hdfgroup.org>
+ * Programmer: James Laird
* Tuesday, June 6, 2006
*
* This program creates HDF5 files with user-defined links. These files
diff --git a/test/getname.c b/test/getname.c
index a6f2f5a..ef0d5ea 100644
--- a/test/getname.c
+++ b/test/getname.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+ * Programmer: Pedro Vicente
* April 12, 2002
*
* Purpose: Tests the "ID to name" functionality
diff --git a/test/gheap.c b/test/gheap.c
index 09ba1cf..077f921 100644
--- a/test/gheap.c
+++ b/test/gheap.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, March 31, 1998
*
* Purpose: Tests the global heap. The global heap is the set of all
diff --git a/test/h5subfiling_vol.c b/test/h5subfiling_vol.c
new file mode 100644
index 0000000..25f1292
--- /dev/null
+++ b/test/h5subfiling_vol.c
@@ -0,0 +1,3641 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: This is a "pass through" VOL connector, which forwards each
+ * VOL callback to an underlying connector.
+ *
+ * It is designed as an example VOL connector for developers to
+ * use when creating new connectors, especially connectors that
+ * are outside of the HDF5 library. As such, it should _NOT_
+ * include _any_ private HDF5 header files. This connector should
+ * therefore only make public HDF5 API calls and use standard C /
+ * POSIX calls.
+ *
+ * Note that the HDF5 error stack must be preserved on code paths
+ * that could be invoked when the underlying VOL connector's
+ * callback can fail.
+ *
+ */
+
+
+/* Header files needed */
+/* Do NOT include private HDF5 files here! */
+#include <assert.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+
+/* Public HDF5 file */
+#include "hdf5.h"
+#include "mpi.h"
+
+/* This connector's header */
+#include "h5subfiling_vol.h"
+
+/* For initial testing... */
+#define SEL_ITER_MAX_SEQ 256
+#define HYPERSLAB_MAX_RANK 8
+
+/**********/
+/* Macros */
+/**********/
+
+/* Whether to display log messge when callback is invoked */
+/* (Uncomment to enable) */
+/* #define ENABLE_EXT_PASSTHRU_LOGGING */
+
+/* Hack for missing va_copy() in old Visual Studio editions
+ * (from H5win2_defs.h - used on VS2012 and earlier)
+ */
+#if defined(_WIN32) && defined(_MSC_VER) && (_MSC_VER < 1800)
+#define va_copy(D,S) ((D) = (S))
+#endif
+
+#ifndef ADDR_MAX
+#define ADDR_MAX 256
+#endif
+
+/************/
+/* Typedefs */
+/************/
+
+
+/* Common object and attribute information */
+typedef struct H5VL_subfiling_item_t {
+ H5I_type_t type;
+ void *file;
+} H5VL_subfiling_item_t;
+
+/* Common object information */
+typedef struct H5VL_subfiling_obj_t {
+ H5VL_subfiling_item_t item; /* Must be first */
+ char obj_name[ADDR_MAX];
+} H5VL_subfiling_obj_t;
+
+/* The file struct */
+typedef struct H5VL_subfiling_file_t {
+ H5VL_subfiling_obj_t obj; /* Must be first */
+ uint64_t h5_file_id; /* Posix file inode */
+ char *file_name;
+ hid_t fcpl_id;
+ hid_t fapl_id;
+ MPI_Comm comm;
+ MPI_Info info;
+ int my_rank;
+ int num_procs;
+ int nobjs;
+ H5_LIST_HEAD(H5VL_subfiling_dset_t) ids;
+} H5VL_subfiling_file_t;
+
+/* The dataset struct */
+typedef struct H5VL_subfiling_dset_t {
+ H5VL_subfiling_obj_t obj; /* Must be first */
+ hid_t type_id;
+ hid_t space_id;
+ hid_t dcpl_id;
+ hid_t dapl_id;
+ haddr_t f_offset;
+ hbool_t mapped;
+ H5_LIST_ENTRY(H5VL_subfiling_dset_t) entry;
+} H5VL_subfiling_dset_t;
+
+/* The pass through VOL info object */
+typedef struct H5VL_subfiling_t {
+ H5VL_subfiling_obj_t obj; /* Must be first */
+ hid_t under_vol_id; /* ID for underlying VOL connector */
+ void *under_object; /* Info object for underlying VOL connector */
+} H5VL_subfiling_t;
+
+/* The pass through VOL wrapper context */
+typedef struct H5VL_subfiling_wrap_ctx_t {
+ hid_t under_vol_id; /* VOL ID for under VOL */
+ void *under_wrap_ctx; /* Object wrapping context for under VOL */
+} H5VL_subfiling_wrap_ctx_t;
+
+
+/********************* */
+/* Function prototypes */
+/********************* */
+
+/* Helper routines */
+static herr_t H5VL_subfiling_file_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...);
+static herr_t H5VL_subfiling_request_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_request_specific_t specific_type, ...);
+static herr_t H5VL_subfiling_link_create_reissue(H5VL_link_create_type_t create_type,
+ void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...);
+static H5VL_subfiling_t *H5VL_subfiling_new_obj(void *under_obj,
+ hid_t under_vol_id);
+static herr_t H5VL_subfiling_free_obj(H5VL_subfiling_t *obj);
+
+static H5VL_subfiling_dset_t *H5VL__subfiling_dset_init(H5VL_subfiling_item_t *item);
+
+/* "Management" callbacks */
+static herr_t H5VL_subfiling_init(hid_t vipl_id);
+static herr_t H5VL_subfiling_term(void);
+
+/* VOL info callbacks */
+static void *H5VL_subfiling_info_copy(const void *info);
+static herr_t H5VL_subfiling_info_cmp(int *cmp_value, const void *info1, const void *info2);
+static herr_t H5VL_subfiling_info_free(void *info);
+static herr_t H5VL_subfiling_info_to_str(const void *info, char **str);
+static herr_t H5VL_subfiling_str_to_info(const char *str, void **info);
+
+/* VOL object wrap / retrieval callbacks */
+static void *H5VL_subfiling_get_object(const void *obj);
+static herr_t H5VL_subfiling_get_wrap_ctx(const void *obj, void **wrap_ctx);
+static void *H5VL_subfiling_wrap_object(void *obj, H5I_type_t obj_type, void *wrap_ctx);
+static void *H5VL_subfiling_unwrap_object(void *obj);
+static herr_t H5VL_subfiling_free_wrap_ctx(void *obj);
+
+/* Attribute callbacks */
+static void *H5VL_subfiling_attr_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_subfiling_attr_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_attr_read(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_attr_close(void *attr, hid_t dxpl_id, void **req);
+
+/* Dataset callbacks */
+static void *H5VL_subfiling_dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_subfiling_dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req);
+static herr_t H5VL_subfiling_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
+static herr_t H5VL_subfiling_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_dataset_close(void *dset, hid_t dxpl_id, void **req);
+
+/* Datatype callbacks */
+static void *H5VL_subfiling_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_subfiling_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_datatype_close(void *dt, hid_t dxpl_id, void **req);
+
+/* File callbacks */
+static void *H5VL_subfiling_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_subfiling_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_file_close(void *file, hid_t dxpl_id, void **req);
+
+/* Group callbacks */
+static void *H5VL_subfiling_group_create(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
+static void *H5VL_subfiling_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_group_close(void *grp, hid_t dxpl_id, void **req);
+
+/* Link callbacks */
+static herr_t H5VL_subfiling_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Object callbacks */
+static void *H5VL_subfiling_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
+static herr_t H5VL_subfiling_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_object_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL_subfiling_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, va_list arguments);
+
+/* Container/connector introspection callbacks */
+static herr_t H5VL_subfiling_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls);
+static herr_t H5VL_subfiling_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type, hbool_t *supported);
+
+/* Async request callbacks */
+static herr_t H5VL_subfiling_request_wait(void *req, uint64_t timeout, H5ES_status_t *status);
+static herr_t H5VL_subfiling_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx);
+static herr_t H5VL_subfiling_request_cancel(void *req);
+static herr_t H5VL_subfiling_request_specific(void *req, H5VL_request_specific_t specific_type, va_list arguments);
+static herr_t H5VL_subfiling_request_optional(void *req, H5VL_request_optional_t opt_type, va_list arguments);
+static herr_t H5VL_subfiling_request_free(void *req);
+
+/* Blob callbacks */
+static herr_t H5VL_subfiling_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
+static herr_t H5VL_subfiling_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
+static herr_t H5VL_subfiling_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
+static herr_t H5VL_subfiling_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+
+/* Token callbacks */
+static herr_t H5VL_subfiling_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value);
+static herr_t H5VL_subfiling_token_to_str(void *obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str);
+static herr_t H5VL_subfiling_token_from_str(void *obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token);
+
+/* Generic optional callback */
+static herr_t H5VL_subfiling_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments);
+
+/*******************/
+/* Local variables */
+/*******************/
+
+/* Pass through VOL connector class struct */
+static const H5VL_class_t H5VL_subfiling_g = {
+ H5VL_SUBFILING_VERSION, /* version */
+ (H5VL_class_value_t)H5VL_SUBFILING_VALUE, /* value */
+ H5VL_SUBFILING_NAME, /* name */
+ 0, /* capability flags */
+ H5VL_subfiling_init, /* initialize */
+ H5VL_subfiling_term, /* terminate */
+ { /* INFO_CLS */
+ sizeof(H5VL_subfiling_info_t), /* size */
+ H5VL_subfiling_info_copy, /* copy */
+ H5VL_subfiling_info_cmp, /* compare */
+ H5VL_subfiling_info_free, /* free */
+ H5VL_subfiling_info_to_str, /* to_str */
+ H5VL_subfiling_str_to_info /* from_str */
+ },
+ { /* WRAP_CLS */
+ H5VL_subfiling_get_object, /* get_object */
+ H5VL_subfiling_get_wrap_ctx, /* get_wrap_ctx */
+ H5VL_subfiling_wrap_object, /* wrap_object */
+ H5VL_subfiling_unwrap_object, /* unwrap_object */
+ H5VL_subfiling_free_wrap_ctx /* free_wrap_ctx */
+ },
+ { /* ATTRIBUTE_CLS */
+ H5VL_subfiling_attr_create, /* create */
+ H5VL_subfiling_attr_open, /* open */
+ H5VL_subfiling_attr_read, /* read */
+ H5VL_subfiling_attr_write, /* write */
+ H5VL_subfiling_attr_get, /* get */
+ H5VL_subfiling_attr_specific, /* specific */
+ H5VL_subfiling_attr_optional, /* optional */
+ H5VL_subfiling_attr_close /* close */
+ },
+ { /* DATASET_CLS */
+ H5VL_subfiling_dataset_create, /* create */
+ H5VL_subfiling_dataset_open, /* open */
+ H5VL_subfiling_dataset_read, /* read */
+ H5VL_subfiling_dataset_write, /* write */
+ H5VL_subfiling_dataset_get, /* get */
+ H5VL_subfiling_dataset_specific, /* specific */
+ H5VL_subfiling_dataset_optional, /* optional */
+ H5VL_subfiling_dataset_close /* close */
+ },
+ { /* DATATYPE_CLS */
+ H5VL_subfiling_datatype_commit, /* commit */
+ H5VL_subfiling_datatype_open, /* open */
+ H5VL_subfiling_datatype_get, /* get_size */
+ H5VL_subfiling_datatype_specific, /* specific */
+ H5VL_subfiling_datatype_optional, /* optional */
+ H5VL_subfiling_datatype_close /* close */
+ },
+ { /* FILE_CLS */
+ H5VL_subfiling_file_create, /* create */
+ H5VL_subfiling_file_open, /* open */
+ H5VL_subfiling_file_get, /* get */
+ H5VL_subfiling_file_specific, /* specific */
+ H5VL_subfiling_file_optional, /* optional */
+ H5VL_subfiling_file_close /* close */
+ },
+ { /* GROUP_CLS */
+ H5VL_subfiling_group_create, /* create */
+ H5VL_subfiling_group_open, /* open */
+ H5VL_subfiling_group_get, /* get */
+ H5VL_subfiling_group_specific, /* specific */
+ H5VL_subfiling_group_optional, /* optional */
+ H5VL_subfiling_group_close /* close */
+ },
+ { /* LINK_CLS */
+ H5VL_subfiling_link_create, /* create */
+ H5VL_subfiling_link_copy, /* copy */
+ H5VL_subfiling_link_move, /* move */
+ H5VL_subfiling_link_get, /* get */
+ H5VL_subfiling_link_specific, /* specific */
+ H5VL_subfiling_link_optional /* optional */
+ },
+ { /* OBJECT_CLS */
+ H5VL_subfiling_object_open, /* open */
+ H5VL_subfiling_object_copy, /* copy */
+ H5VL_subfiling_object_get, /* get */
+ H5VL_subfiling_object_specific, /* specific */
+ H5VL_subfiling_object_optional /* optional */
+ },
+ { /* INTROSPECT_CLS */
+ H5VL_subfiling_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL_subfiling_introspect_opt_query, /* opt_query */
+ },
+ { /* REQUEST_CLS */
+ H5VL_subfiling_request_wait, /* wait */
+ H5VL_subfiling_request_notify, /* notify */
+ H5VL_subfiling_request_cancel, /* cancel */
+ H5VL_subfiling_request_specific, /* specific */
+ H5VL_subfiling_request_optional, /* optional */
+ H5VL_subfiling_request_free /* free */
+ },
+ { /* BLOB_CLS */
+ H5VL_subfiling_blob_put, /* put */
+ H5VL_subfiling_blob_get, /* get */
+ H5VL_subfiling_blob_specific, /* specific */
+ H5VL_subfiling_blob_optional /* optional */
+ },
+ { /* TOKEN_CLS */
+ H5VL_subfiling_token_cmp, /* cmp */
+ H5VL_subfiling_token_to_str, /* to_str */
+ H5VL_subfiling_token_from_str /* from_str */
+ },
+ H5VL_subfiling_optional /* OPTIONAL */
+};
+
+/* The connector identification number, initialized at runtime */
+static hid_t H5VL_SUBFILING_g = H5I_INVALID_HID;
+H5PL_type_t H5PLget_plugin_type(void) {return H5PL_TYPE_VOL;}
+const void *H5PLget_plugin_info(void) {return &H5VL_subfiling_g;}
+
+static int file_create_count = 0;
+static int file_open_count = 0;
+static int file_close_count = 0;
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__pass_through_new_obj
+ *
+ * Purpose: Create a new pass through object for an underlying object
+ *
+ * Return: Success: Pointer to the new pass through object
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 3, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static H5VL_subfiling_t *
+H5VL_subfiling_new_obj(void *under_obj, hid_t under_vol_id)
+{
+ H5VL_subfiling_t *new_obj;
+
+ new_obj = (H5VL_subfiling_t *)calloc(1, sizeof(H5VL_subfiling_t));
+ new_obj->under_object = under_obj;
+ new_obj->under_vol_id = under_vol_id;
+ H5Iinc_ref(new_obj->under_vol_id);
+
+ return new_obj;
+} /* end H5VL__pass_through_new_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__pass_through_free_obj
+ *
+ * Purpose: Release a pass through object
+ *
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Monday, December 3, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_free_obj(H5VL_subfiling_t *obj)
+{
+ hid_t err_id;
+
+ err_id = H5Eget_current_stack();
+
+ H5Idec_ref(obj->under_vol_id);
+
+ H5Eset_current_stack(err_id);
+
+ free(obj);
+
+ return 0;
+} /* end H5VL__pass_through_free_obj() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_register
+ *
+ * Purpose: Register the pass-through VOL connector and retrieve an ID
+ * for it.
+ *
+ * Return: Success: The ID for the pass-through VOL connector
+ * Failure: -1
+ *
+ * Programmer: Quincey Koziol
+ * Wednesday, November 28, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_subfiling_register(void)
+{
+ /* Singleton register the pass-through VOL connector ID */
+ if(H5VL_SUBFILING_g < 0)
+ H5VL_SUBFILING_g = H5VLregister_connector(&H5VL_subfiling_g, H5P_DEFAULT);
+
+ return H5VL_SUBFILING_g;
+} /* end H5VL_subfiling_register() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_init
+ *
+ * Purpose: Initialize this VOL connector, performing any necessary
+ * operations for the connector that will apply to all containers
+ * accessed with the connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_init(hid_t vipl_id)
+{
+ // printf("%s:%d: Subfiling VOL is called.\n", __func__, __LINE__);
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INIT\n");
+#endif
+
+ /* Shut compiler up about unused parameter */
+ vipl_id = vipl_id;
+
+ return 0;
+} /* end H5VL_subfiling_init() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_term
+ *
+ * Purpose: Terminate this VOL connector, performing any necessary
+ * operations for the connector that release connector-wide
+ * resources (usually created / initialized with the 'init'
+ * callback).
+ *
+ * Return: Success: 0
+ * Failure: (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_term(void)
+{
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL TERM\n");
+#endif
+
+ /* Reset VOL ID */
+ H5VL_SUBFILING_g = H5I_INVALID_HID;
+
+ return 0;
+} /* end H5VL_subfiling_term() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_info_copy
+ *
+ * Purpose: Duplicate the connector's info object.
+ *
+ * Returns: Success: New connector info object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_info_copy(const void *_info)
+{
+ const H5VL_subfiling_info_t *info = (const H5VL_subfiling_info_t *)_info;
+ H5VL_subfiling_info_t *new_info;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INFO Copy\n");
+#endif
+
+ /* Allocate new VOL info struct for the pass through connector */
+ new_info = (H5VL_subfiling_info_t *)calloc(1, sizeof(H5VL_subfiling_info_t));
+
+ /* Increment reference count on underlying VOL ID, and copy the VOL info */
+ new_info->under_vol_id = info->under_vol_id;
+ H5Iinc_ref(new_info->under_vol_id);
+ if(info->under_vol_info)
+ H5VLcopy_connector_info(new_info->under_vol_id, &(new_info->under_vol_info), info->under_vol_info);
+
+ return new_info;
+} /* end H5VL_subfiling_info_copy() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_info_cmp
+ *
+ * Purpose: Compare two of the connector's info objects, setting *cmp_value,
+ * following the same rules as strcmp().
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_info_cmp(int *cmp_value, const void *_info1, const void *_info2)
+{
+ const H5VL_subfiling_info_t *info1 = (const H5VL_subfiling_info_t *)_info1;
+ const H5VL_subfiling_info_t *info2 = (const H5VL_subfiling_info_t *)_info2;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INFO Compare\n");
+#endif
+
+ /* Sanity checks */
+ assert(info1);
+ assert(info2);
+
+ /* Initialize comparison value */
+ *cmp_value = 0;
+
+ /* Compare under VOL connector classes */
+ H5VLcmp_connector_cls(cmp_value, info1->under_vol_id, info2->under_vol_id);
+ if(*cmp_value != 0)
+ return 0;
+
+ /* Compare under VOL connector info objects */
+ H5VLcmp_connector_info(cmp_value, info1->under_vol_id, info1->under_vol_info, info2->under_vol_info);
+ if(*cmp_value != 0)
+ return 0;
+
+ return 0;
+} /* end H5VL_subfiling_info_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_info_free
+ *
+ * Purpose: Release an info object for the connector.
+ *
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_info_free(void *_info)
+{
+ H5VL_subfiling_info_t *info = (H5VL_subfiling_info_t *)_info;
+ hid_t err_id;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INFO Free\n");
+#endif
+
+ err_id = H5Eget_current_stack();
+
+ /* Release underlying VOL ID and info */
+ if(info->under_vol_info)
+ H5VLfree_connector_info(info->under_vol_id, info->under_vol_info);
+ H5Idec_ref(info->under_vol_id);
+
+ H5Eset_current_stack(err_id);
+
+ /* Free pass through info object itself */
+ free(info);
+
+ return 0;
+} /* end H5VL_subfiling_info_free() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_info_to_str
+ *
+ * Purpose: Serialize an info object for this connector into a string
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_info_to_str(const void *_info, char **str)
+{
+ const H5VL_subfiling_info_t *info = (const H5VL_subfiling_info_t *)_info;
+ H5VL_class_value_t under_value = (H5VL_class_value_t)-1;
+ char *under_vol_string = NULL;
+ size_t under_vol_str_len = 0;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INFO To String\n");
+#endif
+
+ /* Get value and string for underlying VOL connector */
+ H5VLget_value(info->under_vol_id, &under_value);
+ H5VLconnector_info_to_str(info->under_vol_info, info->under_vol_id, &under_vol_string);
+
+ /* Determine length of underlying VOL info string */
+ if(under_vol_string)
+ under_vol_str_len = strlen(under_vol_string);
+
+ /* Allocate space for our info */
+ *str = (char *)H5allocate_memory(32 + under_vol_str_len, (hbool_t)0);
+ assert(*str);
+
+ /* Encode our info
+ * Normally we'd use snprintf() here for a little extra safety, but that
+ * call had problems on Windows until recently. So, to be as platform-independent
+ * as we can, we're using sprintf() instead.
+ */
+ sprintf(*str, "under_vol=%u;under_info={%s}", (unsigned)under_value, (under_vol_string ? under_vol_string : ""));
+
+ return 0;
+} /* end H5VL_subfiling_info_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_str_to_info
+ *
+ * Purpose: Deserialize a string into an info object for this connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_str_to_info(const char *str, void **_info)
+{
+ H5VL_subfiling_info_t *info;
+ unsigned under_vol_value;
+ const char *under_vol_info_start, *under_vol_info_end;
+ hid_t under_vol_id;
+ void *under_vol_info = NULL;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INFO String To Info\n");
+#endif
+
+ /* Retrieve the underlying VOL connector value and info */
+ sscanf(str, "under_vol=%u;", &under_vol_value);
+ under_vol_id = H5VLregister_connector_by_value((H5VL_class_value_t)under_vol_value, H5P_DEFAULT);
+ under_vol_info_start = strchr(str, '{');
+ under_vol_info_end = strrchr(str, '}');
+ assert(under_vol_info_end > under_vol_info_start);
+ if(under_vol_info_end != (under_vol_info_start + 1)) {
+ char *under_vol_info_str;
+
+ under_vol_info_str = (char *)malloc((size_t)(under_vol_info_end - under_vol_info_start));
+ memcpy(under_vol_info_str, under_vol_info_start + 1, (size_t)((under_vol_info_end - under_vol_info_start) - 1));
+ *(under_vol_info_str + (under_vol_info_end - under_vol_info_start)) = '\0';
+
+ H5VLconnector_str_to_info(under_vol_info_str, under_vol_id, &under_vol_info);
+
+ free(under_vol_info_str);
+ } /* end else */
+
+ /* Allocate new pass-through VOL connector info and set its fields */
+ info = (H5VL_subfiling_info_t *)calloc(1, sizeof(H5VL_subfiling_info_t));
+ info->under_vol_id = under_vol_id;
+ info->under_vol_info = under_vol_info;
+
+ /* Set return value */
+ *_info = info;
+
+ return 0;
+} /* end H5VL_subfiling_str_to_info() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_get_object
+ *
+ * Purpose: Retrieve the 'data' for a VOL object.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_get_object(const void *obj)
+{
+ const H5VL_subfiling_t *o = (const H5VL_subfiling_t *)obj;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL Get object\n");
+#endif
+
+ return H5VLget_object(o->under_object, o->under_vol_id);
+} /* end H5VL_subfiling_get_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_get_wrap_ctx
+ *
+ * Purpose: Retrieve a "wrapper context" for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_get_wrap_ctx(const void *obj, void **wrap_ctx)
+{
+ const H5VL_subfiling_t *o = (const H5VL_subfiling_t *)obj;
+ H5VL_subfiling_wrap_ctx_t *new_wrap_ctx;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL WRAP CTX Get\n");
+#endif
+
+ /* Allocate new VOL object wrapping context for the pass through connector */
+ new_wrap_ctx = (H5VL_subfiling_wrap_ctx_t *)calloc(1, sizeof(H5VL_subfiling_wrap_ctx_t));
+
+ /* Increment reference count on underlying VOL ID, and copy the VOL info */
+ new_wrap_ctx->under_vol_id = o->under_vol_id;
+ H5Iinc_ref(new_wrap_ctx->under_vol_id);
+ H5VLget_wrap_ctx(o->under_object, o->under_vol_id, &new_wrap_ctx->under_wrap_ctx);
+
+ /* Set wrap context to return */
+ *wrap_ctx = new_wrap_ctx;
+
+ return 0;
+} /* end H5VL_subfiling_get_wrap_ctx() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_wrap_object
+ *
+ * Purpose: Use a "wrapper context" to wrap a data object
+ *
+ * Return: Success: Pointer to wrapped object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_wrap_object(void *obj, H5I_type_t obj_type, void *_wrap_ctx)
+{
+ H5VL_subfiling_wrap_ctx_t *wrap_ctx = (H5VL_subfiling_wrap_ctx_t *)_wrap_ctx;
+ H5VL_subfiling_t *new_obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL WRAP Object\n");
+#endif
+
+ /* Wrap the object with the underlying VOL */
+ under = H5VLwrap_object(obj, obj_type, wrap_ctx->under_vol_id, wrap_ctx->under_wrap_ctx);
+ if(under)
+ new_obj = H5VL_subfiling_new_obj(under, wrap_ctx->under_vol_id);
+ else
+ new_obj = NULL;
+
+ return new_obj;
+} /* end H5VL_subfiling_wrap_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_unwrap_object
+ *
+ * Purpose: Unwrap a wrapped object, discarding the wrapper, but returning
+ * underlying object.
+ *
+ * Return: Success: Pointer to unwrapped object
+ * Failure: NULL
+ *
+ *---------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_unwrap_object(void *obj)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL UNWRAP Object\n");
+#endif
+
+ /* Unrap the object with the underlying VOL */
+ under = H5VLunwrap_object(o->under_object, o->under_vol_id);
+
+ if(under)
+ H5VL_subfiling_free_obj(o);
+
+ return under;
+} /* end H5VL_subfiling_unwrap_object() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_free_wrap_ctx
+ *
+ * Purpose: Release a "wrapper context" for an object
+ *
+ * Note: Take care to preserve the current HDF5 error stack
+ * when calling HDF5 API calls.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_free_wrap_ctx(void *_wrap_ctx)
+{
+ H5VL_subfiling_wrap_ctx_t *wrap_ctx = (H5VL_subfiling_wrap_ctx_t *)_wrap_ctx;
+ hid_t err_id;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL WRAP CTX Free\n");
+#endif
+
+ err_id = H5Eget_current_stack();
+
+ /* Release underlying VOL ID and wrap context */
+ if(wrap_ctx->under_wrap_ctx)
+ H5VLfree_wrap_ctx(wrap_ctx->under_wrap_ctx, wrap_ctx->under_vol_id);
+ H5Idec_ref(wrap_ctx->under_vol_id);
+
+ H5Eset_current_stack(err_id);
+
+ /* Free pass through wrap context object itself */
+ free(wrap_ctx);
+
+ return 0;
+} /* end H5VL_subfiling_free_wrap_ctx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_create
+ *
+ * Purpose: Creates an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_attr_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id,
+ hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *attr;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Create\n");
+#endif
+
+ under = H5VLattr_create(o->under_object, loc_params, o->under_vol_id, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req);
+ if(under) {
+ attr = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ attr = NULL;
+
+ return (void*)attr;
+} /* end H5VL_subfiling_attr_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_open
+ *
+ * Purpose: Opens an attribute on an object.
+ *
+ * Return: Success: Pointer to attribute object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_attr_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t aapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *attr;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Open\n");
+#endif
+
+ under = H5VLattr_open(o->under_object, loc_params, o->under_vol_id, name, aapl_id, dxpl_id, req);
+ if(under) {
+ attr = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ attr = NULL;
+
+ return (void *)attr;
+} /* end H5VL_subfiling_attr_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_read
+ *
+ * Purpose: Reads data from attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_attr_read(void *attr, hid_t mem_type_id, void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Read\n");
+#endif
+
+ ret_value = H5VLattr_read(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_attr_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_write
+ *
+ * Purpose: Writes data to attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_attr_write(void *attr, hid_t mem_type_id, const void *buf,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Write\n");
+#endif
+
+ ret_value = H5VLattr_write(o->under_object, o->under_vol_id, mem_type_id, buf, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_attr_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_get
+ *
+ * Purpose: Gets information about an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Get\n");
+#endif
+
+ ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_attr_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_specific
+ *
+ * Purpose: Specific operation on attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Specific\n");
+#endif
+
+ ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_attr_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_optional
+ *
+ * Purpose: Perform a connector-specific operation on an attribute
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_attr_optional(void *obj, H5VL_attr_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Optional\n");
+#endif
+
+ ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_attr_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_attr_close
+ *
+ * Purpose: Closes an attribute.
+ *
+ * Return: Success: 0
+ * Failure: -1, attr not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_attr_close(void *attr, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)attr;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL ATTRIBUTE Close\n");
+#endif
+
+ ret_value = H5VLattr_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying attribute was closed */
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_attr_close() */
+
+static herr_t
+dataset_get_offset_helper(H5VL_subfiling_t *dset, ...)
+{
+ herr_t ret_value;
+ va_list ap;
+ va_start(ap, dset);
+ if ((ret_value = H5VL_subfiling_dataset_optional(dset, H5VL_NATIVE_DATASET_GET_OFFSET, 0, NULL, ap)) < 0)
+ puts("unable to get file_offset");
+ va_end(ap);
+ return ret_value;
+}
+
+static herr_t
+dataset_get_dcpl_helper(H5VL_subfiling_t *dset, ...)
+{
+ herr_t ret_value;
+ va_list ap;
+ va_start(ap, dset);
+ if ((ret_value = H5VL_subfiling_dataset_get(dset, H5VL_DATASET_GET_DCPL, 0, NULL, ap)) < 0)
+ puts("unable to get dataset dcpl");
+ va_end(ap);
+ return ret_value;
+}
+
+
+/*---------------------------------------------------------------------------*/
+static H5VL_subfiling_dset_t *
+H5VL__subfiling_dset_init(H5VL_subfiling_item_t *item)
+{
+ H5VL_subfiling_dset_t *dset = NULL;
+
+ /* Allocate the dataset object that is returned to the user */
+ if(NULL == (dset = malloc(sizeof(H5VL_subfiling_dset_t)))) {
+ puts("can't allocate subfiling dataset struct");
+ return NULL;
+ }
+ memset(dset, 0, sizeof(H5VL_subfiling_dset_t));
+
+ dset->obj.item.type = H5I_DATASET;
+ dset->obj.item.file = item->file;
+ dset->mapped = 0;
+ dset->type_id = -1;
+ dset->space_id = -1;
+ dset->dcpl_id = -1;
+ dset->dapl_id = -1;
+
+ /* Set return value */
+ return((void *)dset);
+
+done:
+ return NULL;
+} /* end H5VL__subfiling_dset_init() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_create
+ *
+ * Purpose: Creates a dataset in a container
+ *
+ * Return: Success: Pointer to a dataset object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_dataset_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
+ hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req )
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ H5VL_subfiling_dset_t *subfiling_dset;
+ H5VL_subfiling_dset_t *_dset = NULL;
+ H5VL_subfiling_t *dset = NULL;
+ haddr_t f_offset;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Create\n");
+#endif
+ if (NULL == (subfiling_dset = H5VL__subfiling_dset_init(&o->obj.item))) {
+ perror("dset_init");
+ return NULL;
+ }
+ else {
+ subfiling_dset->obj.item.file = o->obj.item.file;
+ strcpy(subfiling_dset->obj.obj_name, name);
+
+ if((subfiling_dset->type_id = H5Tcopy(type_id)) < 0) {
+ fprintf(stderr, "failed to copy datatype\n");
+ free(subfiling_dset);
+ goto done;
+ }
+ if((subfiling_dset->space_id = H5Scopy(space_id)) < 0) {
+ fprintf(stderr, "failed to copy dataspace\n");
+ free(subfiling_dset);
+ goto done;
+ }
+ if(H5Sselect_all(subfiling_dset->space_id) < 0) {
+ fprintf(stderr, "can't change selection\n");
+ free(subfiling_dset);
+ goto done;
+ }
+ if((subfiling_dset->dcpl_id = H5Pcopy(dcpl_id)) < 0) {
+ fprintf(stderr, "failed to copy dcpl\n");
+ free(subfiling_dset);
+ goto done;
+ }
+ if((subfiling_dset->dapl_id = H5Pcopy(dapl_id)) < 0) {
+ fprintf(stderr, "failed to copy dapl\n");
+ free(subfiling_dset);
+ goto done;
+ }
+ }
+
+ under = H5VLdataset_create(o->under_object, loc_params, o->under_vol_id,
+ name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req);
+
+ if(under) {
+ dset = H5VL_subfiling_new_obj(under, o->under_vol_id);
+ dset->obj.item.file = subfiling_dset;
+ subfiling_dset->f_offset = 0;
+ if (dataset_get_offset_helper(dset, &f_offset) < 0)
+ puts("Unable to get file_offset");
+ else subfiling_dset->f_offset = f_offset;
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ } /* end if */
+ else
+ dset = NULL;
+
+done:
+ return (void *)dset;
+} /* end H5VL_subfiling_dataset_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_open
+ *
+ * Purpose: Opens a dataset in a container
+ *
+ * Return: Success: Pointer to a dataset object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_dataset_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t dapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ H5VL_subfiling_dset_t *subfiling_dset;
+ H5VL_subfiling_dset_t *_dset = NULL;
+ H5VL_subfiling_t *dset = NULL;
+ hid_t dcpl_id;
+ haddr_t f_offset;
+ void *under;
+
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Open\n");
+#endif
+
+ if (NULL == (subfiling_dset = H5VL__subfiling_dset_init(&o->obj.item))) {
+ perror("dset_init");
+ return NULL;
+ }
+ else {
+ subfiling_dset->obj.item.type = H5I_DATASET;
+ subfiling_dset->obj.item.file = o->obj.item.file;
+ strcpy(subfiling_dset->obj.obj_name, name);
+
+ if((subfiling_dset->dapl_id = H5Pcopy(dapl_id)) < 0) {
+ fprintf(stderr, "failed to copy dapl\n");
+ free(subfiling_dset);
+ goto done;
+ }
+ }
+
+ under = H5VLdataset_open(o->under_object, loc_params, o->under_vol_id, name, dapl_id, dxpl_id, req);
+ if(under) {
+ dset = H5VL_subfiling_new_obj(under, o->under_vol_id);
+ dset->obj.item.file = subfiling_dset;
+ subfiling_dset->f_offset = 0;
+ if (dataset_get_offset_helper(dset, &f_offset) < 0)
+ puts("Unable to get file_offset");
+ else subfiling_dset->f_offset = f_offset;
+ if (dataset_get_dcpl_helper(dset, &dcpl_id) < 0)
+ puts("Unable to get dcpl");
+ else if ((subfiling_dset->dcpl_id = H5Pcopy(dcpl_id)) < 1)
+ puts("Unable to get dcpl_id");
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ } /* end if */
+ else
+ dset = NULL;
+
+done:
+ return (void *)dset;
+} /* end H5VL_subfiling_dataset_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_read
+ *
+ * Purpose: Reads data elements from a dataset into a buffer.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_dataset_read(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, void *buf, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset;
+ H5VL_subfiling_dset_t *subfiling_dset = NULL;
+ H5VL_subfiling_file_t *subfiling_file = NULL;
+ H5S_sel_type sel_type;
+ // H5S_t *mem_space = NULL;
+ // H5S_t *file_space = NULL;
+ H5D_layout_t layout_method;
+ uint64_t h5_file_id;
+ size_t type_extent = 1;
+ int is_simple, simple_n_dims;
+ int ndims, nblocks, my_rank;
+ hid_t real_file_space_id;
+ hid_t real_mem_space_id;
+ hssize_t num_elem_file = -1, num_elem_mem = -1;
+ haddr_t file_offset;
+ herr_t ret_value;
+
+ hssize_t n_blocks;
+ /* For regular hyperslabs */
+ haddr_t start[H5S_MAX_RANK];
+ hsize_t stride[H5S_MAX_RANK];
+ hsize_t count[H5S_MAX_RANK];
+ hsize_t blocklen[H5S_MAX_RANK];
+ void *addrs[H5S_MAX_RANK];
+
+ assert(dset);
+ subfiling_dset = o->obj.item.file;
+ assert(subfiling_dset);
+ subfiling_file = subfiling_dset->obj.item.file;
+ assert(subfiling_file);
+
+ h5_file_id = (uint64_t)subfiling_file->h5_file_id;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Read\n");
+#endif
+
+ type_extent = H5Tget_size(mem_type_id);
+
+ if((layout_method = H5Pget_layout(subfiling_dset->dcpl_id)) < 0)
+ puts("can't get layout property");
+
+ if (layout_method == H5D_CONTIGUOUS) {
+ ret_value = H5FD__dataset_read_contiguous(h5_file_id, subfiling_dset->f_offset, type_extent,
+ subfiling_file->my_rank, subfiling_file->num_procs, o->under_object,
+ mem_type_id, mem_space_id, file_space_id, plist_id, buf);
+ }
+ else {
+ ret_value = H5VLdataset_read(o->under_object, o->under_vol_id,
+ mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
+ }
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_dataset_read() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_write
+ *
+ * Purpose: Writes data elements from a buffer into a dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
+ hid_t file_space_id, hid_t plist_id, const void *buf, void **req)
+{
+ /*
+ * The incoming dset is a H5VL_subfiling_t and has the following fields::
+ * The 'obj' field is VOL specfic and references the vol object that are
+ * created and are used to manage the underlying 'native' objects.
+ * Once created, the dataset object can be used to read and write. The
+ * subfiling_dset_t maintains the subfiling_file_t as a reference for
+ * use with the actual subfiling VFD componenets. Example:
+ * the subfile_dset is referenced by o->obj.item.file;
+ * the subfile_file is referenced by subfile_dset->obj.item.file.
+ *
+ * o->obj: (This will contain the specfics of the created dataset,
+ * e.g. the dataset item and object_name.
+ *
+ * o->under_object: (which is actually the native H5D_t *)
+ * o->under_vol_id: (This is the pass_through vol id which was passed
+ * into the dataset_create and copied here)
+ */
+
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset;
+ H5VL_subfiling_dset_t *subfiling_dset = NULL;
+ H5VL_subfiling_file_t *subfiling_file = NULL;
+ H5S_sel_type sel_type;
+ H5D_layout_t layout_method;
+ uint64_t h5_file_id;
+ size_t type_extent = 1;
+ int is_simple, simple_n_dims;
+ int ndims, nblocks, my_rank;
+ hid_t real_file_space_id;
+ hid_t real_mem_space_id;
+ hssize_t num_elem_file = -1, num_elem_mem = -1;
+ haddr_t file_offset;
+ herr_t ret_value;
+
+ hssize_t n_blocks;
+ /* For regular hyperslabs */
+ haddr_t start[H5S_MAX_RANK];
+ hsize_t stride[H5S_MAX_RANK];
+ hsize_t count[H5S_MAX_RANK];
+ hsize_t blocklen[H5S_MAX_RANK];
+ void *addrs[H5S_MAX_RANK];
+
+ assert(dset);
+ subfiling_dset = o->obj.item.file;
+ assert(subfiling_dset);
+ subfiling_file = subfiling_dset->obj.item.file;
+ assert(subfiling_file);
+
+ h5_file_id = (uint64_t)subfiling_file->h5_file_id;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Write\n");
+#endif
+
+ type_extent = H5Tget_size(mem_type_id);
+
+ if((layout_method = H5Pget_layout(subfiling_dset->dcpl_id)) < 0)
+ puts("can't get layout property");
+
+ if (layout_method == H5D_CONTIGUOUS) {
+ // ret_value = sf_write_vector(h5_file_id, vlen, start, blocklen, addrs);
+ ret_value = H5FD__dataset_write_contiguous(h5_file_id, subfiling_dset->f_offset, type_extent,
+ subfiling_file->my_rank, subfiling_file->num_procs, o->under_object,
+ mem_type_id, mem_space_id, file_space_id, plist_id, buf);
+ }
+ else {
+ ret_value = H5VLdataset_write(o->under_object, o->under_vol_id,
+ mem_type_id, mem_space_id, file_space_id, plist_id, buf, req);
+ }
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_dataset_write() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_get
+ *
+ * Purpose: Gets information about a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_dataset_get(void *dset, H5VL_dataset_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Get\n");
+#endif
+
+ ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_dataset_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_specific
+ *
+ * Purpose: Specific operation on a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ hid_t under_vol_id;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL H5Dspecific\n");
+#endif
+
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_dataset_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_optional
+ *
+ * Purpose: Perform a connector-specific operation on a dataset
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Optional\n");
+#endif
+
+ ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_dataset_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_dataset_close
+ *
+ * Purpose: Closes a dataset.
+ *
+ * Return: Success: 0
+ * Failure: -1, dataset not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_dataset_close(void *dset, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)dset;
+ H5VL_subfiling_dset_t *subfiling_dset = NULL;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATASET Close\n");
+#endif
+ assert(dset);
+ subfiling_dset = o->obj.item.file;
+
+ ret_value = H5VLdataset_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying dataset was closed */
+ if(ret_value >= 0) {
+ if (subfiling_dset)
+ free(subfiling_dset);
+ H5VL_subfiling_free_obj(o);
+ }
+ return ret_value;
+} /* end H5VL_subfiling_dataset_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_datatype_commit
+ *
+ * Purpose: Commits a datatype inside a container.
+ *
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_datatype_commit(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *dt;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATATYPE Commit\n");
+#endif
+
+ under = H5VLdatatype_commit(o->under_object, loc_params, o->under_vol_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req);
+ if(under) {
+ dt = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dt = NULL;
+
+ return (void *)dt;
+} /* end H5VL_subfiling_datatype_commit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_datatype_open
+ *
+ * Purpose: Opens a named datatype inside a container.
+ *
+ * Return: Success: Pointer to datatype object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t tapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *dt;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATATYPE Open\n");
+#endif
+
+ under = H5VLdatatype_open(o->under_object, loc_params, o->under_vol_id, name, tapl_id, dxpl_id, req);
+ if(under) {
+ dt = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ dt = NULL;
+
+ return (void *)dt;
+} /* end H5VL_subfiling_datatype_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_datatype_get
+ *
+ * Purpose: Get information about a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_datatype_get(void *dt, H5VL_datatype_get_t get_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)dt;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATATYPE Get\n");
+#endif
+
+ ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_datatype_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_datatype_specific
+ *
+ * Purpose: Specific operations for datatypes
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ hid_t under_vol_id;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATATYPE Specific\n");
+#endif
+
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_datatype_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_datatype_optional
+ *
+ * Purpose: Perform a connector-specific operation on a datatype
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATATYPE Optional\n");
+#endif
+
+ ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_datatype_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_datatype_close
+ *
+ * Purpose: Closes a datatype.
+ *
+ * Return: Success: 0
+ * Failure: -1, datatype not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_datatype_close(void *dt, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)dt;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL DATATYPE Close\n");
+#endif
+
+ assert(o->under_object);
+
+ ret_value = H5VLdatatype_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying datatype was closed */
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_datatype_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_create
+ *
+ * Purpose: Creates a container using this connector
+ *
+ * Return: Success: Pointer to a file object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_file_create(const char *name, unsigned flags, hid_t fcpl_id,
+ hid_t fapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_info_t *info;
+ H5VL_subfiling_t *file;
+ H5VL_subfiling_file_t *subfiling_file;
+ hid_t under_fapl_id = -1;
+ void *ret_value = NULL;
+ void *under = NULL;
+
+#if 0
+ file_create_count++;
+ printf("%s: count=%d\n", __func__, file_create_count);
+ fflush(stdout);
+#endif
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL FILE Create\n");
+#endif
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Make sure we have info about the underlying VOL to be used */
+ if (!info)
+ return NULL;
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Open the file with the underlying VOL connector */
+ under = H5VLfile_create(name, flags, fcpl_id, under_fapl_id, dxpl_id, req);
+ if(under) {
+ int mpi_enabled = 0;
+ int open_flags = O_RDWR;
+ char *dir_path = NULL;
+ char file_prefix[PATH_MAX];
+ uint64_t h5_file_id = (uint64_t)0;
+
+ /* We can't use the HDF5 file flags directly, these
+ * need to be translated into posix versions
+ * for the subfiling.
+ */
+ if (flags & H5F_ACC_TRUNC) open_flags |= O_TRUNC;
+ if (flags & H5F_ACC_CREAT) open_flags |= O_CREAT;
+
+ file = H5VL_subfiling_new_obj(under, info->under_vol_id);
+ if(NULL == (subfiling_file = (H5VL_subfiling_file_t *)malloc(sizeof(H5VL_subfiling_file_t)))) {
+ perror("malloc");
+ fprintf(stderr, "can't allocate Subfiling file struct");
+ ret_value = file;
+ goto done;
+ }
+ memset(subfiling_file, 0, sizeof(H5VL_subfiling_file_t));
+ file->obj.item.type = H5I_FILE;
+ file->obj.item.file = subfiling_file;
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, info->under_vol_id);
+
+ if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) {
+ MPI_Comm_size(MPI_COMM_WORLD, &subfiling_file->num_procs);
+ MPI_Comm_rank(MPI_COMM_WORLD, &subfiling_file->my_rank);
+ if (subfiling_file->my_rank == 0) {
+ if (H5FD__get_file_ino(name, &h5_file_id) < 0)
+ file = NULL;
+ }
+ if (MPI_Bcast(&h5_file_id, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD) != MPI_SUCCESS)
+ file = NULL;
+ }
+
+ if (file != NULL) {
+ dir_path = strrchr(name,'/');
+ if (dir_path) {
+ *dir_path = '\0';
+ strcpy(file_prefix, name);
+ *dir_path = '/';
+ dir_path = file_prefix;
+ }
+ else {
+ dir_path = getcwd(file_prefix, PATH_MAX);
+ }
+ /* Only open subfiling if we've enabled MPI */
+ if (mpi_enabled && (sf_open_subfiles(h5_file_id, name, dir_path, open_flags) < 0)) {
+ file = NULL;
+ }
+ else {
+ subfiling_file->h5_file_id = h5_file_id;
+ subfiling_file->file_name = strdup(name);
+ }
+ }
+ } /* end if */
+ else
+ file = NULL;
+
+done:
+
+ ret_value = (void *)file;
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ if (info)
+ H5VL_subfiling_info_free(info);
+
+ return (void *)file;
+} /* end H5VL_subfiling_file_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_open
+ *
+ * Purpose: Opens a container created with this connector
+ *
+ * Return: Success: Pointer to a file object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_file_open(const char *name, unsigned flags, hid_t fapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_info_t *info;
+ H5VL_subfiling_file_t *subfiling_file;
+ H5VL_subfiling_t *file;
+ hid_t under_fapl_id = -1;
+ void *ret_value = NULL;
+ void *under = NULL;
+
+#if 0
+ file_open_count++;
+ printf("%s: count=%d\n", __func__, file_open_count);
+ fflush(stdout);
+#endif
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL FILE Open\n");
+#endif
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Make sure we have info about the underlying VOL to be used */
+ if (!info)
+ return NULL;
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Open the file with the underlying VOL connector */
+ under = H5VLfile_open(name, flags, under_fapl_id, dxpl_id, req);
+ if(under) {
+ int mpi_enabled = 0;
+ int open_flags = O_RDWR;
+ char *dir_path = NULL;
+ char file_prefix[PATH_MAX];
+ uint64_t h5_file_id = (uint64_t)-1;
+
+ /* We can't use the HDF5 file flags directly, these
+ * need to be translated into posix versions
+ * for the subfiling.
+ */
+ if (flags & H5F_ACC_TRUNC) open_flags |= O_TRUNC;
+ if (flags & H5F_ACC_CREAT) open_flags |= O_CREAT;
+
+ file = H5VL_subfiling_new_obj(under, info->under_vol_id);
+ if(NULL == (subfiling_file = (H5VL_subfiling_file_t *)malloc(sizeof(H5VL_subfiling_file_t)))) {
+ perror("malloc");
+ fprintf(stderr, "can't allocate Subfiling file struct");
+ ret_value = file;
+ goto done;
+ }
+ memset(subfiling_file, 0, sizeof(H5VL_subfiling_file_t));
+ file->obj.item.type = H5I_FILE;
+ file->obj.item.file = subfiling_file;
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, info->under_vol_id);
+
+ if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) {
+ MPI_Comm_size(MPI_COMM_WORLD, &subfiling_file->num_procs);
+ MPI_Comm_rank(MPI_COMM_WORLD, &subfiling_file->my_rank);
+ if (subfiling_file->my_rank == 0) {
+ if (H5FD__get_file_ino(name, &h5_file_id) < 0)
+ file = NULL;
+ }
+ if (MPI_Bcast(&h5_file_id, 1, MPI_UINT64_T, 0, MPI_COMM_WORLD) != MPI_SUCCESS)
+ file = NULL;
+ }
+
+ if (file != NULL) {
+ dir_path = strrchr(name,'/');
+ if (dir_path) {
+ *dir_path = '\0';
+ strcpy(file_prefix, name);
+ *dir_path = '/';
+ dir_path = file_prefix;
+ }
+ else {
+ dir_path = getcwd(file_prefix, PATH_MAX);
+ }
+
+ /* Only open subfiling if we've enabled MPI */
+ if (mpi_enabled && (sf_open_subfiles(h5_file_id, name, dir_path, open_flags) < 0)) {
+ file = NULL;
+ }
+ else {
+ subfiling_file->h5_file_id = h5_file_id;
+ subfiling_file->file_name = strdup(name);
+ }
+ }
+
+ } /* end if */
+ else
+ file = NULL;
+
+done:
+
+ ret_value = (void *)file;
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ if (info)
+ H5VL_subfiling_info_free(info);
+
+ return (void *)ret_value;
+
+} /* end H5VL_subfiling_file_open() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_get
+ *
+ * Purpose: Get info about a file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL FILE Get\n");
+#endif
+
+ ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_file_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_specific_reissue
+ *
+ * Purpose: Re-wrap vararg arguments into a va_list and reissue the
+ * file specific callback to the underlying VOL connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_file_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+{
+ va_list arguments;
+ herr_t ret_value;
+
+ va_start(arguments, req);
+ ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments);
+ va_end(arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_file_specific_reissue() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_specific
+ *
+ * Purpose: Specific operation on file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_file_specific(void *file, H5VL_file_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)file;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL FILE Specific\n");
+#endif
+
+ /* Unpack arguments to get at the child file pointer when mounting a file */
+ if(specific_type == H5VL_FILE_MOUNT) {
+ H5I_type_t loc_type;
+ const char *name;
+ H5VL_subfiling_t *child_file;
+ hid_t plist_id;
+
+ /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */
+ loc_type = (H5I_type_t)va_arg(arguments, int); /* enum work-around */
+ name = va_arg(arguments, const char *);
+ child_file = (H5VL_subfiling_t *)va_arg(arguments, void *);
+ plist_id = va_arg(arguments, hid_t);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = o->under_vol_id;
+
+ /* Re-issue 'file specific' call, using the unwrapped pieces */
+ ret_value = H5VL_subfiling_file_specific_reissue(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, (int)loc_type, name, child_file->under_object, plist_id);
+ } /* end if */
+ else if(specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
+ H5VL_subfiling_info_t *info;
+ hid_t fapl_id, under_fapl_id;
+ const char *name;
+ htri_t *ret;
+
+ /* Get the arguments for the 'is accessible' check */
+ fapl_id = va_arg(arguments, hid_t);
+ name = va_arg(arguments, const char *);
+ ret = va_arg(arguments, htri_t *);
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(fapl_id, (void **)&info);
+
+ /* Make sure we have info about the underlying VOL to be used */
+ if (!info)
+ return (-1);
+
+ /* Copy the FAPL */
+ under_fapl_id = H5Pcopy(fapl_id);
+
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = info->under_vol_id;
+
+ /* Re-issue 'file specific' call */
+ ret_value = H5VL_subfiling_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id, req, under_fapl_id, name, ret);
+
+ /* Close underlying FAPL */
+ H5Pclose(under_fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_subfiling_info_free(info);
+ } /* end else-if */
+ else {
+ va_list my_arguments;
+
+ /* Make a copy of the argument list for later, if reopening */
+ if(specific_type == H5VL_FILE_REOPEN)
+ va_copy(my_arguments, arguments);
+
+ /* Keep the correct underlying VOL ID for possible async request token */
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Wrap file struct pointer, if we reopened one */
+ if(specific_type == H5VL_FILE_REOPEN) {
+ if(ret_value >= 0) {
+ void **ret = va_arg(my_arguments, void **);
+
+ if(ret && *ret)
+ *ret = H5VL_subfiling_new_obj(*ret, o->under_vol_id);
+ } /* end if */
+
+ /* Finish use of copied vararg list */
+ va_end(my_arguments);
+ } /* end if */
+ } /* end else */
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_file_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_optional
+ *
+ * Purpose: Perform a connector-specific operation on a file
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_file_optional(void *file, H5VL_file_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)file;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL File Optional\n");
+#endif
+
+ ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_file_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_file_close
+ *
+ * Purpose: Closes a file.
+ *
+ * Return: Success: 0
+ * Failure: -1, file not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_file_close(void *_file, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)_file;
+ H5VL_subfiling_file_t *subfiling_file = (H5VL_subfiling_file_t *)o->obj.item.file;
+ int mpi_enabled = 0;
+ herr_t ret_value;
+#if 0
+ file_close_count++;
+ printf("%s: count=%d\n", __func__, file_close_count);
+ fflush(stdout);
+#endif
+ if (file_create_count > 0) {
+ if (file_create_count != file_close_count)
+ puts("mismatched file_create_count and file_close_count");
+ file_create_count = 0;
+ }
+ if (file_open_count > 0) {
+ if (file_open_count != file_close_count)
+ puts("mismatched file_open_count and file_close_count");
+ file_open_count = 0;
+ }
+
+ file_close_count = 0;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL FILE Close\n");
+#endif
+ assert(subfiling_file != NULL);
+ ret_value = H5VLfile_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ if (MPI_Initialized(&mpi_enabled) == MPI_SUCCESS) {
+ uint64_t h5_file_id = (uint64_t)subfiling_file->h5_file_id;
+ if (mpi_enabled && (sf_close_subfiles(h5_file_id) < 0)) {
+ printf("Unable to close subfiles\n");
+ ret_value = -1;
+ }
+ else {
+ if (subfiling_file->file_name)
+ free(subfiling_file->file_name);
+ free(subfiling_file);
+ }
+ }
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying file was closed */
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_file_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_group_create
+ *
+ * Purpose: Creates a group inside a container
+ *
+ * Return: Success: Pointer to a group object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_group_create(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id,
+ hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *group;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL GROUP Create\n");
+#endif
+
+ under = H5VLgroup_create(o->under_object, loc_params, o->under_vol_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req);
+ if(under) {
+ group = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ group = NULL;
+
+ return (void *)group;
+} /* end H5VL_subfiling_group_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_group_open
+ *
+ * Purpose: Opens a group inside a container
+ *
+ * Return: Success: Pointer to a group object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_group_open(void *obj, const H5VL_loc_params_t *loc_params,
+ const char *name, hid_t gapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *group;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL GROUP Open\n");
+#endif
+
+ under = H5VLgroup_open(o->under_object, loc_params, o->under_vol_id, name, gapl_id, dxpl_id, req);
+ if(under) {
+ group = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ group = NULL;
+
+ return (void *)group;
+} /* end H5VL_subfiling_group_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_group_get
+ *
+ * Purpose: Get info about a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
+ void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL GROUP Get\n");
+#endif
+
+ ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_group_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_group_specific
+ *
+ * Purpose: Specific operation on a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_group_specific(void *obj, H5VL_group_specific_t specific_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ hid_t under_vol_id;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL GROUP Specific\n");
+#endif
+
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_group_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_group_optional
+ *
+ * Purpose: Perform a connector-specific operation on a group
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_group_optional(void *obj, H5VL_group_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL GROUP Optional\n");
+#endif
+
+ ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_group_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_group_close
+ *
+ * Purpose: Closes a group.
+ *
+ * Return: Success: 0
+ * Failure: -1, group not closed.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_group_close(void *grp, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)grp;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL H5Gclose\n");
+#endif
+
+ ret_value = H5VLgroup_close(o->under_object, o->under_vol_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ /* Release our wrapper, if underlying file was closed */
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_group_close() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_create_reissue
+ *
+ * Purpose: Re-wrap vararg arguments into a va_list and reissue the
+ * link create callback to the underlying VOL connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_create_reissue(H5VL_link_create_type_t create_type,
+ void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, ...)
+{
+ va_list arguments;
+ herr_t ret_value;
+
+ va_start(arguments, req);
+ ret_value = H5VLlink_create(create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req, arguments);
+ va_end(arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_create_reissue() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_create
+ *
+ * Purpose: Creates a hard / soft / UD / external link.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_create(H5VL_link_create_type_t create_type, void *obj,
+ const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL LINK Create\n");
+#endif
+
+ /* Try to retrieve the "under" VOL id */
+ if(o)
+ under_vol_id = o->under_vol_id;
+
+ /* Fix up the link target object for hard link creation */
+ if(H5VL_LINK_CREATE_HARD == create_type) {
+ void *cur_obj;
+ H5VL_loc_params_t *cur_params;
+
+ /* Retrieve the object & loc params for the link target */
+ cur_obj = va_arg(arguments, void *);
+ cur_params = va_arg(arguments, H5VL_loc_params_t *);
+
+ /* If it's a non-NULL pointer, find the 'under object' and re-set the property */
+ if(cur_obj) {
+ /* Check if we still need the "under" VOL ID */
+ if(under_vol_id < 0)
+ under_vol_id = ((H5VL_subfiling_t *)cur_obj)->under_vol_id;
+
+ /* Set the object for the link target */
+ cur_obj = ((H5VL_subfiling_t *)cur_obj)->under_object;
+ } /* end if */
+
+ /* Re-issue 'link create' call, using the unwrapped pieces */
+ ret_value = H5VL_subfiling_link_create_reissue(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, cur_obj, cur_params);
+ } /* end if */
+ else
+ ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_create() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_copy
+ *
+ * Purpose: Renames an object within an HDF5 container and copies it to a new
+ * group. The original name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o_src = (H5VL_subfiling_t *)src_obj;
+ H5VL_subfiling_t *o_dst = (H5VL_subfiling_t *)dst_obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL LINK Copy\n");
+#endif
+
+ /* Retrieve the "under" VOL id */
+ if(o_src)
+ under_vol_id = o_src->under_vol_id;
+ else if(o_dst)
+ under_vol_id = o_dst->under_vol_id;
+ assert(under_vol_id > 0);
+
+ ret_value = H5VLlink_copy((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_move
+ *
+ * Purpose: Moves a link within an HDF5 file to a new group. The original
+ * name SRC is unlinked from the group graph
+ * and then inserted with the new name DST (which can specify a
+ * new path for the object) as an atomic operation. The names
+ * are interpreted relative to SRC_LOC_ID and
+ * DST_LOC_ID, which are either file IDs or group ID.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
+ void *dst_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id,
+ hid_t lapl_id, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *o_src = (H5VL_subfiling_t *)src_obj;
+ H5VL_subfiling_t *o_dst = (H5VL_subfiling_t *)dst_obj;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL LINK Move\n");
+#endif
+
+ /* Retrieve the "under" VOL id */
+ if(o_src)
+ under_vol_id = o_src->under_vol_id;
+ else if(o_dst)
+ under_vol_id = o_dst->under_vol_id;
+ assert(under_vol_id > 0);
+
+ ret_value = H5VLlink_move((o_src ? o_src->under_object : NULL), loc_params1, (o_dst ? o_dst->under_object : NULL), loc_params2, under_vol_id, lcpl_id, lapl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_move() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_get
+ *
+ * Purpose: Get info about a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_get(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL LINK Get\n");
+#endif
+
+ ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_specific
+ *
+ * Purpose: Specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL LINK Specific\n");
+#endif
+
+ ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_link_optional
+ *
+ * Purpose: Perform a connector-specific operation on a link
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_link_optional(void *obj, H5VL_link_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL LINK Optional\n");
+#endif
+
+ ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_link_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_object_open
+ *
+ * Purpose: Opens an object inside a container.
+ *
+ * Return: Success: Pointer to object
+ * Failure: NULL
+ *
+ *-------------------------------------------------------------------------
+ */
+static void *
+H5VL_subfiling_object_open(void *obj, const H5VL_loc_params_t *loc_params,
+ H5I_type_t *opened_type, hid_t dxpl_id, void **req)
+{
+ H5VL_subfiling_t *new_obj;
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ void *under;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL OBJECT Open\n");
+#endif
+
+ under = H5VLobject_open(o->under_object, loc_params, o->under_vol_id, opened_type, dxpl_id, req);
+ if(under) {
+ new_obj = H5VL_subfiling_new_obj(under, o->under_vol_id);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+ } /* end if */
+ else
+ new_obj = NULL;
+
+ return (void *)new_obj;
+} /* end H5VL_subfiling_object_open() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_object_copy
+ *
+ * Purpose: Copies an object inside a container.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params,
+ const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params,
+ const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
+ void **req)
+{
+ H5VL_subfiling_t *o_src = (H5VL_subfiling_t *)src_obj;
+ H5VL_subfiling_t *o_dst = (H5VL_subfiling_t *)dst_obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL OBJECT Copy\n");
+#endif
+
+ ret_value = H5VLobject_copy(o_src->under_object, src_loc_params, src_name, o_dst->under_object, dst_loc_params, dst_name, o_src->under_vol_id, ocpypl_id, lcpl_id, dxpl_id, req);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o_src->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_object_copy() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_object_get
+ *
+ * Purpose: Get info about an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL OBJECT Get\n");
+#endif
+
+ ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_object_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_object_specific
+ *
+ * Purpose: Specific operation on an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ hid_t under_vol_id;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL OBJECT Specific\n");
+#endif
+
+ // Save copy of underlying VOL connector ID and prov helper, in case of
+ // refresh destroying the current object
+ under_vol_id = o->under_vol_id;
+
+ ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_object_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_object_optional
+ *
+ * Purpose: Perform a connector-specific operation for an object
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_object_optional(void *obj, H5VL_object_optional_t opt_type,
+ hid_t dxpl_id, void **req, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL OBJECT Optional\n");
+#endif
+
+ ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+
+ /* Check for async request */
+ if(req && *req)
+ *req = H5VL_subfiling_new_obj(*req, o->under_vol_id);
+
+ return ret_value;
+} /* end H5VL_subfiling_object_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_introspect_get_conn_clss
+ *
+ * Purpose: Query the connector class.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
+ const H5VL_class_t **conn_cls)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INTROSPECT GetConnCls\n");
+#endif
+
+ /* Check for querying this connector's class */
+ if(H5VL_GET_CONN_LVL_CURR == lvl) {
+ *conn_cls = &H5VL_subfiling_g;
+ ret_value = 0;
+ } /* end if */
+ else
+ ret_value = H5VLintrospect_get_conn_cls(o->under_object, o->under_vol_id,
+ lvl, conn_cls);
+
+ return ret_value;
+} /* end H5VL_subfiling_introspect_get_conn_cls() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_introspect_opt_query
+ *
+ * Purpose: Query if an optional operation is supported by this connector
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_introspect_opt_query(void *obj, H5VL_subclass_t cls,
+ int opt_type, hbool_t *supported)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL INTROSPECT OptQuery\n");
+#endif
+
+ ret_value = H5VLintrospect_opt_query(o->under_object, o->under_vol_id, cls,
+ opt_type, supported);
+
+ return ret_value;
+} /* end H5VL_subfiling_introspect_opt_query() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_wait
+ *
+ * Purpose: Wait (with a timeout) for an async operation to complete
+ *
+ * Note: Releases the request if the operation has completed and the
+ * connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_wait(void *obj, uint64_t timeout,
+ H5ES_status_t *status)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL REQUEST Wait\n");
+#endif
+
+ ret_value = H5VLrequest_wait(o->under_object, o->under_vol_id, timeout, status);
+
+ if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_request_wait() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_notify
+ *
+ * Purpose: Registers a user callback to be invoked when an asynchronous
+ * operation completes
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL REQUEST Notify\n");
+#endif
+
+ ret_value = H5VLrequest_notify(o->under_object, o->under_vol_id, cb, ctx);
+
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_request_notify() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_cancel
+ *
+ * Purpose: Cancels an asynchronous operation
+ *
+ * Note: Releases the request, if connector callback succeeds
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_cancel(void *obj)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL REQUEST Cancel\n");
+#endif
+
+ ret_value = H5VLrequest_cancel(o->under_object, o->under_vol_id);
+
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_request_cancel() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_specific_reissue
+ *
+ * Purpose: Re-wrap vararg arguments into a va_list and reissue the
+ * request specific callback to the underlying VOL connector.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_specific_reissue(void *obj, hid_t connector_id,
+ H5VL_request_specific_t specific_type, ...)
+{
+ va_list arguments;
+ herr_t ret_value;
+
+ va_start(arguments, specific_type);
+ ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments);
+ va_end(arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_request_specific_reissue() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_specific
+ *
+ * Purpose: Specific operation on a request
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_specific(void *obj, H5VL_request_specific_t specific_type,
+ va_list arguments)
+{
+ herr_t ret_value = -1;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL REQUEST Specific\n");
+#endif
+
+ if(H5VL_REQUEST_WAITANY == specific_type ||
+ H5VL_REQUEST_WAITSOME == specific_type ||
+ H5VL_REQUEST_WAITALL == specific_type) {
+ va_list tmp_arguments;
+ size_t req_count;
+
+ /* Sanity check */
+ assert(obj == NULL);
+
+ /* Get enough info to call the underlying connector */
+ va_copy(tmp_arguments, arguments);
+ req_count = va_arg(tmp_arguments, size_t);
+
+ /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */
+ if(req_count > 0) {
+ void **req_array;
+ void **under_req_array;
+ uint64_t timeout;
+ H5VL_subfiling_t *o;
+ size_t u; /* Local index variable */
+
+ /* Get the request array */
+ req_array = va_arg(tmp_arguments, void **);
+
+ /* Get a request to use for determining the underlying VOL connector */
+ o = (H5VL_subfiling_t *)req_array[0];
+
+ /* Create array of underlying VOL requests */
+ under_req_array = (void **)malloc(req_count * sizeof(void **));
+ for(u = 0; u < req_count; u++)
+ under_req_array[u] = ((H5VL_subfiling_t *)req_array[u])->under_object;
+
+ /* Remove the timeout value from the vararg list (it's used in all the calls below) */
+ timeout = va_arg(tmp_arguments, uint64_t);
+
+ /* Release requests that have completed */
+ if(H5VL_REQUEST_WAITANY == specific_type) {
+ size_t *idx; /* Pointer to the index of completed request */
+ H5ES_status_t *status; /* Pointer to the request's status */
+
+ /* Retrieve the remaining arguments */
+ idx = va_arg(tmp_arguments, size_t *);
+ assert(*idx <= req_count);
+ status = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITANY 'request specific' call */
+ ret_value = H5VL_subfiling_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout,
+ idx,
+ status);
+
+ /* Release the completed request, if it completed */
+ if(ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) {
+ H5VL_subfiling_t *tmp_o;
+
+ tmp_o = (H5VL_subfiling_t *)req_array[*idx];
+ H5VL_subfiling_free_obj(tmp_o);
+ } /* end if */
+ } /* end if */
+ else if(H5VL_REQUEST_WAITSOME == specific_type) {
+ size_t *outcount; /* # of completed requests */
+ unsigned *array_of_indices; /* Array of indices for completed requests */
+ H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */
+
+ /* Retrieve the remaining arguments */
+ outcount = va_arg(tmp_arguments, size_t *);
+ assert(*outcount <= req_count);
+ array_of_indices = va_arg(tmp_arguments, unsigned *);
+ array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITSOME 'request specific' call */
+ ret_value = H5VL_subfiling_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, outcount, array_of_indices, array_of_statuses);
+
+ /* If any requests completed, release them */
+ if(ret_value >= 0 && *outcount > 0) {
+ unsigned *idx_array; /* Array of indices of completed requests */
+
+ /* Retrieve the array of completed request indices */
+ idx_array = va_arg(tmp_arguments, unsigned *);
+
+ /* Release the completed requests */
+ for(u = 0; u < *outcount; u++) {
+ H5VL_subfiling_t *tmp_o;
+
+ tmp_o = (H5VL_subfiling_t *)req_array[idx_array[u]];
+ H5VL_subfiling_free_obj(tmp_o);
+ } /* end for */
+ } /* end if */
+ } /* end else-if */
+ else { /* H5VL_REQUEST_WAITALL == specific_type */
+ H5ES_status_t *array_of_statuses; /* Array of statuses for completed requests */
+
+ /* Retrieve the remaining arguments */
+ array_of_statuses = va_arg(tmp_arguments, H5ES_status_t *);
+
+ /* Reissue the WAITALL 'request specific' call */
+ ret_value = H5VL_subfiling_request_specific_reissue(o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout, array_of_statuses);
+
+ /* Release the completed requests */
+ if(ret_value >= 0) {
+ for(u = 0; u < req_count; u++) {
+ if(array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) {
+ H5VL_subfiling_t *tmp_o;
+
+ tmp_o = (H5VL_subfiling_t *)req_array[u];
+ H5VL_subfiling_free_obj(tmp_o);
+ } /* end if */
+ } /* end for */
+ } /* end if */
+ } /* end else */
+
+ /* Release array of requests for underlying connector */
+ free(under_req_array);
+ } /* end if */
+
+ /* Finish use of copied vararg list */
+ va_end(tmp_arguments);
+ } /* end if */
+ else
+ assert(0 && "Unknown 'specific' operation");
+
+ return ret_value;
+} /* end H5VL_subfiling_request_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_optional
+ *
+ * Purpose: Perform a connector-specific operation for a request
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_optional(void *obj, H5VL_request_optional_t opt_type,
+ va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL REQUEST Optional\n");
+#endif
+
+ ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_request_optional() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_request_free
+ *
+ * Purpose: Releases a request, allowing the operation to complete without
+ * application tracking
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_request_free(void *obj)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL REQUEST Free\n");
+#endif
+
+ ret_value = H5VLrequest_free(o->under_object, o->under_vol_id);
+
+ if(ret_value >= 0)
+ H5VL_subfiling_free_obj(o);
+
+ return ret_value;
+} /* end H5VL_subfiling_request_free() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_blob_put
+ *
+ * Purpose: Handles the blob 'put' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_blob_put(void *obj, const void *buf, size_t size,
+ void *blob_id, void *ctx)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL BLOB Put\n");
+#endif
+
+ ret_value = H5VLblob_put(o->under_object, o->under_vol_id, buf, size,
+ blob_id, ctx);
+
+ return ret_value;
+} /* end H5VL_subfiling_blob_put() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_blob_get
+ *
+ * Purpose: Handles the blob 'get' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_blob_get(void *obj, const void *blob_id, void *buf,
+ size_t size, void *ctx)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL BLOB Get\n");
+#endif
+
+ ret_value = H5VLblob_get(o->under_object, o->under_vol_id, blob_id, buf,
+ size, ctx);
+
+ return ret_value;
+} /* end H5VL_subfiling_blob_get() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_blob_specific
+ *
+ * Purpose: Handles the blob 'specific' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_blob_specific(void *obj, void *blob_id,
+ H5VL_blob_specific_t specific_type, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL BLOB Specific\n");
+#endif
+
+ ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id,
+ specific_type, arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_blob_specific() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_blob_optional
+ *
+ * Purpose: Handles the blob 'optional' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_blob_optional(void *obj, void *blob_id,
+ H5VL_blob_optional_t opt_type, va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL BLOB Optional\n");
+#endif
+
+ ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id,
+ opt_type, arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_blob_optional() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_token_cmp
+ *
+ * Purpose: Compare two of the connector's object tokens, setting
+ * *cmp_value, following the same rules as strcmp().
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_token_cmp(void *obj, const H5O_token_t *token1,
+ const H5O_token_t *token2, int *cmp_value)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL TOKEN Compare\n");
+#endif
+
+ /* Sanity checks */
+ assert(obj);
+ assert(token1);
+ assert(token2);
+ assert(cmp_value);
+
+ ret_value = H5VLtoken_cmp(o->under_object, o->under_vol_id, token1, token2, cmp_value);
+
+ return ret_value;
+} /* end H5VL_subfiling_token_cmp() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_token_to_str
+ *
+ * Purpose: Serialize the connector's object token into a string.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_token_to_str(void *obj, H5I_type_t obj_type,
+ const H5O_token_t *token, char **token_str)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL TOKEN To string\n");
+#endif
+
+ /* Sanity checks */
+ assert(obj);
+ assert(token);
+ assert(token_str);
+
+ ret_value = H5VLtoken_to_str(o->under_object, obj_type, o->under_vol_id, token, token_str);
+
+ return ret_value;
+} /* end H5VL_subfiling_token_to_str() */
+
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL_subfiling_token_from_str
+ *
+ * Purpose: Deserialize the connector's object token from a string.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL_subfiling_token_from_str(void *obj, H5I_type_t obj_type,
+ const char *token_str, H5O_token_t *token)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL TOKEN From string\n");
+#endif
+
+ /* Sanity checks */
+ assert(obj);
+ assert(token);
+ assert(token_str);
+
+ ret_value = H5VLtoken_from_str(o->under_object, obj_type, o->under_vol_id, token_str, token);
+
+ return ret_value;
+} /* end H5VL_subfiling_token_from_str() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_subfiling_optional
+ *
+ * Purpose: Handles the generic 'optional' callback
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_subfiling_optional(void *obj, int op_type, hid_t dxpl_id, void **req,
+ va_list arguments)
+{
+ H5VL_subfiling_t *o = (H5VL_subfiling_t *)obj;
+ herr_t ret_value;
+
+#ifdef ENABLE_EXT_PASSTHRU_LOGGING
+ printf("------- SUBFILING VOL generic Optional\n");
+#endif
+
+ ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type,
+ dxpl_id, req, arguments);
+
+ return ret_value;
+} /* end H5VL_subfiling_optional() */
+
diff --git a/test/h5subfiling_vol.h b/test/h5subfiling_vol.h
new file mode 100644
index 0000000..246de33
--- /dev/null
+++ b/test/h5subfiling_vol.h
@@ -0,0 +1,115 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: The public header file for the pass-through VOL connector.
+ */
+
+#ifndef _H5subfiling_vol_H
+#define _H5subfiling_vol_H
+
+/* Public headers needed by this file */
+#include "H5VLpublic.h" /* Virtual Object Layer */
+#include "H5PLextern.h" /* External HDF5 plugins */
+#include "H5FDsubfiling.h" /* H5FD subfiling */
+
+/* Identifier for the pass-through VOL connector */
+#define H5VL_SUBFILING (H5VL_subfiling_register())
+
+/* Characteristics of the pass-through VOL connector */
+#define H5VL_SUBFILING_NAME "subfiling"
+#define H5VL_SUBFILING_VALUE ((H5VL_class_value_t)13031) /* VOL connector ID */
+#define H5VL_SUBFILING_VERSION 1
+
+/* Pass-through VOL connector info */
+typedef struct H5VL_subfiling_info_t {
+ hid_t under_vol_id; /* VOL ID for under VOL */
+ void *under_vol_info; /* VOL info for under VOL */
+} H5VL_subfiling_info_t;
+
+
+#include <string.h>
+#include "mercury/mercury_thread_mutex.h"
+
+#define H5_LIST_HEAD_INITIALIZER(name) { NULL }
+
+#define H5_LIST_HEAD_INIT(struct_head_name, var_name) \
+ struct struct_head_name var_name = H5_LIST_HEAD_INITIALIZER(var_name)
+
+#define H5_LIST_HEAD_DECL(struct_head_name, struct_entry_name) \
+ struct struct_head_name { \
+ struct struct_entry_name *head; \
+ }
+
+#define H5_LIST_HEAD(struct_entry_name) \
+ struct { \
+ struct struct_entry_name *head; \
+ hg_thread_mutex_t lock; \
+ }
+
+#define H5_LIST_ENTRY(struct_entry_name) \
+ struct { \
+ struct struct_entry_name *next; \
+ struct struct_entry_name **prev; \
+ }
+
+#define H5_LIST_INIT(head_ptr) do { \
+ (head_ptr)->head = NULL; \
+ hg_thread_mutex_init(&(head_ptr)->lock);\
+} while (/*CONSTCOND*/0)
+
+#define H5_LIST_IS_EMPTY(head_ptr) \
+ ((head_ptr)->head == NULL)
+
+#define H5_LIST_FIRST(head_ptr) \
+ ((head_ptr)->head)
+
+#define H5_LIST_GET_FIRST(var, head_ptr) \
+ (var = (head_ptr)->head)
+
+#define H5_LIST_NEXT(entry_ptr, entry_field_name) \
+ ((entry_ptr)->entry_field_name.next)
+
+#define H5_LIST_INSERT_HEAD(head_ptr, entry_ptr, entry_field_name) do { \
+ if (((entry_ptr)->entry_field_name.next = (head_ptr)->head) != NULL) \
+ (head_ptr)->head->entry_field_name.prev = \
+ &(entry_ptr)->entry_field_name.next; \
+ (head_ptr)->head = (entry_ptr); \
+ (entry_ptr)->entry_field_name.prev = &(head_ptr)->head; \
+} while (/*CONSTCOND*/0)
+
+/* TODO would be nice to not have any condition */
+#define H5_LIST_REMOVE(entry_ptr, entry_field_name) do { \
+ if ((entry_ptr)->entry_field_name.next != NULL) \
+ (entry_ptr)->entry_field_name.next->entry_field_name.prev = \
+ (entry_ptr)->entry_field_name.prev; \
+ *(entry_ptr)->entry_field_name.prev = (entry_ptr)->entry_field_name.next; \
+} while (/*CONSTCOND*/0)
+
+#define H5_LIST_FOREACH(var, head_ptr, entry_field_name) \
+ for ((var) = ((head_ptr)->head); \
+ (var); \
+ (var) = ((var)->entry_field_name.next))
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5_DLL hid_t H5VL_subfiling_register(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5subfiling_vol_H */
+
diff --git a/test/h5test.c b/test/h5test.c
index 9cca100..022bfde 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, November 19, 1998
*
* Purpose: Provides support functions for most of the hdf5 tests cases.
@@ -2057,23 +2057,23 @@ h5_get_version_string(H5F_libver_t libver)
int
h5_compare_file_bytes(char *f1name, char *f2name)
{
- FILE *f1ptr = NULL; /* two file pointers */
- FILE *f2ptr = NULL;
- hsize_t f1size = 0; /* size of the files */
- hsize_t f2size = 0;
- char f1char = 0; /* one char from each file */
- char f2char = 0;
- hsize_t ii = 0;
- int ret_value = 0; /* for error handling */
+ FILE *f1ptr = NULL; /* two file pointers */
+ FILE *f2ptr = NULL;
+ off_t f1size = 0; /* size of the files */
+ off_t f2size = 0;
+ char f1char = 0; /* one char from each file */
+ char f2char = 0;
+ off_t ii = 0;
+ int ret_value = 0; /* for error handling */
/* Open files for reading */
- f1ptr = fopen(f1name, "r");
+ f1ptr = HDfopen(f1name, "rb");
if (f1ptr == NULL) {
HDfprintf(stderr, "Unable to fopen() %s\n", f1name);
ret_value = -1;
goto done;
}
- f2ptr = fopen(f2name, "r");
+ f2ptr = HDfopen(f2name, "rb");
if (f2ptr == NULL) {
HDfprintf(stderr, "Unable to fopen() %s\n", f2name);
ret_value = -1;
@@ -2081,11 +2081,11 @@ h5_compare_file_bytes(char *f1name, char *f2name)
}
/* Get the file sizes and verify that they equal */
- fseek(f1ptr , 0 , SEEK_END);
- f1size = ftell(f1ptr);
+ HDfseek(f1ptr , 0 , SEEK_END);
+ f1size = HDftell(f1ptr);
- fseek(f2ptr , 0 , SEEK_END);
- f2size = ftell(f2ptr);
+ HDfseek(f2ptr , 0 , SEEK_END);
+ f2size = HDftell(f2ptr);
if (f1size != f2size) {
HDfprintf(stderr, "Files differ in size, %llu vs. %llu\n", f1size, f2size);
@@ -2094,11 +2094,17 @@ h5_compare_file_bytes(char *f1name, char *f2name)
}
/* Compare each byte and fail if a difference is found */
- rewind(f1ptr);
- rewind(f2ptr);
+ HDrewind(f1ptr);
+ HDrewind(f2ptr);
for (ii = 0; ii < f1size; ii++) {
- fread(&f1char, 1, 1, f1ptr);
- fread(&f2char, 1, 1, f2ptr);
+ if(HDfread(&f1char, 1, 1, f1ptr) != 1) {
+ ret_value = -1;
+ goto done;
+ }
+ if(HDfread(&f2char, 1, 1, f2ptr) != 1) {
+ ret_value = -1;
+ goto done;
+ }
if (f1char != f2char) {
HDfprintf(stderr, "Mismatch @ 0x%llX: 0x%X != 0x%X\n", ii, f1char, f2char);
ret_value = -1;
@@ -2107,13 +2113,11 @@ h5_compare_file_bytes(char *f1name, char *f2name)
}
done:
- if (f1ptr) {
- fclose(f1ptr);
- }
- if (f2ptr) {
- fclose(f2ptr);
- }
- return(ret_value);
+ if (f1ptr)
+ HDfclose(f1ptr);
+ if (f2ptr)
+ HDfclose(f2ptr);
+ return ret_value;
} /* end h5_compare_file_bytes() */
/*-------------------------------------------------------------------------
@@ -2169,3 +2173,131 @@ const char *H5_get_srcdir(void)
return(NULL);
} /* end H5_get_srcdir() */
+/*-------------------------------------------------------------------------
+ * Function: h5_duplicate_file_by_bytes
+ *
+ * Purpose: Duplicate a file byte-for-byte at filename/path 'orig'
+ * to a new (or replaced) file at 'dest'.
+ *
+ * Return: Success: 0, completed successfully
+ * Failure: -1
+ *
+ * Programmer: Jake Smith
+ * 24 June 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+h5_duplicate_file_by_bytes(const char *orig, const char *dest)
+{
+ FILE *orig_ptr = NULL;
+ FILE *dest_ptr = NULL;
+ hsize_t fsize = 0;
+ hsize_t read_size = 0;
+ hsize_t max_buf = 0;
+ void *dup_buf = NULL;
+ int ret_value = 0;
+
+ max_buf = 4096 * sizeof(char);
+
+ orig_ptr = HDfopen(orig, "rb");
+ if (NULL == orig_ptr) {
+ ret_value = -1;
+ goto done;
+ }
+
+ HDfseek(orig_ptr , 0 , SEEK_END);
+ fsize = (hsize_t)HDftell(orig_ptr);
+ HDrewind(orig_ptr);
+
+ dest_ptr = HDfopen(dest, "wb");
+ if (NULL == dest_ptr) {
+ ret_value = -1;
+ goto done;
+ }
+
+ read_size = MIN(fsize, max_buf);
+ dup_buf = HDmalloc(read_size);
+ if (NULL == dup_buf) {
+ ret_value = -1;
+ goto done;
+ }
+
+ while (read_size > 0) {
+ if (HDfread(dup_buf, read_size, 1, orig_ptr) != 1) {
+ ret_value = -1;
+ goto done;
+ }
+ HDfwrite(dup_buf, read_size, 1, dest_ptr);
+ fsize -= read_size;
+ read_size = MIN(fsize, max_buf);
+ }
+
+done:
+ if (orig_ptr != NULL)
+ HDfclose(orig_ptr);
+ if (dest_ptr != NULL)
+ HDfclose(dest_ptr);
+ if (dup_buf != NULL)
+ HDfree(dup_buf);
+ return ret_value;
+} /* end h5_duplicate_file_by_bytes() */
+
+/*-------------------------------------------------------------------------
+ * Function: h5_check_if_file_locking_enabled
+ *
+ * Purpose: Checks if file locking is enabled on this file system.
+ *
+ * Return: SUCCEED/FAIL
+ * are_enabled will be FALSE if file locking is disabled on
+ * the file system of if there were errors.
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+h5_check_if_file_locking_enabled(hbool_t *is_enabled)
+{
+ const char *filename = "locking_test_file";
+ int pmode = O_RDWR | O_CREAT | O_TRUNC;
+ int fd = -1;
+
+ *is_enabled = TRUE;
+
+ if((fd = HDopen(filename, pmode, H5_POSIX_CREATE_MODE_RW)) < 0)
+ goto error;
+
+ /* Test HDflock() to see if it works */
+ if(HDflock(fd, LOCK_EX | LOCK_NB) < 0) {
+ if(ENOSYS == errno) {
+ /* When errno is set to ENOSYS, the file system does not support
+ * locking, so ignore it. This is most frequently used on
+ * Lustre. If we also want to check for disabled NFS locks
+ * we'll need to check for ENOLCK, too. That isn't done by
+ * default here since that could also represent an actual
+ * error condition.
+ */
+ errno = 0;
+ *is_enabled = FALSE;
+ }
+ else
+ goto error;
+ }
+ if(HDflock(fd, LOCK_UN) < 0)
+ goto error;
+
+ if(HDclose(fd) < 0)
+ goto error;
+ if(HDremove(filename) < 0)
+ goto error;
+
+ return SUCCEED;
+
+error:
+ *is_enabled = FALSE;
+ if (fd > -1) {
+ HDclose(fd);
+ HDremove(filename);
+ }
+ return FAIL;
+} /* end h5_check_if_file_locking_enabled() */
+
diff --git a/test/h5test.h b/test/h5test.h
index b1ddc58..22047e1 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, November 20, 1998
*
* Purpose: Test support stuff.
@@ -210,6 +210,8 @@ H5TEST_DLL H5FD_class_t *h5_get_dummy_vfd_class(void);
H5TEST_DLL H5VL_class_t *h5_get_dummy_vol_class(void);
H5TEST_DLL const char *h5_get_version_string(H5F_libver_t libver);
H5TEST_DLL int h5_compare_file_bytes(char *fname1, char *fname2);
+H5TEST_DLL int h5_duplicate_file_by_bytes(const char *orig, const char *dest);
+H5TEST_DLL herr_t h5_check_if_file_locking_enabled(hbool_t *are_enabled);
/* Functions that will replace components of a FAPL */
H5TEST_DLL herr_t h5_get_vfd_fapl(hid_t fapl_id);
diff --git a/test/hdfs.c b/test/hdfs.c
index ab39da6..0f4969e 100644
--- a/test/hdfs.c
+++ b/test/hdfs.c
@@ -19,7 +19,7 @@
*
* Demonstrates basic use cases and fapl interaction.
*
- * Programmer: Jacob Smith <jake.smith@hdfgroup.org>
+ * Programmer: Jacob Smith
* 2018-04-23
*/
@@ -30,7 +30,6 @@
#ifdef H5_HAVE_LIBHDFS
#define HDFS_TEST_DEBUG 0
#define HDFS_TEST_MAX_BUF_SIZE 256
-#endif /* H5_HAVE_LIBHDFS */
/*****************************************************************************
*
@@ -372,11 +371,8 @@ if (strcmp((actual), (expected)) != 0) { \
* OTHER MACROS AND DEFINITIONS *
********************************/
-/* copied from src/hdfs.c
- */
-#ifdef H5_HAVE_LIBHDFS
+/* copied from src/hdfs.c */
#define MAXADDR (((haddr_t)1<<(8*sizeof(HDoff_t)-1))-1)
-#endif /* H5_HAVE_LIBHDFS */
#define HDFS_NAMENODE_NAME_MAX_SIZE 128
@@ -384,12 +380,10 @@ if (strcmp((actual), (expected)) != 0) { \
* FILE-LOCAL GLOBAL VARIABLES *
*******************************/
-#ifdef H5_HAVE_LIBHDFS
static const char filename_missing[] = "/tmp/missing.txt";
static const char filename_bard[] = "/tmp/t8.shakespeare.txt";
static const char filename_raven[] = "/tmp/Poe_Raven.txt";
static const char filename_example_h5[] = "/tmp/t.h5";
-#endif /* H5_HAVE_LIBHDFS */
static H5FD_hdfs_fapl_t default_fa = {
1, /* fa version */
@@ -399,6 +393,7 @@ static H5FD_hdfs_fapl_t default_fa = {
"", /* kerberos path */
1024, /* buffer size */
};
+#endif /* H5_HAVE_LIBHDFS */
/******************
* TEST FUNCTIONS *
@@ -429,6 +424,14 @@ static H5FD_hdfs_fapl_t default_fa = {
static int
test_fapl_config_validation(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS fapl configuration validation");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
/*********************
* test-local macros *
*********************/
@@ -604,6 +607,7 @@ error:
} H5E_END_TRY;
}
return 1;
+#endif /* H5_HAVE_LIBHDFS */
} /* end test_fapl_config_validation() */
@@ -630,6 +634,14 @@ error:
static int
test_hdfs_fapl(void)
{
+#ifndef H5_HAVE_LIBHDFS
+ TESTING("HDFS fapl ");
+ SKIPPED();
+ puts(" HDFS VFD is not enabled");
+ fflush(stdout);
+ return 0;
+
+#else
/************************
* test-local variables *
************************/
@@ -681,6 +693,7 @@ error:
} H5E_END_TRY;
return 1;
+#endif /* H5_HAVE_LIBHDFS */
} /* end test_hdfs_fapl() */
@@ -1723,6 +1736,7 @@ main(void)
* commence tests *
******************/
+#ifdef H5_HAVE_LIBHDFS
static char hdfs_namenode_name[HDFS_NAMENODE_NAME_MAX_SIZE] = "";
const char *hdfs_namenode_name_env = NULL;
@@ -1736,6 +1750,7 @@ main(void)
hdfs_namenode_name_env,
HDFS_NAMENODE_NAME_MAX_SIZE);
}
+#endif /* H5_HAVE_LIBHDFS */
h5_reset();
diff --git a/test/hyperslab.c b/test/hyperslab.c
index e702023..8168eed 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Friday, October 10, 1997
*
* Purpose: Hyperslab operations are rather complex, so this file
diff --git a/test/istore.c b/test/istore.c
index c8fe866..e80f260 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Wednesday, October 15, 1997
*
* Purpose: Tests various aspects of indexed raw data storage.
diff --git a/test/lheap.c b/test/lheap.c
index 5f60dca..dd430a3 100644
--- a/test/lheap.c
+++ b/test/lheap.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*
* Purpose: Test local heaps used by symbol tables (groups).
diff --git a/test/links.c b/test/links.c
index 60d3152..cd9f05c 100644
--- a/test/links.c
+++ b/test/links.c
@@ -9037,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_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 */
+ 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)")
@@ -18286,7 +18286,6 @@ main(void)
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
*/
diff --git a/test/mf.c b/test/mf.c
index 7cfc954..8e2f75c 100644
--- a/test/mf.c
+++ b/test/mf.c
@@ -7696,6 +7696,8 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
TEST_ERROR
if(fs_persist) {
+ haddr_t prv_tag = HADDR_UNDEF;
+
/* Re-open the file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_new)) < 0)
TEST_ERROR
@@ -7704,6 +7706,9 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
if(NULL == (f = (H5F_t *)H5VL_object(fid)))
TEST_ERROR
+ /* Set the freespace tag for the metadata cache */
+ H5AC_tag(H5AC__FREESPACE_TAG, &prv_tag); \
+
/* Verify that the large generic manager is there */
H5MF__alloc_to_fs_type(f->shared, H5FD_MEM_DRAW, TBLOCK_SIZE5000, (H5F_mem_page_t *)&fs_type);
if(!H5F_addr_defined(f->shared->fs_addr[fs_type]))
@@ -7754,6 +7759,9 @@ test_page_alloc_xfree(const char *env_h5_drvr, hid_t fapl)
if(found_addr != gaddr1)
TEST_ERROR
+ /* Reset the previous tag */
+ H5AC_tag(prv_tag, NULL); \
+
/* Close file */
if(H5Fclose(fid) < 0)
TEST_ERROR
diff --git a/test/mirror_vfd.c b/test/mirror_vfd.c
index 4da742f..35c3f90 100644
--- a/test/mirror_vfd.c
+++ b/test/mirror_vfd.c
@@ -28,6 +28,8 @@
#ifdef H5_HAVE_MIRROR_VFD
+#include "H5FDmirror_priv.h" /* Private header for the mirror VFD */
+
/* For future consideration, IP address and port number might be
* environment variables?
*/
diff --git a/test/mount.c b/test/mount.c
index 3abe084..4cc02e4 100644
--- a/test/mount.c
+++ b/test/mount.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Wednesday, October 7, 1998
*
* Purpose: Tests file mounting.
diff --git a/test/mtime.c b/test/mtime.c
index 81a20db..8294e80 100644
--- a/test/mtime.c
+++ b/test/mtime.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Thursday, July 30, 1998
*
* Purpose: Determines if the modification time message is working
diff --git a/test/ntypes.c b/test/ntypes.c
index f1d2449..e371b93 100644
--- a/test/ntypes.c
+++ b/test/ntypes.c
@@ -2675,7 +2675,7 @@ error:
* Return: Success: 0
* Failure: -1
*
- * Programmer: pvn@ncsa.uiuc.edu
+ * Programmer: Pedro Vicente
* September 3, 2004
*
* Modifications:
diff --git a/test/ohdr.c b/test/ohdr.c
index ad76576..e5ba215 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Robb Matzke <matzke@llnl.gov>
+/* Programmer: Robb Matzke
* Tuesday, November 24, 1998
*/
#include "h5test.h"
@@ -126,8 +126,12 @@ test_cont(char *filename, hid_t fapl)
FAIL_STACK_ERROR
if(1 != H5O_link(&oh_locB, 1))
FAIL_STACK_ERROR
+ if(H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
+ if(H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5O__expunge_chunks_test(&oh_locA) < 0)
FAIL_STACK_ERROR
@@ -1681,8 +1685,12 @@ main(void)
FAIL_STACK_ERROR
if(1 != H5O_link(&oh_loc, 1))
FAIL_STACK_ERROR
+ if(H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
+ if(H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
@@ -1698,8 +1706,12 @@ main(void)
time_new = 33333333;
if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
+ if(H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
+ if(H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
@@ -1729,8 +1741,12 @@ main(void)
if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
} /* end for */
+ if(H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
+ if(H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
@@ -1772,8 +1788,12 @@ main(void)
time_new = (i + 1) * 1000 + 10;
if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new) < 0)
FAIL_STACK_ERROR
+ if(H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
+ if(H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
} /* end for */
@@ -1802,8 +1822,12 @@ main(void)
time_new = 22222222;
if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new) < 0)
FAIL_STACK_ERROR
+ if(H5AC_prep_for_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_flush(f) < 0)
FAIL_STACK_ERROR
+ if(H5AC_secure_from_file_flush(f) < 0)
+ FAIL_STACK_ERROR
if(H5AC_expunge_entry(f, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0)
FAIL_STACK_ERROR
if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro))
diff --git a/test/page_buffer.c b/test/page_buffer.c
index a508dc9..773b863 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -384,7 +384,6 @@ error:
*
*-------------------------------------------------------------------------
*/
-
static unsigned
test_args(hid_t orig_fapl, const char *env_h5_drvr)
{
diff --git a/test/pool.c b/test/pool.c
index 1851d6e..59f9201 100644
--- a/test/pool.c
+++ b/test/pool.c
@@ -11,7 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+/* Programmer: Quincey Koziol
* Tuesday, May 3, 2005
*/
#include "h5test.h"
@@ -636,10 +636,10 @@ test_allocate_random(void)
/* Initialize random number seed */
curr_time = HDtime(NULL);
-#ifdef QAK
+#if 0
curr_time=1115412944;
HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time);
-#endif /* QAK */
+#endif
HDsrandom((unsigned)curr_time);
/* Create a memory pool */
diff --git a/test/ros3.c b/test/ros3.c
index 73b6ac2..fb7aa2b 100644
--- a/test/ros3.c
+++ b/test/ros3.c
@@ -20,7 +20,7 @@
*
* Demonstrates basic use cases and fapl/dxpl interaction.
*
- * Programmer: Jacob Smith <jake.smith@hdfgroup.org>
+ * Programmer: Jacob Smith
* 2017-10-11
*/
diff --git a/test/s3comms.c b/test/s3comms.c
index 9453b75..9a7d7d6 100644
--- a/test/s3comms.c
+++ b/test/s3comms.c
@@ -15,7 +15,7 @@
*
* Purpose: Unit tests for the S3 Communications (s3comms) module.
*
- * Programmer: Jacob Smith <jake.smith@hdfgroup.org>
+ * Programmer: Jacob Smith
* 2017-10-11
*/
diff --git a/test/set_extent.c b/test/set_extent.c
index 171fd05..17bdb1b 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Pedro Vicente <pvn@ncsa.uiuc.edu>
+ * Programmer: Pedro Vicente
* April 12, 2002
*
* Purpose: Tests the H5Dset_extent call
diff --git a/test/space_overflow.c b/test/space_overflow.c
index 15be9ba..82ddb3b 100644
--- a/test/space_overflow.c
+++ b/test/space_overflow.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Monday, October 26, 1998
*
* Purpose: Create a dataset with a simple data space that has the
diff --git a/test/stab.c b/test/stab.c
index 215d748..ed4b5a0 100644
--- a/test/stab.c
+++ b/test/stab.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Tuesday, November 24, 1998
*/
@@ -171,7 +171,7 @@ test_misc(hid_t fcpl, hid_t fapl, hbool_t new_format)
*
* Failure: number of errors
*
- * Programmer: Robb Matzke <matzke@llnl.gov> 2002-03-28
+ * Programmer: Robb Matzke 2002-03-28
*
* Modifications:
*-------------------------------------------------------------------------
diff --git a/test/swmr.c b/test/swmr.c
index bab91bd..a1bc87d 100644
--- a/test/swmr.c
+++ b/test/swmr.c
@@ -91,7 +91,7 @@ static int test_file_lock_concur(hid_t fapl);
static int test_file_lock_swmr_concur(hid_t fapl);
/* Test file lock environment variable */
-static int test_file_lock_env_var(hid_t fapl);
+static int test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override);
/* Tests for SWMR VFD flag */
static int test_swmr_vfd_flag(void);
@@ -4256,8 +4256,11 @@ test_file_lock_same(hid_t in_fapl)
/* Output message about test being performed */
TESTING("File open with different combinations of flags--single process access");
+ /* Set locking in the fapl */
if((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
+ if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
+ FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
@@ -4416,7 +4419,7 @@ test_file_lock_swmr_same(hid_t in_fapl)
/* Output message about test being performed */
TESTING("File open with different combinations of flags + SWMR flags--single process access");
- /* Get a copy of the parameter in_fapl */
+ /* Set locking in the fapl */
if((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
@@ -4726,8 +4729,11 @@ test_file_lock_concur(hid_t in_fapl)
/* Output message about test being performed */
TESTING("File open with different combinations of flags--concurrent access");
+ /* Set locking in the fapl */
if((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
+ if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
+ FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
@@ -5102,8 +5108,11 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Output message about test being performed */
TESTING("File open with different combintations of flags + SWMR flags--concurrent access");
+ /* Set locking in the fapl */
if((fapl = H5Pcopy(in_fapl)) < 0)
FAIL_STACK_ERROR
+ if(H5Pset_file_locking(fapl, TRUE, TRUE) < 0)
+ FAIL_STACK_ERROR
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[2], fapl, filename, sizeof(filename));
@@ -5134,7 +5143,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5155,7 +5164,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5205,13 +5214,13 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Fork child process */
if((childpid = HDfork()) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
- /* Close unused write end for out_pdf */
+ /* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
HDexit(EXIT_FAILURE);
@@ -5230,7 +5239,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5243,7 +5252,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Open the test file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
@@ -5256,7 +5265,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Wait for child process to complete */
if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Check if child terminated normally */
if(WIFEXITED(child_status)) {
@@ -5284,7 +5293,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5305,7 +5314,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5354,11 +5363,11 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Fork child process */
if((childpid = HDfork()) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5379,7 +5388,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5392,7 +5401,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Open the test file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
@@ -5405,7 +5414,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Wait for child process to complete */
if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Check if child terminated normally */
if(WIFEXITED(child_status)) {
@@ -5428,11 +5437,11 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Fork child process */
if((childpid = HDfork()) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5456,7 +5465,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
HDexit(EXIT_SUCCESS);
}
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5469,7 +5478,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Open the test file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR|H5F_ACC_SWMR_WRITE, fapl)) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Notify child process */
notify = 1;
@@ -5482,7 +5491,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Wait for child process to complete */
if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
- FAIL_STACK_ERROR
+ FAIL_STACK_ERROR
/* Check if child terminated normally */
if(WIFEXITED(child_status)) {
@@ -5509,7 +5518,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5530,7 +5539,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5584,7 +5593,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5598,14 +5607,14 @@ test_file_lock_swmr_concur(hid_t in_fapl)
/* Open the test file */
H5E_BEGIN_TRY {
- child_fid = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+ child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
} H5E_END_TRY;
/* Should fail */
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5659,7 +5668,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5734,7 +5743,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5812,7 +5821,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5835,7 +5844,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
HDexit(EXIT_SUCCESS);
}
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5889,7 +5898,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -5910,7 +5919,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(child_fid == FAIL)
HDexit(EXIT_SUCCESS);
- /* Close the pipe */
+ /* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
@@ -5922,7 +5931,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
FAIL_STACK_ERROR
/* Open the test file */
- if((fid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
+ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
FAIL_STACK_ERROR
/* Notify child process */
@@ -5964,7 +5973,7 @@ test_file_lock_swmr_concur(hid_t in_fapl)
if(childpid == 0) { /* Child process */
hid_t child_fid; /* File ID */
- int child_notify = 0;
+ int child_notify = 0;
/* Close unused write end for out_pdf */
if(HDclose(out_pdf[1]) < 0)
@@ -6046,20 +6055,17 @@ error:
} /* end test_file_lock_swmr_concur() */
-
-
#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */
/****************************************************************
**
-** test_file_lock_swmr_concur(): low-level file test routine.
-** With the implementation of file locking, this test checks file
-** open with different combinations of flags + SWMR flags.
-** This is for concurrent access.
+** test_file_locking():
+** Tests various combinations of file locking flags and
+** and environment variables.
**
*****************************************************************/
static int
-test_file_lock_env_var(hid_t in_fapl)
+test_file_locking(hid_t in_fapl, hbool_t turn_locking_on, hbool_t env_var_override)
{
#if !(defined(H5_HAVE_FORK) && defined(H5_HAVE_WAITPID))
SKIPPED();
@@ -6074,18 +6080,40 @@ test_file_lock_env_var(hid_t in_fapl)
int child_wait_option=0; /* Options passed to waitpid */
int out_pdf[2];
int notify = 0;
+ int exit_status = 0;
+ herr_t ret;
+
+ if (turn_locking_on && env_var_override)
+ TESTING("File locking: ON w/ env var override")
+ else if (turn_locking_on && !env_var_override)
+ TESTING("File locking: ON")
+ else if (!turn_locking_on && env_var_override)
+ TESTING("File locking: OFF w/ env var override")
+ else
+ TESTING("File locking: OFF")
-
- TESTING("File locking environment variable");
-
-
- /* Set the environment variable */
- if(HDsetenv("HDF5_USE_FILE_LOCKING", "FALSE", TRUE) < 0)
+ /* Copy the incoming fapl */
+ if((fapl = H5Pcopy(in_fapl)) < 0)
TEST_ERROR
- if((fapl = H5Pcopy(in_fapl)) < 0)
+ /* Set locking in the fapl */
+ if(H5Pset_file_locking(fapl, turn_locking_on ? TRUE : FALSE, TRUE) < 0)
TEST_ERROR
+ /* If requested, set the environment variable */
+ if (env_var_override) {
+ if(HDsetenv("HDF5_USE_FILE_LOCKING", turn_locking_on ? "FALSE" : "TRUE", TRUE) < 0)
+ TEST_ERROR
+ if(H5F__reparse_file_lock_variable_test() < 0)
+ TEST_ERROR
+ }
+ else {
+ if(HDsetenv("HDF5_USE_FILE_LOCKING", "", TRUE) < 0)
+ TEST_ERROR
+ if(H5F__reparse_file_lock_variable_test() < 0)
+ TEST_ERROR
+ }
+
/* Set the filename to use for this test (dependent on fapl) */
h5_fixname(FILENAME[1], fapl, filename, sizeof(filename));
@@ -6097,10 +6125,8 @@ test_file_lock_env_var(hid_t in_fapl)
if(H5Fclose(fid) < 0)
TEST_ERROR
- /* Open a file for read-only and then read-write. This would
- * normally fail due to the file locking scheme but should
- * pass when the environment variable is set to disable file
- * locking.
+ /* Open a file for read-only and then read-write. This will fail
+ * when the locking scheme is turned on.
*/
/* Create 1 pipe */
@@ -6115,7 +6141,7 @@ test_file_lock_env_var(hid_t in_fapl)
/* Child process */
- hid_t child_fid; /* File ID */
+ hid_t child_fid = H5I_INVALID_HID; /* File ID */
int child_notify = 0;
/* Close unused write end for out_pdf */
@@ -6126,18 +6152,23 @@ test_file_lock_env_var(hid_t in_fapl)
while(child_notify != 1) {
if(HDread(out_pdf[0], &child_notify, sizeof(int)) < 0)
HDexit(EXIT_FAILURE);
- } /* end while */
+ }
- /* Open the test file */
- if((child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
- TEST_ERROR
+ /* Open and close the test file */
+ H5E_BEGIN_TRY {
+ child_fid = H5Fopen(filename, H5F_ACC_RDWR, fapl);
+ ret = H5Fclose(child_fid);
+ } H5E_END_TRY;
/* Close the pipe */
if(HDclose(out_pdf[0]) < 0)
HDexit(EXIT_FAILURE);
- HDexit(EXIT_SUCCESS);
- } /* end if */
+ if(H5I_INVALID_HID == child_fid || FAIL == ret)
+ HDexit(EXIT_FAILURE);
+ else
+ HDexit(EXIT_SUCCESS);
+ } /* end child process work */
/* close unused read end for out_pdf */
if(HDclose(out_pdf[0]) < 0)
@@ -6160,15 +6191,28 @@ test_file_lock_env_var(hid_t in_fapl)
if(HDwaitpid(childpid, &child_status, child_wait_option) < 0)
TEST_ERROR
- /* Check if child terminated normally */
- if(WIFEXITED(child_status)) {
- /* Check exit status of the child */
- if(WEXITSTATUS(child_status) != 0)
- TEST_ERROR
- } /* end if */
+ /* Check exit status of the child */
+ if(WIFEXITED(child_status))
+ exit_status = WEXITSTATUS(child_status);
else
TEST_ERROR
+ /* The child process should have passed or failed as follows:
+ *
+ * locks on: FAIL
+ * locks off: PASS
+ * locks on, env var override: PASS
+ * locks off, env var override: FAIL
+ */
+ if(turn_locking_on && !env_var_override && (0 == exit_status))
+ TEST_ERROR
+ else if(!turn_locking_on && !env_var_override && (0 != exit_status))
+ TEST_ERROR
+ else if(turn_locking_on && env_var_override && (0 != exit_status))
+ TEST_ERROR
+ else if(!turn_locking_on && env_var_override && (0 == exit_status))
+ TEST_ERROR
+
/* Close the file */
if(H5Fclose(fid) < 0)
TEST_ERROR
@@ -6192,8 +6236,81 @@ error:
#endif /* !(defined(H5_HAVE_FORK && defined(H5_HAVE_WAITPID)) */
-} /* end test_file_lock_env_var() */
+} /* end test_file_locking() */
+
+
+/****************************************************************
+**
+** test_different_lock_flags():
+** Tests opening a file multiple times with different lock
+** flags.
+**
+*****************************************************************/
+static int
+test_different_lock_flags(hid_t in_fapl)
+{
+ hid_t fid1 = H5I_INVALID_HID; /* File ID */
+ hid_t fid2 = H5I_INVALID_HID; /* File ID */
+ hid_t fid3 = H5I_INVALID_HID; /* File ID */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access property list */
+ char filename[NAME_BUF_SIZE]; /* File name */
+
+ TESTING("Using different lock flags")
+
+ /* Copy the incoming fapl */
+ if((fapl_id = H5Pcopy(in_fapl)) < 0)
+ TEST_ERROR
+
+ /* Set locking in the fapl */
+ if(H5Pset_file_locking(fapl_id, TRUE, TRUE) < 0)
+ TEST_ERROR
+ /* Set the filename to use for this test (dependent on fapl) */
+ h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename));
+
+ /* Create the test file */
+ if((fid1 = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ TEST_ERROR
+
+ /* Open the test file with the same flags (should pass) */
+ if((fid2 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0)
+ TEST_ERROR
+
+ /* Unset locking in the fapl */
+ if(H5Pset_file_locking(fapl_id, FALSE, FALSE) < 0)
+ TEST_ERROR
+
+ /* Open the test file with different flags (should FAIL) */
+ H5E_BEGIN_TRY {
+ fid3 = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
+ } H5E_END_TRY;
+ if(H5I_INVALID_HID != fid3)
+ FAIL_PUTS_ERROR("Should not have been able to open a file with different locking flags")
+
+ /* Close the files */
+ if(H5Fclose(fid1) < 0)
+ TEST_ERROR
+ if(H5Fclose(fid2) < 0)
+ TEST_ERROR
+
+ /* Close the copied property list */
+ if(H5Pclose(fapl_id) < 0)
+ TEST_ERROR
+
+ PASSED();
+
+ return 0;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl_id);
+ H5Fclose(fid1);
+ H5Fclose(fid2);
+ H5Fclose(fid3);
+ } H5E_END_TRY;
+
+ return -1;
+} /* end test_different_lock_flags() */
static int
test_swmr_vfd_flag(void)
@@ -7019,7 +7136,7 @@ error:
H5Fclose(fid3);
} H5E_END_TRY;
- return -1;
+ return 1;
} /* test_multiple_same() */
@@ -7036,6 +7153,7 @@ main(void)
char *driver = NULL; /* VFD string (from env variable) */
char *lock_env_var = NULL; /* file locking env var pointer */
hbool_t use_file_locking; /* read from env var */
+ hbool_t file_locking_enabled = FALSE; /* Checks if the file system supports locks */
/* Skip this test if SWMR I/O is not supported for the VFD specified
* by the environment variable.
@@ -7056,6 +7174,13 @@ main(void)
else
use_file_locking = TRUE;
+ /* Check if file locking is enabled on this file system */
+ if(use_file_locking)
+ if(h5_check_if_file_locking_enabled(&file_locking_enabled) < 0) {
+ HDprintf("Error when determining if file locks are enabled\n");
+ return EXIT_FAILURE;
+ }
+
/* Set up */
h5_reset();
@@ -7097,7 +7222,7 @@ main(void)
nerrors += test_append_flush_dataset_fixed(fapl);
nerrors += test_append_flush_dataset_multiple(fapl);
- if(use_file_locking) {
+ if(use_file_locking && file_locking_enabled) {
/*
* Tests for:
* file open flags--single process access
@@ -7124,10 +7249,19 @@ main(void)
if(NULL == driver || !HDstrcmp(driver, "") || !HDstrcmp(driver, "sec2"))
nerrors += test_swmr_vfd_flag();
- /* This test changes the HDF5_USE_FILE_LOCKING environment variable
- * so it should be run last.
+ /* Test multiple opens via different locking flags */
+ if (use_file_locking && file_locking_enabled)
+ nerrors += test_different_lock_flags(fapl);
+
+ /* These tests change the HDF5_USE_FILE_LOCKING environment variable
+ * so they should be run last.
*/
- nerrors += test_file_lock_env_var(fapl);
+ if (use_file_locking && file_locking_enabled) {
+ nerrors += test_file_locking(fapl, TRUE, TRUE);
+ nerrors += test_file_locking(fapl, TRUE, FALSE);
+ nerrors += test_file_locking(fapl, FALSE, TRUE);
+ nerrors += test_file_locking(fapl, FALSE, FALSE);
+ }
if(nerrors)
goto error;
diff --git a/test/swmr_addrem_writer.c b/test/swmr_addrem_writer.c
index 71e4929..7ad74ed 100644
--- a/test/swmr_addrem_writer.c
+++ b/test/swmr_addrem_writer.c
@@ -88,26 +88,6 @@ open_skeleton(const char *filename, unsigned verbose)
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
-#ifdef QAK
- /* Increase the initial size of the metadata cache */
- {
- H5AC_cache_config_t mdc_config;
-
- mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- H5Pget_mdc_config(fapl, &mdc_config);
- HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size);
- HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length);
- mdc_config.set_initial_size = 1;
- mdc_config.initial_size = 16 * 1024 * 1024;
- /* mdc_config.epoch_length = 5000; */
- H5Pset_mdc_config(fapl, &mdc_config);
- }
-#endif /* QAK */
-
-#ifdef QAK
- H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024));
-#endif /* QAK */
-
/* Open the file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
diff --git a/test/swmr_generator.c b/test/swmr_generator.c
index f6a4fe2..7fb08df 100644
--- a/test/swmr_generator.c
+++ b/test/swmr_generator.c
@@ -121,38 +121,10 @@ gen_skeleton(const char *filename, hbool_t verbose, hbool_t swmr_write,
if(!HDstrcmp(index_type, "b2"))
max_dims[0] = H5S_UNLIMITED;
-#ifdef QAK
- /* Increase the initial size of the metadata cache */
- {
- H5AC_cache_config_t mdc_config;
-
- mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- H5Pget_mdc_config(fapl, &mdc_config);
- HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size);
- HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length);
- mdc_config.set_initial_size = 1;
- mdc_config.initial_size = 16 * 1024 * 1024;
- /* mdc_config.epoch_length = 5000; */
- H5Pset_mdc_config(fapl, &mdc_config);
- }
-#endif /* QAK */
-
-#ifdef QAK
- H5Pset_small_data_block_size(fapl, (hsize_t)(50 * CHUNK_SIZE * DTYPE_SIZE));
-#endif /* QAK */
-
-#ifdef QAK
- H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024));
-#endif /* QAK */
-
/* Create file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
-#ifdef QAK
- H5Pset_link_phase_change(fcpl, 0, 0);
-#endif /* QAK */
-
/* Emit informational message */
if(verbose)
HDfprintf(stderr, "Creating file\n");
diff --git a/test/swmr_remove_writer.c b/test/swmr_remove_writer.c
index 2bebab9..504ea8a 100644
--- a/test/swmr_remove_writer.c
+++ b/test/swmr_remove_writer.c
@@ -90,26 +90,6 @@ open_skeleton(const char *filename, unsigned verbose, unsigned old)
return -1;
}
-#ifdef QAK
-/* Increase the initial size of the metadata cache */
- {
- H5AC_cache_config_t mdc_config;
-
- mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- H5Pget_mdc_config(fapl, &mdc_config);
- HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size);
- HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length);
- mdc_config.set_initial_size = 1;
- mdc_config.initial_size = 16 * 1024 * 1024;
- /* mdc_config.epoch_length = 5000; */
- H5Pset_mdc_config(fapl, &mdc_config);
- }
-#endif /* QAK */
-
-#ifdef QAK
- H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024));
-#endif /* QAK */
-
/* Open the file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
diff --git a/test/swmr_sparse_writer.c b/test/swmr_sparse_writer.c
index 5173c71..1892fe2 100644
--- a/test/swmr_sparse_writer.c
+++ b/test/swmr_sparse_writer.c
@@ -87,26 +87,6 @@ open_skeleton(const char *filename, unsigned verbose)
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
-#ifdef QAK
- /* Increase the initial size of the metadata cache */
- {
- H5AC_cache_config_t mdc_config;
-
- mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- H5Pget_mdc_config(fapl, &mdc_config);
- HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size);
- HDfprintf(stderr,"mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length);
- mdc_config.set_initial_size = 1;
- mdc_config.initial_size = 16 * 1024 * 1024;
- /* mdc_config.epoch_length = 5000; */
- H5Pset_mdc_config(fapl, &mdc_config);
- }
-#endif /* QAK */
-
-#ifdef QAK
- H5Pset_fapl_log(fapl, "append.log", H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024));
-#endif /* QAK */
-
/* Open the file */
if((fid = H5Fopen(filename, H5F_ACC_RDWR | H5F_ACC_SWMR_WRITE, fapl)) < 0)
return -1;
diff --git a/test/swmr_start_write.c b/test/swmr_start_write.c
index fc7e7a5..0527229 100644
--- a/test/swmr_start_write.c
+++ b/test/swmr_start_write.c
@@ -85,16 +85,6 @@ create_file(const char *filename, hbool_t verbose, FILE *verbose_file,
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
return -1;
-#ifdef QAK
- if(verbose) {
- char verbose_name[1024];
-
- HDsnprintf(verbose_name, sizeof(verbose_name), "swmr_start_write.log.%u", random_seed);
-
- H5Pset_fapl_log(fapl, verbose_name, H5FD_LOG_ALL, (size_t)(512 * 1024 * 1024));
- } /* end if */
-#endif /* QAK */
-
/* Create file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
return -1;
diff --git a/test/swmr_writer.c b/test/swmr_writer.c
index d4387aa..656a5b2 100644
--- a/test/swmr_writer.c
+++ b/test/swmr_writer.c
@@ -90,22 +90,6 @@ open_skeleton(const char *filename, hbool_t verbose, FILE *verbose_file,
return -1;
}
-#ifdef QAK
- /* Increase the initial size of the metadata cache */
- {
- H5AC_cache_config_t mdc_config;
-
- mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- H5Pget_mdc_config(fapl, &mdc_config);
- HDfprintf(stderr, "mdc_config.initial_size = %lu\n", (unsigned long)mdc_config.initial_size);
- HDfprintf(stderr, "mdc_config.epoch_length = %lu\n", (unsigned long)mdc_config.epoch_length);
- mdc_config.set_initial_size = 1;
- mdc_config.initial_size = 16 * 1024 * 1024;
- /* mdc_config.epoch_length = 5000; */
- H5Pset_mdc_config(fapl, &mdc_config);
- }
-#endif /* QAK */
-
if(use_log_vfd) {
char verbose_name[1024];
diff --git a/test/tattr.c b/test/tattr.c
index dab03a7..496dd6c 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -542,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, 0.0))
+ if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Fflush(fil, H5F_SCOPE_GLOBAL);
@@ -551,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, 0.0))
+ if(!H5_DBL_ABS_EQUAL(rdata, (double)0.0f))
TestErrPrintf("attribute value wrong: rdata=%f, should be %f\n",rdata,(double)0.0F);
ret=H5Awrite(att, H5T_NATIVE_DOUBLE, &wdata);
@@ -6773,13 +6773,6 @@ attr_iterate2_cb(hid_t loc_id, const char *attr_name, const H5A_info_t *info,
char attrname[NAME_BUF_SIZE]; /* Object name */
H5A_info_t my_info; /* Local attribute info */
-#ifdef QAK
-HDfprintf(stderr, "attr_name = '%s'\n", attr_name);
-if(info)
- HDfprintf(stderr, "info->corder = %u\n", (unsigned)info->corder);
-HDfprintf(stderr, "op_data->curr = %Hd\n", op_data->curr);
-#endif /* QAK */
-
/* Increment # of times the callback was called */
op_data->ncalled++;
diff --git a/test/tchecksum.c b/test/tchecksum.c
index 6e509fb..82dc135 100644
--- a/test/tchecksum.c
+++ b/test/tchecksum.c
@@ -15,7 +15,7 @@
*
* Created: tchecksum.c
* Aug 21 2006
- * Quincey Koziol <koziol@hdfgroup.org>
+ * Quincey Koziol
*
* Purpose: Test internal checksum routine(s)
*
diff --git a/test/testframe.c b/test/testframe.c
index 3c2a335..cfb62ec 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Programmer: Quincey Koziol
* Tuesday, January 6, 2004
*
* Purpose: Provides support functions for the testing framework.
diff --git a/test/tfile.c b/test/tfile.c
index d6047dc..e7dfcbe 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -3097,7 +3097,6 @@ test_rw_noupdate(void)
** test_userblock_alignment() test, to handle common testing
**
** Programmer: Quincey Koziol
-** koziol@hdfgroup.org
** Septmber 10, 2009
**
*****************************************************************/
@@ -3159,7 +3158,6 @@ test_userblock_alignment_helper1(hid_t fcpl, hid_t fapl)
** test_userblock_alignment() test, to handle common testing
**
** Programmer: Quincey Koziol
-** koziol@hdfgroup.org
** Septmber 10, 2009
**
*****************************************************************/
@@ -3229,7 +3227,6 @@ test_userblock_alignment_helper2(hid_t fapl, hbool_t open_rw)
** object [allocation] alignment size set interact properly.
**
** Programmer: Quincey Koziol
-** koziol@hdfgroup.org
** Septmber 8, 2009
**
*****************************************************************/
diff --git a/test/th5o.c b/test/th5o.c
index ab4a8de..4bc2096 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -243,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_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 */
+ hid_t fid; /* HDF5 File ID */
+ hid_t grp, dset, dtype, dspace; /* Object identifiers */
+ H5L_info2_t li; /* Buffer for H5Lget_info2 */
+ 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);
diff --git a/test/thread_id.c b/test/thread_id.c
index 24aef80..0c804ed 100644
--- a/test/thread_id.c
+++ b/test/thread_id.c
@@ -25,6 +25,8 @@
*/
#include "testhdf5.h"
+#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS)
+
static void my_errx(int, const char *, ...) H5_ATTR_FORMAT(printf, 2, 3);
static void
@@ -40,8 +42,6 @@ my_errx(int code, const char *fmt, ...)
HDexit(code);
}
-#if defined(H5_HAVE_THREADSAFE) && !defined(H5_HAVE_WIN_THREADS)
-
#if defined(H5_HAVE_DARWIN)
typedef struct _pthread_barrierattr {
diff --git a/test/timer.c b/test/timer.c
new file mode 100644
index 0000000..1014e75
--- /dev/null
+++ b/test/timer.c
@@ -0,0 +1,414 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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 files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Programmer: Dana Robinson
+ * May, 2011
+ *
+ * Purpose: Tests the operation of the platform-independent timers.
+ */
+
+#include "h5test.h"
+
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_time_formatting
+ *
+ * Purpose: Tests time string creation.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * May 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_time_formatting(void)
+{
+ char *s = NULL;
+
+ TESTING("Time string formats");
+
+ /* < 0, N/A */
+ s = H5_timer_get_time_string(-1.0F);
+ if(NULL == s || HDstrcmp(s, "N/A") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* 0 0 */
+ s = H5_timer_get_time_string(0.0F);
+ if(NULL == s || HDstrcmp(s, "0.0 s") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* < 1 us nanoseconds */
+ s = H5_timer_get_time_string(123.0E-9F);
+ if(NULL == s || HDstrcmp(s, "123 ns") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* < 1 ms microseconds */
+ s = H5_timer_get_time_string(23.456E-6F);
+ if(NULL == s || HDstrcmp(s, "23.5 us") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* < 1 s milliseconds */
+ s = H5_timer_get_time_string(4.56789E-3F);
+ if(NULL == s || HDstrcmp(s, "4.6 ms") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* < 1 min seconds */
+ s = H5_timer_get_time_string(3.14F);
+ if(NULL == s || HDstrcmp(s, "3.14 s") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* < 1 hr mins, secs */
+ s = H5_timer_get_time_string(2521.0F);
+ if(NULL == s || HDstrcmp(s, "42 m 1 s") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* < 1 d hrs, mins, secs */
+ s = H5_timer_get_time_string(9756.0F);
+ if(NULL == s || HDstrcmp(s, "2 h 42 m 36 s") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ /* > 1 d days, hrs, mins, secs */
+ s = H5_timer_get_time_string(280802.0F);
+ if(NULL == s || HDstrcmp(s, "3 d 6 h 0 m 2 s") != 0)
+ TEST_ERROR;
+ HDfree(s);
+
+ PASSED();
+ return 0;
+
+error:
+ if(s)
+ HDfree(s);
+ return -1;
+
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_timer_system_user
+ *
+ * Purpose: Tests the ability to get system and user times from the
+ * timers.
+ * Some platforms may require special code to get system and
+ * user times. If we do not support that particular platform
+ * dependent functionality, this test is skipped.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * May 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_timer_system_user(void)
+{
+ int i;
+ char *buf = NULL;
+ H5_timer_t timer;
+ H5_timevals_t times;
+ herr_t err;
+
+ TESTING("system/user times");
+
+ err = H5_timer_init(&timer);
+ if(err < 0)
+ TEST_ERROR;
+
+ err = H5_timer_start(&timer);
+ if(err < 0)
+ TEST_ERROR;
+
+ /* The system and user times may not be present on some systems. They
+ * will be -1.0 if they are not.
+ */
+ if(timer.initial.system < (double)0.0f || timer.initial.user < (double)0.0f) {
+ SKIPPED();
+ printf("NOTE: No suitable way to get system/user times on this platform.\n");
+ return 0;
+ }
+
+ /* Do some fake work */
+ for(i=0; i < 1024; i++) {
+ buf = (char *)HDmalloc(1024 * (size_t)i);
+ HDfree(buf);
+ }
+
+ err = H5_timer_stop(&timer);
+ if(err < 0)
+ TEST_ERROR;
+
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0)
+ TEST_ERROR;
+
+ /* System and user times should be non-negative. */
+ if(times.system < (double)0.0f || times.user < (double)0.0f)
+ TEST_ERROR;
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_timer_elapsed
+ *
+ * Purpose: Tests the ability to get elapsed times from the timers.
+ * We should always be able to get an elapsed time,
+ * regardless of the time libraries or platform.
+ *
+ * Return: Success: 0
+ * Failure: -1
+ *
+ * Programmer: Dana Robinson
+ * May 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_timer_elapsed(void)
+{
+ int i;
+ char *buf = NULL;
+ H5_timer_t timer;
+ H5_timevals_t times;
+ herr_t err;
+
+ TESTING("elapsed times");
+
+ err = H5_timer_init(&timer);
+ if(err < 0)
+ TEST_ERROR;
+
+ err = H5_timer_start(&timer);
+ if(err < 0)
+ TEST_ERROR;
+
+ /* Do some fake work */
+ for(i=0; i < 1024; i++) {
+ buf = (char *)HDmalloc(1024 * (size_t)i);
+ HDfree(buf);
+ }
+
+ err = H5_timer_stop(&timer);
+ if(err < 0)
+ TEST_ERROR;
+
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0)
+ TEST_ERROR;
+
+ /* Elapsed time should be non-negative. */
+ if(times.elapsed < (double)0.0f)
+ TEST_ERROR;
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
+}
+
+
+
+static herr_t
+test_timer_functionality(void)
+{
+ int i;
+ char *buf = NULL;
+ H5_timer_t timer;
+
+ H5_timevals_t times;
+ double prev_etime;
+ double prev_total_etime;
+
+ herr_t err;
+
+ TESTING("timer functionality");
+
+ /*****************
+ * CHECK STARTUP *
+ *****************/
+
+ /* Timer should be running after start */
+ err = H5_timer_init(&timer);
+ if(err < 0 || timer.is_running)
+ TEST_ERROR;
+
+ /* Times should be initialized to zero */
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ TEST_ERROR;
+
+ err = H5_timer_get_total_times(timer, &times);
+ if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ TEST_ERROR;
+
+
+ /********************
+ * CHECK START/STOP *
+ ********************/
+
+ /* Running state should change after start */
+ err = H5_timer_start(&timer);
+ if(err < 0 || !timer.is_running)
+ TEST_ERROR;
+
+ /* Do some fake work */
+ for(i=0; i < 1024; i++) {
+ buf = (char *)HDmalloc(1024 * (size_t)i);
+ HDfree(buf);
+ }
+
+ /* Running state should change after stop */
+ err = H5_timer_stop(&timer);
+ if(err < 0 || timer.is_running)
+ TEST_ERROR;
+
+ /* Times should be positive and non-negative */
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0 || times.elapsed < (double)0.0f)
+ TEST_ERROR;
+
+ err = H5_timer_get_total_times(timer, &times);
+ if(err < 0 || times.elapsed < (double)0.0f)
+ TEST_ERROR;
+
+
+ /**********************
+ * CHECK INTERRUPTING *
+ **********************/
+
+ /* Timer should change stat and refresh to 0s */
+ err = H5_timer_init(&timer);
+ if(err < 0 || timer.is_running)
+ TEST_ERROR;
+
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ TEST_ERROR;
+
+ err = H5_timer_get_total_times(timer, &times);
+ if(err < 0 || !H5_DBL_ABS_EQUAL(times.elapsed, (double)0.0f))
+ TEST_ERROR;
+
+ /* Timer state should flip */
+ err = H5_timer_start(&timer);
+ if(err < 0 || !timer.is_running)
+ TEST_ERROR;
+
+ /* Do some fake work */
+ for(i=0; i < 1024; i++) {
+ buf = (char *)HDmalloc(1024 * (size_t)i);
+ HDfree(buf);
+ }
+
+ /* Times should be non-negative */
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0 || times.elapsed < (double)0.0f)
+ TEST_ERROR;
+ prev_etime = times.elapsed;
+
+ err = H5_timer_get_total_times(timer, &times);
+ if(err < 0 || times.elapsed < (double)0.0f)
+ TEST_ERROR;
+ prev_total_etime = times.elapsed;
+
+ /* Do some fake work */
+ for(i=0; i < 1024; i++) {
+ buf = (char *)HDmalloc(1024 * (size_t)i);
+ HDfree(buf);
+ }
+
+ /* State should flip on stop */
+ err = H5_timer_stop(&timer);
+ if(err < 0 || timer.is_running)
+ TEST_ERROR;
+
+ /* Times should be >= than the cached intermediate times */
+ err = H5_timer_get_times(timer, &times);
+ if(err < 0 || times.elapsed < prev_etime)
+ TEST_ERROR;
+
+ err = H5_timer_get_total_times(timer, &times);
+ if(err < 0 || times.elapsed < prev_total_etime)
+ TEST_ERROR;
+
+
+ PASSED();
+ return 0;
+
+error:
+ return -1;
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests the basic functionality of the platform-independent
+ * timers
+ *
+ * Return: Success: 0
+ * Failure: 1
+ *
+ * Programmer: Dana Robinson
+ * May, 2011
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ int nerrors = 0;
+
+ h5_reset();
+
+ printf("Testing platform-independent timer functionality.\n");
+
+ nerrors += test_time_formatting() < 0 ? 1 : 0;
+ nerrors += test_timer_system_user() < 0 ? 1 : 0;
+ nerrors += test_timer_elapsed() < 0 ? 1 : 0;
+ nerrors += test_timer_functionality() < 0 ? 1 : 0;
+
+ if(nerrors) {
+ printf("***** %d platform-independent timer TEST%s FAILED! *****\n",
+ nerrors, nerrors > 1 ? "S" : "");
+ return 1;
+ } else {
+ printf("All platform-independent timer tests passed.\n");
+ return 0;
+ }
+}
+
diff --git a/test/trefer.c b/test/trefer.c
index 12651c7..4bf5c17 100644
--- a/test/trefer.c
+++ b/test/trefer.c
@@ -23,6 +23,8 @@
#define FILE_REF_PARAM "trefer_param.h5"
#define FILE_REF_OBJ "trefer_obj.h5"
+#define FILE_REF_VL_OBJ "trefer_vl_obj.h5"
+#define FILE_REF_CMPND_OBJ "trefer_cmpnd_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"
@@ -55,6 +57,15 @@ typedef struct s1_t {
float c;
} s1_t;
+/* Compound datatype with reference */
+typedef struct s2_t {
+ H5R_ref_t ref0; /* reference */
+ H5R_ref_t ref1; /* reference */
+ H5R_ref_t ref2; /* reference */
+ H5R_ref_t ref3; /* reference */
+ unsigned int dim_idx; /* dimension index of the dataset */
+} s2_t;
+
#define GROUPNAME "/group"
#define GROUPNAME2 "group2"
#define GROUPNAME3 "group3"
@@ -86,12 +97,12 @@ test_reference_params(void)
hid_t aapl_id; /* Attribute access property list */
hid_t dapl_id; /* Dataset access property list */
hsize_t dims1[] = {SPACE1_DIM1};
- H5R_ref_t *wbuf, /* buffer to write to disk */
+ 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 */
+ 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 */
@@ -319,10 +330,10 @@ test_reference_obj(void)
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 */
+ H5R_ref_t *wbuf, /* buffer to write to disk */
*rbuf; /* buffer read from disk */
unsigned *ibuf, *obuf;
- unsigned i, j; /* Counters */
+ unsigned i, j; /* Counters */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
@@ -538,6 +549,564 @@ test_reference_obj(void)
/****************************************************************
**
+** test_reference_vlen_obj(): Test basic H5R (reference) object reference
+** within a vlen type.
+** Tests references to various kinds of objects
+**
+****************************************************************/
+static void
+test_reference_vlen_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};
+ hsize_t vl_dims[] = {1};
+ 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 */
+ hvl_t vl_wbuf = {0, NULL}, vl_rbuf = {0, NULL};
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Object Reference Functions within VLEN type\n"));
+
+ /* Allocate write & read buffers */
+ 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(FILE_REF_VL_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");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* 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 vlen type */
+ tid1 = H5Tvlen_create(H5T_STD_REF);
+ CHECK(tid1, H5I_INVALID_HID, "H5Tvlen_create");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, vl_dims, NULL);
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset3", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* 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");
+
+ /* Create reference to dataset */
+ 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_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_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");
+
+ /* Store references into vlen */
+ vl_wbuf.len = SPACE1_DIM1;
+ vl_wbuf.p = wbuf;
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &vl_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 datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE_REF_VL_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");
+
+ tid1 = H5Dget_type(dataset);
+ CHECK(tid1, H5I_INVALID_HID, "H5Dget_type");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &vl_rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ VERIFY(vl_rbuf.len, SPACE1_DIM1, "H5Dread");
+ rbuf = vl_rbuf.p;
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* 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, SPACE1_DIM1, "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 < 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 = 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 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object");
+
+ /* 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");
+ }
+
+ /* 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");
+
+ /* 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(ibuf);
+ HDfree(obuf);
+} /* test_reference_vlen_obj() */
+
+/****************************************************************
+**
+** test_reference_cmpnd_obj(): Test basic H5R (reference) object reference
+** within a compound type.
+** Tests references to various kinds of objects
+**
+****************************************************************/
+static void
+test_reference_cmpnd_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};
+ hsize_t cmpnd_dims[] = {1};
+ 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 */
+ s2_t cmpnd_wbuf, cmpnd_rbuf;
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing Object Reference Functions within compound type\n"));
+
+ /* Allocate write & read buffers */
+ 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(FILE_REF_CMPND_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");
+
+ /* Close disk dataspace */
+ ret = H5Sclose(sid1);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ /* 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 compound type */
+ tid1 = H5Tcreate(H5T_COMPOUND, sizeof(s2_t));
+ CHECK(tid1, H5I_INVALID_HID, "H5Tcreate");
+
+ /* Insert fields */
+ ret = H5Tinsert(tid1, "ref0", HOFFSET(s2_t, ref0), H5T_STD_REF);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "ref1", HOFFSET(s2_t, ref1), H5T_STD_REF);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "ref2", HOFFSET(s2_t, ref2), H5T_STD_REF);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "ref3", HOFFSET(s2_t, ref3), H5T_STD_REF);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ ret = H5Tinsert(tid1, "dim_idx", HOFFSET(s2_t, dim_idx), H5T_NATIVE_INT);
+ CHECK(ret, FAIL, "H5Tinsert");
+
+ /* Create dataspace for datasets */
+ sid1 = H5Screate_simple(SPACE1_RANK, cmpnd_dims, NULL);
+ CHECK(sid1, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Create a dataset */
+ dataset = H5Dcreate2(fid1, "Dataset3", tid1, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset, H5I_INVALID_HID, "H5Dcreate2");
+
+ /* 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");
+
+ /* Create reference to dataset */
+ 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_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_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");
+
+ /* Store dimensions */
+ cmpnd_wbuf.ref0 = wbuf[0];
+ cmpnd_wbuf.ref1 = wbuf[1];
+ cmpnd_wbuf.ref2 = wbuf[2];
+ cmpnd_wbuf.ref3 = wbuf[3];
+ cmpnd_wbuf.dim_idx = SPACE1_DIM1;
+
+ /* Write selection to disk */
+ ret = H5Dwrite(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cmpnd_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 datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* Close file */
+ ret = H5Fclose(fid1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /* Re-open the file */
+ fid1 = H5Fopen(FILE_REF_CMPND_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");
+
+ tid1 = H5Dget_type(dataset);
+ CHECK(tid1, H5I_INVALID_HID, "H5Dget_type");
+
+ /* Read selection from disk */
+ ret = H5Dread(dataset, tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, &cmpnd_rbuf);
+ CHECK(ret, FAIL, "H5Dread");
+
+ VERIFY(cmpnd_rbuf.dim_idx, SPACE1_DIM1, "H5Dread");
+ rbuf[0] = cmpnd_rbuf.ref0;
+ rbuf[1] = cmpnd_rbuf.ref1;
+ rbuf[2] = cmpnd_rbuf.ref2;
+ rbuf[3] = cmpnd_rbuf.ref3;
+
+ /* Close datatype */
+ ret = H5Tclose(tid1);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ /* 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, SPACE1_DIM1, "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 < 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 = 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 = H5Ropen_object(&rbuf[3], H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(tid1, H5I_INVALID_HID, "H5Ropen_object");
+
+ /* 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");
+ }
+
+ /* 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");
+
+ /* Destroy references */
+ for(j = 0; j < SPACE1_DIM1; j++) {
+ ret = H5Rdestroy(&wbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+ for(j = 0; j < SPACE1_DIM1; j++) {
+ ret = H5Rdestroy(&rbuf[j]);
+ CHECK(ret, FAIL, "H5Rdestroy");
+ }
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(ibuf);
+ HDfree(obuf);
+} /* test_reference_cmpnd_obj() */
+
+/****************************************************************
+**
** test_reference_region(): Test basic H5R (reference) object reference code.
** Tests references to various kinds of objects
**
@@ -566,11 +1135,11 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
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 *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* 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 *dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* 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 */
@@ -968,13 +1537,14 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Rdestroy");
}
- /* Free memory buffers */
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
-
}
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
} /* test_reference_region() */
/****************************************************************
@@ -1007,10 +1577,10 @@ 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 */
- 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 */
+ H5R_ref_t *wbuf = NULL, /* buffer to write to disk */
+ *rbuf = NULL; /* buffer read from disk */
+ uint8_t *dwbuf = NULL, /* Buffer for writing numeric data to disk */
+ *drbuf = NULL; /* Buffer for reading numeric data from disk */
uint8_t *tu8; /* Temporary pointer to uint8 data */
H5O_type_t obj_type; /* Object type */
int i; /* Counter */
@@ -1307,13 +1877,14 @@ test_reference_region_1D(H5F_libver_t libver_low, H5F_libver_t libver_high)
CHECK(ret, FAIL, "H5Rdestroy");
}
- /* Free memory buffers */
- HDfree(wbuf);
- HDfree(rbuf);
- HDfree(dwbuf);
- HDfree(drbuf);
-
}
+
+ /* Free memory buffers */
+ HDfree(wbuf);
+ HDfree(rbuf);
+ HDfree(dwbuf);
+ HDfree(drbuf);
+
} /* test_reference_region_1D() */
/****************************************************************
@@ -2149,10 +2720,10 @@ test_reference_compat_conv(void)
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 */
+ hobj_ref_t *wbuf_obj = NULL; /* Buffer to write to disk */
+ H5R_ref_t *rbuf_obj = NULL; /* Buffer read from disk */
+ hdset_reg_ref_t *wbuf_reg = NULL; /* Buffer to write to disk */
+ H5R_ref_t *rbuf_reg = NULL; /* Buffer read from disk */
H5O_type_t obj_type; /* Object type */
herr_t ret; /* Generic return value */
unsigned int i; /* Counter */
@@ -2862,6 +3433,8 @@ test_reference(void)
test_reference_params(); /* Test for correct parameter checking */
test_reference_obj(); /* Test basic H5R object reference code */
+ test_reference_vlen_obj(); /* Test reference within vlen */
+ test_reference_cmpnd_obj(); /* Test reference within compound type */
/* Loop through all the combinations of low/high version bounds */
for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) {
@@ -2907,6 +3480,8 @@ cleanup_reference(void)
{
HDremove(FILE_REF_PARAM);
HDremove(FILE_REF_OBJ);
+ HDremove(FILE_REF_VL_OBJ);
+ HDremove(FILE_REF_CMPND_OBJ);
HDremove(FILE_REF_REG);
HDremove(FILE_REF_REG_1D);
HDremove(FILE_REF_OBJ_DEL);
diff --git a/test/tselect.c b/test/tselect.c
index aa0ab11..c98db5d 100644
--- a/test/tselect.c
+++ b/test/tselect.c
@@ -15442,14 +15442,14 @@ test_hyper_io_1d(void)
/* Get the dataset's dataspace */
sid = H5Dget_space(did);
- CHECK(sid, H5I_INVALID_HID, "H5Pcreate");
+ CHECK(sid, H5I_INVALID_HID, "H5Dget_space");
ret = H5Sselect_hyperslab(sid, H5S_SELECT_SET, offset, stride, count, block);
CHECK(ret, FAIL, "H5Sselect_hyperslab");
/* Set up contiguous memory dataspace for the selected elements */
dimsm[0] = count[0];
mid = H5Screate_simple(RANK, dimsm, NULL);
- CHECK(mid, H5I_INVALID_HID, "H5Screate");
+ CHECK(mid, H5I_INVALID_HID, "H5Screate_simple");
/* Read all the selected 10th elements in the dataset into "rdata" */
ret = H5Dread(did, H5T_NATIVE_INT, mid, sid, H5P_DEFAULT, rdata);
@@ -15476,6 +15476,77 @@ test_hyper_io_1d(void)
/****************************************************************
**
+** test_h5s_set_extent_none:
+** Test to verify the behavior of dataspace code when passed
+** a dataspace modified by H5Sset_extent_none().
+**
+****************************************************************/
+static void
+test_h5s_set_extent_none(void)
+{
+ hid_t sid = H5I_INVALID_HID;
+ hid_t dst_sid = H5I_INVALID_HID;
+ hid_t null_sid = H5I_INVALID_HID;
+ int rank = 1;
+ hsize_t current_dims = 123;
+ H5S_class_t cls;
+ int out_rank;
+ hsize_t out_dims;
+ hsize_t out_maxdims;
+ hssize_t out_points;
+ htri_t equal;
+ herr_t ret;
+
+ /* Specific values here don't matter as we're just going to reset */
+ sid = H5Screate_simple(rank, &current_dims, NULL);
+ CHECK(sid, H5I_INVALID_HID, "H5Screate_simple");
+
+ /* Dataspace class will be H5S_NULL after this.
+ * In versions prior to 1.10.7 / 1.12.1 this would produce a
+ * dataspace with the internal H5S_NO_CLASS class.
+ */
+ ret = H5Sset_extent_none(sid);
+ CHECK(ret, FAIL, "H5Sset_extent_none");
+ cls = H5Sget_simple_extent_type(sid);
+ VERIFY(cls, H5S_NULL, "H5Sget_simple_extent_type");
+
+ /* Extent getters should generate normal results and not segfault.
+ */
+ out_rank = H5Sget_simple_extent_dims(sid, &out_dims, &out_maxdims);
+ VERIFY(out_rank, 0, "H5Sget_simple_extent_dims");
+ out_rank = H5Sget_simple_extent_ndims(sid);
+ VERIFY(out_rank, 0, "H5Sget_simple_extent_ndims");
+ out_points = H5Sget_simple_extent_npoints(sid);
+ VERIFY(out_points, 0, "H5Sget_simple_extent_npoints");
+
+ /* Check that copying the new (non-)extent works.
+ */
+ dst_sid = H5Screate_simple(rank, &current_dims, NULL);
+ CHECK(dst_sid, H5I_INVALID_HID, "H5Screate_simple");
+ ret = H5Sextent_copy(dst_sid, sid);
+ CHECK(ret, FAIL, "H5Sextent_copy");
+
+ /* Check that H5Sset_extent_none() produces the same extent as
+ * H5Screate(H5S_NULL).
+ */
+ null_sid = H5Screate(H5S_NULL);
+ CHECK(null_sid, H5I_INVALID_HID, "H5Screate");
+ equal = H5Sextent_equal(sid, null_sid);
+ VERIFY(equal, TRUE, "H5Sextent_equal");
+
+ /* Close */
+ ret = H5Sclose(sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(dst_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+ ret = H5Sclose(null_sid);
+ CHECK(ret, FAIL, "H5Sclose");
+
+} /* test_h5s_set_extent_none() */
+
+
+/****************************************************************
+**
** test_select(): Main H5S selection testing routine.
**
****************************************************************/
@@ -15660,6 +15731,11 @@ test_select(void)
/* Test reading of 1-d disjoint file space to 1-d single block memory space */
test_hyper_io_1d();
+ /* Test H5Sset_extent_none() functionality after we updated it to set
+ * the class to H5S_NULL instead of H5S_NO_CLASS.
+ */
+ test_h5s_set_extent_none();
+
} /* test_select() */
diff --git a/test/ttsafe.c b/test/ttsafe.c
index e6edd9a..2de460b 100644
--- a/test/ttsafe.c
+++ b/test/ttsafe.c
@@ -111,6 +111,7 @@ int main(int argc, char *argv[])
AddTest("cancel", tts_cancel, cleanup_cancel, "thread cancellation safety test", NULL);
#endif /* H5_HAVE_PTHREAD_H */
AddTest("acreate", tts_acreate, cleanup_acreate, "multi-attribute creation", NULL);
+ AddTest("attr_vlen", tts_attr_vlen, cleanup_attr_vlen, "multi-file-attribute-vlen read", NULL);
#else /* H5_HAVE_THREADSAFE */
diff --git a/test/ttsafe.h b/test/ttsafe.h
index c29fadc..f1cbe4d 100644
--- a/test/ttsafe.h
+++ b/test/ttsafe.h
@@ -35,12 +35,14 @@ void tts_dcreate(void);
void tts_error(void);
void tts_cancel(void);
void tts_acreate(void);
+void tts_attr_vlen(void);
/* Prototypes for the cleanup routines */
void cleanup_dcreate(void);
void cleanup_error(void);
void cleanup_cancel(void);
void cleanup_acreate(void);
+void cleanup_attr_vlen(void);
#endif /* H5_HAVE_THREADSAFE */
#endif /* TTSAFE_H */
diff --git a/test/ttsafe_attr_vlen.c b/test/ttsafe_attr_vlen.c
new file mode 100644
index 0000000..43a5e9a
--- /dev/null
+++ b/test/ttsafe_attr_vlen.c
@@ -0,0 +1,177 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/********************************************************************
+ *
+ * Testing for thread safety in H5A library operations.
+ * ------------------------------------------------------------------
+ *
+ * Purpose: Verify that the segmentation fault described in HDFFV-11080
+ * is fixed.
+ *
+ * This test simulates what the user did to trigger the error:
+ * --Create an HDF5 file
+ * --Create an attribute with variable length string datatype
+ * --Attach the attribute to a group
+ * --Write data to the attribute
+ * --Close the file
+ * --Create NUM_THREADS threads
+ * --For each thread:
+ * --Open the test file
+ * --Open and read the attribute for each opened file
+ *
+ * The cause of the problem in this jira issue is due to the file pointer
+ * that is set in the variable length string datatype for the attribute.
+ * That file pointer is already closed and therefore needs to be set to
+ * the current opened file pointer when the attribute is accessed.
+ * Similar patch up was done before when reading dataset in H5D__read()
+ * in src/H5Aint.c.
+ * Hopefully this kind of patch can go away when we resolve the
+ * shared file pointer issue.
+ *
+ ********************************************************************/
+
+#include "ttsafe.h"
+
+#ifdef H5_HAVE_THREADSAFE
+
+#define FILENAME "ttsafe_attr_vlen.h5"
+#define ATTR_NAME "root_attr"
+#define NUM_THREADS 32
+
+void *tts_attr_vlen_thread(void *);
+
+void
+tts_attr_vlen(void)
+{
+ H5TS_thread_t threads[NUM_THREADS] = {0}; /* Thread declaration */
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for attribute */
+ hid_t asid = H5I_INVALID_HID; /* Dataspace ID for attribute */
+ hid_t aid = H5I_INVALID_HID; /* The attribute ID */
+ const char *string_attr = "2.0"; /* The attribute data */
+ int ret; /* Return value */
+ int i; /* Local index variable */
+
+ /* Create the HDF5 test file */
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(fid, H5I_INVALID_HID, "H5Fcreate");
+
+ /* Create variable length string type for attribute */
+ atid = H5Tcopy(H5T_C_S1);
+ CHECK(atid, H5I_INVALID_HID, "H5Tcopy");
+ H5Tset_size(atid, H5T_VARIABLE);
+
+ /* Create dataspace for attribute */
+ asid = H5Screate(H5S_SCALAR);
+ CHECK(asid, H5I_INVALID_HID, "H5Screate");
+
+ /* Open the root group */
+ gid = H5Gopen2(fid, "/", H5P_DEFAULT);
+ CHECK(gid, H5I_INVALID_HID, "H5Gopen2");
+
+ /* Attach the attribute to the root group */
+ aid = H5Acreate2(gid, ATTR_NAME, atid, asid, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(aid, H5I_INVALID_HID, "H5Acreate2");
+
+ /* Write data to the attribute */
+ ret = H5Awrite(aid, atid, &string_attr);
+ CHECK(ret, H5I_INVALID_HID, "H5Awrite");
+
+ /* Close IDs */
+ ret = H5Sclose(asid);
+ CHECK(ret, H5I_INVALID_HID, "H5Sclose");
+
+ ret = H5Aclose(aid);
+ CHECK(ret, H5I_INVALID_HID, "H5Aclose");
+
+ ret = H5Gclose(gid);
+ CHECK(ret, H5I_INVALID_HID, "H5Gclose");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, H5I_INVALID_HID, "H5Fclose");
+
+ ret = H5Tclose(atid);
+ CHECK(ret, H5I_INVALID_HID, "H5Tclose");
+
+ /* Start multiple threads and execute tts_attr_vlen_thread() for each thread */
+ for(i = 0; i < NUM_THREADS; i++) {
+ threads[i] = H5TS_create_thread(tts_attr_vlen_thread, NULL, NULL);
+ }
+
+ /* Wait for the threads to end */
+ for(i = 0; i < NUM_THREADS; i++)
+ H5TS_wait_for_thread(threads[i]);
+
+} /* end tts_attr_vlen() */
+
+/* Start execution for each thread */
+void *
+tts_attr_vlen_thread(void H5_ATTR_UNUSED *client_data)
+{
+ hid_t fid = H5I_INVALID_HID; /* File ID */
+ hid_t gid = H5I_INVALID_HID; /* Group ID */
+ hid_t aid = H5I_INVALID_HID; /* Attribute ID */
+ hid_t atid = H5I_INVALID_HID; /* Datatype ID for the attribute */
+ char *string_attr_check; /* The attribute data being read */
+ const char *string_attr = "2.0"; /* The expected attribute data */
+ herr_t ret; /* Return value */
+
+ /* Open the test file */
+ fid = H5Fopen(FILENAME, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, H5I_INVALID_HID, "H5Fopen");
+
+ /* Open the group */
+ gid = H5Gopen2(fid, "/", H5P_DEFAULT);
+ CHECK(gid, H5I_INVALID_HID, "H5Gopen");
+
+ /* Open the attribte */
+ aid = H5Aopen(gid, "root_attr", H5P_DEFAULT);
+ CHECK(aid, H5I_INVALID_HID, "H5Aopen");
+
+ /* Get the attribute datatype */
+ atid = H5Aget_type(aid);
+ CHECK(atid, H5I_INVALID_HID, "H5Aget_type");
+
+ /* Read the attribute */
+ ret = H5Aread(aid, atid, &string_attr_check);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ /* Verify the attribute data is as expected */
+ VERIFY_STR(string_attr_check, string_attr, "H5Aread");
+
+ /* Close IDs */
+ ret = H5Aclose(aid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ ret = H5Gclose(gid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ ret = H5Tclose(atid);
+ CHECK(ret, FAIL, "H5Aclose");
+
+ return NULL;
+} /* end tts_attr_vlen_thread() */
+
+void
+cleanup_attr_vlen(void)
+{
+ HDunlink(FILENAME);
+}
+
+#endif /*H5_HAVE_THREADSAFE*/
+
diff --git a/test/unlink.c b/test/unlink.c
index 48dd79d..f45d7d7 100644
--- a/test/unlink.c
+++ b/test/unlink.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
+ * Programmer: Robb Matzke
* Friday, September 25, 1998
*
* Purpose: Test unlinking operations.
diff --git a/test/vds.c b/test/vds.c
index c4d1391..816acf9 100644
--- a/test/vds.c
+++ b/test/vds.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Programmer: Neil Fortner
* Monday, February 16, 2015
*
* Purpose: Tests datasets with virtual layout.
diff --git a/test/vds_env.c b/test/vds_env.c
index 3d5b5dd..0d0891f 100644
--- a/test/vds_env.c
+++ b/test/vds_env.c
@@ -11,7 +11,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Neil Fortner <nfortne2@hdfgroup.org>
+ * Programmer: Neil Fortner
* Monday, February 16, 2015
*
* Purpose: Tests datasets with virtual layout.
diff --git a/test/vds_swmr.h b/test/vds_swmr.h
index edb01bc..0a194ff 100644
--- a/test/vds_swmr.h
+++ b/test/vds_swmr.h
@@ -95,7 +95,5 @@ H5TEST_DLLVAR char VDS_FILE_NAME[NAME_LEN];
/* Dataset names */
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/vfd.c b/test/vfd.c
index bffc937..8b59341 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -12,7 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
- * Programmer: Raymond Lu<slu@ncsa.uiuc.edu>
+ * Programmer: Raymond Lu
* Tuesday, Sept 24, 2002
*
* Purpose: Tests the basic features of Virtual File Drivers
@@ -2258,46 +2258,51 @@ static int
compare_splitter_config_info(hid_t fapl_id, H5FD_splitter_vfd_config_t *info)
{
int ret_value = 0;
- H5FD_splitter_vfd_config_t fetched_info;
+ H5FD_splitter_vfd_config_t *fetched_info = NULL;
+
+ if (NULL == (fetched_info = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for fetched_info struct failed");
- fetched_info.magic = H5FD_SPLITTER_MAGIC;
- fetched_info.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- fetched_info.rw_fapl_id = H5I_INVALID_HID;
- fetched_info.wo_fapl_id = H5I_INVALID_HID;
+ fetched_info->magic = H5FD_SPLITTER_MAGIC;
+ fetched_info->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ fetched_info->rw_fapl_id = H5I_INVALID_HID;
+ fetched_info->wo_fapl_id = H5I_INVALID_HID;
- if (H5Pget_fapl_splitter(fapl_id, &fetched_info) < 0) {
- SPLITTER_TEST_FAULT("can't get splitter info\n");
+ if (H5Pget_fapl_splitter(fapl_id, fetched_info) < 0) {
+ SPLITTER_TEST_FAULT("can't get splitter info");
}
if (info->rw_fapl_id == H5P_DEFAULT) {
- if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
+ if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
SPLITTER_TEST_FAULT("Read-Write driver mismatch (default)\n");
}
}
else {
- if (H5Pget_driver(fetched_info.rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) {
+ if (H5Pget_driver(fetched_info->rw_fapl_id) != H5Pget_driver(info->rw_fapl_id)) {
SPLITTER_TEST_FAULT("Read-Write driver mismatch\n");
}
}
if (info->wo_fapl_id == H5P_DEFAULT) {
- if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
+ if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(H5P_FILE_ACCESS_DEFAULT)) {
SPLITTER_TEST_FAULT("Write-Only driver mismatch (default)\n");
}
}
else {
- if (H5Pget_driver(fetched_info.wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) {
+ if (H5Pget_driver(fetched_info->wo_fapl_id) != H5Pget_driver(info->wo_fapl_id)) {
SPLITTER_TEST_FAULT("Write-Only driver mismatch\n");
}
}
- if ( (HDstrlen(info->wo_path) != HDstrlen(fetched_info.wo_path)) ||
- HDstrncmp(info->wo_path, fetched_info.wo_path, H5FD_SPLITTER_PATH_MAX))
+ if ( (HDstrlen(info->wo_path) != HDstrlen(fetched_info->wo_path)) ||
+ HDstrncmp(info->wo_path, fetched_info->wo_path, H5FD_SPLITTER_PATH_MAX))
{
- HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info.wo_path);
+ HDfprintf(stderr, "MISMATCH: '%s' :: '%s'\n", info->wo_path, fetched_info->wo_path);
HEXPRINT(H5FD_SPLITTER_PATH_MAX, info->wo_path);
- HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info.wo_path);
+ HEXPRINT(H5FD_SPLITTER_PATH_MAX, fetched_info->wo_path);
SPLITTER_TEST_FAULT("Write-Only file path mismatch\n");
}
done:
+ HDfree(fetched_info);
+
return ret_value;
} /* end compare_splitter_config_info() */
@@ -2331,37 +2336,42 @@ run_splitter_test(const struct splitter_dataset_def *data,
hid_t space_id = H5I_INVALID_HID;
hid_t fapl_id_out = H5I_INVALID_HID;
hid_t fapl_id_cpy = H5I_INVALID_HID;
- H5FD_splitter_vfd_config_t vfd_config;
- char filename_rw[H5FD_SPLITTER_PATH_MAX + 1];
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
+ char *filename_rw = NULL;
FILE *logfile = NULL;
int ret_value = 0;
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = ignore_wo_errors;
- vfd_config.rw_fapl_id = sub_fapl_ids[0];
- vfd_config.wo_fapl_id = sub_fapl_ids[1];
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
+ if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
+ SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
+
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = ignore_wo_errors;
+ vfd_config->rw_fapl_id = sub_fapl_ids[0];
+ vfd_config->wo_fapl_id = sub_fapl_ids[1];
- if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) {
+ if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare file paths\n");
}
if (provide_logfile_path == FALSE) {
- *vfd_config.log_file_path = '\0'; /* reset as empty string */
+ vfd_config->log_file_path[0] = '\0'; /* reset as empty string */
}
/* Create a new fapl to use the SPLITTER file driver */
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("can't create FAPL ID\n");
}
- if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) {
+ if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("can't set splitter FAPL\n");
}
if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) {
SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n");
}
- if (compare_splitter_config_info(fapl_id, &vfd_config) < 0) {
+ if (compare_splitter_config_info(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("information mismatch\n");
}
@@ -2374,7 +2384,7 @@ run_splitter_test(const struct splitter_dataset_def *data,
if (H5I_INVALID_HID == fapl_id_cpy) {
SPLITTER_TEST_FAULT("can't copy FAPL\n");
}
- if (compare_splitter_config_info(fapl_id_cpy, &vfd_config) < 0) {
+ if (compare_splitter_config_info(fapl_id_cpy, vfd_config) < 0) {
SPLITTER_TEST_FAULT("information mismatch\n");
}
if (H5Pclose(fapl_id_cpy) < 0) {
@@ -2401,7 +2411,7 @@ run_splitter_test(const struct splitter_dataset_def *data,
if (H5Pget_driver(fapl_id_out) != H5FD_SPLITTER) {
SPLITTER_TEST_FAULT("wrong file FAPL driver\n");
}
- if (compare_splitter_config_info(fapl_id_out, &vfd_config) < 0) {
+ if (compare_splitter_config_info(fapl_id_out, vfd_config) < 0) {
SPLITTER_TEST_FAULT("information mismatch\n");
}
if (H5Pclose(fapl_id_out) < 0) {
@@ -2439,12 +2449,12 @@ run_splitter_test(const struct splitter_dataset_def *data,
}
/* Verify that the R/W and W/O files are identical */
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
- /* Verify existence of logfile iff appropriate */
- logfile = fopen(vfd_config.log_file_path, "r");
+ /* Verify existence of logfile if appropriate */
+ logfile = fopen(vfd_config->log_file_path, "r");
if ( (TRUE == provide_logfile_path && NULL == logfile) ||
(FALSE == provide_logfile_path && NULL != logfile) )
{
@@ -2454,19 +2464,22 @@ run_splitter_test(const struct splitter_dataset_def *data,
done:
if (ret_value < 0) {
H5E_BEGIN_TRY {
- (void)H5Dclose(dset_id);
- (void)H5Sclose(space_id);
- (void)H5Pclose(fapl_id_out);
- (void)H5Pclose(fapl_id_cpy);
- (void)H5Pclose(fapl_id);
- (void)H5Fclose(file_id);
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Pclose(fapl_id_out);
+ H5Pclose(fapl_id_cpy);
+ H5Pclose(fapl_id);
+ H5Fclose(file_id);
} H5E_END_TRY;
}
- if (logfile != NULL) {
+
+ if (logfile != NULL)
fclose(logfile);
- }
- return ret_value;
+ HDfree(vfd_config);
+ HDfree(filename_rw);
+
+ return ret_value;
} /* end run_splitter_test() */
@@ -2488,25 +2501,28 @@ done:
static int
driver_is_splitter_compatible(hid_t fapl_id)
{
- H5FD_splitter_vfd_config_t vfd_config;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
hid_t split_fapl_id = H5I_INVALID_HID;
herr_t ret = SUCCEED;
int ret_value = 0;
- split_fapl_id = H5Pcreate(H5P_FILE_ACCESS);
- if (H5I_INVALID_HID == split_fapl_id) {
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t)))) {
+ FAIL_PUTS_ERROR("memory allocation for vfd_config struct failed");
+ }
+
+ if(H5I_INVALID_HID == (split_fapl_id = H5Pcreate(H5P_FILE_ACCESS))) {
FAIL_PUTS_ERROR("Can't create contained FAPL");
}
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = FALSE;
- vfd_config.rw_fapl_id = H5P_DEFAULT;
- vfd_config.wo_fapl_id = fapl_id;
- HDstrncpy(vfd_config.wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX);
- *vfd_config.log_file_path = '\0';
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = FALSE;
+ vfd_config->rw_fapl_id = H5P_DEFAULT;
+ vfd_config->wo_fapl_id = fapl_id;
+ HDstrncpy(vfd_config->wo_path, "nonesuch", H5FD_SPLITTER_PATH_MAX);
+ vfd_config->log_file_path[0] = '\0';
H5E_BEGIN_TRY {
- ret = H5Pset_fapl_splitter(split_fapl_id, &vfd_config);
+ ret = H5Pset_fapl_splitter(split_fapl_id, vfd_config);
} H5E_END_TRY;
if (SUCCEED == ret) {
ret_value = -1;
@@ -2517,12 +2533,17 @@ driver_is_splitter_compatible(hid_t fapl_id)
}
split_fapl_id = H5I_INVALID_HID;
+ HDfree(vfd_config);
+
return ret_value;
error:
H5E_BEGIN_TRY {
- (void)H5Pclose(split_fapl_id);
+ H5Pclose(split_fapl_id);
} H5E_END_TRY;
+
+ HDfree(vfd_config);
+
return -1;
} /* end driver_is_splitter_compatible() */
@@ -2545,19 +2566,24 @@ splitter_RO_test(
const struct splitter_dataset_def *data,
hid_t child_fapl_id)
{
- char filename_rw[H5FD_SPLITTER_PATH_MAX + 1];
- H5FD_splitter_vfd_config_t vfd_config;
+ char *filename_rw = NULL;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
hid_t fapl_id = H5I_INVALID_HID;
- int ret_value = 0;
hid_t file_id = H5I_INVALID_HID;
+ int ret_value = 0;
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = FALSE;
- vfd_config.rw_fapl_id = child_fapl_id;
- vfd_config.wo_fapl_id = child_fapl_id;
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
+ if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
+ SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
- if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) {
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = FALSE;
+ vfd_config->rw_fapl_id = child_fapl_id;
+ vfd_config->wo_fapl_id = child_fapl_id;
+
+ if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare splitter file paths\n");
}
@@ -2566,7 +2592,7 @@ splitter_RO_test(
if (H5I_INVALID_HID == fapl_id) {
SPLITTER_TEST_FAULT("can't create FAPL ID\n");
}
- if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) {
+ if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("can't set splitter FAPL\n");
}
if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) {
@@ -2588,7 +2614,7 @@ splitter_RO_test(
* Should fail.
*/
- if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) {
+ if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't write W/O file\n");
}
H5E_BEGIN_TRY {
@@ -2597,13 +2623,13 @@ splitter_RO_test(
if (file_id >= 0) {
SPLITTER_TEST_FAULT("R/O open with extant W/O file unexpectedly successful\n");
}
- HDremove(vfd_config.wo_path);
+ HDremove(vfd_config->wo_path);
/* Attempt R/O open when only R/W file exists
* Should fail.
*/
- if (splitter_create_single_file_at(filename_rw, vfd_config.rw_fapl_id, data) < 0) {
+ if (splitter_create_single_file_at(filename_rw, vfd_config->rw_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't create R/W file\n");
}
H5E_BEGIN_TRY {
@@ -2616,7 +2642,7 @@ splitter_RO_test(
/* Attempt R/O open when both R/W and W/O files exist
*/
- if (splitter_create_single_file_at(vfd_config.wo_path, vfd_config.wo_fapl_id, data) < 0) {
+ if (splitter_create_single_file_at(vfd_config->wo_path, vfd_config->wo_fapl_id, data) < 0) {
SPLITTER_TEST_FAULT("can't create W/O file\n");
}
file_id = H5Fopen(filename_rw, H5F_ACC_RDONLY, fapl_id);
@@ -2642,10 +2668,14 @@ splitter_RO_test(
done:
if (ret_value < 0) {
H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- (void)H5Fclose(file_id);
+ H5Pclose(fapl_id);
+ H5Fclose(file_id);
} H5E_END_TRY;
- } /* end if error */
+ }
+
+ HDfree(vfd_config);
+ HDfree(filename_rw);
+
return ret_value;
} /* end splitter_RO_test() */
@@ -2784,9 +2814,9 @@ splitter_create_single_file_at(
done:
if (ret_value < 0) {
H5E_BEGIN_TRY {
- (void)H5Dclose(dset_id);
- (void)H5Sclose(space_id);
- (void)H5Fclose(file_id);
+ H5Dclose(dset_id);
+ H5Sclose(space_id);
+ H5Fclose(file_id);
} H5E_END_TRY;
} /* end if error */
return ret_value;
@@ -2847,7 +2877,7 @@ splitter_compare_expected_data(hid_t file_id,
done:
if (ret_value < 0) {
H5E_BEGIN_TRY {
- (void)H5Dclose(dset_id);
+ H5Dclose(dset_id);
} H5E_END_TRY;
}
return ret_value;
@@ -2880,8 +2910,9 @@ done:
static int
splitter_tentative_open_test(hid_t child_fapl_id)
{
- char filename_rw[H5FD_SPLITTER_PATH_MAX + 1];
- H5FD_splitter_vfd_config_t vfd_config;
+ const char *filename_tmp = "splitter_tmp.h5";
+ char *filename_rw = NULL;
+ H5FD_splitter_vfd_config_t *vfd_config = NULL;
hid_t fapl_id = H5I_INVALID_HID;
hid_t file_id = H5I_INVALID_HID;
int buf[SPLITTER_SIZE][SPLITTER_SIZE]; /* for comparison */
@@ -2891,6 +2922,11 @@ splitter_tentative_open_test(hid_t child_fapl_id)
struct splitter_dataset_def data; /* for comparison */
int ret_value = 0;
+ if (NULL == (vfd_config = HDcalloc(1, sizeof(H5FD_splitter_vfd_config_t))))
+ SPLITTER_TEST_FAULT("memory allocation for vfd_config struct failed");
+ if (NULL == (filename_rw = HDcalloc(H5FD_SPLITTER_PATH_MAX + 1, sizeof(char))))
+ SPLITTER_TEST_FAULT("memory allocation for filename_rw string failed");
+
/* pre-fill data buffer to write */
for (i=0; i < SPLITTER_SIZE; i++) {
for (j=0; j < SPLITTER_SIZE; j++) {
@@ -2905,13 +2941,13 @@ splitter_tentative_open_test(hid_t child_fapl_id)
data.n_dims = 2;
data.dset_name = SPLITTER_DATASET_NAME;
- vfd_config.magic = H5FD_SPLITTER_MAGIC;
- vfd_config.version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
- vfd_config.ignore_wo_errs = FALSE;
- vfd_config.rw_fapl_id = child_fapl_id;
- vfd_config.wo_fapl_id = child_fapl_id;
+ vfd_config->magic = H5FD_SPLITTER_MAGIC;
+ vfd_config->version = H5FD_CURR_SPLITTER_VFD_CONFIG_VERSION;
+ vfd_config->ignore_wo_errs = FALSE;
+ vfd_config->rw_fapl_id = child_fapl_id;
+ vfd_config->wo_fapl_id = child_fapl_id;
- if (splitter_prepare_file_paths(&vfd_config, filename_rw) < 0) {
+ if (splitter_prepare_file_paths(vfd_config, filename_rw) < 0) {
SPLITTER_TEST_FAULT("can't prepare splitter file paths\n");
}
@@ -2919,14 +2955,23 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) == H5I_INVALID_HID) {
SPLITTER_TEST_FAULT("can't create FAPL ID\n");
}
- if (H5Pset_fapl_splitter(fapl_id, &vfd_config) < 0) {
+ if (H5Pset_fapl_splitter(fapl_id, vfd_config) < 0) {
SPLITTER_TEST_FAULT("can't set splitter FAPL\n");
}
if (H5Pget_driver(fapl_id) != H5FD_SPLITTER) {
SPLITTER_TEST_FAULT("set FAPL not SPLITTER\n");
}
- /* H5Fopen() with RDWR access.
+ /* Create instance of file on disk.
+ * Will be copied verbatim as needed, to avoid issues where differences in
+ * the creation time would befoul comparisons.
+ */
+ if (splitter_create_single_file_at(filename_tmp, child_fapl_id, &data) < 0) {
+ SPLITTER_TEST_FAULT("can't write W/O file\n");
+ }
+
+ /*
+ * H5Fopen() with RDWR access.
* Neither file exist already
* Should fail.
*/
@@ -2940,17 +2985,18 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file unexpectedly created\n");
}
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file unexpectedly created\n");
}
- /* H5Fopen() with RDWR access.
- * W/O file exists already.
+ /*
+ * H5Fopen() with RDWR access.
+ * Only W/O file present.
* Should fail.
*/
- if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) {
- SPLITTER_TEST_FAULT("can't write W/O file\n");
+ if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
+ SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
H5E_BEGIN_TRY {
file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
@@ -2961,21 +3007,22 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file unexpectedly created\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- HDremove(vfd_config.wo_path);
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ HDremove(vfd_config->wo_path);
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("failed to remove W/O file\n");
}
- /* H5Fopen() with RDWR access.
- * R/W file exists already.
+ /*
+ * H5Fopen() with RDWR access.
+ * Only R/W file present.
* Should fail.
*/
- if (splitter_create_single_file_at(filename_rw, child_fapl_id, &data) < 0) {
- SPLITTER_TEST_FAULT("can't write R/W file\n");
+ if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) {
+ SPLITTER_TEST_FAULT("Can't create R/W file copy.\n");
}
H5E_BEGIN_TRY {
file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
@@ -2986,16 +3033,17 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappeared\n");
}
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file unexpectedly created\n");
}
- /* H5Fopen() with RDWR access.
- * Both files already exist.
+ /*
+ * H5Fopen() with RDWR access.
+ * Both files present.
*/
- if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) {
- SPLITTER_TEST_FAULT("can't write W/O file\n");
+ if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
+ SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
file_id = H5Fopen(filename_rw, H5F_ACC_RDWR, fapl_id);
if (file_id == H5I_INVALID_HID) {
@@ -3008,15 +3056,13 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
- SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
- }
- /* H5Fcreate() with TRUNC access.
- * Both files already exist.
+ /*
+ * H5Fcreate() with TRUNC access.
+ * Both files present.
*/
file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
@@ -3030,24 +3076,24 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
+ HDremove(filename_rw);
+ HDremove(vfd_config->wo_path);
- /* H5Fcreate() with TRUNC access.
+ /*
+ * H5Fcreate() with TRUNC access.
* R/W already exists.
*/
- HDremove(filename_rw);
- HDremove(vfd_config.wo_path);
- if (splitter_create_single_file_at(filename_rw, child_fapl_id, &data) < 0) {
- SPLITTER_TEST_FAULT("can't write R/W file\n");
+ if (h5_duplicate_file_by_bytes(filename_tmp, filename_rw) < 0) {
+ SPLITTER_TEST_FAULT("Can't create R/W file copy.\n");
}
-
- if (file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("failed to remove W/O file\n");
}
file_id = H5Fcreate(filename_rw, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
@@ -3061,23 +3107,23 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
+ HDremove(filename_rw);
+ HDremove(vfd_config->wo_path);
- /* H5Fcreate() with TRUNC access.
- * W/O already exists.
+ /*
+ * H5Fcreate() with TRUNC access.
+ * Only W/O present.
*/
- HDremove(filename_rw);
- HDremove(vfd_config.wo_path);
- if (splitter_create_single_file_at(vfd_config.wo_path, child_fapl_id, &data) < 0) {
- SPLITTER_TEST_FAULT("can't write R/W file\n");
+ if (h5_duplicate_file_by_bytes(filename_tmp, vfd_config->wo_path) < 0) {
+ SPLITTER_TEST_FAULT("Can't create W/O file copy.\n");
}
-
if (file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("failed to remove R/W file\n");
}
@@ -3092,16 +3138,19 @@ splitter_tentative_open_test(hid_t child_fapl_id)
if (!file_exists(filename_rw, child_fapl_id)) {
SPLITTER_TEST_FAULT("R/W file mysteriously disappared\n");
}
- if (!file_exists(vfd_config.wo_path, child_fapl_id)) {
+ if (!file_exists(vfd_config->wo_path, child_fapl_id)) {
SPLITTER_TEST_FAULT("W/O file mysteriously disappeared\n");
}
- if (h5_compare_file_bytes(filename_rw, vfd_config.wo_path) < 0) {
+ if (h5_compare_file_bytes(filename_rw, vfd_config->wo_path) < 0) {
SPLITTER_TEST_FAULT("files are not byte-for-byte equivalent\n");
}
+ HDremove(filename_rw);
+ HDremove(vfd_config->wo_path);
/* H5Fcreate with both files absent is tested elsewhere */
- /* Cleanup
+ /*
+ * Cleanup
*/
if (H5Pclose(fapl_id) < 0) {
@@ -3111,10 +3160,14 @@ splitter_tentative_open_test(hid_t child_fapl_id)
done:
if (ret_value < 0) {
H5E_BEGIN_TRY {
- (void)H5Pclose(fapl_id);
- (void)H5Fclose(file_id);
+ H5Pclose(fapl_id);
+ H5Fclose(file_id);
} H5E_END_TRY;
- } /* end if error */
+ }
+
+ HDfree(vfd_config);
+ HDfree(filename_rw);
+
return ret_value;
} /* end splitter_tentative_open_test() */
@@ -3151,7 +3204,7 @@ file_exists(const char *filename, hid_t fapl_id)
error:
H5E_BEGIN_TRY {
- (void)H5Fclose(file_id);
+ H5Fclose(file_id);
} H5E_END_TRY;
return ret_value;
} /* end file_exists() */
@@ -3225,7 +3278,6 @@ test_splitter(void)
TEST_ERROR;
}
-
/* Test file creation, utilizing different child FAPLs (default vs.
* specified), logfile, and Write Channel error ignoring behavior.
*/
@@ -3251,7 +3303,6 @@ test_splitter(void)
/* TODO: SWMR open? */
/* Concurrent opens with both drivers using the Splitter */
-
if (H5Pclose(child_fapl_id) == FAIL) {
TEST_ERROR;
}
@@ -3260,9 +3311,9 @@ test_splitter(void)
return 0;
error:
- if (child_fapl_id != H5I_INVALID_HID) {
- (void)H5Pclose(child_fapl_id);
- }
+ if (child_fapl_id != H5I_INVALID_HID)
+ H5Pclose(child_fapl_id);
+
return -1;
} /* end test_splitter() */
@@ -4162,8 +4213,7 @@ error:
*
* Purpose: Tests the basic features of Virtual File Drivers
*
- * Return: Success: 0
- * Failure: 1
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*
*-------------------------------------------------------------------------
*/
@@ -4199,11 +4249,11 @@ main(void)
if(nerrors) {
HDprintf("***** %d Virtual File Driver TEST%s FAILED! *****\n",
nerrors, nerrors > 1 ? "S" : "");
- return 1;
- } /* end if */
+ return EXIT_FAILURE;
+ }
HDprintf("All Virtual File Driver tests passed.\n");
- return 0;
+ return EXIT_SUCCESS;
} /* end main() */