diff options
-rw-r--r-- | MANIFEST | 216 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | src/H5Gint.c | 8 | ||||
-rw-r--r-- | test/evict_on_close.c | 229 |
4 files changed, 319 insertions, 143 deletions
@@ -1199,55 +1199,55 @@ ./tools/test/h5import/h5importtestutil.sh.in # testfiles for h5import -./tools/h5import/testfiles/binfp64.conf -./tools/h5import/testfiles/binfp64.h5 -./tools/h5import/testfiles/binin16.conf -./tools/h5import/testfiles/binin16.h5 -./tools/h5import/testfiles/binin32.conf -./tools/h5import/testfiles/binin32.h5 -./tools/h5import/testfiles/binin8.conf -./tools/h5import/testfiles/binin8.h5 -./tools/h5import/testfiles/binin8w.conf -./tools/h5import/testfiles/binin8w.h5 -./tools/h5import/testfiles/binuin16.conf -./tools/h5import/testfiles/binuin16.h5 -./tools/h5import/testfiles/binuin32.conf -./tools/h5import/testfiles/binuin32.h5 -./tools/h5import/testfiles/textpfe.conf -./tools/h5import/testfiles/textpfe.h5 -./tools/h5import/testfiles/textpfe64.txt -./tools/h5import/testfiles/txtfp32.conf -./tools/h5import/testfiles/txtfp32.h5 -./tools/h5import/testfiles/txtfp32.txt -./tools/h5import/testfiles/txtfp64.conf -./tools/h5import/testfiles/txtfp64.h5 -./tools/h5import/testfiles/txtfp64.txt -./tools/h5import/testfiles/txtin16.conf -./tools/h5import/testfiles/txtin16.h5 -./tools/h5import/testfiles/txtin16.txt -./tools/h5import/testfiles/txtin32.conf -./tools/h5import/testfiles/txtin32.h5 -./tools/h5import/testfiles/txtin32.txt -./tools/h5import/testfiles/txtin8.conf -./tools/h5import/testfiles/txtin8.h5 -./tools/h5import/testfiles/txtin8.txt -./tools/h5import/testfiles/txtuin16.conf -./tools/h5import/testfiles/txtuin16.h5 -./tools/h5import/testfiles/txtuin16.txt -./tools/h5import/testfiles/txtuin32.conf -./tools/h5import/testfiles/txtuin32.h5 -./tools/h5import/testfiles/txtuin32.txt -./tools/h5import/testfiles/txtstr.conf -./tools/h5import/testfiles/txtstr.h5 -./tools/h5import/testfiles/txtstr.txt -./tools/h5import/testfiles/dbinfp64.h5.txt -./tools/h5import/testfiles/dbinin8.h5.txt -./tools/h5import/testfiles/dbinin8w.h5.txt -./tools/h5import/testfiles/dbinin16.h5.txt -./tools/h5import/testfiles/dbinin32.h5.txt -./tools/h5import/testfiles/dbinuin16.h5.txt -./tools/h5import/testfiles/dbinuin32.h5.txt -./tools/h5import/testfiles/dtxtstr.h5.txt +./tools/test/h5import/testfiles/binfp64.conf +./tools/test/h5import/testfiles/binfp64.h5 +./tools/test/h5import/testfiles/binin16.conf +./tools/test/h5import/testfiles/binin16.h5 +./tools/test/h5import/testfiles/binin32.conf +./tools/test/h5import/testfiles/binin32.h5 +./tools/test/h5import/testfiles/binin8.conf +./tools/test/h5import/testfiles/binin8.h5 +./tools/test/h5import/testfiles/binin8w.conf +./tools/test/h5import/testfiles/binin8w.h5 +./tools/test/h5import/testfiles/binuin16.conf +./tools/test/h5import/testfiles/binuin16.h5 +./tools/test/h5import/testfiles/binuin32.conf +./tools/test/h5import/testfiles/binuin32.h5 +./tools/test/h5import/testfiles/textpfe.conf +./tools/test/h5import/testfiles/textpfe.h5 +./tools/test/h5import/testfiles/textpfe64.txt +./tools/test/h5import/testfiles/txtfp32.conf +./tools/test/h5import/testfiles/txtfp32.h5 +./tools/test/h5import/testfiles/txtfp32.txt +./tools/test/h5import/testfiles/txtfp64.conf +./tools/test/h5import/testfiles/txtfp64.h5 +./tools/test/h5import/testfiles/txtfp64.txt +./tools/test/h5import/testfiles/txtin16.conf +./tools/test/h5import/testfiles/txtin16.h5 +./tools/test/h5import/testfiles/txtin16.txt +./tools/test/h5import/testfiles/txtin32.conf +./tools/test/h5import/testfiles/txtin32.h5 +./tools/test/h5import/testfiles/txtin32.txt +./tools/test/h5import/testfiles/txtin8.conf +./tools/test/h5import/testfiles/txtin8.h5 +./tools/test/h5import/testfiles/txtin8.txt +./tools/test/h5import/testfiles/txtuin16.conf +./tools/test/h5import/testfiles/txtuin16.h5 +./tools/test/h5import/testfiles/txtuin16.txt +./tools/test/h5import/testfiles/txtuin32.conf +./tools/test/h5import/testfiles/txtuin32.h5 +./tools/test/h5import/testfiles/txtuin32.txt +./tools/test/h5import/testfiles/txtstr.conf +./tools/test/h5import/testfiles/txtstr.h5 +./tools/test/h5import/testfiles/txtstr.txt +./tools/test/h5import/testfiles/dbinfp64.h5.txt +./tools/test/h5import/testfiles/dbinin8.h5.txt +./tools/test/h5import/testfiles/dbinin8w.h5.txt +./tools/test/h5import/testfiles/dbinin16.h5.txt +./tools/test/h5import/testfiles/dbinin32.h5.txt +./tools/test/h5import/testfiles/dbinuin16.h5.txt +./tools/test/h5import/testfiles/dbinuin32.h5.txt +./tools/test/h5import/testfiles/dtxtstr.h5.txt # h5diff sources ./tools/src/h5diff/Makefile.am @@ -1262,56 +1262,56 @@ # h5format_convert sources ./tools/src/h5format_convert/Makefile.am -./tools/src/h5format_convert/h5fc_chk_idx.c -./tools/src/h5format_convert/h5fc_gentest.c ./tools/src/h5format_convert/h5format_convert.c -./tools/src/h5format_convert/testfiles/h5fc_v_n_all.ddl -./tools/src/h5format_convert/testfiles/h5fc_v_bt1.ddl -./tools/src/h5format_convert/testfiles/h5fc_v_err.ddl -./tools/src/h5format_convert/testfiles/h5fc_v_non_chunked.ddl -./tools/src/h5format_convert/testfiles/h5fc_d_file.ddl -./tools/src/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl -./tools/src/h5format_convert/testfiles/h5fc_dname.ddl -./tools/src/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl -./tools/src/h5format_convert/testfiles/h5fc_help.ddl -./tools/src/h5format_convert/testfiles/h5fc_v_all.ddl -./tools/src/h5format_convert/testfiles/h5fc_nooption.ddl -./tools/src/h5format_convert/testfiles/h5fc_v_n_1d.ddl -./tools/src/h5format_convert/testfiles/h5fc_nonexistfile.ddl -./tools/src/h5format_convert/testfiles/h5fc_non_v3.h5 -./tools/src/h5format_convert/testfiles/h5fc_edge_v3.h5 -./tools/src/h5format_convert/testfiles/h5fc_err_level.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext1_f.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext1_i.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext1_s.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext2_if.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext2_is.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext2_sf.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext3_isf.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext_none.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext1_f.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext1_i.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext1_s.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext2_if.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext2_is.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 -./tools/src/h5format_convert/testfiles/old_h5fc_ext_none.h5 -./tools/src/h5format_convert/testfiles/h5fc_ext1_f.ddl -./tools/src/h5format_convert/testfiles/h5fc_ext1_i.ddl -./tools/src/h5format_convert/testfiles/h5fc_ext1_s.ddl -./tools/src/h5format_convert/testfiles/h5fc_ext2_if.ddl -./tools/src/h5format_convert/testfiles/h5fc_ext2_is.ddl -./tools/src/h5format_convert/testfiles/h5fc_ext2_sf.ddl -./tools/src/h5format_convert/testfiles/h5fc_ext3_isf.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext1_f.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext1_i.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext1_s.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext2_if.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext2_is.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl -./tools/src/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl -./tools/src/h5format_convert/testh5fc.sh.in +./tools/test/h5format_convert/h5fc_chk_idx.c +./tools/test/h5format_convert/h5fc_gentest.c +./tools/test/h5format_convert/testfiles/h5fc_v_n_all.ddl +./tools/test/h5format_convert/testfiles/h5fc_v_bt1.ddl +./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl +./tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl +./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl +./tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl +./tools/test/h5format_convert/testfiles/h5fc_dname.ddl +./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl +./tools/test/h5format_convert/testfiles/h5fc_help.ddl +./tools/test/h5format_convert/testfiles/h5fc_v_all.ddl +./tools/test/h5format_convert/testfiles/h5fc_nooption.ddl +./tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl +./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl +./tools/test/h5format_convert/testfiles/h5fc_non_v3.h5 +./tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5 +./tools/test/h5format_convert/testfiles/h5fc_err_level.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext1_f.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext1_i.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext1_s.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext2_if.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext2_is.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext2_sf.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext3_isf.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext_none.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.h5 +./tools/test/h5format_convert/testfiles/old_h5fc_ext_none.h5 +./tools/test/h5format_convert/testfiles/h5fc_ext1_f.ddl +./tools/test/h5format_convert/testfiles/h5fc_ext1_i.ddl +./tools/test/h5format_convert/testfiles/h5fc_ext1_s.ddl +./tools/test/h5format_convert/testfiles/h5fc_ext2_if.ddl +./tools/test/h5format_convert/testfiles/h5fc_ext2_is.ddl +./tools/test/h5format_convert/testfiles/h5fc_ext2_sf.ddl +./tools/test/h5format_convert/testfiles/h5fc_ext3_isf.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext1_f.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext1_i.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext1_s.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext2_if.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext2_is.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext2_sf.ddl +./tools/test/h5format_convert/testfiles/old_h5fc_ext3_isf.ddl +./tools/test/h5format_convert/testh5fc.sh.in # h5repack sources ./tools/src/h5repack/Makefile.am @@ -2330,11 +2330,11 @@ ./tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl ./tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl ./tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_zero.tst -./tools/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl -./tools/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl -./tools/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl -./tools/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl -./tools/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl +./tools/test/h5repack/testfiles/1_vds.h5-vds_dset_chunk20x10x5-v.ddl +./tools/test/h5repack/testfiles/2_vds.h5-vds_chunk3x6x9-v.ddl +./tools/test/h5repack/testfiles/3_1_vds.h5-vds_chunk2x5x8-v.ddl +./tools/test/h5repack/testfiles/4_vds.h5-vds_conti-v.ddl +./tools/test/h5repack/testfiles/4_vds.h5-vds_compa-v.ddl # jam utility and tests ./tools/src/h5jam/Makefile.am @@ -3051,6 +3051,9 @@ ./src/Makefile.in ./test/Makefile.in ./testpar/Makefile.in +./tools/Makefile.in +./tools/lib/Makefile.in +./tools/src/Makefile.in ./tools/src/h5copy/Makefile.in ./tools/src/h5diff/Makefile.in ./tools/src/h5dump/Makefile.in @@ -3060,13 +3063,8 @@ ./tools/src/h5ls/Makefile.in ./tools/src/h5repack/Makefile.in ./tools/src/h5stat/Makefile.in -./tools/lib/Makefile.in -./tools/Makefile.in -./tools/src/Makefile.in -./tools/test/Makefile.in ./tools/src/misc/Makefile.in -./tools/src/misc/vds/Makefile.in -./tools/src/perform/Makefile.in +./tools/test/Makefile.in ./tools/test/h5copy/Makefile.in ./tools/test/h5diff/Makefile.in ./tools/test/h5dump/Makefile.in diff --git a/configure.ac b/configure.ac index e4e3516..f9d535b 100644 --- a/configure.ac +++ b/configure.ac @@ -699,7 +699,7 @@ if test "X$HDF_CXX" = "Xyes"; then ## if C++ can handle static cast PAC_PROG_CXX_STATIC_CAST - ## Checking if C++ has offsetof extension, + ## Checking if C++ has offsetof extension, ## note: this test has to be the last of the C++ tests because it sets a definition ## which would be used in the other tests, causing them to fail. PAC_PROG_CXX_OFFSETOF @@ -2869,7 +2869,7 @@ if test ${ac_cv_sizeof_long_double} = 0; then hdf5_cv_ldouble_to_llong_accurate=${hdf5_cv_ldouble_to_llong_accurate=no} else AC_CACHE_VAL([hdf5_cv_ldouble_to_llong_accurate], - [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], + [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])], [hdf5_cv_ldouble_to_llong_accurate=yes], [hdf5_cv_ldouble_to_llong_accurate=no],[])]) fi @@ -3348,6 +3348,9 @@ AC_CONFIG_FILES([src/libhdf5.settings tools/test/h5diff/Makefile tools/test/h5diff/testh5diff.sh tools/test/h5diff/testph5diff.sh + tools/src/h5format_convert/Makefile + tools/test/h5format_convert/Makefile + tools/test/h5format_convert/testh5fc.sh tools/test/h5jam/Makefile tools/test/h5jam/testh5jam.sh tools/test/h5repack/Makefile @@ -3426,7 +3429,7 @@ AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes; AC_OUTPUT -chmod 755 tools/misc/h5cc +chmod 755 tools/src/misc/h5cc if test "X$HDF_FORTRAN" = "Xyes"; then chmod 755 fortran/src/h5fc diff --git a/src/H5Gint.c b/src/H5Gint.c index a0e06f3..90c011a 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -501,6 +501,14 @@ H5G_close(H5G_t *grp) if(H5O_close(&(grp->oloc)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to close") + /* Evict group metadata if evicting on close */ + if(H5F_SHARED(grp->oloc.file) && H5F_EVICT_ON_CLOSE(grp->oloc.file)) { + if(H5AC_flush_tagged_metadata(grp->oloc.file, grp->oloc.addr, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata") + if(H5AC_evict_tagged_metadata(grp->oloc.file, grp->oloc.addr, FALSE, H5AC_ind_read_dxpl_id) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to evict tagged metadata") + } /* end if */ + /* Free memory */ grp->shared = H5FL_FREE(H5G_shared_t, grp->shared); } else { diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 1f515b2..b7482dd 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -27,6 +27,7 @@ #define H5D_TESTING #define H5F_FRIEND /*suppress error about including H5Fpkg */ #define H5F_TESTING +#define H5G_FRIEND /*suppress error about including H5Gpkg */ #define H5I_FRIEND /*suppress error about including H5Ipkg */ #define H5I_TESTING @@ -35,6 +36,7 @@ #include "H5Cpkg.h" #include "H5Dpkg.h" #include "H5Fpkg.h" +#include "H5Gpkg.h" #include "H5Ipkg.h" /* Uncomment to manually inspect cache states */ @@ -46,6 +48,12 @@ const char *FILENAMES[] = { }; #define FILENAME_BUF_SIZE 1024 +/* Group names */ +#define GROUP_OLD_STYLE_1_NAME "old1" +#define GROUP_OLD_STYLE_2_NAME "old2" +#define GROUP_NEW_STYLE_1_NAME "new1" +#define GROUP_NEW_STYLE_2_NAME "new2" + /* Dataset names */ #define DSET_COMPACT_NAME "compact" #define DSET_CONTIGUOUS_NAME "contiguous" @@ -61,7 +69,8 @@ const char *FILENAMES[] = { static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); static hid_t generate_eoc_test_file(hid_t fapl_id); -static herr_t check_configuration(hid_t fid, const char *dset_name); +static herr_t check_dset_scheme(hid_t fid, const char *dset_name); +static herr_t check_group_layout(hid_t fid, const char *group_name, const char *subgroup_name); /*------------------------------------------------------------------------- @@ -124,6 +133,7 @@ generate_eoc_test_file(hid_t fapl_id) char filename[FILENAME_BUF_SIZE]; /* decorated file name */ hid_t fid = -1; /* file ID (returned) */ hid_t fapl_copy_id = -1; /* ID of copied fapl */ + hid_t gid1 = -1, gid2 = -1; /* group IDs */ hid_t sid = -1; /* dataspace ID */ hid_t dcpl_id = -1; /* dataset creation plist */ hid_t did = -1; /* dataset ID */ @@ -141,21 +151,49 @@ generate_eoc_test_file(hid_t fapl_id) /* Get a VFD-specific filename */ h5_fixname(FILENAMES[0], fapl_id, filename, sizeof(filename)); + /* Copy the fapl and set the latest file format */ + if((fapl_copy_id = H5Pcopy(fapl_id)) < 0) + TEST_ERROR; + if(H5Pset_libver_bounds(fapl_copy_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + TEST_ERROR; + + /* Create a data buffer for dataset writes */ + if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int)))) + TEST_ERROR; + /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) TEST_ERROR; - /***********************************************************/ - /* Generate datasets and ensure that the scheme is correct */ - /***********************************************************/ - /* Create the data buffer */ - if(NULL == (data = (int *)HDcalloc(NELEMENTS, sizeof(int)))) + /*******************************************/ + /* CREATE OBJECTS WITH THE OLD FILE FORMAT */ + /*******************************************/ + + /*******************/ + /* Generate groups */ + /*******************/ + + /*********************************************/ + /* Old-style (version 1 B-tree + local heap) */ + /*********************************************/ + + if((gid1 = H5Gcreate2(fid, GROUP_OLD_STYLE_1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + if((gid2 = H5Gcreate2(gid1, GROUP_OLD_STYLE_2_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if(H5Gclose(gid1) < 0) + TEST_ERROR; + if(H5Gclose(gid2) < 0) + TEST_ERROR; + + /********************************************************************/ + /* Generate datasets and ensure that the chunking scheme is correct */ + /********************************************************************/ - /****************************************************/ - /* Old file format data structures (v1 B-tree only) */ - /****************************************************/ + /***********************************/ + /* Old file format data structures */ + /***********************************/ /********************/ /* Version 1 B-tree */ @@ -198,23 +236,39 @@ generate_eoc_test_file(hid_t fapl_id) if(H5Pclose(dcpl_id) < 0) TEST_ERROR; - /***********************************/ - /* New file format data structures */ - /***********************************/ + + /**********************************************/ + /* CREATE OBJECTS WITH THE LATEST FILE FORMAT */ + /**********************************************/ /* Close the file */ if(H5Fclose(fid) < 0) TEST_ERROR; - /* Copy the fapl and set the latest file format */ - if((fapl_copy_id = H5Pcopy(fapl_id)) < 0) - TEST_ERROR; - if(H5Pset_libver_bounds(fapl_copy_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) + /* Reopen the file with the "latest file format" fapl */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_copy_id)) < 0) TEST_ERROR; - /* Reopen the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_copy_id)) < 0) + /*******************/ + /* Generate groups */ + /*******************/ + + /***********************************************/ + /* New-style (version 2 B-tree + fractal heap) */ + /***********************************************/ + + if((gid1 = H5Gcreate2(fid, GROUP_NEW_STYLE_1_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; + if((gid2 = H5Gcreate2(gid1, GROUP_NEW_STYLE_2_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + TEST_ERROR; + if(H5Gclose(gid1) < 0) + TEST_ERROR; + if(H5Gclose(gid2) < 0) + TEST_ERROR; + + /********************************************************************/ + /* Generate datasets and ensure that the scheme is chunking correct */ + /********************************************************************/ /********************/ /* Extensible Array */ @@ -488,7 +542,112 @@ error: /*------------------------------------------------------------------------- - * Function: check_configuration() + * Function: check_group_layout() + * + * Purpose: Verify that the evict-on-close feature works for a given + * group layout. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * Fall 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +check_group_layout(hid_t fid, const char *group_name, const char *subgroup_name) +{ + H5F_t *file_ptr = NULL; /* ptr to internal file struct */ + hid_t gid1 = -1, gid2 = -1; /* group IDs */ + H5G_t *grp_ptr = NULL; /* ptr to internal group struct */ + haddr_t tag1, tag2; /* MD cache tags for groups */ + int32_t before, during, after; /* cache sizes */ + + + /* NOTE: The TESTING() macro is called in main() */ + + /* Get a pointer to the file struct */ + if(NULL == (file_ptr = (H5F_t *)H5I_object_verify(fid, H5I_FILE))) + TEST_ERROR; + + /* Record the number of cache entries */ + before = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE BEFORE GROUP OPEN:\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", before); +#endif + + /* Open groups and get tags */ + if((gid1 = H5Gopen2(fid, group_name, H5P_DEFAULT)) < 0) + TEST_ERROR; + if((gid2 = H5Gopen2(gid1, subgroup_name, H5P_DEFAULT)) < 0) + TEST_ERROR; + + if(NULL == (grp_ptr = (H5G_t *)H5I_object_verify(gid1, H5I_GROUP))) + TEST_ERROR; + tag1 = grp_ptr->oloc.addr; + + if(NULL == (grp_ptr = (H5G_t *)H5I_object_verify(gid2, H5I_GROUP))) + TEST_ERROR; + tag2 = grp_ptr->oloc.addr; + + /* Record the number of cache entries */ + during = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE AFTER OPENING GROUPS (WHILE OPEN):\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("TAGS: group: %#X, subgroup: %#X\n", tag1, tag2); + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", during); +#endif + + /* Close the groups */ + if(H5Gclose(gid1) < 0) + TEST_ERROR; + if(H5Gclose(gid2) < 0) + TEST_ERROR; + + /* Record the number of cache entries */ + after = file_ptr->shared->cache->index_len; + +#ifdef EOC_MANUAL_INSPECTION + HDprintf("\nCACHE AFTER CLOSING GROUPS:\n"); + if(H5AC_dump_cache(file_ptr) < 0) + TEST_ERROR; + HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); +#endif + + /* Ensure that the cache does not contain entries with the tags */ + if(TRUE == verify_tag_not_in_cache(file_ptr, tag1)) + TEST_ERROR; + if(TRUE == verify_tag_not_in_cache(file_ptr, tag2)) + TEST_ERROR; + + /* Compare the number of cache entries */ + if(before != after || before == during) + TEST_ERROR; + + PASSED(); + return SUCCEED; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid1); + H5Gclose(gid2); + } H5E_END_TRY; + + H5_FAILED(); + return FAIL; + +} /* end check_group_layout() */ + + +/*------------------------------------------------------------------------- + * Function: check_dset_scheme() * * Purpose: Verify that the evict-on-close feature works for a given * dataset layout and/or chunk index. @@ -501,7 +660,7 @@ error: *------------------------------------------------------------------------- */ static herr_t -check_configuration(hid_t fid, const char *dset_name) +check_dset_scheme(hid_t fid, const char *dset_name) { H5F_t *file_ptr = NULL; /* ptr to internal file struct */ hid_t did = -1; /* dataset ID */ @@ -537,7 +696,7 @@ check_configuration(hid_t fid, const char *dset_name) TEST_ERROR; tag = dset_ptr->oloc.addr; - /* Read data from the dataset so the cache gets populated with chunk + /* Read data from the dataset so the cache gets populated with chunk entries * and the like. */ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) < 0) @@ -568,7 +727,7 @@ check_configuration(hid_t fid, const char *dset_name) HDprintf("NUMBER OF CACHE ENTRIES: %d\n", after); #endif - /* Ensure that the cache does not contain data items with the tag */ + /* Ensure that the cache does not contain entries with the tag */ if(TRUE == verify_tag_not_in_cache(file_ptr, tag)) TEST_ERROR; @@ -589,7 +748,7 @@ error: H5_FAILED(); return FAIL; -} /* check_configuration() */ +} /* check_dset_scheme() */ /*------------------------------------------------------------------------- @@ -694,7 +853,7 @@ main(void) hid_t fid = -1; /* file ID */ unsigned nerrors = 0; /* number of test errors */ - HDprintf("Testing evict-on-close cache behavior.\n"); + HDprintf("Testing evict-on-close cache behavior\n"); /* Initialize */ h5_reset(); @@ -724,23 +883,31 @@ main(void) PUTS_ERROR("Unable to generate test file\n"); } /* end if */ + /* Run tests with old- and new-style groups + * PASSED() and H5_FAILED() are handled in check_configuration() + */ + TESTING("evict on close with old-style groups"); + nerrors += check_group_layout(fid, GROUP_OLD_STYLE_1_NAME, GROUP_OLD_STYLE_2_NAME) < 0 ? 1 : 0; + TESTING("evict on close with new-style groups"); + nerrors += check_group_layout(fid, GROUP_NEW_STYLE_1_NAME, GROUP_NEW_STYLE_2_NAME) < 0 ? 1 : 0; + /* Run tests with a variety of dataset configurations * PASSED() and H5_FAILED() are handled in check_configuration() */ TESTING("evict on close with version 1 B-tree chunk index"); - nerrors += check_configuration(fid, DSET_BTREE_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_BTREE_NAME) < 0 ? 1 : 0; TESTING("evict on close with extensible array chunk index"); - nerrors += check_configuration(fid, DSET_EARRAY_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_EARRAY_NAME) < 0 ? 1 : 0; TESTING("evict on close with version 2 B-tree chunk index"); - nerrors += check_configuration(fid, DSET_BT2_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_BT2_NAME) < 0 ? 1 : 0; TESTING("evict on close with fixed array chunk index"); - nerrors += check_configuration(fid, DSET_FARRAY_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_FARRAY_NAME) < 0 ? 1 : 0; TESTING("evict on close with \'single chunk\' chunk index"); - nerrors += check_configuration(fid, DSET_SINGLE_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_SINGLE_NAME) < 0 ? 1 : 0; TESTING("evict on close with contiguous layout"); - nerrors += check_configuration(fid, DSET_CONTIGUOUS_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_CONTIGUOUS_NAME) < 0 ? 1 : 0; TESTING("evict on close with compact layout"); - nerrors += check_configuration(fid, DSET_COMPACT_NAME) < 0 ? 1 : 0; + nerrors += check_dset_scheme(fid, DSET_COMPACT_NAME) < 0 ? 1 : 0; /* Close the test file */ if(H5Fclose(fid) < 0) { |