diff options
Diffstat (limited to 'test')
42 files changed, 1621 insertions, 231 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ca975f9..9ff9614 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,6 +25,9 @@ ADD_LIBRARY (${HDF5_TEST_LIB_TARGET} ${LIB_TYPE} ${TEST_LIB_SRCS} ${TEST_LIB_HEA IF (MSVC) TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "ws2_32.lib") ENDIF (MSVC) +IF (MINGW) + TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} "wsock32.lib") +ENDIF (MINGW) TARGET_LINK_LIBRARIES (${HDF5_TEST_LIB_TARGET} ${HDF5_LIB_TARGET}) SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TEST_LIB_TARGET}") H5_SET_LIB_OPTIONS (${HDF5_TEST_LIB_TARGET} ${HDF5_TEST_LIB_NAME} ${LIB_TYPE}) diff --git a/test/Makefile.am b/test/Makefile.am index e47c978..70f49f1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -114,7 +114,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 \ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \ chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ - sys_file1 tfile[1-5].h5 th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 \ + sys_file1 tfile[1-5].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ @@ -131,9 +131,10 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 \ dtransform.h5 test_filters.h5 get_file_name.h5 tstint[1-2].h5 \ unlink_chunked.h5 btree2.h5 objcopy_src.h5 objcopy_dst.h5 \ objcopy_ext.dat trefer1.h5 trefer2.h5 app_ref.h5 farray.h5 \ - earray.h5 efc[0-5].h5 swmr_data.h5 flushrefresh.h5 flushrefresh_VERIFICATION_START \ - flushrefresh_VERIFICATION_CHECKPOINT1 flushrefresh_VERIFICATION_CHECKPOINT2 \ - flushrefresh_VERIFICATION_DONE + earray.h5 efc[0-5].h5 log_vfd_out.log swmr_data.h5 \ + flushrefresh.h5 flushrefresh_VERIFICATION_START \ + flushrefresh_VERIFICATION_CHECKPOINT1 flushrefresh_VERIFICATION_CHECKPOINT2 \ + flushrefresh_VERIFICATION_DONE # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/Makefile.in b/test/Makefile.in index e5667c2..268d334 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -81,6 +81,9 @@ libh5test_la_LIBADD = am_libh5test_la_OBJECTS = h5test.lo testframe.lo cache_common.lo \ swmr_common.lo libh5test_la_OBJECTS = $(am_libh5test_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent am__installdirs = "$(DESTDIR)$(bindir)" am__EXEEXT_1 = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \ stab$(EXEEXT) gheap$(EXEEXT) cache$(EXEEXT) cache_api$(EXEEXT) \ @@ -417,13 +420,26 @@ am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(libh5test_la_SOURCES) accum.c app_ref.c big.c bittests.c \ btree2.c cache.c cache_api.c cache_tagging.c cmpd_dset.c \ cross_read.c dangle.c dsets.c dt_arith.c dtransform.c dtypes.c \ @@ -469,13 +485,16 @@ AMTAR = @AMTAR@ # but which should not be exported to h5cc for building other programs. # AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. +# This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ -AM_LDFLAGS = @AM_LDFLAGS@ +AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ +AS = @AS@ # Set the paths for AFS installs of autotools for Linux machines # Ideally, these tools should never be needed during the build. @@ -535,7 +554,10 @@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ +H5_CXX_SHARED = @H5_CXX_SHARED@ H5_FCFLAGS = @H5_FCFLAGS@ +H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ +H5_LDFLAGS = @H5_LDFLAGS@ H5_LONE_COLON = @H5_LONE_COLON@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ @@ -744,7 +766,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_fast.h5 \ chunk_expand.h5 copy_dcpl_newfile.h5 extend.h5 istore.h5 \ extlinks*.h5 frspace.h5 links*.h5 sys_file1 tfile[1-5].h5 \ - th5s[1-3].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 extern_[1-3].h5 \ + th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 stab.h5 extern_[1-3].h5 \ extern_[1-4][ab].raw gheap[0-4].h5 dt_arith[1-2] links.h5 \ links[0-6]*.h5 extlinks[0-15].h5 tmp big.data \ big[0-9][0-9][0-9][0-9][0-9].h5 stdio.h5 sec2.h5 \ @@ -760,8 +782,8 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog accum.h5 cmpd_dset.h5 \ err_compat.h5 dtransform.h5 test_filters.h5 get_file_name.h5 \ tstint[1-2].h5 unlink_chunked.h5 btree2.h5 objcopy_src.h5 \ objcopy_dst.h5 objcopy_ext.dat trefer1.h5 trefer2.h5 \ - app_ref.h5 farray.h5 earray.h5 efc[0-5].h5 swmr_data.h5 \ - flushrefresh.h5 flushrefresh_VERIFICATION_START \ + app_ref.h5 farray.h5 earray.h5 efc[0-5].h5 log_vfd_out.log \ + swmr_data.h5 flushrefresh.h5 flushrefresh_VERIFICATION_START \ flushrefresh_VERIFICATION_CHECKPOINT1 \ flushrefresh_VERIFICATION_CHECKPOINT2 \ flushrefresh_VERIFICATION_DONE @@ -900,7 +922,7 @@ clean-noinstLTLIBRARIES: rm -f "$${dir}/so_locations"; \ done libh5test.la: $(libh5test_la_OBJECTS) $(libh5test_la_DEPENDENCIES) - $(LINK) $(libh5test_la_OBJECTS) $(libh5test_la_LIBADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(libh5test_la_OBJECTS) $(libh5test_la_LIBADD) $(LIBS) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @@ -964,226 +986,226 @@ clean-noinstPROGRAMS: rm -f $$list accum$(EXEEXT): $(accum_OBJECTS) $(accum_DEPENDENCIES) @rm -f accum$(EXEEXT) - $(LINK) $(accum_OBJECTS) $(accum_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(accum_OBJECTS) $(accum_LDADD) $(LIBS) app_ref$(EXEEXT): $(app_ref_OBJECTS) $(app_ref_DEPENDENCIES) @rm -f app_ref$(EXEEXT) - $(LINK) $(app_ref_OBJECTS) $(app_ref_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(app_ref_OBJECTS) $(app_ref_LDADD) $(LIBS) big$(EXEEXT): $(big_OBJECTS) $(big_DEPENDENCIES) @rm -f big$(EXEEXT) - $(LINK) $(big_OBJECTS) $(big_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(big_OBJECTS) $(big_LDADD) $(LIBS) bittests$(EXEEXT): $(bittests_OBJECTS) $(bittests_DEPENDENCIES) @rm -f bittests$(EXEEXT) - $(LINK) $(bittests_OBJECTS) $(bittests_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(bittests_OBJECTS) $(bittests_LDADD) $(LIBS) btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES) @rm -f btree2$(EXEEXT) - $(LINK) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS) cache$(EXEEXT): $(cache_OBJECTS) $(cache_DEPENDENCIES) @rm -f cache$(EXEEXT) - $(LINK) $(cache_OBJECTS) $(cache_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(cache_OBJECTS) $(cache_LDADD) $(LIBS) cache_api$(EXEEXT): $(cache_api_OBJECTS) $(cache_api_DEPENDENCIES) @rm -f cache_api$(EXEEXT) - $(LINK) $(cache_api_OBJECTS) $(cache_api_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(cache_api_OBJECTS) $(cache_api_LDADD) $(LIBS) cache_tagging$(EXEEXT): $(cache_tagging_OBJECTS) $(cache_tagging_DEPENDENCIES) @rm -f cache_tagging$(EXEEXT) - $(LINK) $(cache_tagging_OBJECTS) $(cache_tagging_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(cache_tagging_OBJECTS) $(cache_tagging_LDADD) $(LIBS) cmpd_dset$(EXEEXT): $(cmpd_dset_OBJECTS) $(cmpd_dset_DEPENDENCIES) @rm -f cmpd_dset$(EXEEXT) - $(LINK) $(cmpd_dset_OBJECTS) $(cmpd_dset_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(cmpd_dset_OBJECTS) $(cmpd_dset_LDADD) $(LIBS) cross_read$(EXEEXT): $(cross_read_OBJECTS) $(cross_read_DEPENDENCIES) @rm -f cross_read$(EXEEXT) - $(LINK) $(cross_read_OBJECTS) $(cross_read_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(cross_read_OBJECTS) $(cross_read_LDADD) $(LIBS) dangle$(EXEEXT): $(dangle_OBJECTS) $(dangle_DEPENDENCIES) @rm -f dangle$(EXEEXT) - $(LINK) $(dangle_OBJECTS) $(dangle_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(dangle_OBJECTS) $(dangle_LDADD) $(LIBS) dsets$(EXEEXT): $(dsets_OBJECTS) $(dsets_DEPENDENCIES) @rm -f dsets$(EXEEXT) - $(LINK) $(dsets_OBJECTS) $(dsets_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(dsets_OBJECTS) $(dsets_LDADD) $(LIBS) dt_arith$(EXEEXT): $(dt_arith_OBJECTS) $(dt_arith_DEPENDENCIES) @rm -f dt_arith$(EXEEXT) - $(LINK) $(dt_arith_OBJECTS) $(dt_arith_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(dt_arith_OBJECTS) $(dt_arith_LDADD) $(LIBS) dtransform$(EXEEXT): $(dtransform_OBJECTS) $(dtransform_DEPENDENCIES) @rm -f dtransform$(EXEEXT) - $(LINK) $(dtransform_OBJECTS) $(dtransform_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(dtransform_OBJECTS) $(dtransform_LDADD) $(LIBS) dtypes$(EXEEXT): $(dtypes_OBJECTS) $(dtypes_DEPENDENCIES) @rm -f dtypes$(EXEEXT) - $(LINK) $(dtypes_OBJECTS) $(dtypes_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(dtypes_OBJECTS) $(dtypes_LDADD) $(LIBS) earray$(EXEEXT): $(earray_OBJECTS) $(earray_DEPENDENCIES) @rm -f earray$(EXEEXT) - $(LINK) $(earray_OBJECTS) $(earray_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(earray_OBJECTS) $(earray_LDADD) $(LIBS) efc$(EXEEXT): $(efc_OBJECTS) $(efc_DEPENDENCIES) @rm -f efc$(EXEEXT) - $(LINK) $(efc_OBJECTS) $(efc_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(efc_OBJECTS) $(efc_LDADD) $(LIBS) enum$(EXEEXT): $(enum_OBJECTS) $(enum_DEPENDENCIES) @rm -f enum$(EXEEXT) - $(LINK) $(enum_OBJECTS) $(enum_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(enum_OBJECTS) $(enum_LDADD) $(LIBS) err_compat$(EXEEXT): $(err_compat_OBJECTS) $(err_compat_DEPENDENCIES) @rm -f err_compat$(EXEEXT) - $(LINK) $(err_compat_OBJECTS) $(err_compat_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(err_compat_OBJECTS) $(err_compat_LDADD) $(LIBS) error_test$(EXEEXT): $(error_test_OBJECTS) $(error_test_DEPENDENCIES) @rm -f error_test$(EXEEXT) - $(LINK) $(error_test_OBJECTS) $(error_test_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(error_test_OBJECTS) $(error_test_LDADD) $(LIBS) extend$(EXEEXT): $(extend_OBJECTS) $(extend_DEPENDENCIES) @rm -f extend$(EXEEXT) - $(LINK) $(extend_OBJECTS) $(extend_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(extend_OBJECTS) $(extend_LDADD) $(LIBS) external$(EXEEXT): $(external_OBJECTS) $(external_DEPENDENCIES) @rm -f external$(EXEEXT) - $(LINK) $(external_OBJECTS) $(external_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(external_OBJECTS) $(external_LDADD) $(LIBS) farray$(EXEEXT): $(farray_OBJECTS) $(farray_DEPENDENCIES) @rm -f farray$(EXEEXT) - $(LINK) $(farray_OBJECTS) $(farray_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(farray_OBJECTS) $(farray_LDADD) $(LIBS) fheap$(EXEEXT): $(fheap_OBJECTS) $(fheap_DEPENDENCIES) @rm -f fheap$(EXEEXT) - $(LINK) $(fheap_OBJECTS) $(fheap_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(fheap_OBJECTS) $(fheap_LDADD) $(LIBS) fillval$(EXEEXT): $(fillval_OBJECTS) $(fillval_DEPENDENCIES) @rm -f fillval$(EXEEXT) - $(LINK) $(fillval_OBJECTS) $(fillval_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(fillval_OBJECTS) $(fillval_LDADD) $(LIBS) filter_fail$(EXEEXT): $(filter_fail_OBJECTS) $(filter_fail_DEPENDENCIES) @rm -f filter_fail$(EXEEXT) - $(LINK) $(filter_fail_OBJECTS) $(filter_fail_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(filter_fail_OBJECTS) $(filter_fail_LDADD) $(LIBS) flush1$(EXEEXT): $(flush1_OBJECTS) $(flush1_DEPENDENCIES) @rm -f flush1$(EXEEXT) - $(LINK) $(flush1_OBJECTS) $(flush1_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(flush1_OBJECTS) $(flush1_LDADD) $(LIBS) flush2$(EXEEXT): $(flush2_OBJECTS) $(flush2_DEPENDENCIES) @rm -f flush2$(EXEEXT) - $(LINK) $(flush2_OBJECTS) $(flush2_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(flush2_OBJECTS) $(flush2_LDADD) $(LIBS) flushrefresh$(EXEEXT): $(flushrefresh_OBJECTS) $(flushrefresh_DEPENDENCIES) @rm -f flushrefresh$(EXEEXT) - $(LINK) $(flushrefresh_OBJECTS) $(flushrefresh_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(flushrefresh_OBJECTS) $(flushrefresh_LDADD) $(LIBS) freespace$(EXEEXT): $(freespace_OBJECTS) $(freespace_DEPENDENCIES) @rm -f freespace$(EXEEXT) - $(LINK) $(freespace_OBJECTS) $(freespace_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(freespace_OBJECTS) $(freespace_LDADD) $(LIBS) gen_bad_ohdr$(EXEEXT): $(gen_bad_ohdr_OBJECTS) $(gen_bad_ohdr_DEPENDENCIES) @rm -f gen_bad_ohdr$(EXEEXT) - $(LINK) $(gen_bad_ohdr_OBJECTS) $(gen_bad_ohdr_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_bad_ohdr_OBJECTS) $(gen_bad_ohdr_LDADD) $(LIBS) gen_bogus$(EXEEXT): $(gen_bogus_OBJECTS) $(gen_bogus_DEPENDENCIES) @rm -f gen_bogus$(EXEEXT) - $(LINK) $(gen_bogus_OBJECTS) $(gen_bogus_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_bogus_OBJECTS) $(gen_bogus_LDADD) $(LIBS) gen_cross$(EXEEXT): $(gen_cross_OBJECTS) $(gen_cross_DEPENDENCIES) @rm -f gen_cross$(EXEEXT) - $(LINK) $(gen_cross_OBJECTS) $(gen_cross_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_cross_OBJECTS) $(gen_cross_LDADD) $(LIBS) gen_deflate$(EXEEXT): $(gen_deflate_OBJECTS) $(gen_deflate_DEPENDENCIES) @rm -f gen_deflate$(EXEEXT) - $(LINK) $(gen_deflate_OBJECTS) $(gen_deflate_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_deflate_OBJECTS) $(gen_deflate_LDADD) $(LIBS) gen_filespace$(EXEEXT): $(gen_filespace_OBJECTS) $(gen_filespace_DEPENDENCIES) @rm -f gen_filespace$(EXEEXT) - $(LINK) $(gen_filespace_OBJECTS) $(gen_filespace_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_filespace_OBJECTS) $(gen_filespace_LDADD) $(LIBS) gen_filters$(EXEEXT): $(gen_filters_OBJECTS) $(gen_filters_DEPENDENCIES) @rm -f gen_filters$(EXEEXT) - $(LINK) $(gen_filters_OBJECTS) $(gen_filters_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_filters_OBJECTS) $(gen_filters_LDADD) $(LIBS) gen_idx$(EXEEXT): $(gen_idx_OBJECTS) $(gen_idx_DEPENDENCIES) @rm -f gen_idx$(EXEEXT) - $(LINK) $(gen_idx_OBJECTS) $(gen_idx_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_idx_OBJECTS) $(gen_idx_LDADD) $(LIBS) gen_new_array$(EXEEXT): $(gen_new_array_OBJECTS) $(gen_new_array_DEPENDENCIES) @rm -f gen_new_array$(EXEEXT) - $(LINK) $(gen_new_array_OBJECTS) $(gen_new_array_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_new_array_OBJECTS) $(gen_new_array_LDADD) $(LIBS) gen_new_fill$(EXEEXT): $(gen_new_fill_OBJECTS) $(gen_new_fill_DEPENDENCIES) @rm -f gen_new_fill$(EXEEXT) - $(LINK) $(gen_new_fill_OBJECTS) $(gen_new_fill_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_new_fill_OBJECTS) $(gen_new_fill_LDADD) $(LIBS) gen_new_group$(EXEEXT): $(gen_new_group_OBJECTS) $(gen_new_group_DEPENDENCIES) @rm -f gen_new_group$(EXEEXT) - $(LINK) $(gen_new_group_OBJECTS) $(gen_new_group_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_new_group_OBJECTS) $(gen_new_group_LDADD) $(LIBS) gen_new_mtime$(EXEEXT): $(gen_new_mtime_OBJECTS) $(gen_new_mtime_DEPENDENCIES) @rm -f gen_new_mtime$(EXEEXT) - $(LINK) $(gen_new_mtime_OBJECTS) $(gen_new_mtime_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_new_mtime_OBJECTS) $(gen_new_mtime_LDADD) $(LIBS) gen_new_super$(EXEEXT): $(gen_new_super_OBJECTS) $(gen_new_super_DEPENDENCIES) @rm -f gen_new_super$(EXEEXT) - $(LINK) $(gen_new_super_OBJECTS) $(gen_new_super_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_new_super_OBJECTS) $(gen_new_super_LDADD) $(LIBS) gen_noencoder$(EXEEXT): $(gen_noencoder_OBJECTS) $(gen_noencoder_DEPENDENCIES) @rm -f gen_noencoder$(EXEEXT) - $(LINK) $(gen_noencoder_OBJECTS) $(gen_noencoder_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_noencoder_OBJECTS) $(gen_noencoder_LDADD) $(LIBS) gen_nullspace$(EXEEXT): $(gen_nullspace_OBJECTS) $(gen_nullspace_DEPENDENCIES) @rm -f gen_nullspace$(EXEEXT) - $(LINK) $(gen_nullspace_OBJECTS) $(gen_nullspace_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_nullspace_OBJECTS) $(gen_nullspace_LDADD) $(LIBS) gen_sizes_lheap$(EXEEXT): $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_DEPENDENCIES) @rm -f gen_sizes_lheap$(EXEEXT) - $(LINK) $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_sizes_lheap_OBJECTS) $(gen_sizes_lheap_LDADD) $(LIBS) gen_specmetaread$(EXEEXT): $(gen_specmetaread_OBJECTS) $(gen_specmetaread_DEPENDENCIES) @rm -f gen_specmetaread$(EXEEXT) - $(LINK) $(gen_specmetaread_OBJECTS) $(gen_specmetaread_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_specmetaread_OBJECTS) $(gen_specmetaread_LDADD) $(LIBS) gen_udlinks$(EXEEXT): $(gen_udlinks_OBJECTS) $(gen_udlinks_DEPENDENCIES) @rm -f gen_udlinks$(EXEEXT) - $(LINK) $(gen_udlinks_OBJECTS) $(gen_udlinks_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gen_udlinks_OBJECTS) $(gen_udlinks_LDADD) $(LIBS) getname$(EXEEXT): $(getname_OBJECTS) $(getname_DEPENDENCIES) @rm -f getname$(EXEEXT) - $(LINK) $(getname_OBJECTS) $(getname_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(getname_OBJECTS) $(getname_LDADD) $(LIBS) gheap$(EXEEXT): $(gheap_OBJECTS) $(gheap_DEPENDENCIES) @rm -f gheap$(EXEEXT) - $(LINK) $(gheap_OBJECTS) $(gheap_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(gheap_OBJECTS) $(gheap_LDADD) $(LIBS) hyperslab$(EXEEXT): $(hyperslab_OBJECTS) $(hyperslab_DEPENDENCIES) @rm -f hyperslab$(EXEEXT) - $(LINK) $(hyperslab_OBJECTS) $(hyperslab_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(hyperslab_OBJECTS) $(hyperslab_LDADD) $(LIBS) istore$(EXEEXT): $(istore_OBJECTS) $(istore_DEPENDENCIES) @rm -f istore$(EXEEXT) - $(LINK) $(istore_OBJECTS) $(istore_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(istore_OBJECTS) $(istore_LDADD) $(LIBS) lheap$(EXEEXT): $(lheap_OBJECTS) $(lheap_DEPENDENCIES) @rm -f lheap$(EXEEXT) - $(LINK) $(lheap_OBJECTS) $(lheap_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(lheap_OBJECTS) $(lheap_LDADD) $(LIBS) links$(EXEEXT): $(links_OBJECTS) $(links_DEPENDENCIES) @rm -f links$(EXEEXT) - $(LINK) $(links_OBJECTS) $(links_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(links_OBJECTS) $(links_LDADD) $(LIBS) links_env$(EXEEXT): $(links_env_OBJECTS) $(links_env_DEPENDENCIES) @rm -f links_env$(EXEEXT) - $(LINK) $(links_env_OBJECTS) $(links_env_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(links_env_OBJECTS) $(links_env_LDADD) $(LIBS) mf$(EXEEXT): $(mf_OBJECTS) $(mf_DEPENDENCIES) @rm -f mf$(EXEEXT) - $(LINK) $(mf_OBJECTS) $(mf_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(mf_OBJECTS) $(mf_LDADD) $(LIBS) mount$(EXEEXT): $(mount_OBJECTS) $(mount_DEPENDENCIES) @rm -f mount$(EXEEXT) - $(LINK) $(mount_OBJECTS) $(mount_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(mount_OBJECTS) $(mount_LDADD) $(LIBS) mtime$(EXEEXT): $(mtime_OBJECTS) $(mtime_DEPENDENCIES) @rm -f mtime$(EXEEXT) - $(LINK) $(mtime_OBJECTS) $(mtime_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(mtime_OBJECTS) $(mtime_LDADD) $(LIBS) ntypes$(EXEEXT): $(ntypes_OBJECTS) $(ntypes_DEPENDENCIES) @rm -f ntypes$(EXEEXT) - $(LINK) $(ntypes_OBJECTS) $(ntypes_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(ntypes_OBJECTS) $(ntypes_LDADD) $(LIBS) objcopy$(EXEEXT): $(objcopy_OBJECTS) $(objcopy_DEPENDENCIES) @rm -f objcopy$(EXEEXT) - $(LINK) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(objcopy_OBJECTS) $(objcopy_LDADD) $(LIBS) ohdr$(EXEEXT): $(ohdr_OBJECTS) $(ohdr_DEPENDENCIES) @rm -f ohdr$(EXEEXT) - $(LINK) $(ohdr_OBJECTS) $(ohdr_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(ohdr_OBJECTS) $(ohdr_LDADD) $(LIBS) pool$(EXEEXT): $(pool_OBJECTS) $(pool_DEPENDENCIES) @rm -f pool$(EXEEXT) - $(LINK) $(pool_OBJECTS) $(pool_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(pool_OBJECTS) $(pool_LDADD) $(LIBS) reserved$(EXEEXT): $(reserved_OBJECTS) $(reserved_DEPENDENCIES) @rm -f reserved$(EXEEXT) - $(LINK) $(reserved_OBJECTS) $(reserved_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(reserved_OBJECTS) $(reserved_LDADD) $(LIBS) set_extent$(EXEEXT): $(set_extent_OBJECTS) $(set_extent_DEPENDENCIES) @rm -f set_extent$(EXEEXT) - $(LINK) $(set_extent_OBJECTS) $(set_extent_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(set_extent_OBJECTS) $(set_extent_LDADD) $(LIBS) space_overflow$(EXEEXT): $(space_overflow_OBJECTS) $(space_overflow_DEPENDENCIES) @rm -f space_overflow$(EXEEXT) - $(LINK) $(space_overflow_OBJECTS) $(space_overflow_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(space_overflow_OBJECTS) $(space_overflow_LDADD) $(LIBS) stab$(EXEEXT): $(stab_OBJECTS) $(stab_DEPENDENCIES) @rm -f stab$(EXEEXT) - $(LINK) $(stab_OBJECTS) $(stab_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(stab_OBJECTS) $(stab_LDADD) $(LIBS) swmr_generator$(EXEEXT): $(swmr_generator_OBJECTS) $(swmr_generator_DEPENDENCIES) @rm -f swmr_generator$(EXEEXT) - $(LINK) $(swmr_generator_OBJECTS) $(swmr_generator_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(swmr_generator_OBJECTS) $(swmr_generator_LDADD) $(LIBS) swmr_reader$(EXEEXT): $(swmr_reader_OBJECTS) $(swmr_reader_DEPENDENCIES) @rm -f swmr_reader$(EXEEXT) - $(LINK) $(swmr_reader_OBJECTS) $(swmr_reader_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(swmr_reader_OBJECTS) $(swmr_reader_LDADD) $(LIBS) swmr_writer$(EXEEXT): $(swmr_writer_OBJECTS) $(swmr_writer_DEPENDENCIES) @rm -f swmr_writer$(EXEEXT) - $(LINK) $(swmr_writer_OBJECTS) $(swmr_writer_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(swmr_writer_OBJECTS) $(swmr_writer_LDADD) $(LIBS) tcheck_version$(EXEEXT): $(tcheck_version_OBJECTS) $(tcheck_version_DEPENDENCIES) @rm -f tcheck_version$(EXEEXT) - $(LINK) $(tcheck_version_OBJECTS) $(tcheck_version_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(tcheck_version_OBJECTS) $(tcheck_version_LDADD) $(LIBS) testhdf5$(EXEEXT): $(testhdf5_OBJECTS) $(testhdf5_DEPENDENCIES) @rm -f testhdf5$(EXEEXT) - $(LINK) $(testhdf5_OBJECTS) $(testhdf5_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(testhdf5_OBJECTS) $(testhdf5_LDADD) $(LIBS) testmeta$(EXEEXT): $(testmeta_OBJECTS) $(testmeta_DEPENDENCIES) @rm -f testmeta$(EXEEXT) - $(LINK) $(testmeta_OBJECTS) $(testmeta_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(testmeta_OBJECTS) $(testmeta_LDADD) $(LIBS) ttsafe$(EXEEXT): $(ttsafe_OBJECTS) $(ttsafe_DEPENDENCIES) @rm -f ttsafe$(EXEEXT) - $(LINK) $(ttsafe_OBJECTS) $(ttsafe_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(ttsafe_OBJECTS) $(ttsafe_LDADD) $(LIBS) unlink$(EXEEXT): $(unlink_OBJECTS) $(unlink_DEPENDENCIES) @rm -f unlink$(EXEEXT) - $(LINK) $(unlink_OBJECTS) $(unlink_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(unlink_OBJECTS) $(unlink_LDADD) $(LIBS) vfd$(EXEEXT): $(vfd_OBJECTS) $(vfd_DEPENDENCIES) @rm -f vfd$(EXEEXT) - $(LINK) $(vfd_OBJECTS) $(vfd_LDADD) $(LIBS) + $(AM_V_CCLD)$(LINK) $(vfd_OBJECTS) $(vfd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -1299,22 +1321,25 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vfd.Po@am__quote@ .c.o: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< diff --git a/test/bad_compound.h5 b/test/bad_compound.h5 Binary files differnew file mode 100644 index 0000000..1834a2e --- /dev/null +++ b/test/bad_compound.h5 diff --git a/test/btree2.c b/test/btree2.c index 1d1796c..d8abc84 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -7712,6 +7712,9 @@ main(void) nerrors += test_modify(fapl, &cparam, &tparam); } /* end for */ + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index 08890a8..d7f7842 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -2208,6 +2208,9 @@ main (int argc, char *argv[]) puts("Testing compound member ordering:"); nerrors += test_ooo_order(fname); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); + if (nerrors) { printf("***** %u FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); diff --git a/test/dsets.c b/test/dsets.c index be6988b..c483ffe 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -4162,7 +4162,7 @@ test_nbit_int_size(hid_t file) */ if((precision = H5Tget_precision(datatype)) == 0) { H5_FAILED(); - printf(" Line %d: wrong precision size: %d\n",__LINE__, precision); + printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); goto error; } /* end if */ @@ -4172,7 +4172,7 @@ test_nbit_int_size(hid_t file) if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { H5_FAILED(); - printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size); + HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); goto error; } /* end if */ @@ -4369,7 +4369,7 @@ test_nbit_flt_size(hid_t file) */ if((precision = H5Tget_precision(datatype)) == 0) { H5_FAILED(); - printf(" Line %d: wrong precision size: %d\n",__LINE__, precision); + printf(" Line %d: wrong precision size: %zu\n",__LINE__, precision); goto error; } /* end if */ @@ -4379,7 +4379,7 @@ test_nbit_flt_size(hid_t file) if((dset_size = H5Dget_storage_size(dataset)) < DSET_DIM1*DSET_DIM2*(precision/8) || dset_size > DSET_DIM1*DSET_DIM2*(precision/8) + 1*KB) { H5_FAILED(); - printf(" Line %d: wrong dataset size: %d\n",__LINE__, dset_size); + HDfprintf(stdout, " Line %d: wrong dataset size: %Hu\n",__LINE__, dset_size); goto error; } /* end if */ @@ -9908,6 +9908,9 @@ main(void) /* Close 2nd FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; printf("All dataset tests passed.\n"); diff --git a/test/dtypes.c b/test/dtypes.c index 655472c..a66a34c 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -23,6 +23,7 @@ #include <math.h> #include <time.h> #include "h5test.h" +#include "H5srcdir.h" #include "H5Iprivate.h" /* For checking that datatype id's don't leak */ /* Number of elements in each test */ @@ -81,6 +82,8 @@ const char *FILENAME[] = { NULL }; +#define TESTFILE "bad_compound.h5" + typedef struct complex_t { double re; double im; @@ -3126,6 +3129,132 @@ error: /*------------------------------------------------------------------------- + * Function: test_compound_18 + * + * Purpose: Tests that library fails correctly when opening a dataset + * a compound datatype with zero fields. + * + * Return: Success: 0 + * Failure: number of errors + * + * Programmer: Quincey Koziol + * Thursday, April 14, 2011 + * + *------------------------------------------------------------------------- + */ +static int +test_compound_18(void) +{ + hid_t file = -1; + hid_t gid = -1; + hid_t did = -1; + hid_t aid = -1; + hid_t tid = -1; + hid_t sid = -1; + hsize_t dim = 1; + const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ + char filename[1024]; + herr_t ret; + + TESTING("accessing objects with compound datatypes that have no fields"); + + /* Create compound datatype, but don't insert fields */ + tid = H5Tcreate(H5T_COMPOUND, (size_t)8); + assert(tid > 0); + + /* Attempt to create file with compound datatype that has no fields */ + /* Create File */ + h5_fixname(FILENAME[3], H5P_DEFAULT, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Create a dataspace to use */ + sid = H5Screate_simple(1, &dim, NULL); + assert(sid > 0); + + /* Create a dataset with the bad compound datatype */ + H5E_BEGIN_TRY { + did = H5Dcreate2(file, "dataset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; + if(did > 0) { + H5Dclose(did); + FAIL_PUTS_ERROR("created dataset with bad compound datatype") + } /* end if */ + + /* Create a group */ + gid = H5Gcreate2(file, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + assert(gid > 0); + + /* Create an attribute with the bad compound datatype */ + H5E_BEGIN_TRY { + aid = H5Acreate2(gid, "attr", tid, sid, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; + if(aid > 0) { + H5Aclose(aid); + FAIL_PUTS_ERROR("created attribute with bad compound datatype") + } /* end if */ + + /* Commit the datatype */ + H5E_BEGIN_TRY { + ret = H5Tcommit2(file, "cmpnd", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + } H5E_END_TRY; + if(ret >= 0) { + FAIL_PUTS_ERROR("committed named datatype with bad compound datatype") + } /* end if */ + + /* Close IDs */ + if(H5Tclose(tid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + + + /* Open Generated File */ + /* (generated with gen_bad_compound.c) */ + if((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + + /* Try to open the datatype */ + H5E_BEGIN_TRY { + tid = H5Topen2(file, "cmpnd", H5P_DEFAULT); + } H5E_END_TRY; + if(tid > 0) { + H5Tclose(tid); + FAIL_PUTS_ERROR("opened named datatype with bad compound datatype") + } /* end if */ + + /* Try to open the dataset */ + H5E_BEGIN_TRY { + did = H5Dopen2(file, "dataset", H5P_DEFAULT); + } H5E_END_TRY; + if(did > 0) { + H5Dclose(did); + FAIL_PUTS_ERROR("opened dataset with bad compound datatype") + } /* end if */ + + /* Open the group with the attribute */ + if((gid = H5Gopen2(file, "group", H5P_DEFAULT)) < 0) TEST_ERROR + + /* Try to open the dataset */ + H5E_BEGIN_TRY { + aid = H5Aopen(gid, "attr", H5P_DEFAULT); + } H5E_END_TRY; + if(aid > 0) { + H5Aclose(aid); + FAIL_PUTS_ERROR("opened attribute with bad compound datatype") + } /* end if */ + + /* Close IDs */ + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + +error: + return 1; +} /* end test_compound_18() */ + + +/*------------------------------------------------------------------------- * Function: test_query * * Purpose: Tests query functions of compound and enumeration types. @@ -6532,6 +6661,7 @@ main(void) nerrors += test_compound_15(); nerrors += test_compound_16(); nerrors += test_compound_17(); + nerrors += test_compound_18(); nerrors += test_conv_enum_1(); nerrors += test_conv_enum_2(); nerrors += test_conv_bitfield(); diff --git a/test/earray.c b/test/earray.c index d3b51a4..132913b 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2944,6 +2944,9 @@ main(void) finish_tparam(&tparam); } /* end for */ + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All extensible array tests passed."); @@ -3192,6 +3192,9 @@ main(void) if(H5Pclose(fcpl_id) < 0) TEST_ERROR + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); + if(nerrors) goto error; diff --git a/test/enum.c b/test/enum.c index c627af1..e9f607d 100644 --- a/test/enum.c +++ b/test/enum.c @@ -583,6 +583,9 @@ main(void) H5Fclose(file); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) goto error; puts("All enum tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/extend.c b/test/extend.c index 3ffcadc..5951e69 100644 --- a/test/extend.c +++ b/test/extend.c @@ -287,6 +287,9 @@ main (void) if(H5Sclose(mem_space) < 0) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) { printf("***** %d FAILURE%s! *****\n", nerrors, (1 == nerrors) ? "" : "S"); exit(1); diff --git a/test/external.c b/test/external.c index 3e1388c..1dedeab 100644 --- a/test/external.c +++ b/test/external.c @@ -957,6 +957,10 @@ main (void) nerrors += test_2(fapl); nerrors += test_3(fapl); nerrors += test_4(fapl); + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors>0) goto error; if (H5Fclose(file) < 0) goto error; diff --git a/test/farray.c b/test/farray.c index 8b6a617..2844a5d 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1648,6 +1648,9 @@ main(void) nerrors += test_skip_elmts(fapl, &cparam, &tparam, (hsize_t)(tparam.nelmts - 1), FALSE, "skipping to last element"); } /* end for */ + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All fixed array tests passed."); diff --git a/test/fheap.c b/test/fheap.c index afbe56c..2cb8796 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16691,6 +16691,9 @@ HDfprintf(stderr, "Uncomment tests!\n"); HDfprintf(stderr, "Uncomment tests!\n"); #endif /* QAK */ + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All fractal heap tests passed."); diff --git a/test/fillval.c b/test/fillval.c index cd12b98..847dfbd 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -2177,6 +2177,9 @@ main(int argc, char *argv[]) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All fill value tests passed."); diff --git a/test/filter_fail.c b/test/filter_fail.c index 9b46421..c48be14 100644 --- a/test/filter_fail.c +++ b/test/filter_fail.c @@ -391,6 +391,9 @@ int main(void) nerrors += (test_filter_write(filename, fapl, FALSE) < 0 ? 1 : 0); nerrors += (test_filter_read(filename, fapl) < 0 ? 1 : 0); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); /* Make sure we can close the library */ diff --git a/test/freespace.c b/test/freespace.c index b4a774f..6960e6d 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -2854,6 +2854,9 @@ main(void) nerrors += test_fs_sect_extend(fapl); nerrors += test_fs_sect_iterate(fapl); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All free-space tests passed."); diff --git a/test/gen_bad_compound.c b/test/gen_bad_compound.c new file mode 100644 index 0000000..b864195 --- /dev/null +++ b/test/gen_bad_compound.c @@ -0,0 +1,86 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * April 14, 2011 + * + * Purpose: This program is run to generate an HDF5 data file with objects + * that use compound datatypes with no fields (now forbidden to + * be created by the library, as of v1.4.x). It must be built/run + * with a copy of the 1.2.x library. + */ + +#include <assert.h> +#include "hdf5.h" + +#define FILENAME "bad_compound.h5" + +int main() +{ + hid_t file; + hid_t cmpd_dt; + hid_t sid; + hid_t did; + hid_t aid; + hid_t gid; + hsize_t dim = 1; + herr_t ret; + + /* Create compound datatype, but don't insert fields */ + cmpd_dt = H5Tcreate(H5T_COMPOUND, (size_t)8); + assert(cmpd_dt > 0); + + /* Create File */ + file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + assert(file > 0); + + /* Create a dataspace to use */ + sid = H5Screate_simple(1, &dim, NULL); + assert(sid > 0); + + /* Create a dataset with the bad compound datatype */ + did = H5Dcreate(file, "dataset", cmpd_dt, sid, H5P_DEFAULT); + assert(did > 0); + + /* Create a group */ + gid = H5Gcreate(file, "group", (size_t)0); + assert(gid > 0); + + /* Create an attribute with the bad compound datatype */ + aid = H5Acreate(gid, "attr", cmpd_dt, sid, H5P_DEFAULT); + assert(aid > 0); + + /* Commit the datatype */ + ret = H5Tcommit(file, "cmpnd", cmpd_dt); + assert(ret >= 0); + + /* Close IDs */ + ret = H5Gclose(gid); + assert(ret >= 0); + ret = H5Aclose(aid); + assert(ret >= 0); + ret = H5Sclose(sid); + assert(ret >= 0); + ret = H5Dclose(did); + assert(ret >= 0); + ret = H5Tclose(cmpd_dt); + assert(ret >= 0); + ret = H5Fclose(file); + assert(ret >= 0); + + return(0); +} + diff --git a/test/gen_filespace.c b/test/gen_filespace.c index 293e3df..7ee2a7a 100644 --- a/test/gen_filespace.c +++ b/test/gen_filespace.c @@ -45,7 +45,7 @@ static void gen_file(void) unsigned i, j; /* Local index variable */ H5F_file_space_type_t fs_type; /* File space handling strategy */ - for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, (H5F_file_space_type_t)(fs_type)++) { + for(j = 0, fs_type = H5F_FILE_SPACE_ALL_PERSIST; j < NELMTS(FILENAMES); j++, fs_type = (H5F_file_space_type_t)(fs_type + 1)) { /* Get a copy of the default file creation property */ fcpl = H5Pcreate(H5P_FILE_CREATE); diff --git a/test/getname.c b/test/getname.c index bbaaa04..1e50dcc 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2934,6 +2934,9 @@ main(void) /* Close file */ H5Fclose(file_id); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; puts("All getname tests passed."); diff --git a/test/gheap.c b/test/gheap.c index 2829e34..f30935a 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -545,6 +545,10 @@ main (void) nerrors += test_3(fapl); nerrors += test_4(fapl); nerrors += test_ooo_indices(fapl); + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) goto error; puts("All global heap tests passed."); diff --git a/test/h5test.c b/test/h5test.c index 8762f90..ae864f0 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -27,6 +27,11 @@ #include "h5test.h" #include "H5srcdir.h" +/* Necessary for h5_verify_cached_stabs() */ +#define H5G_PACKAGE +#define H5G_TESTING +#include "H5Gpkg.h" + #ifdef H5_HAVE_WINSOCK_H #include <process.h> #include <direct.h> @@ -1147,3 +1152,92 @@ h5_make_local_copy(char *origfilename, char *local_copy_name) return 0; } + + +/*------------------------------------------------------------------------- + * Function: h5_verify_cached_stabs_cb + * + * Purpose: Callback function for h5_verify_cached_stabs. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Neil Fortner + * Tuesday, April 12, 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +h5_verify_cached_stabs_cb(hid_t oid, const char UNUSED *name, + const H5O_info_t *oinfo, void UNUSED *udata) +{ + if(oinfo->type == H5O_TYPE_GROUP) + return(H5G_verify_cached_stabs_test(oid)); + else + return(0); +} /* end h5_verify_cached_stabs_cb() */ + + +/*------------------------------------------------------------------------- + * Function: h5_verify_cached_stabs + * + * Purpose: Verify that all groups in every file in base_name have + * their symbol table information cached (if present, and if + * the parent group also uses a symbol table). Does not + * check that the root group's symbol table information is + * cached in the superblock. + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Neil Fortner + * Tuesday, April 12, 2011 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +h5_verify_cached_stabs(const char *base_name[], hid_t fapl) +{ + hid_t file = -1; + char filename[1024]; + int i = 0; + + while(base_name[i]) { + if (h5_fixname(base_name[i], fapl, filename, sizeof(filename)) == NULL) + continue; + + H5E_BEGIN_TRY { + file = H5Fopen(filename, H5F_ACC_RDONLY, fapl); + } H5E_END_TRY + if(file < 0) { + i++; + continue; + } /* end if */ + + if(H5Ovisit(file, H5_INDEX_NAME, H5_ITER_NATIVE, + h5_verify_cached_stabs_cb, NULL) < 0) + goto error; + + if(H5Fclose(file) < 0) + goto error; + file = -1; + + i++; + } /* end while */ + + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(file); + } H5E_END_TRY; + + return -1; +} + diff --git a/test/h5test.h b/test/h5test.h index 7994f72..5d3fb17 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -151,6 +151,7 @@ H5TEST_DLL void h5_show_hostname(void); H5TEST_DLL h5_stat_size_t h5_get_file_size(const char *filename, hid_t fapl); H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(char *origfilename, char *local_copy_name); +H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); /* Routines for operating on the list of tests (for the "all in one" tests) */ H5TEST_DLL void TestUsage(void); diff --git a/test/istore.c b/test/istore.c index fb0f3fc..3ae8da7 100644 --- a/test/istore.c +++ b/test/istore.c @@ -665,6 +665,9 @@ main(int argc, char *argv[]) H5Pclose(fcpl); H5Fclose(file); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) { printf("***** %d I-STORE TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); diff --git a/test/lheap.c b/test/lheap.c index ab6ee9f..51ae25b 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -199,6 +199,9 @@ main(void) } PASSED(); + /* Verify symbol table messages are cached */ + if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + puts("All local heap tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/links.c b/test/links.c index a9fd954..cba49f4 100644 --- a/test/links.c +++ b/test/links.c @@ -1627,7 +1627,7 @@ test_deprec(hid_t fapl, hbool_t new_format) hid_t file_id = -1; hid_t group1_id = -1; hid_t group2_id = -1; - H5G_stat_t sb_hard1, sb_hard2, sb_soft1; + H5G_stat_t sb_hard1, sb_hard2, sb_soft1, sb_soft2; H5G_obj_t obj_type; /* Object type */ hsize_t num_objs; /* Number of objects in a group */ char filename[1024]; @@ -1656,6 +1656,7 @@ test_deprec(hid_t fapl, hbool_t new_format) if(H5Glink(file_id, H5G_LINK_HARD, "group2", "group1/link_to_group2") < 0) FAIL_STACK_ERROR if(H5Glink2(file_id, "group1", H5G_LINK_HARD, group2_id, "link_to_group1") < 0) FAIL_STACK_ERROR if(H5Glink2(file_id, "link_to_group1", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/soft_link_to_group1") < 0) FAIL_STACK_ERROR + if(H5Glink2(file_id, "dangle", H5G_LINK_SOFT, H5G_SAME_LOC, "group2/dangle_soft_link") < 0) FAIL_STACK_ERROR /* Test getting the names for objects */ if(H5Gget_objname_by_idx(group1_id, (hsize_t)0, tmpstr, sizeof(tmpstr)) < 0) FAIL_STACK_ERROR @@ -1708,6 +1709,15 @@ test_deprec(hid_t fapl, hbool_t new_format) if(HDstrcmp("link_to_group1", tmpstr)) TEST_ERROR + /* Test the dangling soft link */ + if(H5Gget_objinfo(file_id, "/group2/dangle_soft_link", FALSE, &sb_soft2) < 0) FAIL_STACK_ERROR + if(sb_soft2.type != H5G_LINK) TEST_ERROR + if(sb_soft2.linklen != HDstrlen("dangle") + 1) TEST_ERROR + + if(H5Gget_linkval(group2_id, "dangle_soft_link", sb_soft2.linklen, tmpstr) < 0) FAIL_STACK_ERROR + if(HDstrcmp("dangle", tmpstr)) TEST_ERROR + + /* Test H5Gmove and H5Gmove2 */ if(H5Gmove(file_id, "group1", "moved_group1") < 0) FAIL_STACK_ERROR if(H5Gmove2(file_id, "group2", group1_id, "moved_group2") < 0) FAIL_STACK_ERROR @@ -3538,7 +3548,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(memb_addr, 0, sizeof memb_addr); HDmemset(sv, 0, sizeof sv); - for(mt = 0; mt < H5FD_MEM_NTYPES; mt++) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { memb_map[mt] = H5FD_MEM_SUPER; memb_fapl[mt] = H5P_DEFAULT; } /* end for */ @@ -3566,11 +3576,11 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) sprintf(sv[H5FD_MEM_LHEAP], "%%s-%c.h5", 'l'); memb_name[H5FD_MEM_LHEAP] = sv[H5FD_MEM_LHEAP]; - memb_addr[H5FD_MEM_LHEAP] = HADDR_MAX*2/3; + memb_addr[H5FD_MEM_LHEAP] = (HADDR_MAX/3)*2; sprintf(sv[H5FD_MEM_OHDR], "%%s-%c.h5", 'o'); memb_name[H5FD_MEM_OHDR] = sv[H5FD_MEM_OHDR]; - memb_addr[H5FD_MEM_OHDR] = HADDR_MAX*5/6; + memb_addr[H5FD_MEM_OHDR] = (HADDR_MAX/6)*5; /* create "multi" fapl */ multi_fapl = h5_fileaccess(); @@ -6868,7 +6878,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Release file 1's EFC */ - if(H5Frelease_file_cache(fid1) < 0) + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only the parent file is now open */ @@ -7006,7 +7016,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Release file 1's EFC */ - if(H5Frelease_file_cache(fid1) < 0) + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ @@ -7116,7 +7126,7 @@ external_file_cache(hid_t fapl, hbool_t new_format) TEST_ERROR /* Release file 1's EFC */ - if(H5Frelease_file_cache(fid1) < 0) + if(H5Fclear_elink_file_cache(fid1) < 0) TEST_ERROR /* Verify that only file 1 is now open */ @@ -9636,7 +9646,7 @@ link_filters(hid_t fapl, hbool_t new_format) /* Check that the file size is smaller with the filter */ if((double)filesize_filtered - > (filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) + > ((double)filesize_unfiltered * FILTER_FILESIZE_MAX_FRACTION)) TEST_ERROR /* Close */ @@ -11204,9 +11214,9 @@ delete_by_idx(hid_t fapl) herr_t ret; /* Generic return value */ /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -11520,7 +11530,7 @@ delete_by_idx_old(hid_t fapl) herr_t ret; /* Generic return value */ /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { /* Print test banner */ if(order == H5_ITER_INC) TESTING("deleting links by index in increasing order in old-style group") @@ -12043,9 +12053,9 @@ link_iterate(hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -12495,7 +12505,7 @@ link_iterate_old(hid_t fapl) iter_info.visited = visited; /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("iterating over links by name index in increasing order in old-style group") @@ -12731,9 +12741,9 @@ open_by_idx(hid_t fapl) if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -12947,7 +12957,7 @@ open_by_idx_old(hid_t fapl) if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("open object by name index in increasing order in old-style group") @@ -13167,9 +13177,9 @@ object_info(hid_t fapl) if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -13403,7 +13413,7 @@ object_info_old(hid_t fapl) if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("query object info by name index in increasing order in old-style group") @@ -13556,9 +13566,9 @@ group_info(hid_t fapl) if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <=H5_INDEX_CRT_ORDER; idx_type++) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -13967,7 +13977,7 @@ group_info_old(hid_t fapl) unsigned u, v; /* Local index variables */ /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { if(order == H5_ITER_INC) { TESTING("query group info by name index in increasing order in old-style group") } /* end if */ @@ -14529,6 +14539,9 @@ main(void) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); /* Test that external links can be used after a library reset. MUST be diff --git a/test/links_env.c b/test/links_env.c index c792386..2da5e64 100644 --- a/test/links_env.c +++ b/test/links_env.c @@ -171,6 +171,9 @@ main(void) nerrors += external_link_env(fapl, TRUE) < 0 ? 1 : 0; + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); /* Results */ @@ -1174,7 +1174,8 @@ test_mf_fs_alloc_free(hid_t fapl) /* Remove section A from free-space */ if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], - (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0) + (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0) + TEST_ERROR /* Free the free-space section node */ if(H5MF_sect_simple_free((H5FS_section_info_t *)node) < 0) diff --git a/test/mount.c b/test/mount.c index f358634..f63404d 100644 --- a/test/mount.c +++ b/test/mount.c @@ -4383,6 +4383,9 @@ main(void) nerrors += test_sharedclose(fapl); nerrors += test_multisharedclose(fapl); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) goto error; puts("All mount tests passed."); diff --git a/test/mtime.c b/test/mtime.c index 83e8354..6e00fe0 100644 --- a/test/mtime.c +++ b/test/mtime.c @@ -184,6 +184,9 @@ main(void) } PASSED(); + /* Verify symbol table messages are cached */ + if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + /* All looks good */ puts("All modification time tests passed."); h5_cleanup(FILENAME, fapl); diff --git a/test/ntypes.c b/test/ntypes.c index fa208e3..3310a82 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -2892,6 +2892,10 @@ main(void) if(H5Fclose(file) < 0) goto error; + + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if(nerrors) goto error; diff --git a/test/objcopy.c b/test/objcopy.c index 56e2c5b..95b2db3 100755 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -8962,6 +8962,9 @@ main(void) /* Reset file address checking info */ addr_reset(); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + /* Results */ if(nerrors) { printf("***** %d OBJECT COPY TEST%s FAILED! *****\n", diff --git a/test/ohdr.c b/test/ohdr.c index 109d59c..502a8b1 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -795,6 +795,9 @@ main(void) TEST_ERROR } /* end for */ + /* Verify symbol table messages are cached */ + if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR + puts("All object header tests passed."); h5_cleanup(FILENAME, fapl); return(0); diff --git a/test/set_extent.c b/test/set_extent.c index b99d1c3..ded8009 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -208,6 +208,9 @@ int main( void ) /* Close 2nd FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + h5_cleanup(FILENAME, fapl); HDremove(EXT_FILE_NAME1); diff --git a/test/stab.c b/test/stab.c index d897899..b460d90 100644 --- a/test/stab.c +++ b/test/stab.c @@ -1198,6 +1198,9 @@ main(void) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + /* Check for test errors */ if(nerrors) goto error; diff --git a/test/testlibinfo.sh.in b/test/testlibinfo.sh.in index 5bcd300..91eda16 100644 --- a/test/testlibinfo.sh.in +++ b/test/testlibinfo.sh.in @@ -74,27 +74,11 @@ fi # built too. if [ -n $Shared_Lib ]; then h5libdir=../src/.libs + shlib=$(grep dlname ../src/libhdf5.la | sed -e "s/dlname='//" -e "s/'//") else h5libdir=../src fi -# Different OS uses different naming for shared libs. -case `uname -s` in - Darwin) # MacOS - shlibsuffix=.dylib - break - ;; - AIX) # AIX .a is already a shared lib - # this is a temporary patch. - shlibsuffix=.a - break - ;; - *) # default - shlibsuffix=.so - break - ;; -esac - h5libsettings=../src/libhdf5.settings # Part 1: @@ -102,9 +86,9 @@ h5libsettings=../src/libhdf5.settings # libhdf5.settings file. # Check dynamic library file if built. if [ x-$Shared_Lib = x-yes ]; then - CHECK_LIBINFO ${h5libdir}/libhdf5${shlibsuffix} + CHECK_LIBINFO ${h5libdir}/${shlib} else - SKIP ${h5libdir}/libhdf5${shlibsuffix} + SKIP shlib fi # Though rare, libhdf5.a may not have been built. diff --git a/test/th5o.c b/test/th5o.c index 17619ee..70f8067 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -1225,6 +1225,111 @@ test_h5o_comment_by_name(void) } /* test_h5o_comment_by_name() */ + +/**************************************************************** +** +** test_h5o_getinfo_same_file(): Test that querying the object info for +** objects in the same file will return the same file "number" +** +****************************************************************/ +static void +test_h5o_getinfo_same_file(void) +{ + hid_t fid1, fid2; /* HDF5 File ID */ + hid_t gid1, gid2; /* Group IDs */ + H5O_info_t oinfo1, oinfo2; /* Object info structs */ + herr_t ret; /* Value returned from API calls */ + + /* Create a new HDF5 file */ + fid1 = H5Fcreate(TEST_FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Create two groups in the file */ + gid1 = H5Gcreate2(fid1, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gcreate2"); + gid2 = H5Gcreate2(fid1, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gcreate2"); + + /* Reset object info */ + HDmemset(&oinfo1, 0, sizeof(oinfo1)); + HDmemset(&oinfo2, 0, sizeof(oinfo2)); + + /* Query the object info for each object, through group IDs */ + ret = H5Oget_info(gid1, &oinfo1); + CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info(gid2, &oinfo2); + CHECK(ret, FAIL, "H5Oget_info"); + + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + + /* Reset object info */ + HDmemset(&oinfo1, 0, sizeof(oinfo1)); + HDmemset(&oinfo2, 0, sizeof(oinfo2)); + + /* Query the object info for each object, by name */ + ret = H5Oget_info_by_name(fid1, "group1", &oinfo1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name(fid1, "group2", &oinfo2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + + /* Close everything */ + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Gclose(gid2); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + + /* Open file twice */ + fid1 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fopen"); + fid2 = H5Fopen(TEST_FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); + CHECK(fid2, FAIL, "H5Fopen"); + + /* Open the two groups in the file */ + gid1 = H5Gopen2(fid1, "group1", H5P_DEFAULT); + CHECK(gid1, FAIL, "H5Gopen2"); + gid2 = H5Gopen2(fid2, "group2", H5P_DEFAULT); + CHECK(gid2, FAIL, "H5Gopen2"); + + /* Reset object info */ + HDmemset(&oinfo1, 0, sizeof(oinfo1)); + HDmemset(&oinfo2, 0, sizeof(oinfo2)); + + /* Query the object info for each object, through group IDs */ + ret = H5Oget_info(gid1, &oinfo1); + CHECK(ret, FAIL, "H5Oget_info"); + ret = H5Oget_info(gid2, &oinfo2); + CHECK(ret, FAIL, "H5Oget_info"); + + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + + /* Reset object info */ + HDmemset(&oinfo1, 0, sizeof(oinfo1)); + HDmemset(&oinfo2, 0, sizeof(oinfo2)); + + /* Query the object info for each object, by name */ + ret = H5Oget_info_by_name(fid1, "group1", &oinfo1, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + ret = H5Oget_info_by_name(fid1, "group2", &oinfo2, H5P_DEFAULT); + CHECK(ret, FAIL, "H5Oget_info_by_name"); + + VERIFY(oinfo1.fileno, oinfo2.fileno, "file number from H5Oget_info"); + + /* Close everything */ + ret = H5Gclose(gid1); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Gclose(gid2); + CHECK(ret, FAIL, "H5Gclose"); + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(fid2); + CHECK(ret, FAIL, "H5Fclose"); + +} /* test_h5o_getinfo_same_file() */ /**************************************************************** @@ -1246,6 +1351,7 @@ test_h5o(void) test_h5o_link(); /* Test object link routine */ test_h5o_comment(); /* Test routines for comment */ test_h5o_comment_by_name(); /* Test routines for comment by name */ + test_h5o_getinfo_same_file(); /* Test info for objects in the same file */ } /* test_h5o() */ diff --git a/test/th5s.c b/test/th5s.c index 52fbe76..d0d176a 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -33,11 +33,16 @@ #define DATAFILE "th5s1.h5" #define NULLFILE "th5s2.h5" #define BASICFILE "th5s3.h5" -#define BASICDATASET "basic_dataset" +#define ZEROFILE "th5s4.h5" +#define BASICDATASET "basic_dataset" +#define BASICDATASET1 "basic_dataset1" #define BASICDATASET2 "basic_dataset2" +#define BASICDATASET3 "basic_dataset3" +#define BASICDATASET4 "basic_dataset4" #define BASICATTR "basic_attribute" #define NULLDATASET "null_dataset" #define NULLATTR "null_attribute" +#define EXTFILE_NAME "ext_file" /* 3-D dataset with fixed dimensions */ #define SPACE1_RANK 3 @@ -87,7 +92,7 @@ test_h5s_basic(void) hid_t fid1; /* HDF5 File IDs */ hid_t sid1, sid2; /* Dataspace ID */ hid_t dset1; /* Dataset ID */ - hid_t aid1; /* Attribute ID */ + hid_t aid1; /* Attribute ID */ int rank; /* Logical rank of dataspace */ hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; hsize_t dims2[] = {SPACE2_DIM1, SPACE2_DIM2, SPACE2_DIM3, @@ -103,7 +108,7 @@ test_h5s_basic(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Dataspace Manipulation\n")); - sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + sid1 = H5Screate_simple(SPACE1_RANK, dims1, max2); CHECK(sid1, FAIL, "H5Screate_simple"); n = H5Sget_simple_extent_npoints(sid1); @@ -139,9 +144,7 @@ test_h5s_basic(void) VERIFY(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(hsize_t)), 0, "H5Sget_simple_extent_dims"); - /* Change max dims from zero to non-zero and back again */ - ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, max2); - CHECK(ret, FAIL, "H5Sset_extent_simple"); + /* Change max dims to be equal to the dimensions */ ret = H5Sset_extent_simple(sid1, SPACE1_RANK, dims1, NULL); CHECK(ret, FAIL, "H5Sset_extent_simple"); rank = H5Sget_simple_extent_dims(sid1, tdims, tmax); @@ -190,24 +193,10 @@ test_h5s_basic(void) } /* Verify that incorrect dimensions don't work */ - dims1[0]=0; - sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); - VERIFY(sid1, FAIL, "H5Screate_simple"); - dims1[0] = H5S_UNLIMITED; sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); VERIFY(sid1, FAIL, "H5Screate_simple"); - dims1[0]=0; - sid1 = H5Screate(H5S_SIMPLE); - CHECK(sid1, FAIL, "H5Screate"); - - ret = H5Sset_extent_simple(sid1,SPACE1_RANK,dims1,NULL); - VERIFY(ret, FAIL, "H5Sset_extent_simple"); - - ret = H5Sclose(sid1); - CHECK_I(ret, "H5Sclose"); - dims1[0] = H5S_UNLIMITED; sid1 = H5Screate(H5S_SIMPLE); CHECK(sid1, FAIL, "H5Screate"); @@ -524,6 +513,618 @@ test_h5s_null(void) /**************************************************************** ** +** test_h5s_zero_dim(): Test the code for dataspace with zero dimension size +** +****************************************************************/ +static void +test_h5s_zero_dim(void) +{ + hid_t fid1; /* HDF5 File IDs */ + hid_t sid1, attr_sid; /* Dataspace ID */ + hid_t sid_chunk; /* Dataspace ID for chunked dataset */ + hid_t dset1; /* Dataset ID */ + hid_t plist_id; /* Dataset creation property list */ + hid_t attr; /* Attribute ID */ + int rank; /* Logical rank of dataspace */ + hsize_t dims1[] = {0, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t max_dims[] = {SPACE1_DIM1+1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t extend_dims[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t chunk_dims[] = {SPACE1_DIM1, SPACE1_DIM2/3, SPACE1_DIM3}; + hsize_t tdims[SPACE1_RANK]; /* Dimension array to test with */ + int wdata[SPACE1_DIM2][SPACE1_DIM3]; + int rdata[SPACE1_DIM2][SPACE1_DIM3]; + short wdata_short[SPACE1_DIM2][SPACE1_DIM3]; + short rdata_short[SPACE1_DIM2][SPACE1_DIM3]; + int wdata_real[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3]; + int rdata_real[SPACE1_DIM1][SPACE1_DIM2][SPACE1_DIM3]; + int val = 3; + hsize_t start[] = {0, 0, 0}; + hsize_t count[] = {3, 15, 13}; + hsize_t coord[1][3]; /* Coordinates for point selection */ + hssize_t nelem; /* Number of elements */ + H5S_sel_type sel_type; /* Type of selection currently */ + H5S_class_t stype; /* dataspace type */ + herr_t ret; /* Generic return value */ + unsigned int i, j, k; + + /* Output message about test being performed */ + MESSAGE(5, ("Testing Dataspace with zero dimension size\n")); + + /* Make sure we can create the space with the dimension size 0 (starting from v1.8.7). + * The dimension doesn't need to be unlimited. */ + sid1 = H5Screate_simple(SPACE1_RANK, dims1, NULL); + CHECK(sid1, FAIL, "H5Screate_simple"); + + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + sid1 = H5Screate(H5S_SIMPLE); + CHECK(sid1, FAIL, "H5Screate"); + + /* SID1 has the 1st dimension size as zero. The maximal dimension will be + * the same as the dimension because of the NULL passed in. */ + ret = H5Sset_extent_simple(sid1,SPACE1_RANK,dims1,NULL); + CHECK(ret, FAIL, "H5Sset_extent_simple"); + + /* Check that the dataspace actually has 0 elements */ + nelem = H5Sget_simple_extent_npoints(sid1); + VERIFY(nelem, 0, "H5Sget_simple_extent_npoints"); + + /* Check that the dataspace was created with an "all" selection */ + sel_type = H5Sget_select_type(sid1); + VERIFY(sel_type, H5S_SEL_ALL, "H5Sget_select_type"); + + /* Check that the dataspace has 0 elements selected */ + nelem = H5Sget_select_npoints(sid1); + VERIFY(nelem, 0, "H5Sget_select_npoints"); + + /* Change to "none" selection */ + ret = H5Sselect_none(sid1); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Check that the dataspace has 0 elements selected */ + nelem = H5Sget_select_npoints(sid1); + VERIFY(nelem, 0, "H5Sget_select_npoints"); + + /* Try to select all dataspace */ + ret = H5Sselect_all(sid1); + CHECK(ret, FAIL, "H5Sselect_all"); + + /* Check that the dataspace has 0 elements selected */ + nelem = H5Sget_select_npoints(sid1); + VERIFY(nelem, 0, "H5Sget_select_npoints"); + + /* Create the dataspace for chunked dataset with the first dimension size as zero. + * The maximal dimensions are bigger than the dimensions for later expansion. */ + sid_chunk = H5Screate_simple(SPACE1_RANK, dims1, max_dims); + CHECK(sid_chunk, FAIL, "H5Screate_simple"); + + /*============================================ + * Make sure we can use 0-dimension to create + * contiguous, chunked, compact, and external + * datasets, and also attribute. + *============================================ + */ + fid1 = H5Fcreate(ZEROFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fcreate"); + + /* Initialize the data */ + for(i=0; i<SPACE1_DIM2; i++) + for(j=0; j<SPACE1_DIM3; j++) { + wdata[i][j] = i + j; + rdata[i][j] = 7; + wdata_short[i][j] = i + j; + rdata_short[i][j] = 7; + } + + for(i=0; i<SPACE1_DIM1; i++) + for(j=0; j<SPACE1_DIM2; j++) + for(k=0; k<SPACE1_DIM3; k++) + wdata_real[i][j][k] = i + j + k; + + + /*===================== Contiguous dataset =======================*/ + dset1 = H5Dcreate2(fid1, BASICDATASET, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dcreate2"); + + /* Write "nothing" to the dataset */ + ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, wdata); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, rdata); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + } + + /* Write "nothing" to the dataset (with type conversion :-) */ + ret = H5Dwrite(dset1, H5T_NATIVE_SHORT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata_short); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, rdata_short); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata_short[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata_short[i][j]); + } + } + } + + /* Select a hyperslab beyond its current dimension sizes, then try to write + * the data. It should fail. */ + ret = H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL); + CHECK(ret, FAIL, "H5Sselect_hyperslab"); + + H5E_BEGIN_TRY { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, wdata); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dwrite"); + + /* Change to "none" selection */ + ret = H5Sselect_none(sid1); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Select a point beyond the dimension size, then try to write the data. + * It should fail. */ + coord[0][0]=2; coord[0][1]=5; coord[0][2]=3; + ret = H5Sselect_elements(sid1, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + H5E_BEGIN_TRY { + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, sid1, H5P_DEFAULT, &val); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dwrite"); + + /* Restore the selection to all */ + ret = H5Sselect_all(sid1); + CHECK(ret, FAIL, "H5Sselect_all"); + + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + + /*=================== Chunked dataset ====================*/ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + CHECK(plist_id, FAIL, "H5Pcreate"); + + ret = H5Pset_chunk(plist_id, SPACE1_RANK, chunk_dims); + CHECK(ret, FAIL, "H5Pset_chunk"); + + dset1 = H5Dcreate2(fid1, BASICDATASET1, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dcreate2"); + + /* Write "nothing" to the dataset */ + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + + /* Now extend the dataset to SPACE1_DIM1*SPACE1_DIM2*SPACE1_DIM3 and make sure + * we can write data to it */ + ret = H5Dset_extent(dset1, extend_dims); + CHECK(ret, FAIL, "H5Dset_extent"); + + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata_real); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_real); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM1; i++) { + for(j=0; j<SPACE1_DIM2; j++) { + for(k=0; k<SPACE1_DIM3; k++) { + if(rdata_real[i][j][k] != wdata_real[i][j][k]) { + H5_FAILED(); + printf("element [%d][%d][%d] is %d but should have been %d\n", + i, j, k, rdata_real[i][j][k], wdata_real[i][j][k]); + } + } + } + } + + /* Now shrink the first dimension size of the dataset to 0 and make sure no data is in it */ + extend_dims[0] = 0; + ret = H5Dset_extent(dset1, extend_dims); + CHECK(ret, FAIL, "H5Dset_extent"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + + /* Now extend the first dimension size of the dataset to SPACE1_DIM1*3 past the maximal size. + * It is supposed to fail. */ + extend_dims[0] = SPACE1_DIM1*3; + H5E_BEGIN_TRY { + ret = H5Dset_extent(dset1, extend_dims); + } H5E_END_TRY; + VERIFY(ret, FAIL, "H5Dset_extent"); + + ret = H5Pclose(plist_id); + CHECK(ret, FAIL, "H5Pclose"); + + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + + /*=================== Compact dataset =====================*/ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + CHECK(plist_id, FAIL, "H5Pcreate"); + + ret = H5Pset_layout(plist_id, H5D_COMPACT); + CHECK(ret, FAIL, "H5Pset_layout"); + + ret = H5Pset_alloc_time(plist_id, H5D_ALLOC_TIME_EARLY); + CHECK(ret, FAIL, "H5Pset_alloc_time"); + + dset1 = H5Dcreate2(fid1, BASICDATASET2, H5T_NATIVE_INT, sid1, H5P_DEFAULT, plist_id, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dcreate2"); + + /* Write "nothing" to the dataset */ + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + + ret = H5Pclose(plist_id); + CHECK(ret, FAIL, "H5Pclose"); + + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + + /*=========== Contiguous dataset with external storage ============*/ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + CHECK(plist_id, FAIL, "H5Pcreate"); + + ret = H5Pset_layout(plist_id, H5D_CONTIGUOUS); + CHECK(ret, FAIL, "H5Pset_layout"); + + /* Change the DCPL for contiguous layout with external storage. The size of the reserved + * space in the external file is the size of the dataset (zero because one dimension size is zero). + * There's no need to clean up the external file since the library doesn't create it + * until the data is written to it. */ + ret = H5Pset_external(plist_id, EXTFILE_NAME, (off_t)0, (hsize_t)0); + CHECK(ret, FAIL, "H5Pset_external"); + + dset1 = H5Dcreate2(fid1, BASICDATASET3, H5T_NATIVE_INT, sid1, H5P_DEFAULT, plist_id, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dcreate2"); + + /* Write "nothing" to the dataset */ + ret = H5Dwrite(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, wdata); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, sid1, H5S_ALL, H5P_DEFAULT, rdata); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + } + + ret = H5Pclose(plist_id); + CHECK(ret, FAIL, "H5Pclose"); + + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + + /*=============== Create an attribute for the file ================*/ + attr = H5Acreate2(fid1, NULLATTR, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Acreate2"); + + /* Write "nothing" to the attribute */ + ret = H5Awrite(attr, H5T_NATIVE_INT, wdata); + CHECK(ret, FAIL, "H5Awrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the attribute (make certain our buffer is unmodified) */ + ret = H5Aread(attr, H5T_NATIVE_INT, rdata); + CHECK(ret, FAIL, "H5Aread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + } + + /* Write "nothing" to the attribute (with type conversion :-) */ + ret = H5Awrite(attr, H5T_NATIVE_SHORT, wdata_short); + CHECK(ret, FAIL, "H5Awrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + /* Try reading from the attribute (with type conversion :-) (make certain our buffer is unmodified) */ + ret = H5Aread(attr, H5T_NATIVE_SHORT, rdata_short); + CHECK(ret, FAIL, "H5Aread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata_short[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata_short[i][j]); + } + } + } + + /*=============================================================== + * Extend the dimension to make it a normal dataspace (3x15x13). + * Verify that data can be written to and read from the chunked + * dataset now. + *=============================================================== + */ + dims1[0]=SPACE1_DIM1; + ret = H5Sset_extent_simple(sid_chunk,SPACE1_RANK,dims1,max_dims); + CHECK(ret, FAIL, "H5Sset_extent_simple"); + + nelem = H5Sget_simple_extent_npoints(sid_chunk); + CHECK(nelem, FAIL, "H5Sget_simple_extent_npoints"); + VERIFY(nelem, SPACE1_DIM1 * SPACE1_DIM2 * SPACE1_DIM3, + "H5Sget_simple_extent_npoints"); + + rank = H5Sget_simple_extent_ndims(sid_chunk); + CHECK(rank, FAIL, "H5Sget_simple_extent_ndims"); + VERIFY(rank, SPACE1_RANK, "H5Sget_simple_extent_ndims"); + + rank = H5Sget_simple_extent_dims(sid_chunk, tdims, NULL); + CHECK(rank, FAIL, "H5Sget_simple_extent_dims"); + VERIFY(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(hsize_t)), 0, + "H5Sget_simple_extent_dims"); + + /* Set it to chunked dataset */ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + CHECK(plist_id, FAIL, "H5Pcreate"); + + ret = H5Pset_chunk(plist_id, SPACE1_RANK, chunk_dims); + CHECK(ret, FAIL, "H5Pset_chunk"); + + dset1 = H5Dcreate2(fid1, BASICDATASET4, H5T_NATIVE_INT, sid_chunk, H5P_DEFAULT, plist_id, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dcreate2"); + + ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata_real); + CHECK(ret, FAIL, "H5Dwrite"); + + ret = H5Fflush(fid1, H5F_SCOPE_GLOBAL); + CHECK(ret, FAIL, "H5Fflush"); + + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata_real); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM1; i++) { + for(j=0; j<SPACE1_DIM2; j++) { + for(k=0; k<SPACE1_DIM3; k++) { + if(rdata_real[i][j][k] != wdata_real[i][j][k]) { + H5_FAILED(); + printf("element [%d][%d][%d] is %d but should have been %d\n", + i, j, k, rdata_real[i][j][k], wdata_real[i][j][k]); + } + } + } + } + + ret = H5Pclose(plist_id); + CHECK(ret, FAIL, "H5Pclose"); + + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + + /* Change the dimensions to make them zero size again (0x0x0). Verify that + * no element is in the dataspace. */ + dims1[0]=dims1[1]=dims1[2]=0; + ret = H5Sset_extent_simple(sid_chunk,SPACE1_RANK,dims1,NULL); + CHECK(ret, FAIL, "H5Sset_extent_simple"); + + /* Check that the dataspace actually has 0 elements */ + nelem = H5Sget_simple_extent_npoints(sid_chunk); + VERIFY(nelem, 0, "H5Sget_simple_extent_npoints"); + + /* Check that the dataspace was created with an "all" selection */ + sel_type = H5Sget_select_type(sid_chunk); + VERIFY(sel_type, H5S_SEL_ALL, "H5Sget_select_type"); + + /* Check that the dataspace has 0 elements selected */ + nelem = H5Sget_select_npoints(sid_chunk); + VERIFY(nelem, 0, "H5Sget_select_npoints"); + + /* Change to "none" selection */ + ret = H5Sselect_none(sid_chunk); + CHECK(ret, FAIL, "H5Sselect_none"); + + /* Check that the dataspace has 0 elements selected */ + nelem = H5Sget_select_npoints(sid_chunk); + VERIFY(nelem, 0, "H5Sget_select_npoints"); + + ret = H5Sclose(sid_chunk); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); + + /*============================================ + * Reopen the file to check the data space + *============================================ + */ + fid1 = H5Fopen(ZEROFILE, H5F_ACC_RDONLY, H5P_DEFAULT); + CHECK(fid1, FAIL, "H5Fopen"); + + /* Reopen the chunked dataset */ + dset1 = H5Dopen2(fid1, BASICDATASET1, H5P_DEFAULT); + CHECK(dset1, FAIL, "H5Dopen2"); + + /* Get the space of the dataset and querry it */ + sid1 = H5Dget_space(dset1); + CHECK(sid1, FAIL, "H5Dget_space"); + + /* Verify the class type of dataspace */ + stype = H5Sget_simple_extent_type(sid1); + VERIFY(stype, H5S_SIMPLE, "H5Sget_simple_extent_type"); + + /* Verify there is zero element in the dataspace */ + nelem = H5Sget_simple_extent_npoints(sid1); + VERIFY(nelem, 0, "H5Sget_simple_extent_npoints"); + + /* Verify the dimension sizes are correct */ + rank = H5Sget_simple_extent_dims(sid1, tdims, NULL); + CHECK(rank, FAIL, "H5Sget_simple_extent_dims"); + VERIFY(tdims[0], 0, "H5Sget_simple_extent_dims"); + VERIFY(tdims[1], SPACE1_DIM2, "H5Sget_simple_extent_dims"); + VERIFY(tdims[2], SPACE1_DIM3, "H5Sget_simple_extent_dims"); + + /* Try reading from the dataset (make certain our buffer is unmodified) */ + ret = H5Dread(dset1, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata); + CHECK(ret, FAIL, "H5Dread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata[i][j]); + } + } + } + + /* Close the dataset and its dataspace */ + ret = H5Dclose(dset1); + CHECK(ret, FAIL, "H5Dclose"); + + ret = H5Sclose(sid1); + CHECK(ret, FAIL, "H5Sclose"); + + /* Open the attribute for the file */ + attr = H5Aopen(fid1, NULLATTR, H5P_DEFAULT); + CHECK(attr, FAIL, "H5Aopen"); + + /* Get the space of the dataset */ + attr_sid = H5Aget_space(attr); + CHECK(attr_sid, FAIL, "H5Aget_space"); + + /* Verify the class type of dataspace */ + stype = H5Sget_simple_extent_type(attr_sid); + VERIFY(stype, H5S_SIMPLE, "H5Sget_simple_extent_type"); + + /* Verify there is zero element in the dataspace */ + nelem = H5Sget_simple_extent_npoints(attr_sid); + VERIFY(nelem, 0, "H5Sget_simple_extent_npoints"); + + /* Try reading from the attribute (make certain our buffer is unmodified) */ + ret = H5Aread(attr, H5T_NATIVE_SHORT, rdata_short); + CHECK(ret, FAIL, "H5Aread"); + + /* Check results */ + for(i=0; i<SPACE1_DIM2; i++) { + for(j=0; j<SPACE1_DIM3; j++) { + if(rdata_short[i][j] != 7) { + H5_FAILED(); + printf("element [%d][%d] is %d but should have been 7\n", + i, j, rdata_short[i][j]); + } + } + } + + /* Close attribute */ + ret=H5Aclose(attr); + CHECK(ret, FAIL, "H5Aclose"); + + /* Close the dataspace */ + ret = H5Sclose(attr_sid); + CHECK(ret, FAIL, "H5Sclose"); + + ret = H5Fclose(fid1); + CHECK(ret, FAIL, "H5Fclose"); +} /* test_h5s_zero_dim() */ + + +/**************************************************************** +** ** test_h5s_encode(): Test H5S (dataspace) encoding and decoding. ** ****************************************************************/ @@ -1591,6 +2192,7 @@ test_h5s(void) test_h5s_basic(); /* Test basic H5S code */ test_h5s_null(); /* Test Null dataspace H5S code */ + test_h5s_zero_dim(); /* Test dataspace with zero dimension size */ test_h5s_encode(); /* Test encoding and decoding */ test_h5s_scalar_write(); /* Test scalar H5S writing code */ test_h5s_scalar_read(); /* Test scalar H5S reading code */ @@ -1625,4 +2227,5 @@ cleanup_h5s(void) remove(DATAFILE); remove(NULLFILE); remove(BASICFILE); + remove(ZEROFILE); } diff --git a/test/tvlstr.c b/test/tvlstr.c index 87008aa..02bd59d 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -388,6 +388,7 @@ static void test_vlstring_type(void) hid_t tid_vlstr; H5T_cset_t cset; H5T_str_t pad; + htri_t vl_str; /* Whether string is VL */ herr_t ret; /* Output message about test being performed */ @@ -417,6 +418,11 @@ static void test_vlstring_type(void) ret = H5Tis_variable_str(tid_vlstr); VERIFY(ret, TRUE, "H5Tis_variable_str"); + /* Verify that the class detects as a string */ + vl_str = H5Tdetect_class(tid_vlstr, H5T_STRING); + CHECK(vl_str, FAIL, "H5Tdetect_class"); + VERIFY(vl_str, TRUE, "H5Tdetect_class"); + /* Check default character set and padding */ cset = H5Tget_cset(tid_vlstr); VERIFY(cset, H5T_CSET_ASCII, "H5Tget_cset"); diff --git a/test/unlink.c b/test/unlink.c index 9bd6f42..604b014 100644 --- a/test/unlink.c +++ b/test/unlink.c @@ -2549,6 +2549,9 @@ main(void) /* Close 2nd FAPL */ H5Pclose(fapl2); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); + if (nerrors) { printf("***** %d FAILURE%s! *****\n", nerrors, 1==nerrors?"":"S"); exit(1); @@ -30,28 +30,34 @@ #define CORE_INCREMENT (4*KB) /*Macros for Direct VFD*/ -#define MBOUNDARY 512 -#define FBSIZE (4*KB) -#define CBSIZE (8*KB) -#define THRESHOLD 1 -#define DSET1_NAME "dset1" -#define DSET1_DIM1 1024 -#define DSET1_DIM2 32 -#define DSET2_NAME "dset2" -#define DSET2_DIM 4 +#define MBOUNDARY 512 +#define FBSIZE (4*KB) +#define CBSIZE (8*KB) +#define THRESHOLD 1 +#define DSET1_NAME "dset1" +#define DSET1_DIM1 1024 +#define DSET1_DIM2 32 +#define DSET2_NAME "dset2" +#define DSET2_DIM 4 const char *FILENAME[] = { - "sec2_file", - "core_file", - "family_file", - "new_family_v16_", - "multi_file", - "direct_file", + "sec2_file", /*0*/ + "core_file", /*1*/ + "family_file", /*2*/ + "new_family_v16_", /*3*/ + "multi_file", /*4*/ + "direct_file", /*5*/ + "log_file", /*6*/ + "stdio_file", /*7*/ + "windows_file", /*8*/ NULL }; +#define LOG_FILENAME "log_vfd_out.log" + #define COMPAT_BASENAME "family_v16_" + /*------------------------------------------------------------------------- * Function: test_sec2 @@ -64,21 +70,17 @@ const char *FILENAME[] = { * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * - * Modifications: - * - * Raymond Lu - * Wednesday, June 23, 2004 - * Added test for H5Fget_filesize. - * *------------------------------------------------------------------------- */ static herr_t test_sec2(void) { - hid_t file=(-1), fapl, access_fapl = -1; - char filename[1024]; - int *fhandle=NULL; - hsize_t file_size; + hid_t file = -1; + hid_t fapl = -1; + hid_t access_fapl = -1; + char filename[1024]; + int *fhandle = NULL; + hsize_t file_size = 0; TESTING("SEC2 file driver"); @@ -88,47 +90,53 @@ test_sec2(void) TEST_ERROR; h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR; /* Retrieve the access property list... */ - if ((access_fapl = H5Fget_access_plist(file)) < 0) + if((access_fapl = H5Fget_access_plist(file)) < 0) + TEST_ERROR; + + /* Check that the driver is correct */ + if(H5FD_SEC2 != H5Pget_driver(access_fapl)) TEST_ERROR; /* ...and close the property list */ - if (H5Pclose(access_fapl) < 0) + if(H5Pclose(access_fapl) < 0) TEST_ERROR; /* Check file handle API */ if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) TEST_ERROR; - if(*fhandle<0) + if(*fhandle < 0) TEST_ERROR; /* Check file size API */ if(H5Fget_filesize(file, &file_size) < 0) TEST_ERROR; - /* There is no garantee the size of metadata in file is constant. + /* There is no guarantee the size of metadata in file is constant. * Just try to check if it's reasonable. It's 2KB right now. */ - if(file_size<1*KB || file_size>4*KB) + if(file_size < 1 * KB || file_size > 4 * KB) TEST_ERROR; if(H5Fclose(file) < 0) TEST_ERROR; + h5_cleanup(FILENAME, fapl); PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Pclose (fapl); + H5Pclose(fapl); H5Fclose(file); } H5E_END_TRY; return -1; } + /*------------------------------------------------------------------------- * Function: test_direct @@ -162,7 +170,7 @@ test_direct(void) int i, j, n; #endif /*H5_HAVE_DIRECT*/ - TESTING("Direct I/O file driver"); + TESTING("DIRECT I/O file driver"); #ifndef H5_HAVE_DIRECT SKIPPED(); @@ -199,6 +207,10 @@ test_direct(void) if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; + /* Check that the driver is correct */ + if(H5FD_DIRECT != H5Pget_driver(access_fapl)) + TEST_ERROR; + /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; @@ -346,15 +358,6 @@ error: * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * - * Modifications: - * - * Raymond Lu - * Wednesday, June 23, 2004 - * Added test for H5Fget_filesize. - * - * Raymond Lu, 2006-11-30 - * Enabled the driver to read an existing file depending on - * the setting of the backing_store and file open flags. *------------------------------------------------------------------------- */ static herr_t @@ -384,6 +387,10 @@ test_core(void) if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; + /* Check that the driver is correct */ + if(H5FD_CORE != H5Pget_driver(access_fapl)) + TEST_ERROR; + /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; @@ -627,17 +634,6 @@ error: * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * - * Modifications: - * - * Raymond Lu - * Wednesday, June 23, 2004 - * Added test for H5Fget_filesize. - * - * Raymond Lu - * June 2, 2005 - * Added a function test_family_opens() to test different - * wrong way to reopen family files. - * *------------------------------------------------------------------------- */ static herr_t @@ -696,6 +692,10 @@ test_family(void) if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; + /* Check that the driver is correct */ + if(H5FD_FAMILY != H5Pget_driver(access_fapl)) + TEST_ERROR; + /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; @@ -924,12 +924,6 @@ test_multi_opens(char *fname) * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * - * Modifications: - * - * Raymond Lu - * Wednesday, June 23, 2004 - * Added test for H5Fget_filesize. - * *------------------------------------------------------------------------- */ static herr_t @@ -985,7 +979,7 @@ test_multi(void) sprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g'); memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP]; - memb_addr[H5FD_MEM_GHEAP] = HADDR_MAX*3/4; + memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX/4)*3; if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, TRUE) < 0) @@ -1015,6 +1009,10 @@ test_multi(void) if ((access_fapl = H5Fget_access_plist(file)) < 0) TEST_ERROR; + /* Check that the driver is correct */ + if(H5FD_MULTI != H5Pget_driver(access_fapl)) + TEST_ERROR; + /* ...and close the property list */ if (H5Pclose(access_fapl) < 0) TEST_ERROR; @@ -1125,12 +1123,265 @@ error: /*------------------------------------------------------------------------- + * Function: test_log + * + * Purpose: Tests the file handle interface for log driver + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * Tuesday, March 22, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_log(void) +{ + hid_t file = -1; + hid_t fapl = -1; + hid_t access_fapl = -1; + char filename[1024]; + int *fhandle = NULL; + hsize_t file_size = 0; + unsigned int flags = H5FD_LOG_ALL; + size_t buf_size = 0; + + TESTING("LOG file driver"); + + /* Set property list and file name for log driver. */ + fapl = h5_fileaccess(); + if(H5Pset_fapl_log(fapl, LOG_FILENAME, 0, buf_size) < 0) + TEST_ERROR; + h5_fixname(FILENAME[6], fapl, filename, sizeof filename); + + /* Create the test file */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR; + + /* Retrieve the access property list... */ + if((access_fapl = H5Fget_access_plist(file)) < 0) + TEST_ERROR; + + /* Check that the driver is correct */ + if(H5FD_LOG != H5Pget_driver(access_fapl)) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + + /* Check file handle API */ + if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) + TEST_ERROR; + if(*fhandle < 0) + TEST_ERROR; + + /* Check file size API */ + if(H5Fget_filesize(file, &file_size) < 0) + TEST_ERROR; + + /* There is no guarantee the size of metadata in file is constant. + * Just try to check if it's reasonable. It's 2KB right now. + */ + if(file_size < 1 * KB || file_size > 4 * KB) + TEST_ERROR; + + if(H5Fclose(file) < 0) + TEST_ERROR; + + h5_cleanup(FILENAME, fapl); + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Fclose(file); + } H5E_END_TRY; + return -1; +} + + +/*------------------------------------------------------------------------- + * Function: test_stdio + * + * Purpose: Tests the file handle interface for STDIO driver + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * Tuesday, March 22, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_stdio(void) +{ + hid_t file = -1; + hid_t fapl = -1; + hid_t access_fapl = -1; + char filename[1024]; + FILE *fhandle = NULL; + hsize_t file_size = 0; + + + TESTING("STDIO file driver"); + + /* Set property list and file name for STDIO driver. */ + fapl = h5_fileaccess(); + if(H5Pset_fapl_stdio(fapl) < 0) + TEST_ERROR; + h5_fixname(FILENAME[7], fapl, filename, sizeof filename); + + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR; + + /* Retrieve the access property list... */ + if((access_fapl = H5Fget_access_plist(file)) < 0) + TEST_ERROR; + + /* Check that the driver is correct */ + if(H5FD_STDIO != H5Pget_driver(access_fapl)) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + + /* Check file handle API */ + if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) + TEST_ERROR; + if(NULL == fhandle) + TEST_ERROR; + + /* Check file size API */ + if(H5Fget_filesize(file, &file_size) < 0) + TEST_ERROR; + + /* There is no guarantee the size of metadata in file is constant. + * Just try to check if it's reasonable. It's 2KB right now. + */ + if(file_size < 1 * KB || file_size > 4 * KB) + TEST_ERROR; + + if(H5Fclose(file) < 0) + TEST_ERROR; + + h5_cleanup(FILENAME, fapl); + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Fclose(file); + } H5E_END_TRY; + return -1; +} + + + +/*------------------------------------------------------------------------- + * Function: test_windows + * + * Purpose: Tests the file handle interface for WINDOWS driver + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Dana Robinson + * Tuesday, March 22, 2011 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_windows(void) +{ +#ifdef _WIN32 + + hid_t file = -1; + hid_t fapl = -1; + hid_t access_fapl = -1; + char filename[1024]; + int *fhandle = NULL; + hsize_t file_size = 0; + +#endif /*_WIN32*/ + + TESTING("WINDOWS file driver"); + +#ifndef _WIN32 + + SKIPPED(); + return 0; + +#else /*_WIN32*/ + + /* Set property list and file name for WINDOWS driver. */ + fapl = h5_fileaccess(); + if(H5Pset_fapl_windows(fapl) < 0) + TEST_ERROR; + h5_fixname(FILENAME[8], fapl, filename, sizeof filename); + + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR; + + /* Retrieve the access property list... */ + if((access_fapl = H5Fget_access_plist(file)) < 0) + TEST_ERROR; + + /* Check that the driver is correct */ + if(H5FD_WINDOWS!= H5Pget_driver(access_fapl)) + TEST_ERROR; + + /* ...and close the property list */ + if(H5Pclose(access_fapl) < 0) + TEST_ERROR; + + /* Check file handle API */ + if(H5Fget_vfd_handle(file, H5P_DEFAULT, (void **)&fhandle) < 0) + TEST_ERROR; + if(*fhandle < 0) + TEST_ERROR; + + /* Check file size API */ + if(H5Fget_filesize(file, &file_size) < 0) + TEST_ERROR; + + /* There is no guarantee the size of metadata in file is constant. + * Just try to check if it's reasonable. It's 2KB right now. + */ + if(file_size < 1 * KB || file_size > 4 * KB) + TEST_ERROR; + + if(H5Fclose(file) < 0) + TEST_ERROR; + + h5_cleanup(FILENAME, fapl); + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Fclose(file); + } H5E_END_TRY; + return -1; + +#endif /*_WIN32*/ +} + + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the basic features of Virtual File Drivers * - * Return: Success: exit(0) - * Failure: exit(1) + * Return: Success: 0 + * Failure: 1 * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 @@ -1144,12 +1395,17 @@ main(void) h5_reset(); - nerrors += test_sec2() < 0 ? 1 : 0; - nerrors += test_core() < 0 ? 1 : 0; - nerrors += test_family() < 0 ? 1 : 0; - nerrors += test_family_compat() < 0 ? 1 : 0; - nerrors += test_multi() < 0 ? 1 : 0; - nerrors += test_direct() < 0 ? 1 : 0; + printf("Testing basic Virtual File Driver functionality.\n"); + + nerrors += test_sec2() < 0 ? 1 : 0; + nerrors += test_core() < 0 ? 1 : 0; + nerrors += test_family() < 0 ? 1 : 0; + nerrors += test_family_compat() < 0 ? 1 : 0; + nerrors += test_multi() < 0 ? 1 : 0; + nerrors += test_direct() < 0 ? 1 : 0; + nerrors += test_log() < 0 ? 1 : 0; + nerrors += test_stdio() < 0 ? 1 : 0; + nerrors += test_windows() < 0 ? 1 : 0; if(nerrors) { printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", |