From a03d35dc22a4be89c09d923e439167de697510d0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 07:27:32 -0500 Subject: HDFFV-9407 Add test --- MANIFEST | 1 + release_docs/RELEASE.txt | 18 +++++++++++------- tools/test/h5dump/CMakeTests.cmake | 30 ++++++++++++++++++++++++++++++ tools/testfiles/t128bit_float.h5 | Bin 0 -> 2160 bytes 4 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 tools/testfiles/t128bit_float.h5 diff --git a/MANIFEST b/MANIFEST index 9f82784..3285ec2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1698,6 +1698,7 @@ ./tools/testfiles/h5dump-help.txt ./tools/testfiles/non_existing.ddl ./tools/testfiles/packedbits.ddl +./tools/testfiles/t128bit_float.h5 ./tools/testfiles/taindices.h5 ./tools/testfiles/tall-1.ddl ./tools/testfiles/tall-2.ddl diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 986b1e8..c8061f5 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -59,11 +59,11 @@ New Features (ADB - 2019/06/12, HDFFV-10805) - Add options to enable or disable building tools and tests - - Configure options --enable-tests and --enable-tools were added for + + Configure options --enable-tests and --enable-tools were added for autotools configure. These options are enabled by default, and can be - disabled with either --disable-tests (or tools) or --enable-tests=no - (or --enable-tools=no). Build time is reduced ~20% when tools are + disabled with either --disable-tests (or tools) or --enable-tests=no + (or --enable-tools=no). Build time is reduced ~20% when tools are disabled, 35% when tests are disabled, 45% when both are disabled. Reenabling them after the initial build requires running configure again with the option(s) enabled. @@ -240,7 +240,6 @@ New Features (ADB - 2018/12/12, HDFVIEW-4) - - Removed H5I_REFERENCE from the Java wrappers This ID class was never used by the library and has been removed @@ -251,7 +250,12 @@ New Features Tools: ------ - - + - h5dump was fixed for 128-bit floats, but was missing a test. + + New test greps for the first 15 numbers of the 128-bit value. + + (ADB - 2019/06/23, HDFFV-9407) + High-Level APIs: --------------- @@ -286,7 +290,7 @@ Bug Fixes since HDF5-1.10.3 release H5F_LIBVER_V18, the H5Ocopy() call will fail with the error stack indicating that the fill value version is out of bounds. - This was fixed by changing the fill value message version to H5O_FILL_VERSION_3 + This was fixed by changing the fill value message version to H5O_FILL_VERSION_3 (from H5O_FILL_VERSION_2) for H5F_LIBVER_V18. (VC - 2019/6/14, HDFFV-10800) diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index 13d71a6..070e98e 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -320,6 +320,7 @@ ${HDF5_TOOLS_DIR}/testfiles/tvlenstr_array.h5 ${HDF5_TOOLS_DIR}/testfiles/tvlstr.h5 ${HDF5_TOOLS_DIR}/testfiles/tvms.h5 + ${HDF5_TOOLS_DIR}/testfiles/t128bit_float.h5 ${HDF5_TOOLS_DIR}/testfiles/zerodim.h5 ) set (HDF5_ERROR_REFERENCE_TEST_FILES @@ -674,6 +675,32 @@ endif () endmacro () + macro (ADD_H5_GREP_TEST resultfile resultcode result_check) + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + # Remove any output file left over from previous test run + add_test ( + NAME H5DUMP-${resultfile}-clear-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${resultfile}.out + ${resultfile}.out.err + ) + set_tests_properties (H5DUMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std") + add_test ( + NAME H5DUMP-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles/std" + -D "TEST_OUTPUT=${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${result_check}" + -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake" + ) + set_tests_properties (H5DUMP-${resultfile} PROPERTIES DEPENDS "H5DUMP-${resultfile}-clear-objects") + endif () + endmacro () + macro (ADD_H5ERR_MASK_TEST resultfile resultcode result_errcheck) if (NOT HDF5_ENABLE_USING_MEMCHECKER) # Remove any output file left over from previous test run @@ -1551,6 +1578,9 @@ # test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue ADD_H5_TEST (err_attr_dspace 1 err_attr_dspace.h5) + # test to verify HDFFV-9407: long double full precision + ADD_H5_GREP_TEST (t128bit_float 1 "1.123456789012345" -m %.35Lf t128bit_float.h5) + ############################################################################## ### P L U G I N T E S T S ############################################################################## diff --git a/tools/testfiles/t128bit_float.h5 b/tools/testfiles/t128bit_float.h5 new file mode 100644 index 0000000..134d510 Binary files /dev/null and b/tools/testfiles/t128bit_float.h5 differ -- cgit v0.12 From cb92adccf61d712ee8c4fcac04c1b297c05ab941 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 24 Jun 2019 14:39:51 -0500 Subject: Move pragma statements outside of routines, to make older compilers happy. --- src/H5Tnative.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/H5Tnative.c b/src/H5Tnative.c index f40d81b..d213c45 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -515,6 +515,9 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_type() */ +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_integer @@ -551,9 +554,6 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { -/* Disable warning for intentional identical branches here -QAK */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) { match = H5T_NATIVE_INT_MATCH_CHAR; native_size = sizeof(char); @@ -573,7 +573,6 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, match = H5T_NATIVE_INT_MATCH_LLONG; native_size = sizeof(long long); } -#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) { match = H5T_NATIVE_INT_MATCH_LLONG; @@ -659,7 +658,11 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_integer() */ +#pragma GCC diagnostic pop +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_float @@ -698,9 +701,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali HDassert(size>0); if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { -/* Disable warning for intentional identical branches here -QAK */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wduplicated-branches" if(size<=sizeof(float)) { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); @@ -724,7 +724,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali native_size = sizeof(double); #endif } -#pragma GCC diagnostic pop } else { #if H5_SIZEOF_LONG_DOUBLE !=0 if(size>sizeof(double)) { @@ -788,7 +787,11 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_float() */ +#pragma GCC diagnostic pop +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" /*------------------------------------------------------------------------- * Function: H5T__get_native_bitfield @@ -818,9 +821,6 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { -/* Disable warning for intentional identical branches here -QAK */ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) { tid = H5T_NATIVE_B8; native_size = 1; @@ -842,7 +842,6 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, native_size = 8; align = H5T_NATIVE_UINT64_ALIGN_g; } -#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) { tid = H5T_NATIVE_B64; @@ -878,6 +877,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5T__get_native_bitfield() */ +#pragma GCC diagnostic pop /*------------------------------------------------------------------------- -- cgit v0.12 From ee07744966b28206fb843716194786ad433171b6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 15:04:07 -0500 Subject: HDFFV-9407 add autotools test --- config/cmake/CTestCustom.cmake | 1 + tools/test/h5dump/testh5dump.sh.in | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 75d73cd..6db0f6f 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -93,6 +93,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects H5DUMP_VDS-clearall-objects + H5DUMP-t128bit_float #uses grepTest.cmake ######### tools/h5format_convert ######### H5FC-clearall-objects ######### tools/h5import ######### diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index e1c02cf..c4efd8f 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -34,6 +34,7 @@ H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary RM='rm -rf' CMP='cmp' DIFF='diff -c' +GREP='grep' CP='cp' DIRNAME='dirname' LS='ls' @@ -83,6 +84,7 @@ $SRC_H5DUMP_TESTFILES/charsets.h5 $SRC_H5DUMP_TESTFILES/file_space.h5 $SRC_H5DUMP_TESTFILES/filter_fail.h5 $SRC_H5DUMP_TESTFILES/packedbits.h5 +$SRC_H5DUMP_TESTFILES/t128bit_float.h5 $SRC_H5DUMP_TESTFILES/taindices.h5 $SRC_H5DUMP_TESTFILES/tall.h5 $SRC_H5DUMP_TESTFILES/tarray1.h5 @@ -903,6 +905,30 @@ TOOLTEST_HELP() { } +# Call the h5dump tool and grep for a value +# +GREPTEST() +{ + expectdata=$1 + actual=$TESTDIR/$2 + actual_err="$TESTDIR/`basename $2 .ddl`.oerr" + shift + + # Run test. + TESTING $DUMPER -p $@ + ( + cd $TESTDIR + $ENVCMD $RUNSERIAL $DUMPER_BIN -p "$@" + ) >$actual 2>$actual_err + $GREP $expectdata $actual > /dev/null + if [ $? -eq 0 ]; then + echo " PASSED" + else + echo " FAILED" + nerrors="`expr $nerrors + 1`" + fi +} + # Print a "SKIP" message SKIP() { TESTING $DUMPER $@ @@ -1363,6 +1389,9 @@ TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 # test to verify HDFFV-10333: error similar to H5O_attr_decode in the jira issue TOOLTEST err_attr_dspace.ddl err_attr_dspace.h5 +# test to verify HDFFV-9407: long double full precision +GREPTEST "1.123456789012345" t128bit_float.ddl -m %.35Lf t128bit_float.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From 1891324419030e10c24071d0a6537a4f1631c63e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 15:45:38 -0500 Subject: Need to shift off two arguments --- tools/test/h5dump/testh5dump.sh.in | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index c4efd8f..894aa5e 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -913,6 +913,7 @@ GREPTEST() actual=$TESTDIR/$2 actual_err="$TESTDIR/`basename $2 .ddl`.oerr" shift + shift # Run test. TESTING $DUMPER -p $@ -- cgit v0.12 From f6ddfd7dda8aa95b33ae89b87c70493d5c644dbe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 24 Jun 2019 16:10:20 -0500 Subject: Add test cleanup --- tools/test/h5dump/testh5dump.sh.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in index 894aa5e..e5680cf 100644 --- a/tools/test/h5dump/testh5dump.sh.in +++ b/tools/test/h5dump/testh5dump.sh.in @@ -928,6 +928,11 @@ GREPTEST() echo " FAILED" nerrors="`expr $nerrors + 1`" fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi } # Print a "SKIP" message -- cgit v0.12 From f4015bed9e7ee43468240e734232f9114b749d4f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 24 Jun 2019 14:33:54 -0700 Subject: Updated the Java attribute test so that attribute access property lists are created and used correctly. --- java/test/TestH5A.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java index 536364c..7d336e1 100644 --- a/java/test/TestH5A.java +++ b/java/test/TestH5A.java @@ -50,6 +50,7 @@ public class TestH5A { long type_id = -1; long space_id = -1; long lapl_id = -1; + long aapl_id = -1; private final void _deleteFile(String filename) { File file = new File(filename); @@ -90,8 +91,10 @@ public class TestH5A { assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0); space_id = H5.H5Screate(HDF5Constants.H5S_NULL); assertTrue(space_id > 0); - lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); assertTrue(lapl_id > 0); + aapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + assertTrue(aapl_id > 0); type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE); assertTrue(type_id > 0); int status = H5.H5Tenum_insert(type_id, "test", 1); @@ -122,6 +125,8 @@ public class TestH5A { try {H5.H5Sclose(space_id);} catch (Exception ex) {} if (lapl_id > 0) try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + if (aapl_id > 0) + try {H5.H5Pclose(aapl_id);} catch (Exception ex) {} System.out.println(); } @@ -194,7 +199,6 @@ public class TestH5A { long n = 0; long attr_id = -1; long attribute_id = -1; - long aapl_id = HDF5Constants.H5P_DEFAULT; try { attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, @@ -203,7 +207,7 @@ public class TestH5A { // Opening the existing attribute, obj_name(Created by H5ACreate2) // by index, attached to an object identifier. attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, - 0, HDF5Constants.H5P_DEFAULT, lapl_id); + 0, aapl_id, lapl_id); assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0); @@ -258,7 +262,7 @@ public class TestH5A { try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + aapl_id, lapl_id); assertTrue("testH5Acreate_by_name: H5Acreate_by_name", attribute_id >= 0); @@ -289,7 +293,7 @@ public class TestH5A { boolean bool_val = false; try { - attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id); + attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id); ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name); @@ -328,7 +332,7 @@ public class TestH5A { try { attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, - type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + type_id, space_id, HDF5Constants.H5P_DEFAULT, aapl_id, lapl_id); ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, new_attr_name, lapl_id); @@ -369,7 +373,7 @@ public class TestH5A { try { attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, - HDF5Constants.H5P_DEFAULT, lapl_id); + aapl_id, lapl_id); assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0); ret_name = H5.H5Aget_name(attribute_id); assertEquals(ret_name, attr_name); -- cgit v0.12 From d9653606d8b38689c7f4d0c757753b8acc378a04 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Mon, 24 Jun 2019 18:00:02 -0500 Subject: Fix for HDFFV-10808 H5Pset_file_space_strategy succeeds when using H5Pset_libver_bounds v18,v18. Fails file creation when non-default free-space info is set in fcpl and the library version high bound is less than v110 because free-space info message is introduced in library release v110. --- src/H5Fpkg.h | 3 + src/H5Fsuper.c | 64 +++++++++++++ src/H5MF.c | 3 + src/H5Ofsinfo.c | 10 +- src/H5Oprivate.h | 12 +++ test/tfile.c | 286 +++++++++++++++++++++++++++++++------------------------ 6 files changed, 249 insertions(+), 129 deletions(-) diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 335d0a7..6c1156f 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -318,6 +318,9 @@ struct H5F_file_t { H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ hsize_t fs_threshold; /* Free space section threshold */ hbool_t fs_persist; /* Free-space persist or not */ + unsigned fs_version; /* Free-space version: */ + /* It is used to update fsinfo message in the superblock + extension when closing down the free-space managers */ hbool_t use_tmp_space; /* Whether temp. file space allocation is allowed */ haddr_t tmp_addr; /* Next address to use for temp. space in the file */ hbool_t point_of_no_return; /* Flag to indicate that we can't go back and delete a freespace header when it's used up */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index ef52844..7d90df1 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -80,6 +80,15 @@ static const unsigned HDF5_superblock_ver_bounds[] = { HDF5_SUPERBLOCK_VERSION_LATEST /* H5F_LIBVER_LATEST */ }; +/* Format version bounds for fsinfo message */ +/* This message exists starting library release v1.10 */ +static const unsigned H5O_fsinfo_ver_bounds[] = { + H5O_INVALID_VERSION, /* H5F_LIBVER_EARLIEST */ + H5O_INVALID_VERSION, /* H5F_LIBVER_V18 */ + H5O_FSINFO_VERSION_1, /* H5F_LIBVER_V110 */ + H5O_FSINFO_VERSION_LATEST /* H5F_LIBVER_LATEST */ +}; + /*------------------------------------------------------------------------- * Function: H5F__super_ext_create @@ -782,6 +791,14 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free-space manager info message") /* Update changed values */ + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || + fsinfo.version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_FILE, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + if(f->shared->fs_version != fsinfo.version) + f->shared->fs_version = fsinfo.version; + if(f->shared->fs_strategy != fsinfo.strategy) { f->shared->fs_strategy = fsinfo.strategy; @@ -1375,6 +1392,11 @@ H5F__super_init(H5F_t *f) fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; fsinfo.mapped = FALSE; + /* Set the version for the fsinfo message */ + if(H5O__fsinfo_set_version(f, &fsinfo) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") + f->shared->fs_version = fsinfo.version; + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; @@ -1801,3 +1823,45 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5F__super_ext_remove_msg() */ + +/*------------------------------------------------------------------------- + * Function: H5O__fsinfo_set_version + * + * Purpose: Set the version to encode the fsinfo message with. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2019 + * + *------------------------------------------------------------------------- + */ +herr_t +H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) +{ + unsigned version; /* Message version */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(f); + HDassert(fsinfo); + + version = H5O_FSINFO_VERSION_1; + + /* Upgrade to the version indicated by the file's low bound if higher */ + if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) { + version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]); + } + + /* Version bounds check */ + if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || + version > H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)]) + HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "File space info message's version out of bounds") + + /* Set the message version */ + fsinfo->version = version; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5O__fsinfo_set_version() */ diff --git a/src/H5MF.c b/src/H5MF.c index 0d368d4..8d7ab96 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1835,6 +1835,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_pre_fsm_fsalloc; + fsinfo.version = f->shared->fs_version; /* Write the free space manager message -- message must already exist */ if(H5F__super_ext_write_msg(f, H5O_FSINFO_ID, &fsinfo, FALSE, H5O_MSG_FLAG_MARK_IF_UNKNOWN) < 0) @@ -1973,6 +1974,8 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.page_size = f->shared->fs_page_size; fsinfo.pgend_meta_thres = f->shared->pgend_meta_thres; fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; + fsinfo.version = f->shared->fs_version; + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index bb15f62..ec2328c 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -65,10 +65,6 @@ const H5O_msg_class_t H5O_MSG_FSINFO[1] = {{ H5O__fsinfo_debug /* debug the message */ }}; -/* Current version of free-space manager info information */ -#define H5O_FSINFO_VERSION_0 0 -#define H5O_FSINFO_VERSION_1 1 - /* Declare a free list to manage the H5O_fsinfo_t struct */ H5FL_DEFINE_STATIC(H5O_fsinfo_t); @@ -157,11 +153,13 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file space strategy") } /* end switch */ + fsinfo->version = H5O_FSINFO_VERSION_1; fsinfo->mapped = TRUE; } else { - HDassert(vers == H5O_FSINFO_VERSION_1); + HDassert(vers >= H5O_FSINFO_VERSION_1); + fsinfo->version = vers; fsinfo->strategy = (H5F_fspace_strategy_t)*p++; /* File space strategy */ fsinfo->persist = *p++; /* Free-space persist or not */ H5F_DECODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section threshold */ @@ -214,7 +212,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c HDassert(p); HDassert(fsinfo); - *p++ = H5O_FSINFO_VERSION_1; /* message version */ + *p++ = (uint8_t)fsinfo->version; /* message version */ *p++ = fsinfo->strategy; /* File space strategy */ *p++ = (unsigned char)fsinfo->persist; /* Free-space persist or not */ H5F_ENCODE_LENGTH(f, p, fsinfo->threshold); /* Free-space section size threshold */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 5987ecf..d143f31 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -804,6 +804,17 @@ typedef uint32_t H5O_refcount_t; /* Contains # of links to object, if >1 */ typedef unsigned H5O_unknown_t; /* Original message type ID */ +/* To indicate an invalid version for a message that does not exist yet for the release */ +/* Message version is 1 byte so the value can be 0 to 255 */ +#define H5O_INVALID_VERSION 256 + +/* The initial version of the fsinfo message: deprecated */ +/* This version is mapped to version 1 from release 1.10.1 onwards */ +#define H5O_FSINFO_VERSION_0 0 + +/* The latest version for fsinfo message */ +#define H5O_FSINFO_VERSION_1 1 +#define H5O_FSINFO_VERSION_LATEST H5O_FSINFO_VERSION_1 /* * File space info Message. * Contains file space management info and @@ -811,6 +822,7 @@ typedef unsigned H5O_unknown_t; /* Original message type ID */ * (Data structure in memory) */ typedef struct H5O_fsinfo_t { + unsigned version; /* Version number */ H5F_fspace_strategy_t strategy; /* File space strategy */ hbool_t persist; /* Persisting free-space or not */ hsize_t threshold; /* Free-space section threshold */ diff --git a/test/tfile.c b/test/tfile.c index c15064a..0dd0700 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -181,8 +181,8 @@ const char *FILESPACE_NAME[] = { /* Local test function declarations for version bounds */ static void test_libver_bounds_low_high(void); static void test_libver_bounds_super(hid_t fapl); -static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr); -static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr); +static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); +static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm); static void test_libver_bounds_obj(hid_t fapl); static void test_libver_bounds_dataset(hid_t fapl); static void test_libver_bounds_dataspace(hid_t fapl); @@ -4819,7 +4819,7 @@ test_filespace_1_10_0_compatible(void) for(j = 0; j < NELMTS(OLD_1_10_0_FILENAME); j++) { /* Make a copy of the test file */ status = h5_make_local_copy(OLD_1_10_0_FILENAME[j], FILE5); - CHECK(status, FAIL, "h5_make_local_copy"); + CHECK(status, FAIL, "h5_make_local_copy"); /* Open the temporary test file */ fid = H5Fopen(FILE5, H5F_ACC_RDWR, H5P_DEFAULT); @@ -5583,13 +5583,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #A and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5604,13 +5604,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #B and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5627,13 +5627,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, FALSE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #C and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, FALSE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, FALSE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5648,13 +5648,13 @@ test_libver_bounds_super(hid_t fapl) /* Verify superblock version when creating a file with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_create(fapl, fcpl, TRUE); - test_libver_bounds_super_create(fapl, fcpl, FALSE); + test_libver_bounds_super_create(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_create(fapl, fcpl, FALSE, TRUE); /* Verify superblock version when opening a file which is created with input fapl, fcpl #D and with/without SWMR access */ - test_libver_bounds_super_open(fapl, fcpl, TRUE); - test_libver_bounds_super_open(fapl, fcpl, FALSE); + test_libver_bounds_super_open(fapl, fcpl, TRUE, TRUE); + test_libver_bounds_super_open(fapl, fcpl, FALSE, TRUE); /* Close the fcpl */ ret = H5Pclose(fcpl); @@ -5666,8 +5666,8 @@ test_libver_bounds_super(hid_t fapl) /************************************************************************************************** ** ** test_libver_bounds_super_create(): -** Verify the following when the file is created with the input fapl, fcpl, and -** with/without SWMR access: +** Verify the following when the file is created with the input fapl, fcpl, +** and with/without SWMR access: ** (a) the superblock version # ** (b) the file's low bound setting ** (c) fail or succeed in creating the file @@ -5679,7 +5679,10 @@ test_libver_bounds_super(hid_t fapl) ** in the input fapl. The next three rows list the expected results for #a to #c. ** "-->" indicates "upgrade to" ** -** Creating a file with write access +** The last table lists the expected results in creating the file when non-default +** free-space info (fsinfo) is enabled in fcpl. +** +** Creating a file with write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -5690,7 +5693,7 @@ test_libver_bounds_super(hid_t fapl) ** File creation | succeed | ** |______________________________________________________________________________| ** -** Creating a file with SWMR-write access +** Creating a file with SWMR-write access ** -------------------------------------------------------------------------------- ** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | ** |______________________________________________________________________________| @@ -5698,12 +5701,19 @@ test_libver_bounds_super(hid_t fapl) ** |------------------------------------------------------------------------------| ** File's low bound | -- | ->v110 | -- | ->v110 | no change | ** |------------------------------------------------------------------------------| -** File creation | fail | succeed | fail | succeed | succed | +** File creation | fail | succeed | fail | succeed | succeed | +** |______________________________________________________________________________| +** +** Creating a file with write/SWMR-write access + non-default fsinfo +** -------------------------------------------------------------------------------- +** | (earliest, v18) | (earliest, v110) | (v18, v18) | (v18, v110) | (v110, v110) | +** |______________________________________________________________________________| +** File creation | fail | succeed | fail | succeed | succeed | ** |______________________________________________________________________________| ** ******************************************************************************************************/ static void -test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) +test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { hid_t fid = -1; /* File ID */ H5F_t *f = NULL; /* Internal file pointer */ @@ -5726,8 +5736,10 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ret = H5Pget_libver_bounds(fapl, &low, &high); CHECK(ret, FAIL, "H5Pget_libver_bounds"); - if(is_swmr) { /* SWMR is enabled */ + if(non_def_fsm && high < H5F_LIBVER_V110) + VERIFY(fid, FAIL, "H5Fcreate"); + else if(is_swmr) { /* SWMR is enabled */ if(high >= H5F_LIBVER_V110) { /* Should succeed */ VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(HDF5_SUPERBLOCK_VERSION_3, f->shared->sblock->super_vers, "HDF5_superblock_ver_bounds"); @@ -5736,37 +5748,37 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) } else /* Should fail */ VERIFY(fid >= 0, FALSE, "H5Fcreate"); - } - else { /* Should succeed */ + } else { /* Should succeed */ VERIFY(fid >= 0, TRUE, "H5Fcreate"); VERIFY(low, f->shared->low_bound, "HDF5_superblock_ver_bounds"); switch(low) { case H5F_LIBVER_EARLIEST: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF || - f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 || - f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_DEF || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_1 || + f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_V18: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_2); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_V110: case H5F_LIBVER_V112: - ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); - VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); - break; + ok = (f->shared->sblock->super_vers == HDF5_SUPERBLOCK_VERSION_3); + VERIFY(ok, TRUE, "HDF5_superblock_ver_bounds"); + break; case H5F_LIBVER_ERROR: case H5F_LIBVER_NBOUNDS: default: - ERROR("H5Pget_libver_bounds"); + ERROR("H5Pget_libver_bounds"); } /* end switch */ - } + + } /* end else */ if(fid >= 0) { /* Close the file */ ret = H5Fclose(fid); @@ -5793,11 +5805,14 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** For file open, the file's superblock version, the low/high bounds setting in fapl, ** and with/without SWMR file access will determine the results for #a and #b. ** -** The first row for the following tables is the 5 pairs of low/high bounds setting +** The first row for the following tables (#A - #B) is the 5 pairs of low/high bounds setting ** in the input fapl. The next two rows list the expected results for #a and #b. ** "-->" indicates "upgrade to" ** -** Opening a file with write access +** The last table (#C) lists the expected results in opening the file when non-default +** free-space info (fsinfo) is enabled in fcpl. +** +** (A) Opening a file with write access ** ** Superblock version 0, 1 ** -------------------------------------------------------------------------------- @@ -5829,7 +5844,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** ** ** -** Opening a file with SWMR-write access +** (B) Opening a file with SWMR-write access ** ** Superblock version 0, 1, 2 ** ------------------------------------------------------------------------------- @@ -5851,9 +5866,17 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr) ** |_____________________________________________________________________________| ** ** +** (C) Opening a file with write/SWMR-write access + non-default fsinfo +** ------------------------------------------------------------------------------- +** | (earliest, v18) | (earliest, v10) | (v18, v18) | (v18, v110) | (v110, v110) | +** |_____________________________________________________________________________| +** File open | fail | succeed | fail | succeed | succeed | +** |_____________________________________________________________________________| +** +** ******************************************************************************************************/ static void -test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) +test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { hid_t fid = -1; /* File ID */ H5F_t *f = NULL; /* Internal file pointer */ @@ -5863,96 +5886,113 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr) herr_t ret; /* Return value */ /* Create the file with the input fcpl and fapl */ - fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + H5E_BEGIN_TRY { + fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); + } H5E_END_TRY; - /* Get the internal file pointer */ - f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); + /* Retrieve the low/high bounds */ + ret = H5Pget_libver_bounds(fapl, &low, &high); + CHECK(ret, FAIL, "H5Pget_libver_bounds"); - /* The file's superblock version */ - super_vers = f->shared->sblock->super_vers; + if(non_def_fsm && high < H5F_LIBVER_V110) { + VERIFY(fid, FAIL, "H5Fcreate"); - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); + } else { + VERIFY(fid >= 0, TRUE, "H5Fcreate"); - /* Create a default file access property list */ - new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + /* Get the internal file pointer */ + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); - /* Loop through all the combinations of low/high bounds in new_fapl */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { - H5E_BEGIN_TRY { - ret = H5Pset_libver_bounds(new_fapl, low, high); - } H5E_END_TRY; + /* The file's superblock version */ + super_vers = f->shared->sblock->super_vers; - /* Invalid combinations */ - if (ret < 0) - continue; + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); - /* Open the file with or without SWMR access */ - H5E_BEGIN_TRY { - fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); - } H5E_END_TRY; + /* Create a default file access property list */ + new_fapl = H5Pcreate(H5P_FILE_ACCESS); + CHECK(new_fapl, FAIL, "H5Pcreate"); - /* Get the internal file pointer if the open succeeds */ - if(fid >= 0) { - f = (H5F_t *)H5VL_object(fid); - CHECK(f, NULL, "H5VL_object"); - } + /* Loop through all the combinations of low/high bounds in new_fapl */ + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + H5E_BEGIN_TRY { + ret = H5Pset_libver_bounds(new_fapl, low, high); + } H5E_END_TRY; - /* Verify the file open succeeds or fails */ - switch(super_vers) { - case 3: - if(high >= H5F_LIBVER_V110) { - /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } else /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - break; - - case 2: - if(is_swmr) /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); - - /* Close the file */ - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; - - case 1: - case 0: - if(is_swmr) /* Should fail */ - VERIFY(fid >= 0, FALSE, "H5Fopen"); - else { /* Should succeed */ - VERIFY(fid >= 0, TRUE, "H5Fopen"); - VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); - - ret = H5Fclose(fid); - CHECK(ret, FAIL, "H5Fclose"); - } - break; + /* Invalid combinations */ + if (ret < 0) + continue; + + /* Open the file with or without SWMR access */ + H5E_BEGIN_TRY { + fid = H5Fopen(FILE8, H5F_ACC_RDWR | (is_swmr ? H5F_ACC_SWMR_WRITE : 0), new_fapl); + } H5E_END_TRY; + + if(non_def_fsm && high < H5F_LIBVER_V110) { + VERIFY(fid, FAIL, "H5Fopen"); + continue; + } + + /* Get the internal file pointer if the open succeeds */ + if(fid >= 0) { + f = (H5F_t *)H5VL_object(fid); + CHECK(f, NULL, "H5VL_object"); + } - default: - break; - } /* end switch */ + /* Verify the file open succeeds or fails */ + switch(super_vers) { + case 3: + if(high >= H5F_LIBVER_V110) { + /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V110, TRUE, "HDF5_superblock_ver_bounds"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } else /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + break; + + case 2: + if(is_swmr) /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + else { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound >= H5F_LIBVER_V18, TRUE, "HDF5_superblock_ver_bounds"); + + /* Close the file */ + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } + break; + + case 1: + case 0: + if(is_swmr) /* Should fail */ + VERIFY(fid >= 0, FALSE, "H5Fopen"); + else { /* Should succeed */ + VERIFY(fid >= 0, TRUE, "H5Fopen"); + VERIFY(f->shared->low_bound, low, "HDF5_superblock_ver_bounds"); + + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + } + break; + + default: + break; + } /* end switch */ + } /* end for */ } /* end for */ - } /* end for */ - /* Close the file access property list */ - ret = H5Pclose(new_fapl); - CHECK(ret, FAIL, "H5Pclose"); + /* Close the file access property list */ + ret = H5Pclose(new_fapl); + CHECK(ret, FAIL, "H5Pclose"); + } /* end else */ } /* end test_libver_bounds_super_open() */ -- cgit v0.12 From 71de5b808818a2619fe179eac4f6c6ec892a4420 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 25 Jun 2019 11:47:33 -0500 Subject: Correct hid_t error value to H5I_INVALID_HID in tests related to libver_bounds. --- test/tfile.c | 224 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 112 insertions(+), 112 deletions(-) diff --git a/test/tfile.c b/test/tfile.c index 0dd0700..9e17c34 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -5501,16 +5501,16 @@ test_libver_bounds(void) static void test_libver_bounds_low_high(void) { - hid_t fapl = -1; /* File access property list */ - H5F_libver_t low, high; /* Low and high bounds */ - herr_t ret; /* The return value */ + hid_t fapl = H5I_INVALID_HID; /* File access property list */ + H5F_libver_t low, high; /* Low and high bounds */ + herr_t ret; /* The return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing setting (low, high) format version bounds\n")); /* Create a file access property list */ fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(fapl, FAIL, "H5Pcreate"); + CHECK(fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high version bounds */ for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) @@ -5573,13 +5573,13 @@ test_libver_bounds_low_high(void) static void test_libver_bounds_super(hid_t fapl) { - hid_t fcpl = -1; /* File creation property list */ - herr_t ret; /* The return value */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + herr_t ret; /* The return value */ /* Create a default fcpl: #A */ /* This will result in superblock version 0 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Verify superblock version when creating a file with input fapl, fcpl #A and with/without SWMR access */ @@ -5598,7 +5598,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with v1-btree K value enabled: #B */ /* This will result in superblock version 1 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_istore_k(fcpl, 64); CHECK(ret, FAIL, "H5Pset_istore_k"); @@ -5619,7 +5619,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with shared messages enabled: #C */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_shared_mesg_nindexes(fcpl, 1); CHECK(ret, FAIL, "H5Pset_shared_mesg_nindexes"); ret = H5Pset_shared_mesg_index(fcpl, 0, H5O_SHMESG_ATTR_FLAG, 2); @@ -5642,7 +5642,7 @@ test_libver_bounds_super(hid_t fapl) /* Create a fcpl with persistent free-space manager enabled: #D */ /* This will result in superblock version 2 */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1); CHECK(ret, FAIL, "H5Pset_file_space"); @@ -5715,11 +5715,11 @@ test_libver_bounds_super(hid_t fapl) static void test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { - hid_t fid = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ - H5F_libver_t low, high; /* Low and high bounds */ - hbool_t ok; /* The result is ok or not */ - herr_t ret; /* The return value */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file pointer */ + H5F_libver_t low, high; /* Low and high bounds */ + hbool_t ok; /* The result is ok or not */ + herr_t ret; /* The return value */ /* Try to create the file */ H5E_BEGIN_TRY { @@ -5737,7 +5737,7 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n CHECK(ret, FAIL, "H5Pget_libver_bounds"); if(non_def_fsm && high < H5F_LIBVER_V110) - VERIFY(fid, FAIL, "H5Fcreate"); + VERIFY(fid, H5I_INVALID_HID, "H5Fcreate"); else if(is_swmr) { /* SWMR is enabled */ if(high >= H5F_LIBVER_V110) { /* Should succeed */ @@ -5878,9 +5878,9 @@ test_libver_bounds_super_create(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t n static void test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non_def_fsm) { - hid_t fid = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file pointer */ - hid_t new_fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + H5F_t *f = NULL; /* Internal file pointer */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ unsigned super_vers; /* Superblock version */ H5F_libver_t low, high; /* Low and high bounds */ herr_t ret; /* Return value */ @@ -5895,7 +5895,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non CHECK(ret, FAIL, "H5Pget_libver_bounds"); if(non_def_fsm && high < H5F_LIBVER_V110) { - VERIFY(fid, FAIL, "H5Fcreate"); + VERIFY(fid, H5I_INVALID_HID, "H5Fcreate"); } else { VERIFY(fid >= 0, TRUE, "H5Fcreate"); @@ -5932,7 +5932,7 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non } H5E_END_TRY; if(non_def_fsm && high < H5F_LIBVER_V110) { - VERIFY(fid, FAIL, "H5Fopen"); + VERIFY(fid, H5I_INVALID_HID, "H5Fopen"); continue; } @@ -6025,10 +6025,10 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non static void test_libver_bounds_obj(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t gid = -1; /* Group ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t new_fapl = -1; /* File access property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ H5O_info_t oinfo; /* Object info */ @@ -6041,7 +6041,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a default file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Enable shared message in the fcpl */ /* This will result in a version 2 object header */ @@ -6052,7 +6052,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create the file with the fcpl and the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -6071,7 +6071,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a file with the default fcpl and input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Get root group's object info */ ret = H5Oget_info_by_name2(fid, "/", &oinfo, H5O_INFO_HDR, H5P_DEFAULT); @@ -6087,7 +6087,7 @@ test_libver_bounds_obj(hid_t fapl) /* Create a new default file access property list which is used to open the file in the "for" loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Loop through all the combinations of low/high bounds in new_fapl */ /* Open the file with the fapl; create a group and verify the @@ -6185,11 +6185,11 @@ test_libver_bounds_obj(hid_t fapl) static void test_libver_bounds_dataset(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File access property list */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t dcpl = -1; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ H5D_t *dset = NULL; /* Internal dataset pointer */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6206,15 +6206,15 @@ test_libver_bounds_dataset(hid_t fapl) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create the dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a contiguous dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataset pointer */ dset = (H5D_t *)H5VL_object(did); @@ -6246,9 +6246,9 @@ test_libver_bounds_dataset(hid_t fapl) with "no filter edge chunks" enabled. This will result in a version 4 layout message */ sid = H5Screate_simple(2, fix_dims2, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, fix_chunks2); CHECK(ret, FAIL, "H5Pset_chunk"); ret = H5Pset_chunk_opts(dcpl, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS); @@ -6289,14 +6289,14 @@ test_libver_bounds_dataset(hid_t fapl) /* Create a default file access property list which is used to open the file in the 'for' loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset with 2 unlimited dimensions in the 'for' loop */ sid = H5Screate_simple(2, dims2, max_dims2); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, chunks2); CHECK(ret, FAIL, "H5Pset_chunk"); @@ -6325,7 +6325,7 @@ test_libver_bounds_dataset(hid_t fapl) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal file pointer */ dset = (H5D_t *)H5VL_object(did); @@ -6409,14 +6409,14 @@ test_libver_bounds_dataset(hid_t fapl) static void test_libver_bounds_dataspace(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File access property list */ - hid_t did = -1, did_null = -1; /* Dataset IDs */ - hid_t did_compact = -1, did_contig = -1; /* Dataset IDs */ - hid_t sid = -1, sid_null = -1; /* Dataspace IDs */ - hid_t sid_compact = -1, sid_contig = -1; /* Dataspace IDs */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dcpl_compact = -1, dcpl_contig = -1; /* Dataset creation property lists */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t did = H5I_INVALID_HID, did_null = H5I_INVALID_HID; /* Dataset IDs */ + hid_t did_compact = H5I_INVALID_HID, did_contig = H5I_INVALID_HID; /* Dataset IDs */ + hid_t sid = H5I_INVALID_HID, sid_null = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t sid_compact = H5I_INVALID_HID, sid_contig = H5I_INVALID_HID; /* Dataspace IDs */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t dcpl_compact = H5I_INVALID_HID, dcpl_contig = H5I_INVALID_HID; /* Dataset creation property lists */ H5S_t *space = NULL, *space_null = NULL; /* Internal dataspace pointers */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6432,19 +6432,19 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create scalar dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a dataset with the scalar dataspace */ did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataspace pointer */ sid = H5Dget_space(did); - CHECK(sid, FAIL, "H5Dget_space"); + CHECK(sid, H5I_INVALID_HID, "H5Dget_space"); space = (H5S_t *)H5I_object(sid); CHECK(space, NULL, "H5I_object"); @@ -6453,15 +6453,15 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create null dataspace */ sid_null = H5Screate(H5S_NULL); - CHECK(sid_null, FAIL, "H5Screate"); + CHECK(sid_null, H5I_INVALID_HID, "H5Screate"); /* Create a dataset with the null dataspace */ did_null = H5Dcreate2(fid, DSET_NULL, H5T_NATIVE_INT, sid_null, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did_null, FAIL, "H5Dcreate"); + CHECK(did_null, H5I_INVALID_HID, "H5Dcreate"); /* Get the internal dataspace pointer */ sid_null = H5Dget_space(did_null); - CHECK(sid_null, FAIL, "H5Dget_space"); + CHECK(sid_null, H5I_INVALID_HID, "H5Dget_space"); space_null = (H5S_t *)H5I_object(sid_null); CHECK(space_null, NULL, "H5I_object"); @@ -6487,29 +6487,29 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create a default file access property list which is used to open the file in the 'for' loop */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset */ sid = H5Screate_simple(1, dims, max_dims); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 1, chunks); CHECK(ret, FAIL, "H5Pset_chunk"); /* Set up dataspace and dcpl for creating a compact dataset */ sid_compact = H5Screate_simple(1, dims, NULL); - CHECK(sid_compact, FAIL, "H5Screate_simple"); + CHECK(sid_compact, H5I_INVALID_HID, "H5Screate_simple"); dcpl_compact = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl_compact, FAIL, "H5Pcreate"); + CHECK(dcpl_compact, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_layout(dcpl_compact, H5D_COMPACT); CHECK(ret, FAIL, "H5Pset_layout"); /* Set up dataspace and dcpl for creating a contiguous dataset */ sid_contig = H5Screate_simple(2, dims2, NULL); - CHECK(sid_contig, FAIL, "H5Screate_simple"); + CHECK(sid_contig, H5I_INVALID_HID, "H5Screate_simple"); dcpl_contig = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl_contig, FAIL, "H5Pcreate"); + CHECK(dcpl_contig, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_layout(dcpl_contig, H5D_CONTIGUOUS); CHECK(ret, FAIL, "H5Pset_layout"); @@ -6541,31 +6541,31 @@ test_libver_bounds_dataspace(hid_t fapl) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETA, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the chunked dataset */ tmp_sid = H5Dget_space(did); - CHECK(tmp_sid, FAIL, "H5Dget_space"); + CHECK(tmp_sid, H5I_INVALID_HID, "H5Dget_space"); tmp_space = (H5S_t *)H5I_object(tmp_sid); CHECK(tmp_space, NULL, "H5I_object"); /* Create the compact dataset */ did_compact = H5Dcreate2(fid, DSETB, H5T_NATIVE_INT, sid_compact, H5P_DEFAULT, dcpl_compact, H5P_DEFAULT); - CHECK(did_compact, FAIL, "H5Dcreate2"); + CHECK(did_compact, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the compact dataset */ tmp_sid_compact = H5Dget_space(did_compact); - CHECK(tmp_sid_compact, FAIL, "H5Dget_space"); + CHECK(tmp_sid_compact, H5I_INVALID_HID, "H5Dget_space"); tmp_space_compact = (H5S_t *)H5I_object(tmp_sid_compact); CHECK(tmp_space_compact, NULL, "H5I_object"); /* Create the contiguous dataset */ did_contig = H5Dcreate2(fid, DSETC, H5T_NATIVE_INT, sid_contig, H5P_DEFAULT, dcpl_contig, H5P_DEFAULT); - CHECK(did_contig, FAIL, "H5Dcreate2"); + CHECK(did_contig, H5I_INVALID_HID, "H5Dcreate2"); /* Get the internal dataspace pointer for the contiguous dataset */ tmp_sid_contig = H5Dget_space(did_contig); - CHECK(tmp_sid_contig, FAIL, "H5Dget_space"); + CHECK(tmp_sid_contig, H5I_INVALID_HID, "H5Dget_space"); tmp_space_contig = (H5S_t *)H5I_object(tmp_sid_contig); CHECK(tmp_space_contig, NULL, "H5I_object"); @@ -6647,8 +6647,8 @@ test_libver_bounds_dataspace(hid_t fapl) static void test_libver_bounds_datatype(hid_t fapl) { - hid_t tid = -1, tid_enum = -1, tid_array = -1; /* Datatype IDs */ - hid_t tid_compound = -1, tid_vlen = -1; /* Datatype IDs */ + hid_t tid = H5I_INVALID_HID, tid_enum = H5I_INVALID_HID, tid_array = H5I_INVALID_HID; /* Datatype IDs */ + hid_t tid_compound = H5I_INVALID_HID, tid_vlen = H5I_INVALID_HID; /* Datatype IDs */ int enum_value; /* Value for enum datatype */ typedef struct s1 { /* Data structure for compound datatype */ char c; @@ -6739,13 +6739,13 @@ test_libver_bounds_datatype(hid_t fapl) static void test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) { - hid_t fid = -1; /* File ID */ - hid_t new_fapl = -1; /* File acess property list */ - hid_t dcpl = -1; /* Dataset creation property list */ - hid_t dtid = -1; /* Datatype ID for the dataset */ - hid_t str_tid = -1; /* String datatype ID */ - hid_t did = -1; /* Dataset ID */ - hid_t sid = -1; /* Dataspace ID */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t new_fapl = H5I_INVALID_HID; /* File acess property list */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ + hid_t dtid = H5I_INVALID_HID; /* Datatype ID for the dataset */ + hid_t str_tid = H5I_INVALID_HID; /* String datatype ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ hsize_t dims[1] = {1}; /* Dimension sizes */ hsize_t dims2[2] = {5, 4}; /* Dimension sizes */ hsize_t max_dims2[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Maximum dimension sizes */ @@ -6762,12 +6762,12 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create the file with the input fapl */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create a committed datatype of string which will be used later inside the 'for' loop */ str_tid = H5Tcopy(H5T_C_S1); - CHECK(str_tid, FAIL, "H5Tcopy"); + CHECK(str_tid, H5I_INVALID_HID, "H5Tcopy"); ret = H5Tset_size(str_tid, (size_t)10); CHECK(ret, FAIL, "H5Tset_size"); ret = H5Tcommit2(fid, "datatype", str_tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -6777,15 +6777,15 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create dataspace */ sid = H5Screate_simple(1, dims, NULL); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); /* Create a dataset with the input tid */ did = H5Dcreate2(fid, DSET1, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the dataset's datatype */ dtid = H5Dget_type(did); - CHECK(dtid, FAIL, "H5Dget_type"); + CHECK(dtid, H5I_INVALID_HID, "H5Dget_type"); /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); @@ -6827,13 +6827,13 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create a default file access property list */ new_fapl = H5Pcreate(H5P_FILE_ACCESS); - CHECK(new_fapl, FAIL, "H5Pcreate"); + CHECK(new_fapl, H5I_INVALID_HID, "H5Pcreate"); /* Set up dataspace and dcpl for creating a chunked dataset */ sid = H5Screate_simple(2, dims2, max_dims2); - CHECK(sid, FAIL, "H5Screate_simple"); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); dcpl = H5Pcreate(H5P_DATASET_CREATE); - CHECK(dcpl, FAIL, "H5Pcreate"); + CHECK(dcpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_chunk(dcpl, 2, chunks); CHECK(ret, FAIL, "H5Pset_chunk"); @@ -6877,11 +6877,11 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) /* Create the chunked dataset */ did = H5Dcreate2(fid, DSETNAME, tid, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); - CHECK(did, FAIL, "H5Dcreate2"); + CHECK(did, H5I_INVALID_HID, "H5Dcreate2"); /* Get the dataset's datatype */ dtid = H5Dget_type(did); - CHECK(dtid, FAIL, "H5Dget_type"); + CHECK(dtid, H5I_INVALID_HID, "H5Dget_type"); /* Get the internal datatype pointer */ dtype = (H5T_t *)H5I_object(dtid); @@ -6974,14 +6974,14 @@ test_libver_bounds_datatype_check(hid_t fapl, hid_t tid) static void test_libver_bounds_attributes(hid_t fapl) { - hid_t fid = -1; /* File ID */ - hid_t fcpl = -1; /* File creation property list */ - hid_t new_fapl = -1; /* File access property list */ - hid_t tid = -1; /* Datatype ID */ - hid_t gid = -1; /* Group ID */ - hid_t sid = -1; /* Dataspace ID */ - hid_t aid = -1; /* Attribute ID */ - hid_t attr_cpl = -1; /* Attribute creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fcpl = H5I_INVALID_HID; /* File creation property list */ + hid_t new_fapl = H5I_INVALID_HID; /* File access property list */ + hid_t tid = H5I_INVALID_HID; /* Datatype ID */ + hid_t gid = H5I_INVALID_HID; /* Group ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t aid = H5I_INVALID_HID; /* Attribute ID */ + hid_t attr_cpl = H5I_INVALID_HID; /* Attribute creation property list */ H5A_t *attr = NULL; /* Internal attribute pointer */ H5F_t *f = NULL; /* Internal file pointer */ H5F_libver_t low, high; /* Low and high bounds */ @@ -6993,11 +6993,11 @@ test_libver_bounds_attributes(hid_t fapl) /* Create the file */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, H5P_DEFAULT, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Integer datatpye */ tid = H5Tcopy(H5T_NATIVE_INT); - CHECK(tid, FAIL, "H5Tcopy"); + CHECK(tid, H5I_INVALID_HID, "H5Tcopy"); /* Create a committed datatype */ ret = H5Tcommit2(fid, "datatype", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); @@ -7005,15 +7005,15 @@ test_libver_bounds_attributes(hid_t fapl) /* Create dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a group */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); /* Attach an attribute to the group with the committed datatype */ aid = H5Acreate2(gid, "attr1", tid, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); @@ -7047,13 +7047,13 @@ test_libver_bounds_attributes(hid_t fapl) /* Enable character encoding in attribute creation property list */ attr_cpl = H5Pcreate(H5P_ATTRIBUTE_CREATE); - CHECK(attr_cpl, FAIL, "H5Pcreate"); + CHECK(attr_cpl, H5I_INVALID_HID, "H5Pcreate"); ret = H5Pset_char_encoding(attr_cpl, H5T_CSET_UTF8); CHECK(ret, FAIL, "H5Pset_char_encoding"); /* Attach an attribute to the group with character encoding set */ aid = H5Acreate2(gid, "attr3", H5T_NATIVE_INT, sid, attr_cpl, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); @@ -7092,7 +7092,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Create a copy of the file creation property list */ fcpl = H5Pcreate(H5P_FILE_CREATE); - CHECK(fcpl, FAIL, "H5Pcreate"); + CHECK(fcpl, H5I_INVALID_HID, "H5Pcreate"); /* Enable shared datatype message */ ret = H5Pset_shared_mesg_nindexes(fcpl, 1); @@ -7102,23 +7102,23 @@ test_libver_bounds_attributes(hid_t fapl) /* Create the file with shared datatype message enabled */ fid = H5Fcreate(FILE8, H5F_ACC_TRUNC, fcpl, fapl); - CHECK(fid, FAIL, "H5Fcreate"); + CHECK(fid, H5I_INVALID_HID, "H5Fcreate"); /* Create an integer datatye */ tid = H5Tcopy(H5T_NATIVE_INT); - CHECK(tid, FAIL, "H5Tcopy"); + CHECK(tid, H5I_INVALID_HID, "H5Tcopy"); /* Create dataspace */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Create a group */ gid = H5Gcreate2(fid, GRP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - CHECK(gid, FAIL, "H5Gcreate2"); + CHECK(gid, H5I_INVALID_HID, "H5Gcreate2"); /* Attach an attribute to the group with shared integer datatype */ aid = H5Acreate2(gid, ATTR_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT); - CHECK(aid, FAIL, "H5Acreate2"); + CHECK(aid, H5I_INVALID_HID, "H5Acreate2"); /* Get the internal attribute pointer */ attr = (H5A_t *)H5VL_object(aid); @@ -7157,7 +7157,7 @@ test_libver_bounds_attributes(hid_t fapl) /* Create a scalar dataspace to be used later for the attribute */ sid = H5Screate(H5S_SCALAR); - CHECK(sid, FAIL, "H5Screate"); + CHECK(sid, H5I_INVALID_HID, "H5Screate"); /* Loop through all the combinations of low/high bounds */ /* Open the file and group and attach an attribute to the group */ -- cgit v0.12 From b40a6f75aaf3d40c6ea5f9cc8beb74ae8aaaba96 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 25 Jun 2019 12:08:33 -0700 Subject: Fixed a memory issue in trefer.c. --- test/trefer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/trefer.c b/test/trefer.c index 4bf9caf..9af5c89 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -526,7 +526,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) hssize_t hssize_ret; /* hssize_t return value */ htri_t tri_ret; /* htri_t return value */ herr_t ret; /* Generic return value */ - haddr_t addr = HADDR_UNDEF; /* test for undefined reference */ + hdset_reg_ref_t undef_reg[1]; /* test for undefined reference */ hid_t dset_NA; /* Dataset id for undefined reference */ hid_t space_NA; /* Dataspace id for undefined reference */ hsize_t dims_NA[1] = {1}; /* Dims array for undefined reference */ @@ -744,7 +744,7 @@ test_reference_region(H5F_libver_t libver_low, H5F_libver_t libver_high) CHECK(ret, FAIL, "H5Dread"); /* Try to read an unaddressed dataset */ - dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, &addr); + dset2 = H5Rdereference2(dset1, dapl_id, H5R_DATASET_REGION, undef_reg); VERIFY(dset2, FAIL, "H5Rdereference2 haddr_undef"); /* Try to open objects */ @@ -1781,8 +1781,8 @@ test_reference(void) test_reference_obj(); /* Test basic H5R object reference code */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) -- cgit v0.12 From 3768566139df18928aa29ece0eff3010b224633b Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Tue, 25 Jun 2019 14:47:53 -0500 Subject: Add release notes. --- release_docs/RELEASE.txt | 16 ++++++++++++++++ src/H5Fsuper.c | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c8061f5..7c9bbfa 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -282,6 +282,22 @@ Bug Fixes since HDF5-1.10.3 release Library ------- + - Fixed an issue where creating a file with non-default file space info + together with library high bound setting to H5F_LIBVER_V18. + + When setting non-default file space info in fcpl via + H5Pset_file_space_strategy() and then creating a file with + both high and low library bounds set to + H5F_LIBVER_V18 in fapl, the library succeeds in creating the file. + File creation should fail because the feature of setting non-default + file space info does not exist in library release 1.8 or earlier. + + This was fixed by setting and checking the proper version in the + file space info message based on the library low and high bounds + when creating and opening the HDF5 file. + + (VC - 2019/6/25, HDFFV-10808) + - Fixed an issue where copying a version 1.8 dataset between files using H5Ocopy fails due to an incompatible fill version diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 7d90df1..f4ff645 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1850,9 +1850,8 @@ H5O__fsinfo_set_version(H5F_t *f, H5O_fsinfo_t *fsinfo) version = H5O_FSINFO_VERSION_1; /* Upgrade to the version indicated by the file's low bound if higher */ - if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) { + if(H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)] != H5O_INVALID_VERSION) version = MAX(version, H5O_fsinfo_ver_bounds[H5F_LOW_BOUND(f)]); - } /* Version bounds check */ if(H5O_fsinfo_ver_bounds[H5F_HIGH_BOUND(f)] == H5O_INVALID_VERSION || -- cgit v0.12 From 8ac60adaa2af21b57185c145d70a12d16a0b7409 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 25 Jun 2019 23:19:09 -0700 Subject: Banish enum increment warnings --- test/enc_dec_plist.c | 4 ++-- test/th5s.c | 4 ++-- test/vds.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c index 2c8f691..23bec6e 100644 --- a/test/enc_dec_plist.c +++ b/test/enc_dec_plist.c @@ -187,8 +187,8 @@ main(void) -1 }; /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ char* low_string; /* The low bound string */ char* high_string; /* The high bound string */ diff --git a/test/th5s.c b/test/th5s.c index c5dfa97..a48979b 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -3366,8 +3366,8 @@ test_h5s(void) test_h5s_zero_dim(); /* Test dataspace with zero dimension size */ /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { /* Invalid combinations, just continue */ if(high == H5F_LIBVER_EARLIEST || high < low) diff --git a/test/vds.c b/test/vds.c index af052a8..30f8eec 100644 --- a/test/vds.c +++ b/test/vds.c @@ -12160,8 +12160,8 @@ main(void) if((my_fapl = H5Pcopy(fapl)) < 0) TEST_ERROR /* Loop through all the combinations of low/high version bounds */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { char msg[80]; /* Message for file version bounds */ char *low_string; /* The low bound string */ char *high_string; /* The high bound string */ -- cgit v0.12