From ad2a7f47896cf636b42fbc73b96781b2d5200f56 Mon Sep 17 00:00:00 2001 From: Jacob Smith Date: Fri, 31 May 2019 17:24:26 -0500 Subject: First pass at repack consolidating external storage if layout given. Checks out manually, tests still complain. --- tools/src/h5repack/h5repack_copy.c | 15 ++++++++++++--- tools/test/h5repack/Makefile.am | 3 ++- tools/test/h5repack/h5repack.sh.in | 3 ++- tools/test/h5repack/h5repackgentest.c | 8 ++++---- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 544793a..c638f3d 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -807,8 +807,17 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_type failed"); if ((dcpl_in = H5Dget_create_plist(dset_in)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_create_plist failed"); - if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + /* If the input dataset has external storage, it must be contiguous. + * Accordingly, there would be no filter or chunk properties to preserve. + */ + if (H5Pget_external_count(dcpl_in)) { + if ((dcpl_out = H5Pcreate(H5P_DATASET_CREATE)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcreate failed"); + } + else { + if ((dcpl_out = H5Pcopy(dcpl_in)) < 0) + HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pcopy failed"); + } if ((rank = H5Sget_simple_extent_ndims(f_space_id)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed"); HDmemset(dims, 0, sizeof dims); @@ -1175,7 +1184,7 @@ do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dclose failed"); } /*------------------------------------------------------------------------- - * we do not have request for filter/chunking use H5Ocopy instead + * we do not have request for filter/chunking; use H5Ocopy instead *------------------------------------------------------------------------- */ else { diff --git a/tools/test/h5repack/Makefile.am b/tools/test/h5repack/Makefile.am index ff950e4..38f7b2f 100644 --- a/tools/test/h5repack/Makefile.am +++ b/tools/test/h5repack/Makefile.am @@ -59,7 +59,8 @@ endif # Temporary files. *.h5 are generated by h5repack. They should # copied to the testfiles/ directory if update is required. -CHECK_CLEANFILES+=*.h5 *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 +# *.dat files may be created by h5repackgentest. +CHECK_CLEANFILES+=*.h5 *.dat *.bin testfiles/h5diff_attr1.h5 testfiles/tfamily*.h5 DISTCLEANFILES=h5repack.sh h5repack_plugin.sh include $(top_srcdir)/config/conclude.am diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in index 9851e89..56df3c8 100644 --- a/tools/test/h5repack/h5repack.sh.in +++ b/tools/test/h5repack/h5repack.sh.in @@ -675,7 +675,8 @@ VERIFY_EXTERNAL_CONSOLIDATION() ) # flag if any of the above checks failed - if [ $prev_nerrors != $nerrors ]; then + if [ $prev_nerrors != $nerrors ] + then echo ". . . *FAILED*" nerrors="`expr $prev_nerrors + 1`" else diff --git a/tools/test/h5repack/h5repackgentest.c b/tools/test/h5repack/h5repackgentest.c index 8076b42..0eec88c 100644 --- a/tools/test/h5repack/h5repackgentest.c +++ b/tools/test/h5repack/h5repackgentest.c @@ -8,7 +8,7 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ static void -generate_external_int32le(hbool_t external) +generate_int32le(hbool_t external) { char filename[MAX_NAME_SIZE]; hid_t file; @@ -67,7 +67,7 @@ generate_external_int32le(hbool_t external) HDassert(H5Dclose(dset) >= 0); HDassert(H5Sclose(dspace) >= 0); HDassert(H5Fclose(file) >= 0); -} /* end generate_external_int32le() */ +} /* end generate_int32le() */ /* ---------------------------------------------------------------------------- @@ -75,8 +75,8 @@ generate_external_int32le(hbool_t external) int main(void) { - generate_external_int32le(FALSE); - generate_external_int32le(TRUE); + generate_int32le(FALSE); + generate_int32le(TRUE); return 0; } /* end main() */ -- cgit v0.12