summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-04-21 15:41:50 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-04-21 15:41:50 (GMT)
commitaeb1500897862ab8e0c500bd0a6986d229c4e5f2 (patch)
tree422757fe6b1a946a69c3d47b1a6ba4c8fc7dafba /test
parentae1144f8826dcecc68ec923bb7261f2a8153735c (diff)
parent3968c5c3bf16dc23a0a2ff1fa8d6c64dd2f8d32a (diff)
downloadhdf5-aeb1500897862ab8e0c500bd0a6986d229c4e5f2.zip
hdf5-aeb1500897862ab8e0c500bd0a6986d229c4e5f2.tar.gz
hdf5-aeb1500897862ab8e0c500bd0a6986d229c4e5f2.tar.bz2
Merge remote-tracking branch 'origin/develop' into
bugfix/HDFFV-9655-plugin-path-relative
Diffstat (limited to 'test')
-rw-r--r--test/CMakeTests.cmake4
-rw-r--r--test/Makefile.am14
-rw-r--r--test/cache.c106
-rw-r--r--test/cache_image.c477
-rw-r--r--test/evict_on_close.c99
-rw-r--r--test/fheap.c688
-rw-r--r--test/page_buffer.c135
-rw-r--r--test/plugin.c744
-rw-r--r--test/set_extent.c13
9 files changed, 1560 insertions, 720 deletions
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 959fe64..86c5cb3 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -750,7 +750,7 @@ if (NOT CYGWIN)
endif ()
set_tests_properties (H5TEST-cache PROPERTIES
DEPENDS H5TEST-clear-cache-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=3"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 1800)
@@ -768,7 +768,7 @@ add_test (
add_test (NAME H5TEST-cache_image COMMAND $<TARGET_FILE:cache_image>)
set_tests_properties (H5TEST-cache_image PROPERTIES
DEPENDS H5TEST-clear-cache_image-objects
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=3"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
diff --git a/test/Makefile.am b/test/Makefile.am
index a64cd0e..79dc17f 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -100,10 +100,10 @@ if BUILD_ALL_CONDITIONAL
noinst_PROGRAMS=$(BUILD_ALL_PROGS)
endif
-if HAVE_SHARED_CONDITIONAL
- # The libh5test library provides common support code for the tests.
- noinst_LTLIBRARIES=libh5test.la
+# The libh5test library provides common support code for the tests.
+noinst_LTLIBRARIES=libh5test.la
+if HAVE_SHARED_CONDITIONAL
# The libdynlib1, libdynlib2, libdynlib3, and libdynlib4 library for testing plugin module plugin.c.
# Build it as shared library if configure is enabled for shared library.
lib_LTLIBRARIES=libdynlib1.la libdynlib2.la libdynlib3.la libdynlib4.la
@@ -111,13 +111,13 @@ if HAVE_SHARED_CONDITIONAL
libdynlib2_la_SOURCES=dynlib2.c
libdynlib3_la_SOURCES=dynlib3.c
libdynlib4_la_SOURCES=dynlib4.c
+ libdynlib1_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlib2_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlib3_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
+ libdynlib4_la_LDFLAGS = -avoid-version -module -shared -export-dynamic
install-exec-hook:
$(RM) $(DESTDIR)$(libdir)/*dynlib*
-
-else
- # The libh5test library provides common support code for the tests.
- noinst_LTLIBRARIES=libh5test.la
endif
libh5test_la_SOURCES=h5test.c testframe.c cache_common.c swmr_common.c
diff --git a/test/cache.c b/test/cache.c
index ba6fb0e..6658c70 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -241,10 +241,16 @@ smoke_check_1(int express_test, unsigned paged)
H5F_t * file_ptr = NULL;
if(paged)
- TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache, paged aggregation")
+ TESTING("smoke check #1P -- all clean, ins, dest, ren, 4/2 MB cache")
else
TESTING("smoke check #1 -- all clean, ins, dest, ren, 4/2 MB cache")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -442,10 +448,16 @@ smoke_check_2(int express_test, unsigned paged)
H5F_t * file_ptr = NULL;
if(paged)
- TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache, paged aggregation")
+ TESTING("smoke check #2P -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache")
else
TESTING("smoke check #2 -- ~1/2 dirty, ins, dest, ren, 4/2 MB cache")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -642,10 +654,16 @@ smoke_check_3(int express_test, unsigned paged)
H5F_t * file_ptr = NULL;
if(paged)
- TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache, paged aggregation")
+ TESTING("smoke check #3P -- all clean, ins, dest, ren, 2/1 KB cache")
else
TESTING("smoke check #3 -- all clean, ins, dest, ren, 2/1 KB cache")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -843,10 +861,16 @@ smoke_check_4(int express_test, unsigned paged)
H5F_t * file_ptr = NULL;
if(paged)
- TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache, paged aggregation")
+ TESTING("smoke check #4P -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache")
else
TESTING("smoke check #4 -- ~1/2 dirty, ins, dest, ren, 2/1 KB cache")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -1092,10 +1116,16 @@ smoke_check_5(int express_test, unsigned paged)
};
if(paged)
- TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1, paged aggregation")
+ TESTING("smoke check #5P -- all clean, ins, prot, unprot, AR cache 1")
else
TESTING("smoke check #5 -- all clean, ins, prot, unprot, AR cache 1")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -1330,10 +1360,16 @@ smoke_check_6(int express_test, unsigned paged)
};
if(paged)
- TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1, paged aggregation")
+ TESTING("smoke check #6P -- ~1/2 dirty, ins, prot, unprot, AR cache 1")
else
TESTING("smoke check #6 -- ~1/2 dirty, ins, prot, unprot, AR cache 1")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
pass = TRUE;
switch (express_test)
@@ -1569,10 +1605,16 @@ smoke_check_7(int express_test, unsigned paged)
};
if(paged)
- TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2, paged aggregation")
+ TESTING("smoke check #7P -- all clean, ins, prot, unprot, AR cache 2")
else
TESTING("smoke check #7 -- all clean, ins, prot, unprot, AR cache 2")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -1808,10 +1850,16 @@ smoke_check_8(int express_test, unsigned paged)
};
if(paged)
- TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2, paged aggregation")
+ TESTING("smoke check #8P -- ~1/2 dirty, ins, prot, unprot, AR cache 2")
else
TESTING("smoke check #8 -- ~1/2 dirty, ins, prot, unprot, AR cache 2")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -2008,10 +2056,16 @@ smoke_check_9(int express_test, unsigned paged)
H5C_t * cache_ptr = NULL;
if(paged)
- TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked, paged aggregation")
+ TESTING("smoke check #9P -- all clean, ins, dest, ren, 4/2 MB, corked")
else
TESTING("smoke check #9 -- all clean, ins, dest, ren, 4/2 MB, corked")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -2330,10 +2384,16 @@ smoke_check_10(int express_test, unsigned paged)
H5C_t * cache_ptr = NULL;
if(paged)
- TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked, paged aggregation")
+ TESTING("smoke check #10P -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked")
else
TESTING("smoke check #10 -- ~1/2 dirty, ins, dest, ren, 4/2 MB, corked")
+ if ( paged && ( express_test > 0 ) ) {
+
+ SKIPPED();
+ return(0);
+ }
+
switch (express_test)
{
case 0:
@@ -2646,7 +2706,7 @@ express_test, unsigned paged)
#endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */
if(paged)
- TESTING("write permitted check -- 1/0 MB cache, paged aggregation")
+ TESTING("write permitted check -- 1/0 MB cache (paged aggregation)")
else
TESTING("write permitted check -- 1/0 MB cache")
@@ -13329,7 +13389,7 @@ check_multiple_read_protect(unsigned paged)
test_entry_t * entry_ptr;
if(paged)
- TESTING("multiple read only protects on a single entry (paged aggregation)")
+ TESTING("multiple read only protects on a single entry (paged aggr)")
else
TESTING("multiple read only protects on a single entry")
@@ -15954,7 +16014,7 @@ check_destroy_pinned_err(unsigned paged)
H5F_t * file_ptr = NULL;
if(paged)
- TESTING("destroy cache with permanently pinned entry error (paged aggregation)")
+ TESTING("destroy cache with permanently pinned entry error (pgd aggr)")
else
TESTING("destroy cache with permanently pinned entry error")
@@ -24438,7 +24498,7 @@ check_auto_cache_resize_epoch_markers(unsigned paged)
};
if(paged)
- TESTING("automatic cache resize epoch marker management (paged aggregation)")
+ TESTING("automatic cache resize epoch marker management (paged aggr)")
else
TESTING("automatic cache resize epoch marker management")
@@ -28230,13 +28290,13 @@ check_metadata_blizzard_absence(hbool_t fill_via_insertion, unsigned paged)
if(fill_via_insertion) {
if(paged)
- TESTING("to ensure metadata blizzard absence when inserting (paged aggregation)")
+ TESTING("to ensure metadata blizzard absence when inserting (pgd aggr)")
else
TESTING("to ensure metadata blizzard absence when inserting")
} /* end if */
else {
if(paged)
- TESTING("to ensure metadata blizzard absence on protect/unprotect (paged aggregation)")
+ TESTING("to ensure metadata blizzard absence on protect/unprotect (pa)")
else
TESTING("to ensure metadata blizzard absence on protect/unprotect")
} /* end else */
@@ -34383,7 +34443,7 @@ check_entry_deletions_during_scans(unsigned paged)
H5F_t * file_ptr = NULL;
if(paged)
- TESTING("entry deletion during list scan detection and adaption (paged aggregation)")
+ TESTING("entry deletion during list scan detection and adaption (par)")
else
TESTING("entry deletion during list scan detection and adaption")
@@ -36394,6 +36454,18 @@ main(void)
/* Test with paged aggregation enabled or not */
/* Each test will call setup_cache() which set up the file space strategy according to "paged" */
for(paged = FALSE; paged <= TRUE; paged++) {
+
+ if ( paged ) {
+
+ HDfprintf(stdout,
+ "\n\nRe-running tests with paged aggregation:\n");
+
+ if ( express_test > 0 )
+ HDfprintf(stdout, " Skipping smoke checks.\n");
+
+ HDfprintf(stdout, "\n");
+ }
+
nerrs += smoke_check_1(express_test, paged);
nerrs += smoke_check_2(express_test, paged);
nerrs += smoke_check_3(express_test, paged);
diff --git a/test/cache_image.c b/test/cache_image.c
index f49f7b3..378c21e 100644
--- a/test/cache_image.c
+++ b/test/cache_image.c
@@ -35,7 +35,7 @@ static void create_datasets(hid_t file_id, int min_dset, int max_dset);
static void delete_datasets(hid_t file_id, int min_dset, int max_dset);
static void open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm,
- const char *hdf_file_name, unsigned cache_image_flags,
+ hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags,
hid_t *file_id_ptr, H5F_t **file_ptr_ptr, H5C_t **cache_ptr_ptr);
static void attempt_swmr_open_hdf5_file(hbool_t create_file,
hbool_t set_mdci_fapl, const char *hdf_file_name);
@@ -62,6 +62,7 @@ static unsigned cache_image_api_error_check_3(void);
static unsigned cache_image_api_error_check_4(void);
static unsigned get_free_sections_test(void);
+static unsigned evict_on_close_test(void);
/****************************************************************************/
@@ -535,7 +536,7 @@ delete_datasets(hid_t file_id, int min_dset, int max_dset)
static void
open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
hbool_t read_only, hbool_t set_mdci_fapl, hbool_t config_fsm,
- const char *hdf_file_name, unsigned cache_image_flags,
+ hbool_t set_eoc, const char *hdf_file_name, unsigned cache_image_flags,
hid_t *file_id_ptr, H5F_t ** file_ptr_ptr, H5C_t ** cache_ptr_ptr)
{
const char * fcn_name = "open_hdf5_file()";
@@ -601,7 +602,8 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
/* call H5Pset_libver_bounds() on the fapl_id */
if ( pass ) {
- if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0 ) {
+ if ( H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST,
+ H5F_LIBVER_LATEST) < 0 ) {
pass = FALSE;
failure_mssg = "H5Pset_libver_bounds() failed.\n";
@@ -667,7 +669,8 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
}
if ( ( pass ) && ( config_fsm ) ) {
- if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0) {
+ if(H5Pset_file_space_strategy(fcpl_id, H5F_FSPACE_STRATEGY_PAGE,
+ TRUE, (hsize_t)1) < 0) {
pass = FALSE;
failure_mssg = "H5Pset_file_space_strategy() failed.";
}
@@ -675,6 +678,18 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+ /* set evict on close if indicated */
+ if ( ( pass ) && ( set_eoc ) ) {
+
+ if ( H5Pset_evict_on_close(fapl_id, TRUE) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Pset_evict_on_close() failed.";
+ }
+ }
+
+ if ( show_progress ) HDfprintf(stdout, "%s: cp = %d.\n", fcn_name, cp++);
+
/* open the file */
if ( pass ) {
@@ -682,10 +697,12 @@ open_hdf5_file(hbool_t create_file, hbool_t mdci_sbem_expected,
if ( fcpl_id != -1 )
- file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC,
+ fcpl_id, fapl_id);
else
- file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ file_id = H5Fcreate(hdf_file_name, H5F_ACC_TRUNC,
+ H5P_DEFAULT, fapl_id);
} else {
@@ -1362,6 +1379,7 @@ check_cache_image_ctl_flow_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -1415,6 +1433,7 @@ check_cache_image_ctl_flow_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1476,6 +1495,7 @@ check_cache_image_ctl_flow_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1637,6 +1657,7 @@ check_cache_image_ctl_flow_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -1679,6 +1700,7 @@ check_cache_image_ctl_flow_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1718,6 +1740,7 @@ check_cache_image_ctl_flow_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1894,6 +1917,7 @@ check_cache_image_ctl_flow_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -1935,6 +1959,7 @@ check_cache_image_ctl_flow_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -1988,6 +2013,7 @@ check_cache_image_ctl_flow_3(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2041,6 +2067,7 @@ check_cache_image_ctl_flow_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2091,6 +2118,7 @@ check_cache_image_ctl_flow_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2260,6 +2288,7 @@ check_cache_image_ctl_flow_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2301,6 +2330,7 @@ check_cache_image_ctl_flow_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2343,6 +2373,7 @@ check_cache_image_ctl_flow_4(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2385,6 +2416,7 @@ check_cache_image_ctl_flow_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2424,6 +2456,7 @@ check_cache_image_ctl_flow_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2589,6 +2622,7 @@ check_cache_image_ctl_flow_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2648,6 +2682,7 @@ check_cache_image_ctl_flow_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2700,6 +2735,7 @@ check_cache_image_ctl_flow_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -2867,6 +2903,7 @@ check_cache_image_ctl_flow_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2915,6 +2952,7 @@ check_cache_image_ctl_flow_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__GEN_MDCI_SBE_MESG,
/* file_id_ptr */ &file_id,
@@ -2957,6 +2995,7 @@ check_cache_image_ctl_flow_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3149,6 +3188,7 @@ cache_image_smoke_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3215,6 +3255,7 @@ cache_image_smoke_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3280,6 +3321,7 @@ cache_image_smoke_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3346,6 +3388,7 @@ cache_image_smoke_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3388,6 +3431,7 @@ cache_image_smoke_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3567,6 +3611,7 @@ cache_image_smoke_check_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3630,6 +3675,7 @@ cache_image_smoke_check_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3675,6 +3721,7 @@ cache_image_smoke_check_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3865,6 +3912,7 @@ cache_image_smoke_check_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -3927,6 +3975,7 @@ cache_image_smoke_check_3(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -3992,6 +4041,7 @@ cache_image_smoke_check_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4055,6 +4105,7 @@ cache_image_smoke_check_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4248,6 +4299,7 @@ cache_image_smoke_check_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4312,6 +4364,7 @@ cache_image_smoke_check_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4379,6 +4432,7 @@ cache_image_smoke_check_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4442,6 +4496,7 @@ cache_image_smoke_check_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4493,7 +4548,6 @@ cache_image_smoke_check_4(void)
if ( show_progress )
HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
-
/* 13) Delete the file */
@@ -4653,6 +4707,7 @@ cache_image_smoke_check_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4742,6 +4797,7 @@ cache_image_smoke_check_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -4842,6 +4898,7 @@ cache_image_smoke_check_5(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4893,6 +4950,7 @@ cache_image_smoke_check_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -4953,6 +5011,7 @@ cache_image_smoke_check_5(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5161,6 +5220,7 @@ cache_image_smoke_check_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5225,6 +5285,7 @@ cache_image_smoke_check_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5303,6 +5364,7 @@ cache_image_smoke_check_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5362,6 +5424,7 @@ cache_image_smoke_check_6(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5559,6 +5622,7 @@ cache_image_api_error_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5619,6 +5683,7 @@ cache_image_api_error_check_1(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5681,6 +5746,7 @@ cache_image_api_error_check_1(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -5744,6 +5810,7 @@ cache_image_api_error_check_1(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5931,6 +5998,7 @@ cache_image_api_error_check_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -5991,6 +6059,7 @@ cache_image_api_error_check_2(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6053,6 +6122,7 @@ cache_image_api_error_check_2(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ 0,
/* file_id_ptr */ &file_id,
@@ -6116,6 +6186,7 @@ cache_image_api_error_check_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6177,6 +6248,7 @@ cache_image_api_error_check_2(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6337,6 +6409,7 @@ cache_image_api_error_check_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6422,6 +6495,7 @@ cache_image_api_error_check_3(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6743,6 +6817,7 @@ cache_image_api_error_check_4(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -6997,6 +7072,7 @@ cache_image_api_error_check_4(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7209,6 +7285,7 @@ get_free_sections_test(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ TRUE,
/* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7274,6 +7351,7 @@ get_free_sections_test(void)
/* read_only */ TRUE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7398,6 +7476,7 @@ get_free_sections_test(void)
/* read_only */ FALSE,
/* set_mdci_fapl */ FALSE,
/* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
/* hdf_file_name */ filename,
/* cache_image_flags */ H5C_CI__ALL_FLAGS,
/* file_id_ptr */ &file_id,
@@ -7566,6 +7645,388 @@ get_free_sections_test(void)
/*-------------------------------------------------------------------------
+ * Function: evict_on_close_test()
+ *
+ * Purpose: If a file containing a cache image which in turn
+ * contains dirty entries is opened R/O, the metadata
+ * cache must refuse to evict the dirty entries, as
+ * it will not be able to reload them from file. This
+ * is a bit tricky, as the dirty entries must marked as
+ * clean in the metadata cache so that the MDC will not
+ * attempt to flush then on file close.
+ *
+ * The objective of this test is to verify that the
+ * metadata will not evict dirty entries in the above
+ * context when the file is opened with the evict on close
+ * FAPL entry.
+ *
+ * Do this by creating a HDF5 file with a cache image
+ * containing dirty metadata.
+ *
+ * Then close the file, re-open it R/O, and scan its
+ * contents twice. If evict on close succeeds in evicting
+ * the dirty metadata, the second scan will fail, as valid
+ * versions of the dirty metadata will not be available.
+ *
+ * To make the test more useful, enable persistant free
+ * space managers.
+ *
+ * The test is set up as follows:
+ *
+ * 1) Create a HDF5 file without a cache image requested
+ * and persistant free space managers enabled.
+ *
+ * 2) Create some data sets and verify them.
+ *
+ * 3) Close the file.
+ *
+ * 4) Open the file R/W, and with cache image requested.
+ *
+ * 5) Verify the datasets created in 2) above. This will
+ * force their (clean) metadata into the metadata cache,
+ * and hence into the cache image.
+ *
+ * 6) Create some more datasets.
+ *
+ * 7) Close the file.
+ *
+ * 8) Open the file R/O and with evict on close enabled.
+ *
+ * 9) Verify all datasets twice.
+ *
+ * 10) Close the file.
+ *
+ * 11) Open the file R/W and with evict on close enabled.
+ *
+ * 12) Verify all datasets twice.
+ *
+ * 13) Close the file.
+ *
+ * 14) Discard the file.
+ *
+ * Return: void
+ *
+ * Programmer: John Mainzer
+ * 3/23/17
+ *
+ *-------------------------------------------------------------------------
+ */
+static unsigned
+evict_on_close_test(void)
+{
+#ifndef H5_HAVE_PARALLEL
+ const char * fcn_name = "evict_on_close_test()";
+ char filename[512];
+ hbool_t show_progress = FALSE;
+ hbool_t verbose = FALSE;
+ hid_t file_id = -1;
+ H5F_t *file_ptr = NULL;
+ H5C_t *cache_ptr = NULL;
+ int cp = 0;
+#endif /* H5_HAVE_PARALLEL */
+
+ TESTING("Cache image / evict on close interaction");
+
+#ifdef H5_HAVE_PARALLEL
+ SKIPPED();
+ HDputs(" EoC not supported in the parallel library.");
+ return 0;
+#else
+
+ pass = TRUE;
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* setup the file name */
+ if ( pass ) {
+
+ if ( h5_fixname(FILENAMES[0], H5P_DEFAULT, filename, sizeof(filename))
+ == NULL ) {
+
+ pass = FALSE;
+ failure_mssg = "h5_fixname() failed.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 1) Create a HDF5 file without a cache image requested
+ * and persistant free space managers enabled.
+ */
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ TRUE,
+ /* mdci_sbem_expected */ FALSE,
+ /* read_only */ FALSE,
+ /* set_mdci_fapl */ FALSE,
+ /* config_fsm */ TRUE,
+ /* set_eoc */ FALSE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 2) Create some data sets and verify them. */
+
+ if ( pass ) {
+
+ create_datasets(file_id, 1, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 3) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (1).\n";
+
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 4) Open the file R/W, and with cache image requested. */
+
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ FALSE,
+ /* mdci_sbem_expected */ FALSE,
+ /* read_only */ FALSE,
+ /* set_mdci_fapl */ TRUE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ FALSE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 5) Verify the datasets created in 2) above. This will
+ * force their (clean) metadata into the metadata cache,
+ * and hence into the cache image.
+ */
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 10);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 6) Create some more datasets and verify them */
+
+ if ( pass ) {
+
+ create_datasets(file_id, 11, 20);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 11, 20);
+ }
+
+ if ( verbose ) {
+
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ HDfprintf(stdout, "index size / index dirty size = %lld / %lld\n",
+ (long long)(cache_ptr->index_size),
+ (long long)(cache_ptr->dirty_index_size));
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 7) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (2).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 8) Open the file R/O and with evict on close enabled. */
+
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ FALSE,
+ /* mdci_sbem_expected */ TRUE,
+ /* read_only */ TRUE,
+ /* set_mdci_fapl */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ TRUE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s*: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 9) Verify all datasets twice */
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 20);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 20);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 10) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (3).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 11) Open the file R/w and with evict on close enabled. */
+
+ if ( pass ) {
+
+ open_hdf5_file(/* create_file */ FALSE,
+ /* mdci_sbem_expected */ TRUE,
+ /* read_only */ FALSE,
+ /* set_mdci_fapl */ FALSE,
+ /* config_fsm */ FALSE,
+ /* set_eoc */ TRUE,
+ /* hdf_file_name */ filename,
+ /* cache_image_flags */ H5C_CI__ALL_FLAGS,
+ /* file_id_ptr */ &file_id,
+ /* file_ptr_ptr */ &file_ptr,
+ /* cache_ptr_ptr */ &cache_ptr);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s*: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 12) Verify all datasets twice */
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 20);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) {
+
+ verify_datasets(file_id, 1, 20);
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 13) Close the file. */
+
+ if ( pass ) {
+
+ if ( H5Fclose(file_id) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "H5Fclose() failed (3).\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+
+ /* 14) Discard the file. */
+
+ if ( pass ) {
+
+ if ( HDremove(filename) < 0 ) {
+
+ pass = FALSE;
+ failure_mssg = "HDremove() failed.\n";
+ }
+ }
+
+ if ( show_progress )
+ HDfprintf(stdout, "%s: cp = %d, pass = %d.\n", fcn_name, cp++, pass);
+
+ if ( pass ) { PASSED(); } else { H5_FAILED(); }
+
+ if ( ! pass )
+ HDfprintf(stdout, "%s: failure_mssg = \"%s\".\n",
+ FUNC, failure_mssg);
+
+ return !pass;
+#endif /* H5_HAVE_PARALLEL */
+
+} /* evict_on_close_test() */
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Purpose: Run tests on the cache code contained in H5C.c
@@ -7614,9 +8075,9 @@ main(void)
nerrs += cache_image_api_error_check_4();
nerrs += get_free_sections_test();
+ nerrs += evict_on_close_test();
return(nerrs > 0);
} /* main() */
-
diff --git a/test/evict_on_close.c b/test/evict_on_close.c
index b00c1e4..147976b 100644
--- a/test/evict_on_close.c
+++ b/test/evict_on_close.c
@@ -39,6 +39,12 @@
#include "H5Gpkg.h"
#include "H5Ipkg.h"
+/* Evict on close is not supported under parallel at this time.
+ * In the meantime, we just run a simple check that EoC can't be
+ * enabled in parallel HDF5.
+ */
+#ifndef H5_HAVE_PARALLEL
+
/* Uncomment to manually inspect cache states */
/* (Requires debug build of the library) */
/* #define EOC_MANUAL_INSPECTION */
@@ -992,3 +998,96 @@ error:
} /* end main() */
+#else
+
+
+/*-------------------------------------------------------------------------
+ * Function: check_evict_on_close_parallel_fail()
+ *
+ * Purpose: Verify that the H5Pset_evict_on_close() call fails in
+ * parallel HDF5.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Spring 2017
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+check_evict_on_close_parallel_fail(void)
+{
+ hid_t fapl_id = -1;
+ hbool_t evict_on_close;
+ herr_t status;
+
+ TESTING("evict on close fails in parallel");
+
+ /* Create a fapl */
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ TEST_ERROR;
+
+ /* Set the evict on close property (should fail)*/
+ evict_on_close = TRUE;
+ H5E_BEGIN_TRY {
+ status = H5Pset_evict_on_close(fapl_id, evict_on_close);
+ } H5E_END_TRY;
+ if(status >= 0)
+ FAIL_PUTS_ERROR("H5Pset_evict_on_close() did not fail in parallel HDF5.");
+
+ /* close fapl */
+ if(H5Pclose(fapl_id) < 0)
+ TEST_ERROR;
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5_FAILED();
+ return FAIL;
+
+} /* check_evict_on_close_parallel_fail() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main (parallel version)
+ *
+ * Return: EXIT_FAILURE/EXIT_SUCCESS
+ *
+ * Programmer: Dana Robinson
+ * Spring 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ unsigned nerrors = 0; /* number of test errors */
+
+ HDprintf("Testing evict-on-close cache behavior\n");
+
+ /* Initialize */
+ h5_reset();
+
+ /* Test that EoC fails in parallel HDF5 */
+ nerrors += check_evict_on_close_parallel_fail() < 0 ? 1 : 0;
+
+ if(nerrors)
+ goto error;
+
+ HDprintf("All evict-on-close tests passed.\n");
+ HDprintf("Note that EoC is not supported under parallel so most tests are skipped.\n");
+
+ return EXIT_SUCCESS;
+
+error:
+
+ HDprintf("***** %u evict-on-close test%s FAILED! *****\n",
+ nerrors, nerrors > 1 ? "S" : "");
+
+ return EXIT_FAILURE;
+
+} /* main() - parallel */
+
+#endif /* H5_HAVE_PARALLEL */
+
diff --git a/test/fheap.c b/test/fheap.c
index f08c0f8..e741aad 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -81,6 +81,10 @@
#define DBLOCK_SIZE(fh, r) H5HF_get_dblock_size_test(fh, r) /* Size of a direct block in a given row */
#define DBLOCK_FREE(fh, r) H5HF_get_dblock_free_test(fh, r) /* Free space in a direct block of a given row */
+/* The number of settings for testing: page buffering, file space strategy and persisting free-space */
+#define NUM_PB_FS 6
+#define PAGE_BUFFER_PAGE_SIZE 4096
+
const char *FILENAME[] = {
"fheap",
NULL
@@ -549,7 +553,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc,
del_str = get_del_string(tparam);
HDassert(del_str);
test_desc = (char *)H5MM_malloc(HDstrlen(del_str) + HDstrlen(base_desc));
- sprintf(test_desc, base_desc, del_str);
+ HDsprintf(test_desc, base_desc, del_str);
TESTING(test_desc);
H5MM_xfree(del_str);
H5MM_xfree(test_desc);
@@ -7679,10 +7683,10 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_
TESTING("incremental object insertion and removal")
for(i = 0; i < 100; i++) {
- sprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i);
+ HDsprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i);
for(j = 0; j < i; j++) {
- sprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j);
+ HDsprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j);
if(H5HF_remove(fh, dxpl, heap_id[j]) < 0)
FAIL_STACK_ERROR
@@ -16367,21 +16371,40 @@ main(void)
fheap_test_param_t tparam; /* Testing parameters */
H5HF_create_t small_cparam; /* Creation parameters for "small" heap */
H5HF_create_t large_cparam; /* Creation parameters for "large" heap */
- hid_t fapl = -1; /* File access property list for data files */
- hid_t fcpl = -1; /* File creation property list for data files */
- hid_t fcpl2 = -1; /* File creation property list for data files */
+ hid_t fapl = -1, def_fapl = -1; /* File access property list for data files */
+ hid_t pb_fapl = -1; /* File access property list for data files */
+ hid_t fcpl = -1, def_fcpl = -1; /* File creation property list for data files */
fheap_test_type_t curr_test; /* Current test being worked on */
- unsigned u; /* Local index variable */
+ unsigned u, v; /* Local index variable */
unsigned nerrors = 0; /* Cumulative error count */
- int ExpressMode; /* Express testing level */
+ unsigned num_pb_fs = 1; /* The number of settings to test for page buffering and file space handling */
+ int ExpressMode; /* Express testing level */
/* Reset library */
h5_reset();
- fapl = h5_fileaccess();
+ def_fapl = h5_fileaccess();
ExpressMode = GetTestExpress();
+
+ /*
+ * Caution when turning on ExpressMode 0:
+ * It will activate testing with different combinations of
+ * page buffering and file space strategy and the
+ * running time will be long.
+ * For parallel build, the last two tests for page buffering
+ * are skipped because this feature is disabled in parallel.
+ * Activate full testing when this feature is re-enabled
+ * in the future for parallel build.
+ */
if(ExpressMode > 1)
- printf("***Express test mode on. Some tests may be skipped\n");
+ HDprintf("***Express test mode on. Some tests may be skipped\n");
+ else if(ExpressMode == 0) {
+#ifdef H5_HAVE_PARALLEL
+ num_pb_fs = NUM_PB_FS - 2;
+#else
+ num_pb_fs = NUM_PB_FS;
+#endif
+ }
/* Initialize heap creation parameters */
init_small_cparam(&small_cparam);
@@ -16392,359 +16415,409 @@ main(void)
shared_wobj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
shared_robj_g = (unsigned char *)H5MM_malloc(shared_obj_size_g);
- /* create a file creation property list */
- if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ /* Create a copy def_fapl and enable page buffering */
+ if((pb_fapl = H5Pcopy(def_fapl)) < 0)
+ TEST_ERROR
+ if(H5Pset_page_buffer_size(pb_fapl, PAGE_BUFFER_PAGE_SIZE, 0, 0) < 0)
TEST_ERROR
- if((fcpl2 = H5Pcopy(fcpl)) < 0) TEST_ERROR
- /* Set file space strategy and persisting free-space */
- /* This will be modified later on to run the test with different file space strategy setting */
- if(H5Pset_file_space_strategy(fcpl2, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)1) < 0)
+ /* Create a file creation property list */
+ if((def_fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
TEST_ERROR
/* Initialize the shared write buffer for objects */
for(u = 0; u < shared_obj_size_g; u++)
shared_wobj_g[u] = (unsigned char)u;
- /* Iterate over the testing parameters */
- for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) {
- /* Clear the testing parameters */
- HDmemset(&tparam, 0, sizeof(fheap_test_param_t));
- tparam.actual_id_len = HEAP_ID_LEN;
+ for(v = 0; v < num_pb_fs; v++) {
- /* This will be modified later on to run the test with different file space strategy setting */
- tparam.my_fcpl = fcpl2;
+ if((fcpl = H5Pcopy(def_fcpl)) < 0)
+ TEST_ERROR
- /* Set appropriate testing parameters for each test */
- switch(curr_test) {
- /* "Normal" testing parameters */
- case FHEAP_TEST_NORMAL:
- puts("Testing with normal parameters");
+ switch(v) {
+ case 0:
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, FALSE, (hsize_t)1) < 0)
+ TEST_ERROR
+ fapl = def_fapl;
break;
-
- /* "Re-open heap" testing parameters */
- case FHEAP_TEST_REOPEN:
- puts("Testing with reopen heap flag set");
- tparam.reopen_heap = FHEAP_TEST_REOPEN;
+ case 1:
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+ fapl = def_fapl;
+ break;
+ case 2:
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ TEST_ERROR
+ fapl = def_fapl;
+ break;
+ case 3:
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+ fapl = def_fapl;
+ break;
+ case 4:
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1) < 0)
+ TEST_ERROR
+ fapl = pb_fapl;
+ break;
+ case 5:
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1) < 0)
+ TEST_ERROR
+ fapl = pb_fapl;
break;
- /* An unknown test? */
- case FHEAP_TEST_NTESTS:
+ case NUM_PB_FS:
default:
goto error;
- } /* end switch */
-
- /* Test fractal heap creation */
- nerrors += test_create(fapl, &small_cparam, &tparam);
- nerrors += test_reopen(fapl, &small_cparam, &tparam);
- nerrors += test_open_twice(fapl, &small_cparam, &tparam);
- nerrors += test_delete_open(fapl, &small_cparam, &tparam);
+ }
- nerrors += test_id_limits(fapl, &small_cparam, tparam.my_fcpl);
- nerrors += test_filtered_create(fapl, &small_cparam, tparam.my_fcpl);
- nerrors += test_size(fapl, &small_cparam, tparam.my_fcpl);
- nerrors += test_reopen_hdr(fapl, &small_cparam, tparam.my_fcpl);
+ /* Iterate over the testing parameters */
+ for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) {
+ /* Clear the testing parameters */
+ HDmemset(&tparam, 0, sizeof(fheap_test_param_t));
+ tparam.actual_id_len = HEAP_ID_LEN;
- {
- fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */
-
- /* Filling with different sized objects */
- for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) {
- tparam.fill = fill;
+ /* Set to run with different file space setting */
+ tparam.my_fcpl = fcpl;
/* Set appropriate testing parameters for each test */
- switch(fill) {
- /* "Bulk fill" heap blocks with 'large' objects */
- case FHEAP_TEST_FILL_LARGE:
- puts("Bulk-filling blocks w/large objects");
+ switch(curr_test) {
+ /* "Normal" testing parameters */
+ case FHEAP_TEST_NORMAL:
+ HDputs("Testing with normal parameters");
break;
- /* "Bulk fill" heap blocks with 'single' objects */
- case FHEAP_TEST_FILL_SINGLE:
- puts("Bulk-filling blocks w/single object");
+ /* "Re-open heap" testing parameters */
+ case FHEAP_TEST_REOPEN:
+ HDputs("Testing with reopen heap flag set");
+ tparam.reopen_heap = FHEAP_TEST_REOPEN;
break;
/* An unknown test? */
- case FHEAP_TEST_FILL_N:
+ case FHEAP_TEST_NTESTS:
default:
goto error;
} /* end switch */
- /*
- * Test fractal heap managed object insertion
- */
+ /* Test fractal heap creation */
+ nerrors += test_create(fapl, &small_cparam, &tparam);
+ nerrors += test_reopen(fapl, &small_cparam, &tparam);
+ nerrors += test_open_twice(fapl, &small_cparam, &tparam);
+ nerrors += test_delete_open(fapl, &small_cparam, &tparam);
- /* "Weird" sized objects */
- nerrors += test_man_insert_weird(fapl, &small_cparam, &tparam);
+ nerrors += test_id_limits(fapl, &small_cparam, tparam.my_fcpl);
+ nerrors += test_filtered_create(fapl, &small_cparam, tparam.my_fcpl);
+ nerrors += test_size(fapl, &small_cparam, tparam.my_fcpl);
+ nerrors += test_reopen_hdr(fapl, &small_cparam, tparam.my_fcpl);
-#ifdef ALL_INSERT_TESTS
- /* "Standard" sized objects, building from simple to complex heaps */
- nerrors += test_man_insert_first(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_second(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_root_mult(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_force_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_fill_second(fapl, &small_cparam, &tparam);
- nerrors += test_man_insert_third_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_second_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_second_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_third_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_fourth_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_all_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_first_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_second_direct_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_second_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_second_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_recursive_indirect_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_2nd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_recursive_indirect_two_deep(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_recursive_indirect_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_all_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_start_4th_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_first_4th_recursive_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_4th_recursive_indirect_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_all_4th_recursive_indirect(fapl, &small_cparam, &tparam);
-#endif /* ALL_INSERT_TESTS */
- /* If this test fails, uncomment the tests above, which build up to this
- * level of complexity gradually. -QAK
- */
- if(ExpressMode > 1)
- printf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n");
- else
- nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam);
+ {
+ fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */
- /*
- * Test fractal heap object deletion
- */
- /* Simple removal */
- nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_one(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_two(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_one_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_REVERSE;
- nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
- tparam.del_dir = FHEAP_DEL_REVERSE;
- nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
-
- /* Incremental insert & removal */
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_man_incr_insert_remove(fapl, &small_cparam, &tparam);
+ /* Filling with different sized objects */
+ for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) {
+ tparam.fill = fill;
- {
- fheap_test_del_dir_t del_dir; /* Deletion direction */
- fheap_test_del_drain_t drain_half; /* Deletion draining */
+ /* Set appropriate testing parameters for each test */
+ switch(fill) {
+ /* "Bulk fill" heap blocks with 'large' objects */
+ case FHEAP_TEST_FILL_LARGE:
+ HDputs("Bulk-filling blocks w/large objects");
+ break;
- /* More complex removal patterns */
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
- tparam.del_dir = del_dir;
- for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) {
- tparam.drain_half = drain_half;
- /* Don't need to test deletion directions when deleting entire heap */
- if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL)
+ /* "Bulk fill" heap blocks with 'single' objects */
+ case FHEAP_TEST_FILL_SINGLE:
+ HDputs("Bulk-filling blocks w/single object");
break;
- /* Simple insertion patterns */
- nerrors += test_man_remove_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_two_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_first_row(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam);
- if(ExpressMode > 1)
- printf("***Express test mode on. Some tests skipped\n");
- else {
- nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam);
- nerrors += test_man_remove_3rd_indirect(fapl, &small_cparam, &tparam);
- } /* end else */
-
- /* Skip blocks insertion */
- /* (covers insertion & deletion of skipped blocks) */
- nerrors += test_man_skip_start_block(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_start_block_add_back(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_2nd_block(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_one_partial_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_row_skip_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_skip_direct_skip_indirect_two_rows_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_indirect_two_rows_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- if(ExpressMode > 1)
- printf("***Express test mode on. Some tests skipped\n");
- else {
- nerrors += test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- nerrors += test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
- } /* end else */
-
- /* Fragmented insertion patterns */
- /* (covers insertion & deletion of fragmented blocks) */
- nerrors += test_man_frag_simple(fapl, &small_cparam, &tparam);
- nerrors += test_man_frag_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_frag_2nd_direct(fapl, &small_cparam, &tparam);
- nerrors += test_man_frag_3rd_direct(fapl, &small_cparam, &tparam);
+ /* An unknown test? */
+ case FHEAP_TEST_FILL_N:
+ default:
+ goto error;
+ } /* end switch */
+
+ /*
+ * Test fractal heap managed object insertion
+ */
+
+ /* "Weird" sized objects */
+ nerrors += test_man_insert_weird(fapl, &small_cparam, &tparam);
+
+#ifdef ALL_INSERT_TESTS
+ /* "Standard" sized objects, building from simple to complex heaps */
+ nerrors += test_man_insert_first(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_second(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_root_mult(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_force_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_fill_second(fapl, &small_cparam, &tparam);
+ nerrors += test_man_insert_third_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_second_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_second_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_third_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_fourth_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_all_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_first_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_second_direct_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_second_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_second_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_recursive_indirect_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_2nd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_recursive_indirect_two_deep(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_3rd_recursive_indirect_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_all_3rd_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_start_4th_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_first_4th_recursive_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_4th_recursive_indirect_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_all_4th_recursive_indirect(fapl, &small_cparam, &tparam);
+#endif /* ALL_INSERT_TESTS */
+ /* If this test fails, uncomment the tests above, which build up to this
+ * level of complexity gradually. -QAK
+ */
+ if(ExpressMode > 1)
+ HDprintf("***Express test mode on. test_man_start_5th_recursive_indirect is skipped\n");
+ else
+ nerrors += test_man_start_5th_recursive_indirect(fapl, &small_cparam, &tparam);
+
+ /*
+ * Test fractal heap object deletion
+ */
+ /* Simple removal */
+ nerrors += test_man_remove_bogus(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_one(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_two(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_one_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_REVERSE;
+ nerrors += test_man_remove_two_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
+ tparam.del_dir = FHEAP_DEL_REVERSE;
+ nerrors += test_man_remove_three_larger(fapl, &small_cparam, &tparam);
+
+ /* Incremental insert & removal */
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_man_incr_insert_remove(fapl, &small_cparam, &tparam);
+
+ {
+ fheap_test_del_dir_t del_dir; /* Deletion direction */
+ fheap_test_del_drain_t drain_half; /* Deletion draining */
+
+ /* More complex removal patterns */
+ for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
+ tparam.del_dir = del_dir;
+ for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) {
+ tparam.drain_half = drain_half;
+ /* Don't need to test deletion directions when deleting entire heap */
+ if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL)
+ break;
+
+ /* Simple insertion patterns */
+ nerrors += test_man_remove_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_two_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_first_row(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_first_two_rows(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_first_four_rows(fapl, &small_cparam, &tparam);
+ if(ExpressMode > 1)
+ HDprintf("***Express test mode on. Some tests skipped\n");
+ else {
+ nerrors += test_man_remove_all_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_2nd_indirect(fapl, &small_cparam, &tparam);
+ nerrors += test_man_remove_3rd_indirect(fapl, &small_cparam, &tparam);
+ } /* end else */
+
+ /* Skip blocks insertion */
+ /* (covers insertion & deletion of skipped blocks) */
+ nerrors += test_man_skip_start_block(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_start_block_add_back(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_2nd_block(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_one_partial_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_row_skip_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_skip_direct_skip_indirect_two_rows_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_indirect_two_rows_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ if(ExpressMode > 1)
+ HDprintf("***Express test mode on. Some tests skipped\n");
+ else {
+ nerrors += test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ nerrors += test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(fapl, &small_cparam, &tparam);
+ } /* end else */
+
+ /* Fragmented insertion patterns */
+ /* (covers insertion & deletion of fragmented blocks) */
+ nerrors += test_man_frag_simple(fapl, &small_cparam, &tparam);
+ nerrors += test_man_frag_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_frag_2nd_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_man_frag_3rd_direct(fapl, &small_cparam, &tparam);
+ } /* end for */
} /* end for */
- } /* end for */
- /* Reset deletion drain parameter */
- tparam.drain_half = FHEAP_DEL_DRAIN_ALL;
+ /* Reset deletion drain parameter */
+ tparam.drain_half = FHEAP_DEL_DRAIN_ALL;
- } /* end block */
+ } /* end block */
} /* end for */
- } /* end block */
+ } /* end block */
- /*
- * Test fractal heap 'huge' & 'tiny' object insertion & deletion
- */
- {
- fheap_test_del_dir_t del_dir; /* Deletion direction */
- unsigned id_len; /* Length of heap IDs */
-
- /* Test "normal" & "direct" storage of 'huge' & 'tiny' heap IDs */
- for(id_len = 0; id_len < 3; id_len++) {
- /* Set the ID length for this test */
- small_cparam.id_len = (uint16_t)id_len;
-
- /* Print information about each test */
- switch(id_len) {
- /* Use "normal" form for 'huge' object's heap IDs */
- case 0:
- puts("Using 'normal' heap ID format for 'huge' objects");
- break;
+ /*
+ * Test fractal heap 'huge' & 'tiny' object insertion & deletion
+ */
+ {
+ fheap_test_del_dir_t del_dir; /* Deletion direction */
+ unsigned id_len; /* Length of heap IDs */
+
+ /* Test "normal" & "direct" storage of 'huge' & 'tiny' heap IDs */
+ for(id_len = 0; id_len < 3; id_len++) {
+ /* Set the ID length for this test */
+ small_cparam.id_len = (uint16_t)id_len;
+
+ /* Print information about each test */
+ switch(id_len) {
+ /* Use "normal" form for 'huge' object's heap IDs */
+ case 0:
+ HDputs("Using 'normal' heap ID format for 'huge' objects");
+ break;
- /* Use "direct" form for 'huge' object's heap IDs */
- case 1:
- puts("Using 'direct' heap ID format for 'huge' objects");
+ /* Use "direct" form for 'huge' object's heap IDs */
+ case 1:
+ HDputs("Using 'direct' heap ID format for 'huge' objects");
- /* Adjust actual length of heap IDs for directly storing 'huge' object's file offset & length in heap ID */
- tparam.actual_id_len = 17; /* 1 + 8 (file address size) + 8 (file length size) */
- break;
+ /* Adjust actual length of heap IDs for directly storing 'huge' object's file offset & length in heap ID */
+ tparam.actual_id_len = 17; /* 1 + 8 (file address size) + 8 (file length size) */
+ break;
- /* Use "direct" storage for 'huge' objects and larger IDs for 'tiny' objects */
- case 2:
- small_cparam.id_len = 37;
- puts("Using 'direct' heap ID format for 'huge' objects and larger IDs for 'tiny' objects");
- tparam.actual_id_len = 37;
- break;
+ /* Use "direct" storage for 'huge' objects and larger IDs for 'tiny' objects */
+ case 2:
+ small_cparam.id_len = 37;
+ HDputs("Using 'direct' heap ID format for 'huge' objects and larger IDs for 'tiny' objects");
+ tparam.actual_id_len = 37;
+ break;
- /* An unknown test? */
- default:
- goto error;
- } /* end switch */
+ /* An unknown test? */
+ default:
+ goto error;
+ } /* end switch */
+
+ /* Try several different methods of deleting objects */
+ for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
+ tparam.del_dir = del_dir;
+
+ /* Test 'huge' object insert & delete */
+ nerrors += test_huge_insert_one(fapl, &small_cparam, &tparam);
+ nerrors += test_huge_insert_two(fapl, &small_cparam, &tparam);
+ nerrors += test_huge_insert_three(fapl, &small_cparam, &tparam);
+ nerrors += test_huge_insert_mix(fapl, &small_cparam, &tparam);
+ nerrors += test_filtered_huge(fapl, &small_cparam, &tparam);
+
+ /* Test 'tiny' object insert & delete */
+ nerrors += test_tiny_insert_one(fapl, &small_cparam, &tparam);
+ nerrors += test_tiny_insert_two(fapl, &small_cparam, &tparam);
+ nerrors += test_tiny_insert_mix(fapl, &small_cparam, &tparam);
+ } /* end for */
+ } /* end for */
+
+ /* Reset the "normal" heap ID lengths */
+ small_cparam.id_len = 0;
+ tparam.actual_id_len = HEAP_ID_LEN;
+ } /* end block */
+
+ /* Test I/O filter support */
/* Try several different methods of deleting objects */
+ {
+ fheap_test_del_dir_t del_dir; /* Deletion direction */
+
for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
tparam.del_dir = del_dir;
- /* Test 'huge' object insert & delete */
- nerrors += test_huge_insert_one(fapl, &small_cparam, &tparam);
- nerrors += test_huge_insert_two(fapl, &small_cparam, &tparam);
- nerrors += test_huge_insert_three(fapl, &small_cparam, &tparam);
- nerrors += test_huge_insert_mix(fapl, &small_cparam, &tparam);
- nerrors += test_filtered_huge(fapl, &small_cparam, &tparam);
-
- /* Test 'tiny' object insert & delete */
- nerrors += test_tiny_insert_one(fapl, &small_cparam, &tparam);
- nerrors += test_tiny_insert_two(fapl, &small_cparam, &tparam);
- nerrors += test_tiny_insert_mix(fapl, &small_cparam, &tparam);
+ /* Controlled tests */
+ /* XXX: Re-enable file size checks in these tests, after the file has persistent free space tracking working */
+ nerrors += test_filtered_man_root_direct(fapl, &small_cparam, &tparam);
+ nerrors += test_filtered_man_root_indirect(fapl, &small_cparam, &tparam);
+
+ /* Random tests, with compressed blocks */
+ tparam.comp = FHEAP_TEST_COMPRESS;
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50*1000*1000) : (hsize_t)(25*1000*1000)), fapl, &small_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50*1000*1000) : (hsize_t)(2*1000*1000)), fapl, &small_cparam, &tparam);
+
+ /* Reset block compression */
+ tparam.comp = FHEAP_TEST_NO_COMPRESS;
} /* end for */
- } /* end for */
+ } /* end block */
+
+ /* Random object insertion & deletion */
+ if(ExpressMode > 1)
+ HDprintf("***Express test mode on. Some tests skipped\n");
+ else {
+ /* Random tests using "small" heap creation parameters */
+ HDputs("Using 'small' heap creation parameters");
+
+ /* (reduce size of tests when re-opening each time) */
+ /* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam);
+
+ tparam.del_dir = FHEAP_DEL_HEAP;
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam);
- /* Reset the "normal" heap ID lengths */
- small_cparam.id_len = 0;
- tparam.actual_id_len = HEAP_ID_LEN;
- } /* end block */
+ /* Random tests using "large" heap creation parameters */
+ HDputs("Using 'large' heap creation parameters");
+ tparam.actual_id_len = LARGE_HEAP_ID_LEN;
- /* Test I/O filter support */
+ /* (reduce size of tests when re-opening each time) */
+ /* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */
+ tparam.del_dir = FHEAP_DEL_FORWARD;
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam);
- /* Try several different methods of deleting objects */
- {
- fheap_test_del_dir_t del_dir; /* Deletion direction */
+ tparam.del_dir = FHEAP_DEL_HEAP;
+ nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam);
+ nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam);
- for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) {
- tparam.del_dir = del_dir;
+ /* Reset the "normal" heap ID length */
+ tparam.actual_id_len = SMALL_HEAP_ID_LEN;
+ } /* end else */
- /* Controlled tests */
-/* XXX: Re-enable file size checks in these tests, after the file has persistent free space tracking working */
- nerrors += test_filtered_man_root_direct(fapl, &small_cparam, &tparam);
- nerrors += test_filtered_man_root_indirect(fapl, &small_cparam, &tparam);
+ /* Test object writing support */
- /* Random tests, with compressed blocks */
+ /* Basic object writing */
+ nerrors += test_write(fapl, &small_cparam, &tparam);
+
+ /* Writing objects in heap with filters */
tparam.comp = FHEAP_TEST_COMPRESS;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50*1000*1000) : (hsize_t)(25*1000*1000)), fapl, &small_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(50*1000*1000) : (hsize_t)(2*1000*1000)), fapl, &small_cparam, &tparam);
+ nerrors += test_write(fapl, &small_cparam, &tparam);
/* Reset block compression */
tparam.comp = FHEAP_TEST_NO_COMPRESS;
} /* end for */
- } /* end block */
-
- /* Random object insertion & deletion */
- if(ExpressMode > 1)
- printf("***Express test mode on. Some tests skipped\n");
- else {
- /* Random tests using "small" heap creation parameters */
- puts("Using 'small' heap creation parameters");
-
- /* (reduce size of tests when re-opening each time) */
-/* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam);
-
- tparam.del_dir = FHEAP_DEL_HEAP;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &small_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &small_cparam, &tparam);
-
- /* Random tests using "large" heap creation parameters */
- puts("Using 'large' heap creation parameters");
- tparam.actual_id_len = LARGE_HEAP_ID_LEN;
-
- /* (reduce size of tests when re-opening each time) */
-/* XXX: Try to speed things up enough that these tests don't have to be reduced when re-opening */
- tparam.del_dir = FHEAP_DEL_FORWARD;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam);
-
- tparam.del_dir = FHEAP_DEL_HEAP;
- nerrors += test_random((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(50*1000*1000)), fapl, &large_cparam, &tparam);
- nerrors += test_random_pow2((curr_test == FHEAP_TEST_NORMAL ? (hsize_t)(100*1000*1000) : (hsize_t)(4*1000*1000)), fapl, &large_cparam, &tparam);
-
- /* Reset the "normal" heap ID length */
- tparam.actual_id_len = SMALL_HEAP_ID_LEN;
- } /* end else */
-
- /* Test object writing support */
- /* Basic object writing */
- nerrors += test_write(fapl, &small_cparam, &tparam);
-
- /* Writing objects in heap with filters */
- tparam.comp = FHEAP_TEST_COMPRESS;
- nerrors += test_write(fapl, &small_cparam, &tparam);
+ if(H5Pclose(fcpl) < 0)
+ TEST_ERROR
+ } /* end num_pb_fs */
- /* Reset block compression */
- tparam.comp = FHEAP_TEST_NO_COMPRESS;
- } /* end for */
+ /* Tests that address specific bugs */
+ tparam.my_fcpl = def_fcpl;
+ fapl = def_fapl;
/* Tests that address specific bugs */
nerrors += test_bug1(fapl, &small_cparam, &tparam);
@@ -16754,7 +16827,7 @@ main(void)
if(nerrors)
goto error;
- puts("All fractal heap tests passed.");
+ HDputs("All fractal heap tests passed.");
/* Release space for the shared objects */
H5MM_xfree(shared_wobj_g);
@@ -16763,12 +16836,12 @@ main(void)
H5MM_xfree(shared_lens_g);
H5MM_xfree(shared_offs_g);
- if(H5Pclose(fcpl) < 0) TEST_ERROR
- if(H5Pclose(fcpl2) < 0) TEST_ERROR
+ if(H5Pclose(def_fcpl) < 0) TEST_ERROR
+ if(H5Pclose(pb_fapl) < 0) TEST_ERROR
/* Clean up file used */
#ifndef QAK
- h5_cleanup(FILENAME, fapl);
+ h5_cleanup(FILENAME, def_fapl);
#else /* QAK */
HDfprintf(stderr, "Uncomment cleanup!\n");
#endif /* QAK */
@@ -16776,14 +16849,17 @@ HDfprintf(stderr, "Uncomment cleanup!\n");
return 0;
error:
- puts("*** TESTS FAILED ***");
+ HDputs("*** TESTS FAILED ***");
H5E_BEGIN_TRY {
H5MM_xfree(shared_wobj_g);
H5MM_xfree(shared_robj_g);
H5MM_xfree(shared_ids_g);
H5MM_xfree(shared_lens_g);
H5MM_xfree(shared_offs_g);
- H5Pclose(fapl);
+ H5Pclose(def_fapl);
+ H5Pclose(pb_fapl);
+ H5Pclose(def_fcpl);
+ H5Pclose(fcpl);
} H5E_END_TRY;
return 1;
} /* end main() */
diff --git a/test/page_buffer.c b/test/page_buffer.c
index b94ad03..54a25d6 100644
--- a/test/page_buffer.c
+++ b/test/page_buffer.c
@@ -52,6 +52,10 @@ static unsigned test_raw_data_handling(hid_t orig_fapl, const char *env_h5_drvr)
static unsigned test_lru_processing(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_min_threshold(hid_t orig_fapl, const char *env_h5_drvr);
static unsigned test_stats_collection(hid_t orig_fapl, const char *env_h5_drvr);
+#ifdef H5_HAVE_PARALLEL
+static unsigned verify_page_buffering_disabled(hid_t orig_fapl,
+ const char *env_h5_drvr);
+#endif /* H5_HAVE_PARALLEL */
const char *FILENAME[] = {
"filepaged",
@@ -2007,6 +2011,121 @@ error:
/*-------------------------------------------------------------------------
+ * Function: verify_page_buffering_disabled()
+ *
+ * Purpose: This function should only be called in parallel
+ * builds.
+ *
+ * At present, page buffering should be disabled in parallel
+ * builds. Verify this.
+ *
+ * Return: 0 if test is sucessful
+ * 1 if test fails
+ *
+ * Programmer: John Mainzer
+ * 03/21/17
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#ifdef H5_HAVE_PARALLEL
+static unsigned
+verify_page_buffering_disabled(hid_t orig_fapl, const char *env_h5_drvr)
+{
+ char filename[FILENAME_LEN]; /* Filename to use */
+ hid_t file_id = -1; /* File ID */
+ hid_t fcpl = -1;
+ hid_t fapl = -1;
+
+ TESTING("Page Buffering Disabled");
+ h5_fixname(FILENAME[0], orig_fapl, filename, sizeof(filename));
+
+
+ /* first, try to create a file with page buffering enabled */
+
+ if((fapl = H5Pcopy(orig_fapl)) < 0)
+ TEST_ERROR
+
+ if(set_multi_split(env_h5_drvr, fapl, 4096) != 0)
+ TEST_ERROR;
+
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 4096) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_page_buffer_size(fapl, 4096*8, 0, 0) < 0)
+ FAIL_STACK_ERROR;
+
+ /* try to create the file -- should fail */
+ H5E_BEGIN_TRY {
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl);
+ } H5E_END_TRY;
+
+ if(file_id >= 0)
+ TEST_ERROR;
+
+ /* now, create a file, close it, and then try to open it with page
+ * buffering enabled.
+ */
+ if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, 0, (hsize_t)1) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pset_file_space_page_size(fcpl, 4096) < 0)
+ FAIL_STACK_ERROR;
+
+ /* create the file */
+ if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR;
+
+ /* close the file */
+ if(H5Fclose(file_id) < 0)
+ FAIL_STACK_ERROR;
+
+ /* try to open the file using the fapl prepared above which enables
+ * page buffering. Should fail.
+ */
+ H5E_BEGIN_TRY {
+ file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl);
+ } H5E_END_TRY;
+
+ if(file_id >= 0)
+ TEST_ERROR;
+
+ if(H5Pclose(fcpl) < 0)
+ FAIL_STACK_ERROR;
+
+ if(H5Pclose(fapl) < 0)
+ FAIL_STACK_ERROR;
+
+ PASSED()
+
+ return 0;
+
+error:
+
+ H5E_BEGIN_TRY {
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+
+ return 1;
+
+} /* verify_page_buffering_disabled() */
+#endif /* H5_HAVE_PARALLEL */
+
+
+/*-------------------------------------------------------------------------
* Function: main()
*
* Purpose: Main function for the page buffer tests.
@@ -2026,8 +2145,6 @@ main(void)
unsigned nerrors = 0; /* Cumulative error count */
const char *env_h5_drvr = NULL; /* File Driver value from environment */
-#ifndef H5_HAVE_PARALLEL
-
h5_reset();
/* Get the VFD to use */
@@ -2052,12 +2169,21 @@ main(void)
PUTS_ERROR("Can't get VFD-dependent fapl")
} /* end if */
+#ifdef H5_HAVE_PARALLEL
+
+ HDputs("Page Buffering is disabled for parallel.");
+ nerrors += verify_page_buffering_disabled(fapl, env_h5_drvr);
+
+#else /* H5_HAVE_PARALLEL */
+
nerrors += test_args(fapl, env_h5_drvr);
nerrors += test_raw_data_handling(fapl, env_h5_drvr);
nerrors += test_lru_processing(fapl, env_h5_drvr);
nerrors += test_min_threshold(fapl, env_h5_drvr);
nerrors += test_stats_collection(fapl, env_h5_drvr);
+#endif /* H5_HAVE_PARALLEL */
+
h5_clean_files(FILENAME, fapl);
if(nerrors)
@@ -2065,11 +2191,6 @@ main(void)
HDputs("All Page Buffering tests passed.");
-#else
- SKIPPED()
- HDputs("Page Buffering is disabled for parallel.");
-#endif
-
HDexit(EXIT_SUCCESS);
error:
diff --git a/test/plugin.c b/test/plugin.c
index 1d55a5d..2939595 100644
--- a/test/plugin.c
+++ b/test/plugin.c
@@ -22,8 +22,10 @@
#include "H5srcdir.h"
/*
- * This file needs to access private datatypes from the H5Z package.
+ * This file needs to access private datatypes from the H5Z and H5PL package.
*/
+#define H5PL_FRIEND
+#include "H5PLpkg.h"
#define H5Z_FRIEND
#include "H5Zpkg.h"
@@ -42,8 +44,8 @@ const char *FILENAME[] = {
/* Dataset names for testing filters */
#define DSET_DEFLATE_NAME "deflate"
#define DSET_DYNLIB1_NAME "dynlib1"
-#define DSET_DYNLIB2_NAME "dynlib2"
-#define DSET_DYNLIB4_NAME "dynlib4"
+#define DSET_DYNLIB2_NAME "dynlib2"
+#define DSET_DYNLIB4_NAME "dynlib4"
/* Parameters for internal filter test */
#define FILTER_CHUNK_DIM1 2
@@ -63,39 +65,36 @@ const char *FILENAME[] = {
#define GROUP_ITERATION 1000
int points_deflate[DSET_DIM1][DSET_DIM2],
- points_dynlib1[DSET_DIM1][DSET_DIM2],
- points_dynlib2[DSET_DIM1][DSET_DIM2],
- points_dynlib4[DSET_DIM1][DSET_DIM2],
- points_bzip2[DSET_DIM1][DSET_DIM2];
+ points_dynlib1[DSET_DIM1][DSET_DIM2],
+ points_dynlib2[DSET_DIM1][DSET_DIM2],
+ points_dynlib4[DSET_DIM1][DSET_DIM2],
+ points_bzip2[DSET_DIM1][DSET_DIM2];
/*-------------------------------------------------------------------------
- * Function: test_filter_internal
+ * Function: test_filter_internal
*
- * Purpose: Tests writing entire data and partial data with filters
+ * Purpose: Tests writing entire data and partial data with filters
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * 27 February 2013
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
{
- hid_t dataset; /* Dataset ID */
- hid_t dxpl; /* Dataset xfer property list ID */
- hid_t write_dxpl; /* Dataset xfer property list ID for writing */
- hid_t sid; /* Dataspace ID */
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ herr_t ret_value = -1;
+ hid_t dataset = -1; /* Dataset ID */
+ hid_t dxpl = -1; /* Dataset xfer property list ID */
+ hid_t write_dxpl = -1; /* Dataset xfer property list ID for writing */
+ hid_t sid = -1; /* Dataspace ID */
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
const hsize_t hs_offset[2] = {FILTER_HS_OFFSET1, FILTER_HS_OFFSET2}; /* Hyperslab offset */
- const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
+ const hsize_t hs_size[2] = {FILTER_HS_SIZE1, FILTER_HS_SIZE2}; /* Hyperslab size */
void *tconv_buf = NULL; /* Temporary conversion buffer */
- int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
- size_t i, j; /* Local index variables */
- int n = 0;
+ int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2];
+ size_t i, j; /* Local index variables */
+ int n = 0;
/* Create the data space */
if((sid = H5Screate_simple(2, size, NULL)) < 0) TEST_ERROR
@@ -112,15 +111,14 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
TESTING(" filters (setup)");
/* Check if all the filters are available */
- if(H5Pall_filters_avail(dcpl)!=TRUE) {
+ if(H5Pall_filters_avail(dcpl) != TRUE) {
H5_FAILED();
- printf(" Line %d: Incorrect filter availability\n",__LINE__);
+ HDprintf(" Line %d: Incorrect filter availability\n", __LINE__);
TEST_ERROR
} /* end if */
/* Create the dataset */
- if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT,
- dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dataset = H5Dcreate2(fid, name, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) TEST_ERROR
PASSED();
@@ -130,20 +128,16 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
*/
TESTING(" filters (uninitialized read)");
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
- for(i=0; i<(size_t)size[0]; i++) {
- for(j=0; j<(size_t)size[1]; j++) {
- if(0!=check[i][j]) {
- H5_FAILED();
- printf(" Read a non-zero value.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- TEST_ERROR
- }
- }
- }
+ for(i=0; i<(size_t)size[0]; i++)
+ for(j=0; j<(size_t)size[1]; j++)
+ if(0 != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Read a non-zero value.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ TEST_ERROR
+ } /* end if */
PASSED();
/*----------------------------------------------------------------------
@@ -154,14 +148,11 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
TESTING(" filters (write)");
n = 0;
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- points[i][j] = (int)(n++);
- }
- }
+ for(i=0; i<size[0]; i++)
+ for(j=0; j<size[1]; j++)
+ points[i][j] = (int)(n++);
- if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) TEST_ERROR;
PASSED();
@@ -172,22 +163,19 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
TESTING(" filters (read)");
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
- /* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- fprintf(stderr," At original: %d\n", (int)points[i][j]);
- fprintf(stderr," At returned: %d\n", (int)check[i][j]);
- TEST_ERROR
- }
- }
- }
+ /* Check that the values read are the same as the values written */
+ for(i=0; i<size[0]; i++)
+ for(j=0; j<size[1]; j++)
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ HDfprintf(stderr," Read different values than written.\n");
+ HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDfprintf(stderr," At original: %d\n", (int)points[i][j]);
+ HDfprintf(stderr," At returned: %d\n", (int)check[i][j]);
+ TEST_ERROR
+ } /* end if */
PASSED();
@@ -200,30 +188,24 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
*/
TESTING(" filters (modify)");
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]/2; j++) {
- points[i][j] = (int)HDrandom () % RANDOM_LIMIT;
- }
- }
- if(H5Dwrite (dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0)
- TEST_ERROR;
+ for(i=0; i<size[0]; i++)
+ for(j=0; j<size[1]/2; j++)
+ points[i][j] = (int)HDrandom () % RANDOM_LIMIT;
- /* Read the dataset back and check it */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, write_dxpl, points) < 0) TEST_ERROR;
- /* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- TEST_ERROR
- }
- }
- }
+ /* Read the dataset back and check it */
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
+
+ /* Check that the values read are the same as the values written */
+ for(i=0; i<size[0]; i++)
+ for(j=0; j<size[1]; j++)
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ TEST_ERROR
+ } /* end if */
PASSED();
@@ -238,19 +220,17 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
if(H5Dclose(dataset) < 0) TEST_ERROR;
if((dataset = H5Dopen2(fid, name, H5P_DEFAULT)) < 0) TEST_ERROR;
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0)
- TEST_ERROR;
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, check) < 0) TEST_ERROR;
- /* Check that the values read are the same as the values written */
- for(i = 0; i < size[0]; i++)
- for(j = 0; j < size[1]; j++)
- if(points[i][j] != check[i][j]) {
- H5_FAILED();
- printf(" Read different values than written.\n");
- printf(" At index %lu,%lu\n",
- (unsigned long)i, (unsigned long)j);
- TEST_ERROR
- } /* end if */
+ /* Check that the values read are the same as the values written */
+ for(i = 0; i < size[0]; i++)
+ for(j = 0; j < size[1]; j++)
+ if(points[i][j] != check[i][j]) {
+ H5_FAILED();
+ HDprintf(" Read different values than written.\n");
+ HDprintf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ TEST_ERROR
+ } /* end if */
PASSED();
@@ -262,124 +242,107 @@ test_filter_internal(hid_t fid, const char *name, hid_t dcpl)
*/
TESTING(" filters (partial I/O)");
- for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom() % RANDOM_LIMIT;
- }
- }
- if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size,
- NULL) < 0) TEST_ERROR;
+ for(i=0; i<(size_t)hs_size[0]; i++)
+ for(j=0; j<(size_t)hs_size[1]; j++)
+ points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] = (int)HDrandom() % RANDOM_LIMIT;
+
+ if(H5Sselect_hyperslab(sid, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0) TEST_ERROR;
/* (Use the "read" DXPL because partial I/O on corrupted data test needs to ignore errors during writing) */
- if(H5Dwrite (dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0)
- TEST_ERROR;
+ if(H5Dwrite(dataset, H5T_NATIVE_INT, sid, sid, dxpl, points) < 0) TEST_ERROR;
- if(H5Dread (dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0)
- TEST_ERROR;
+ if(H5Dread(dataset, H5T_NATIVE_INT, sid, sid, dxpl, check) < 0) TEST_ERROR;
- /* Check that the values read are the same as the values written */
- for(i=0; i<(size_t)hs_size[0]; i++) {
- for(j=0; j<(size_t)hs_size[1]; j++) {
- if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] !=
- check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n",
- (unsigned long)((size_t)hs_offset[0]+i),
- (unsigned long)((size_t)hs_offset[1]+j));
- fprintf(stderr," At original: %d\n",
- (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- fprintf(stderr," At returned: %d\n",
- (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
- TEST_ERROR
- }
- }
- }
+ /* Check that the values read are the same as the values written */
+ for(i=0; i<(size_t)hs_size[0]; i++)
+ for(j=0; j<(size_t)hs_size[1]; j++)
+ if(points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j] != check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]) {
+ H5_FAILED();
+ HDfprintf(stderr," Read different values than written.\n");
+ HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)((size_t)hs_offset[0]+i), (unsigned long)((size_t)hs_offset[1]+j));
+ HDfprintf(stderr," At original: %d\n", (int)points[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
+ HDfprintf(stderr," At returned: %d\n", (int)check[(size_t)hs_offset[0]+i][(size_t)hs_offset[1]+j]);
+ TEST_ERROR
+ } /* end if */
PASSED();
/* Save the data written to the file for later comparison when the file
* is reopened for read test */
- for(i=0; i<size[0]; i++) {
- for(j=0; j<size[1]; j++) {
- if(!HDstrcmp(name, DSET_DEFLATE_NAME)) {
- points_deflate[i][j] = points[i][j];
- } else if(!HDstrcmp(name, DSET_DYNLIB1_NAME)) {
- points_dynlib1[i][j] = points[i][j];
- } else if(!HDstrcmp(name, DSET_DYNLIB2_NAME)) {
- points_dynlib2[i][j] = points[i][j];
- } else if(!HDstrcmp(name, DSET_DYNLIB4_NAME)) {
- points_dynlib4[i][j] = points[i][j];
- }
- }
- }
+ for(i=0; i<size[0]; i++)
+ for(j=0; j<size[1]; j++)
+ if(!HDstrcmp(name, DSET_DEFLATE_NAME))
+ points_deflate[i][j] = points[i][j];
+ else if(!HDstrcmp(name, DSET_DYNLIB1_NAME))
+ points_dynlib1[i][j] = points[i][j];
+ else if(!HDstrcmp(name, DSET_DYNLIB2_NAME))
+ points_dynlib2[i][j] = points[i][j];
+ else if(!HDstrcmp(name, DSET_DYNLIB4_NAME))
+ points_dynlib4[i][j] = points[i][j];
+
+ ret_value = 0;
+error:
/* Clean up objects used for this test */
- if(H5Dclose (dataset) < 0) TEST_ERROR
- if(H5Sclose (sid) < 0) TEST_ERROR
- if(H5Pclose (dxpl) < 0) TEST_ERROR
- free (tconv_buf);
-
- return(0);
+ H5E_BEGIN_TRY {
+ H5Dclose(dataset);
+ H5Sclose(sid);
+ H5Pclose(dxpl);
+ } H5E_END_TRY
-error:
if(tconv_buf)
- free (tconv_buf);
- return -1;
+ HDfree(tconv_buf);
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_filters_for_datasets
+ * Function: test_filters_for_datasets
*
- * Purpose: Tests creating datasets and writing data with dynamically
- * loaded filters
+ * Purpose: Tests creating datasets and writing data with dynamically loaded filters
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * 14 March 2013
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_filters_for_datasets(hid_t file)
{
- hid_t dc; /* Dataset creation property list ID */
- const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
- unsigned int compress_level = 9;
- unsigned int dynlib4_values[4];
+ herr_t ret_value = -1;
+ hid_t dc = -1; /* Dataset creation property list ID */
+ const hsize_t chunk_size[2] = {FILTER_CHUNK_DIM1, FILTER_CHUNK_DIM2}; /* Chunk dimensions */
+ unsigned int compress_level = 9;
+ unsigned int dynlib4_values[4];
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
*----------------------------------------------------------
*/
- puts("Testing deflate filter");
+ HDputs("Testing deflate filter");
#ifdef H5_HAVE_FILTER_DEFLATE
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
- if(H5Pset_deflate (dc, 6) < 0) TEST_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_deflate(dc, 6) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DEFLATE_NAME,dc) < 0) TEST_ERROR
+ if(test_filter_internal(file, DSET_DEFLATE_NAME, dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) TEST_ERROR
+ if(H5Pclose(dc) < 0) TEST_ERROR
#else /* H5_HAVE_FILTER_DEFLATE */
SKIPPED();
- puts(" Deflate filter not enabled");
+ HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
/*----------------------------------------------------------
* STEP 2: Test DYNLIB1 by itself.
*----------------------------------------------------------
*/
- puts(" DYNLIB1 filter");
+ HDputs(" DYNLIB1 filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
- if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB1, H5Z_FLAG_MANDATORY, (size_t)1, &compress_level) < 0) TEST_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_filter(dc, H5Z_FILTER_DYNLIB1, H5Z_FLAG_MANDATORY, (size_t)1, &compress_level) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DYNLIB1_NAME,dc) < 0) TEST_ERROR
+ if(test_filter_internal(file, DSET_DYNLIB1_NAME, dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) TEST_ERROR
+ if(H5Pclose(dc) < 0) TEST_ERROR
/* Unregister the dynamic filter DYNLIB1 for testing purpose. The next time when this test is run for
* the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
@@ -390,15 +353,15 @@ test_filters_for_datasets(hid_t file)
* STEP 3: Test DYNLIB2 by itself.
*----------------------------------------------------------
*/
- puts(" DYNLIB2 filter");
+ HDputs(" DYNLIB2 filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
- if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL) < 0) TEST_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_filter(dc, H5Z_FILTER_DYNLIB2, H5Z_FLAG_MANDATORY, 0, NULL) < 0) TEST_ERROR
if(test_filter_internal(file,DSET_DYNLIB2_NAME,dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) TEST_ERROR
+ if(H5Pclose(dc) < 0) TEST_ERROR
/* Unregister the dynamic filter DYNLIB2 for testing purpose. The next time when this test is run for
* the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
@@ -409,93 +372,90 @@ test_filters_for_datasets(hid_t file)
* STEP 4: Test DYNLIB4 by itself.
*----------------------------------------------------------
*/
- puts(" DYNLIB4 filter");
+ HDputs(" DYNLIB4 filter");
if((dc = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
- if(H5Pset_chunk (dc, 2, chunk_size) < 0) TEST_ERROR
+ if(H5Pset_chunk(dc, 2, chunk_size) < 0) TEST_ERROR
dynlib4_values[0] = 9;
if(H5get_libversion(&dynlib4_values[1], &dynlib4_values[2], &dynlib4_values[3]) < 0) TEST_ERROR
- if(H5Pset_filter (dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) TEST_ERROR
+ if(H5Pset_filter(dc, H5Z_FILTER_DYNLIB4, H5Z_FLAG_MANDATORY, (size_t)4, dynlib4_values) < 0) TEST_ERROR
- if(test_filter_internal(file,DSET_DYNLIB4_NAME,dc) < 0) TEST_ERROR
+ if(test_filter_internal(file, DSET_DYNLIB4_NAME, dc) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (dc) < 0) TEST_ERROR
+ if(H5Pclose(dc) < 0) TEST_ERROR
/* Unregister the dynamic filter DYNLIB4 for testing purpose. The next time when this test is run for
* the new file format, the library's H5PL code has to search in the table of loaded plugin libraries
* for this filter. */
if(H5Zunregister(H5Z_FILTER_DYNLIB4) < 0) TEST_ERROR
- return 0;
+ ret_value = 0;
error:
- return -1;
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Pclose(dc);
+ } H5E_END_TRY
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_read_data
+ * Function: test_read_data
*
- * Purpose: Tests reading data and compares values
+ * Purpose: Tests reading data and compares values
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * 14 March 2013
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_read_data(hid_t dataset, int *origin_data)
{
- int check[DSET_DIM1][DSET_DIM2];
- const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
- int *data_p = origin_data;
+ herr_t ret_value = -1;
+ int check[DSET_DIM1][DSET_DIM2];
+ const hsize_t size[2] = {DSET_DIM1, DSET_DIM2}; /* Dataspace dimensions */
+ int *data_p = origin_data;
size_t i, j; /* Local index variables */
/* Read the dataset back */
- if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0)
- TEST_ERROR;
+ if(H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, check) < 0) TEST_ERROR;
/* Check that the values read are the same as the values written */
- for(i=0; i<size[0]; i++) {
+ for(i=0; i<size[0]; i++)
for(j=0; j<size[1]; j++) {
- if(*data_p != check[i][j]) {
- H5_FAILED();
- fprintf(stderr," Read different values than written.\n");
- fprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
- fprintf(stderr," At original: %d\n", *data_p);
- fprintf(stderr," At returned: %d\n", (int)check[i][j]);
- TEST_ERROR
- }
+ if(*data_p != check[i][j]) {
+ H5_FAILED();
+ HDfprintf(stderr," Read different values than written.\n");
+ HDfprintf(stderr," At index %lu,%lu\n", (unsigned long)i, (unsigned long)j);
+ HDfprintf(stderr," At original: %d\n", *data_p);
+ HDfprintf(stderr," At returned: %d\n", (int)check[i][j]);
+ TEST_ERROR
+ } /* end if */
data_p++;
- }
- }
+ }
PASSED();
- return 0;
+ ret_value = 0;
error:
- return -1;
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_read_with_filters
- *
- * Purpose: Tests reading dataset created with dynamically loaded filters
+ * Function: test_read_with_filters
*
- * Return: Success: 0
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * 14 March 2013
+ * Purpose: Tests reading dataset created with dynamically loaded filters
*
+ * Return: Success: 0
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_read_with_filters(hid_t file)
{
- hid_t dset; /* Dataset ID */
+ herr_t ret_value = -1;
+ hid_t dset = -1; /* Dataset ID */
/*----------------------------------------------------------
* STEP 1: Test deflation by itself.
@@ -515,7 +475,7 @@ test_read_with_filters(hid_t file)
/* Clean up objects used for this test */
#else /* H5_HAVE_FILTER_DEFLATE */
SKIPPED();
- puts(" Deflate filter not enabled");
+ HDputs(" Deflate filter not enabled");
#endif /* H5_HAVE_FILTER_DEFLATE */
/*----------------------------------------------------------
@@ -524,7 +484,7 @@ test_read_with_filters(hid_t file)
*/
TESTING(" DYNLIB1 filter");
- if((dset = H5Dopen2(file,DSET_DYNLIB1_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset = H5Dopen2(file, DSET_DYNLIB1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
if(test_read_data(dset, (int *)points_dynlib1) < 0) TEST_ERROR
@@ -536,7 +496,7 @@ test_read_with_filters(hid_t file)
*/
TESTING(" DYNLIB2 filter");
- if((dset = H5Dopen2(file,DSET_DYNLIB2_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset = H5Dopen2(file, DSET_DYNLIB2_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
if(test_read_data(dset, (int *)points_dynlib2) < 0) TEST_ERROR
@@ -554,27 +514,33 @@ test_read_with_filters(hid_t file)
if(H5Dclose(dset) < 0) TEST_ERROR
- return 0;
+ ret_value = 0;
error:
- return -1;
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ } H5E_END_TRY
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_noread_data
+ * Function: test_noread_data
*
- * Purpose: Tests not reading data
+ * Purpose: Tests not reading data
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: 0
+ * Failure: -1
*
*-------------------------------------------------------------------------
*/
static herr_t
test_noread_data(hid_t dataset)
{
+ herr_t ret_value = -1;
int check[DSET_DIM1][DSET_DIM2];
- herr_t ret;
+ herr_t ret = -1;
/* Read the dataset back */
H5E_BEGIN_TRY {
@@ -584,27 +550,28 @@ test_noread_data(hid_t dataset)
TEST_ERROR
PASSED();
- return 0;
+ ret_value = 0;
error:
- return -1;
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_noread_with_filters
+ * Function: test_noread_with_filters
*
- * Purpose: Tests reading dataset created with dynamically loaded filters disabled
+ * Purpose: Tests reading dataset created with dynamically loaded filters disabled
*
* Return: Success: 0
- * Failure: -1
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_noread_with_filters(hid_t file)
{
- hid_t dset; /* Dataset ID */
- unsigned plugin_state; /* status of plugins */
+ herr_t ret_value = -1;
+ hid_t dset = -1; /* Dataset ID */
+ unsigned plugin_state; /* status of plugins */
+
TESTING("DYNLIB1 filter with plugins disabled");
/* disable filter plugin */
@@ -612,44 +579,45 @@ test_noread_with_filters(hid_t file)
plugin_state = plugin_state & ~H5PL_FILTER_PLUGIN;
if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
- if((dset = H5Dopen2(file,DSET_DYNLIB1_NAME,H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset = H5Dopen2(file, DSET_DYNLIB1_NAME, H5P_DEFAULT)) < 0) TEST_ERROR
if(test_noread_data(dset) < 0) TEST_ERROR
if(H5Dclose(dset) < 0) TEST_ERROR
- /* re-enable filter plugin */
- plugin_state = plugin_state | H5PL_FILTER_PLUGIN;
- if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
-
- return 0;
+ ret_value = 0;
error:
/* re-enable filter plugin */
plugin_state = plugin_state | H5PL_FILTER_PLUGIN;
- if(H5PLset_loading_state(plugin_state) < 0) TEST_ERROR
- return -1;
+ H5PLset_loading_state(plugin_state);
+
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ } H5E_END_TRY
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_filters_for_groups
+ * Function: test_filters_for_groups
*
- * Purpose: Tests creating group with dynamically loaded filters
+ * Purpose: Tests creating group with dynamically loaded filters
*
* Return: Success: 0
- * Failure: -1
- *
- * Programmer: Raymond Lu
- * 1 April 2013
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_filters_for_groups(hid_t file)
{
- hid_t gcpl, gid, group;
- int i;
- char gname[256];
+ herr_t ret_value = -1;
+ hid_t gcpl = -1;
+ hid_t gid = -1;
+ hid_t group = -1;
+ int i;
+ char gname[256];
TESTING("DYNLIB3 filter for group");
@@ -662,8 +630,8 @@ test_filters_for_groups(hid_t file)
if((gid = H5Gcreate2(file, "group1", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create multiple groups under "group1" */
- for (i=0; i < GROUP_ITERATION; i++) {
- sprintf(gname, "group_%d", i);
+ for(i=0; i < GROUP_ITERATION; i++) {
+ HDsprintf(gname, "group_%d", i);
if((group = H5Gcreate2(gid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group) < 0) TEST_ERROR
}
@@ -672,14 +640,21 @@ test_filters_for_groups(hid_t file)
if(H5Gclose(gid) < 0) TEST_ERROR
/* Clean up objects used for this test */
- if(H5Pclose (gcpl) < 0) TEST_ERROR
+ if(H5Pclose(gcpl) < 0) TEST_ERROR
PASSED();
- return 0;
+ ret_value = 0;
error:
- return -1;
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Gclose(group);
+ H5Gclose(gid);
+ H5Pclose(gcpl);
+ } H5E_END_TRY
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
@@ -698,7 +673,9 @@ error:
static herr_t
test_groups_with_filters(hid_t file)
{
- hid_t gid, group;
+ herr_t ret_value = -1;
+ hid_t gid;
+ hid_t group;
int i;
char gname[256];
@@ -708,8 +685,8 @@ test_groups_with_filters(hid_t file)
if((gid = H5Gopen2(file, "group1", H5P_DEFAULT)) < 0) TEST_ERROR
/* Create multiple groups under "group1" */
- for (i=0; i < GROUP_ITERATION; i++) {
- sprintf(gname, "group_%d", i);
+ for(i=0; i < GROUP_ITERATION; i++) {
+ HDsprintf(gname, "group_%d", i);
if((group = H5Gopen2(gid, gname, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Gclose(group) < 0) TEST_ERROR
}
@@ -719,114 +696,168 @@ test_groups_with_filters(hid_t file)
PASSED();
- return 0;
+ ret_value = 0;
error:
- return -1;
+ /* Clean up objects used for this test */
+ H5E_BEGIN_TRY {
+ H5Gclose(group);
+ H5Gclose(gid);
+ } H5E_END_TRY
+
+ return ret_value;
}
/*-------------------------------------------------------------------------
- * Function: test_filter_path_apis
+ * Function: test_filter_path_apis
*
- * Purpose: Tests accessing the path table for dynamically loaded filters
+ * Purpose: Tests accessing the path table for dynamically loaded filters
*
* Return: Success: 0
- * Failure: -1
- *
+ * Failure: -1
*-------------------------------------------------------------------------
*/
static herr_t
test_filter_path_apis(void)
{
- int i;
+ herr_t ret_value = -1;
+ unsigned int i;
unsigned int ndx;
herr_t ret;
+ ssize_t pathlen = -1;
char pathname[256];
+ char tempname[256];
- puts("Testing access to the filter path table");
+ HDputs("Testing access to the filter path table");
+
+ if(H5Zfilter_avail(H5Z_FILTER_DYNLIB1) != TRUE) TEST_ERROR
ndx = H5PLsize();
TESTING(" remove");
/* Remove all existing paths*/
- for (i=ndx; i > 0; i--) {
- if (H5PLremove(i-1) < 0) {
- fprintf(stderr," at %d: %s\n", i, pathname);
+ for(i=ndx; i > 0; i--)
+ if(H5PLremove(i-1) < 0) {
+ HDfprintf(stderr," at %d: %s\n", i, pathname);
TEST_ERROR
- }
- }
+ } /* end if */
/* Verify the table is empty */
- if (H5PLsize() > 0) TEST_ERROR
+ if(H5PLsize() > 0) TEST_ERROR
PASSED();
- TESTING(" remove (exceed)");
+ TESTING(" remove (exceed min)");
/* Exceed the min path removal */
H5E_BEGIN_TRY {
ret = H5PLremove(0);
} H5E_END_TRY
- if (ret >= 0)
- TEST_ERROR
+ if(ret >= 0) TEST_ERROR
PASSED();
TESTING(" append");
/* Create multiple paths to fill table */
- for (i=0; i < 16; i++) {
- sprintf(pathname, "a_path_%d", i);
- if (H5PLappend(pathname) < 0) {
- fprintf(stderr," at %d: %s\n", i, pathname);
+ for(i=0; i < H5PL_MAX_PATH_NUM; i++) {
+ HDsprintf(pathname, "a_path_%d", i);
+ if(H5PLappend(pathname) < 0) {
+ HDfprintf(stderr," at %d: %s\n", i, pathname);
TEST_ERROR
}
}
/* Verify the table is full */
- if (H5PLsize() != 16) TEST_ERROR
+ if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR
PASSED();
TESTING(" append (exceed)");
/* Exceed the max path append */
H5E_BEGIN_TRY {
- sprintf(pathname, "a_path_%d", 16);
+ HDsprintf(pathname, "a_path_%d", H5PL_MAX_PATH_NUM);
ret = H5PLappend(pathname);
} H5E_END_TRY
- if (ret >= 0)
+ if(ret >= 0) TEST_ERROR
+ PASSED();
+
+ TESTING(" remove (exceed max)");
+ /* Exceed the max path removal */
+ H5E_BEGIN_TRY {
+ ret = H5PLremove(H5PL_MAX_PATH_NUM);
+ } H5E_END_TRY
+ if(ret >= 0) TEST_ERROR
+ PASSED();
+
+ TESTING(" get (path name)");
+ if((pathlen = H5PLget(0, NULL, 0)) <= 0) {
+ HDfprintf(stderr," get path 0 length failed\n");
TEST_ERROR
+ }
+ if(pathlen != 8) TEST_ERROR
+
+ if((pathlen = H5PLget(0, pathname, 256)) <= 0) {
+ HDfprintf(stderr," get 0 len: %d : %s\n", pathlen, pathname);
+ TEST_ERROR
+ }
+ if(HDstrcmp(pathname, "a_path_0") != 0) {
+ HDfprintf(stderr," get 0: %s\n", pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ TESTING(" get (bounds)");
+ if((pathlen = H5PLget(1, pathname, 256)) <= 0) TEST_ERROR
+ if(HDstrcmp(pathname, "a_path_1") != 0) {
+ HDfprintf(stderr," get 1: %s\n", pathname);
+ TEST_ERROR
+ }
+ if((pathlen = H5PLget(H5PL_MAX_PATH_NUM - 1, pathname, 256)) <= 0) TEST_ERROR
+ HDsprintf(tempname, "a_path_%d", H5PL_MAX_PATH_NUM - 1);
+ if(HDstrcmp(pathname, tempname) != 0) {
+ HDfprintf(stderr," get %d: %s\n", H5PL_MAX_PATH_NUM - 1, pathname);
+ TEST_ERROR
+ }
+ PASSED();
+
+ TESTING(" get (bounds exceed)");
+ H5E_BEGIN_TRY {
+ pathlen = H5PLget(H5PL_MAX_PATH_NUM, NULL, 0);
+ } H5E_END_TRY
+ if(pathlen > 0) TEST_ERROR
PASSED();
TESTING(" remove (verify for prepend)");
/* Remove one path*/
- if (H5PLremove(8) < 0) TEST_ERROR
+ if(H5PLremove(8) < 0) TEST_ERROR
/* Verify that the entries were moved */
- sprintf(pathname, "%s", H5PLget(8));
- if (strcmp(pathname, "a_path_9") != 0) {
- fprintf(stderr," get 8: %s\n", pathname);
+ if((pathlen = H5PLget(8, pathname, 256)) <= 0) TEST_ERROR
+ if(HDstrcmp(pathname, "a_path_9") != 0) {
+ HDfprintf(stderr," get 8: %s\n", pathname);
TEST_ERROR
}
PASSED();
/* Verify the table is not full */
- if (H5PLsize() != 15) TEST_ERROR
+ if (H5PLsize() != H5PL_MAX_PATH_NUM - 1) TEST_ERROR
TESTING(" prepend");
/* Prepend one path*/
- sprintf(pathname, "a_path_%d", 17);
- if (H5PLprepend(pathname) < 0) {
- fprintf(stderr," prepend 17: %s\n", pathname);
+ HDsprintf(pathname, "a_path_%d", H5PL_MAX_PATH_NUM + 1);
+ if(H5PLprepend(pathname) < 0) {
+ HDfprintf(stderr," prepend %d: %s\n", H5PL_MAX_PATH_NUM + 1, pathname);
TEST_ERROR
}
/* Verify the table is full */
- if (H5PLsize() != 16) TEST_ERROR
+ if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR
/* Verify that the entries were moved */
- sprintf(pathname, "%s", H5PLget(8));
- if (strcmp(pathname, "a_path_7") != 0) {
- fprintf(stderr," get 8: %s\n", pathname);
+ if(H5PLget(8, pathname, 256) <= 0) TEST_ERROR
+ if(HDstrcmp(pathname, "a_path_7") != 0) {
+ HDfprintf(stderr," get 8: %s\n", pathname);
TEST_ERROR
}
- sprintf(pathname, "%s", H5PLget(0));
- if (strcmp(pathname, "a_path_17") != 0) {
- fprintf(stderr," get 0: %s\n", pathname);
+ if(H5PLget(0, pathname, 256) <= 0) TEST_ERROR
+ HDsprintf(tempname, "a_path_%d", H5PL_MAX_PATH_NUM + 1);
+ if(HDstrcmp(pathname, tempname) != 0) {
+ HDfprintf(stderr," get 0: %s\n", pathname);
TEST_ERROR
}
PASSED();
@@ -834,86 +865,85 @@ test_filter_path_apis(void)
TESTING(" prepend (exceed)");
/* Exceed the max path prepend */
H5E_BEGIN_TRY {
- sprintf(pathname, "a_path_%d", 18);
+ HDsprintf(pathname, "a_path_%d", H5PL_MAX_PATH_NUM + 2);
ret = H5PLprepend(pathname);
} H5E_END_TRY
- if (ret >= 0)
- TEST_ERROR
+ if(ret >= 0) TEST_ERROR
PASSED();
TESTING(" replace");
/* Replace one path*/
- sprintf(pathname, "a_path_%d", 20);
- if (H5PLput(pathname, 1) < 0) {
- fprintf(stderr," replace 1: %s\n", pathname);
+ HDsprintf(pathname, "a_path_%d", H5PL_MAX_PATH_NUM + 4);
+ if(H5PLreplace(pathname, 1) < 0) {
+ HDfprintf(stderr," replace 1: %s\n", pathname);
TEST_ERROR
}
/* Verify the table is full */
- if (H5PLsize() != 16) TEST_ERROR
+ if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR
/* Verify that the entries were not moved */
- sprintf(pathname, "%s", H5PLget(0));
- if (strcmp(pathname, "a_path_17") != 0) {
- fprintf(stderr," get 0: %s\n", pathname);
+ if(H5PLget(0, pathname, 256) <= 0) TEST_ERROR
+ HDsprintf(tempname, "a_path_%d", H5PL_MAX_PATH_NUM + 1);
+ if(HDstrcmp(pathname, tempname) != 0) {
+ HDfprintf(stderr," get 0: %s\n", pathname);
TEST_ERROR
}
- sprintf(pathname, "%s", H5PLget(2));
- if (strcmp(pathname, "a_path_1") != 0) {
- fprintf(stderr," get 2: %s\n", pathname);
+ if(H5PLget(2, pathname, 256) <= 0) TEST_ERROR
+ if(HDstrcmp(pathname, "a_path_1") != 0) {
+ HDfprintf(stderr," get 2: %s\n", pathname);
TEST_ERROR
}
PASSED();
TESTING(" remove (verify for insert)");
/* Remove one path*/
- if (H5PLremove(4) < 0) TEST_ERROR
+ if(H5PLremove(4) < 0) TEST_ERROR
/* Verify that the entries were moved */
- sprintf(pathname, "%s", H5PLget(4));
- if (strcmp(pathname, "a_path_4") != 0) {
- fprintf(stderr," get 4: %s\n", pathname);
+ if(H5PLget(4, pathname, 256) <= 0) TEST_ERROR
+ if(HDstrcmp(pathname, "a_path_4") != 0) {
+ HDfprintf(stderr," get 4: %s\n", pathname);
TEST_ERROR
}
PASSED();
/* Verify the table is not full */
- if (H5PLsize() != 15) TEST_ERROR
+ if(H5PLsize() != 15) TEST_ERROR
TESTING(" insert");
/* Insert one path*/
- sprintf(pathname, "a_path_%d", 21);
- if (H5PLinsert(pathname, 3) < 0){
- fprintf(stderr," insert 3: %s\n", pathname);
+ HDsprintf(pathname, "a_path_%d", H5PL_MAX_PATH_NUM + 5);
+ if(H5PLinsert(pathname, 3) < 0) {
+ HDfprintf(stderr," insert 3: %s\n", pathname);
TEST_ERROR
}
/* Verify that the entries were moved */
- sprintf(pathname, "%s", H5PLget(4));
- if (strcmp(pathname, "a_path_2") != 0){
- fprintf(stderr," get 4: %s\n", pathname);
+ if(H5PLget(4, pathname, 256) <= 0) TEST_ERROR
+ if(HDstrcmp(pathname, "a_path_2") != 0) {
+ HDfprintf(stderr," get 4: %s\n", pathname);
TEST_ERROR
}
PASSED();
/* Verify the table is full */
- if (H5PLsize() != 16) TEST_ERROR
+ if(H5PLsize() != H5PL_MAX_PATH_NUM) TEST_ERROR
TESTING(" insert (exceed)");
/* Exceed the max path insert */
H5E_BEGIN_TRY {
- sprintf(pathname, "a_path_%d", 22);
+ HDsprintf(pathname, "a_path_%d", H5PL_MAX_PATH_NUM + 6);
ret = H5PLinsert(pathname, 12);
} H5E_END_TRY
- if (ret >= 0)
- TEST_ERROR
+ if(ret >= 0) TEST_ERROR
- PASSED ();
+ PASSED();
- return 0;
+ ret_value = 0;
error:
- return -1;
+ return ret_value;
}
@@ -935,24 +965,24 @@ int
main(void)
{
char filename[FILENAME_BUF_SIZE];
- hid_t file, fapl, fapl2;
- unsigned new_format;
- int mdc_nelmts;
- size_t rdcc_nelmts;
- size_t rdcc_nbytes;
- double rdcc_w0;
- int nerrors = 0;
+ hid_t file = -1;
+ hid_t fapl = -1;
+ hid_t fapl2 = -1;
+ unsigned new_format;
+ int mdc_nelmts;
+ size_t rdcc_nelmts;
+ size_t rdcc_nbytes;
+ double rdcc_w0;
+ int nerrors = 0;
/* Testing setup */
h5_reset();
fapl = h5_fileaccess();
/* Turn off the chunk cache, so all the chunks are immediately written to disk */
- if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0)
- TEST_ERROR
+ if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) TEST_ERROR
rdcc_nbytes = 0;
- if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0)
- TEST_ERROR
+ if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) TEST_ERROR
/* Copy the file access property list */
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
@@ -968,17 +998,16 @@ main(void)
/* Set the FAPL for the type of format */
if(new_format) {
- puts("\nTesting with new file format:");
+ HDputs("\nTesting with new file format:");
my_fapl = fapl2;
} /* end if */
else {
- puts("Testing with old file format:");
+ HDputs("Testing with old file format:");
my_fapl = fapl;
} /* end else */
/* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0)
- TEST_ERROR
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR
/* Test dynamically loaded filters for chunked dataset */
nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0);
@@ -986,8 +1015,7 @@ main(void)
/* Test dynamically loaded filters for groups */
nerrors += (test_filters_for_groups(file) < 0 ? 1 : 0);
- if(H5Fclose(file) < 0)
- TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
} /* end for */
/* Close FAPL */
@@ -997,21 +1025,20 @@ main(void)
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
- puts("\nTesting reading data with with dynamic plugin filters:");
+ HDputs("\nTesting reading data with with dynamic plugin filters:");
/* Close the library so that all loaded plugin libraries are unloaded */
h5_reset();
fapl = h5_fileaccess();
/* Reopen the file for testing data reading */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Read the data with filters */
- nerrors += (test_read_with_filters(file) < 0 ? 1 : 0);
+ nerrors += (test_read_with_filters(file) < 0 ? 1 : 0);
/* Open the groups with filters */
- nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0);
+ nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0);
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1021,29 +1048,26 @@ main(void)
fapl = h5_fileaccess();
/* Reopen the file for testing data reading */
- if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
- TEST_ERROR
+ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR
/* Read the data with disabled filters */
nerrors += (test_noread_with_filters(file) < 0 ? 1 : 0);
- if(H5Fclose(file) < 0)
- TEST_ERROR
+ if(H5Fclose(file) < 0) TEST_ERROR
/* Test the APIs for access to the filter plugin path table */
nerrors += (test_filter_path_apis() < 0 ? 1 : 0);
- if(nerrors)
- TEST_ERROR
- printf("All plugin tests passed.\n");
+ if(nerrors) TEST_ERROR
+
+ HDprintf("All plugin tests passed.\n");
h5_cleanup(FILENAME, fapl);
return 0;
error:
nerrors = MAX(1, nerrors);
- printf("***** %d PLUGIN TEST%s FAILED! *****\n",
- nerrors, 1 == nerrors ? "" : "S");
+ HDprintf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S");
return 1;
}
diff --git a/test/set_extent.c b/test/set_extent.c
index 17dc6a0..052a35a 100644
--- a/test/set_extent.c
+++ b/test/set_extent.c
@@ -2603,13 +2603,6 @@ static int test_random_rank4( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
volatile unsigned i, j, k, l, m; /* Local indices */
char filename[NAME_BUF_SIZE];
- /*!FIXME Skip the test if a fixed array index is requested, as resizing
- * fixed arrays is broken now. Extensible arrays are also broken. Remove
- * these lines as appropriate when these problems are fixed. */
- /* Fixed Array index type is now fixed */
- if(index_type == RANK4_INDEX_EARRAY)
- return 0;
-
/* create a new file */
h5_fixname(FILENAME[4], fapl, filename, sizeof filename);
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
@@ -2814,12 +2807,6 @@ static int test_random_rank4_vl( hid_t fapl, hid_t dcpl, hbool_t do_fillvalue,
volatile unsigned i, j, k, l, m; /* Local indices */
char filename[NAME_BUF_SIZE];
- /*!FIXME Skip the test if a fixed array index is requested, as resizing
- * fixed arrays is broken now. Extensible arrays are also broken. Remove
- * these lines as appropriate when these problems are fixed. */
- if(index_type == RANK4_INDEX_FARRAY || index_type == RANK4_INDEX_EARRAY)
- return 0;
-
/* Initialize fill value buffers so they aren't freed in case of an error */
fill_value.len = 0;
fill_value.p = NULL;